Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-11231 PMM Updates UI #2904

Merged
merged 46 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
6a25374
PMM-11231 Setup PMM UI
matejkubinec Mar 15, 2024
0612fcb
PMM-11231 Update working directory for node setup
matejkubinec Mar 18, 2024
bcc34f2
PMM-11231 Adjust setup node step
matejkubinec Mar 18, 2024
b59a3d6
Merge branch 'v3' into PMM-11231-pmm-updates-ui
matejkubinec Mar 22, 2024
6c5c039
PMM-11231 Add build & cleanup makefile
matejkubinec Mar 22, 2024
4a302de
PMM-11231 Use correct UI directory
matejkubinec Mar 22, 2024
430cf5e
PMM-11231 Adjust pmm-ui build directory
matejkubinec Mar 25, 2024
1e0ec32
PMM-11231 Add install commands
matejkubinec Mar 25, 2024
b0039cc
PMM-11231 Add pmm ui directory to files section
matejkubinec Mar 25, 2024
d43c7ac
PMM-11231 Copy correct build files
matejkubinec Mar 25, 2024
9de6da9
Merge branch 'v3' into PMM-11231-pmm-updates-ui
matejkubinec Apr 9, 2024
056475d
PMM-11231 Handle token rotation
matejkubinec May 13, 2024
7891203
Merge branch 'v3' into PMM-11231-pmm-updates-ui
matejkubinec May 13, 2024
0fb9834
Merge branch 'v3' into PMM-11231-pmm-updates-ui
matejkubinec May 17, 2024
9b2e892
PMM-11231 Simplify spec file
matejkubinec May 20, 2024
5e65f0b
PMM-11231 Update dependencies
matejkubinec May 20, 2024
1ff025a
PMM-11231 Allow use of eslints non flat config
matejkubinec May 20, 2024
57a0760
PMM-11231 Align version fetch logic with previous
matejkubinec May 20, 2024
b5fe26a
PMM-11231 Refactor fetching icon
matejkubinec May 20, 2024
a420dc6
Merge branch 'v3' into PMM-11231-pmm-updates-ui
matejkubinec Jun 4, 2024
b96b1a9
PMM-11231 Update compose file
matejkubinec Jun 5, 2024
d1abfc5
Merge branch 'v3' into PMM-11231-pmm-updates-ui
matejkubinec Jun 5, 2024
d33922d
PMM-11231 Use /pmm-ui as path
matejkubinec Jun 7, 2024
a191887
PMM-11231 Allow specifying pmm server image through env variable
matejkubinec Jun 10, 2024
a625613
PMM-11231 Switch to tanstack query
matejkubinec Jun 18, 2024
732ae7b
Merge branch 'v3' into PMM-11231-pmm-updates-ui
matejkubinec Jun 25, 2024
6940ec1
Merge branch 'v3' into PMM-11231-pmm-updates-ui
matejkubinec Jun 26, 2024
ff0388a
PMM-11231 Update dev configuration
matejkubinec Jun 28, 2024
ae5d5d8
PMM-11231 Use correct naming & switch to hooks
matejkubinec Jun 28, 2024
aad2a90
Merge branch 'v3' into PMM-11231-pmm-updates-ui
matejkubinec Jun 28, 2024
d40c2ed
PMM-11231 Use different name for update image
matejkubinec Jun 28, 2024
15af0eb
Merge branch 'v3' into PMM-11231-pmm-updates-ui
matejkubinec Jul 4, 2024
e9a654f
PMM-11231 Disable auth_request for pmm-ui
matejkubinec Jul 4, 2024
a46f06f
PMM-11231 Rework redirect to login
matejkubinec Jul 4, 2024
c6ff9f2
Merge branch 'v3' into PMM-11231-pmm-updates-ui
matejkubinec Jul 9, 2024
5eb4685
PMM-11231 Update api response
matejkubinec Jul 9, 2024
d1192fb
PMM-11231 Add link to support
matejkubinec Jul 9, 2024
9d8d66c
PMM-11231 Fix support url redirect
matejkubinec Jul 9, 2024
13783c1
PMM-11231 Fix lint
matejkubinec Jul 9, 2024
b4d06f2
PMM-11231 Fix typings
matejkubinec Jul 9, 2024
c43a199
PMM-11231 Add admin & auth check
matejkubinec Jul 9, 2024
d0e38c6
PMM-12930 Make page component responsive
matejkubinec Jul 9, 2024
f4a4278
PMM-12930 Add Page unit tests
matejkubinec Jul 9, 2024
2b30722
Merge branch 'v3' into PMM-11231-pmm-updates-ui
matejkubinec Jul 16, 2024
a9ca17f
Merge branch 'v3 into PMM-11231-pmm-updates-ui
matejkubinec Jul 23, 2024
7660144
PMM-11231 Update api endpoints
matejkubinec Jul 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- "qan-api2/**"
- "update/**"
- "vmproxy/**"
- "ui/**"

jobs:
test:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
- "qan-api2/**"
- "update/**"
- "vmproxy/**"
- "ui/**"

jobs:
test:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/managed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- 'qan-api2/**'
- 'update/**'
- 'vmproxy/**'
- "ui/**"

jobs:
test:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/qan-api2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
- "managed/**"
- "update/**"
- "vmproxy/**"
- "ui/**"

jobs:
test:
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: UI

on:
push:
branches:
- main
- v3
- pmm-*
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
paths-ignore:
- "admin/**"
- "agent/**"
- "api-tests/**"
- "cli-tests/**"
- "docs/**"
- "managed/**"
- "managed-dev/**"
- "qan-api2/**"
- "vmproxy/**"
- "update/**"

jobs:
ci:
name: CI
runs-on: ubuntu-22.04

defaults:
run:
working-directory: ${{ github.workspace }}/ui

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup nodejs
uses: actions/setup-node@v4
with:
node-version-file: ui/.nvmrc
cache: yarn
cache-dependency-path: ui

- name: Run lint
run: |
make lint

- name: Run unit tests
run: |
make test

- name: Build application
run: |
make build
1 change: 1 addition & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- "managed/**"
- "qan-api2/**"
- "vmproxy/**"
- "ui/**"

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/vmproxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
- "managed/**"
- "qan-api2/**"
- "update/**"
- "ui/**"

jobs:
test:
Expand Down
6 changes: 6 additions & 0 deletions build/ansible/roles/nginx/files/conf.d/pmm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@
try_files $uri /index.html break;
}

# PMM UI
location /pmm-ui {
alias /usr/share/pmm-ui;
try_files $uri /index.html break;
}

# Grafana
rewrite ^/$ $scheme://$http_host/graph/;
rewrite ^/graph$ /graph/;
Expand Down
10 changes: 8 additions & 2 deletions build/packages/rpm/server/SPECS/pmm-managed.spec
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,21 @@ export PMM_RELEASE_BRANCH=""
cd src/github.com/percona/pmm/managed
make release

cd ../ui
make release

%install
install -d -p %{buildroot}%{_bindir}
install -d -p %{buildroot}%{_sbindir}
install -d -p %{buildroot}%{_datadir}/%{name}
install -d -p %{buildroot}%{_datadir}/pmm-ui
install -p -m 0755 bin/pmm-managed %{buildroot}%{_sbindir}/pmm-managed
install -p -m 0755 bin/pmm-managed-init %{buildroot}%{_sbindir}/pmm-managed-init
install -p -m 0755 bin/pmm-managed-starlark %{buildroot}%{_sbindir}/pmm-managed-starlark

cd src/github.com/percona/pmm
cp -pa ./api/swagger %{buildroot}%{_datadir}/%{name}

cp -pa ./ui/dist/. %{buildroot}%{_datadir}/pmm-ui

%files
%license src/%{provider}/LICENSE
Expand All @@ -62,9 +65,12 @@ cp -pa ./api/swagger %{buildroot}%{_datadir}/%{name}
%{_sbindir}/pmm-managed-init
%{_sbindir}/pmm-managed-starlark
%{_datadir}/%{name}

%{_datadir}/pmm-ui

%changelog
* Fri Mar 22 2024 Matej Kubinec <[email protected]> - 3.0.0-1
- PMM-11231 add pmm ui

* Thu Jul 28 2022 Alex Tymchuk <[email protected]> - 2.30.0-1
- PMM-10036 migrate to monorepo

Expand Down
4 changes: 4 additions & 0 deletions ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['@percona/eslint-config-react'],
};
26 changes: 26 additions & 0 deletions ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

testdata/*
1 change: 1 addition & 0 deletions ui/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.20.2
24 changes: 24 additions & 0 deletions ui/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
dev:
yarn dev

ci: setup lint test build

format: setup
yarn format

lint: setup
yarn lint

test: setup
yarn test

setup:
yarn install --frozen-lockfile

build: setup
yarn build

release: build

clean:
rm -r dist
44 changes: 44 additions & 0 deletions ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Percona Monitoring and Management UI

[Percona Monitoring and Management (PMM)](https://www.percona.com/software/database-tools/percona-monitoring-and-management) is a best-of-breed open source database monitoring solution. It helps you reduce complexity, optimize performance, and improve the security of your business-critical database environments, no matter where they are located or deployed.
PMM helps users to:
* Reduce Complexity
* Optimize Database Performance
* Improve Data Security

See the [PMM Documentation](https://www.percona.com/doc/percona-monitoring-and-management/2.x/index.html) for more information.

## Pre-Requisites

Make sure you have the following installed:
- [node 18](https://nodejs.org/en) (you can also use [nvm](https://github.com/nvm-sh/nvm) to manage node versions)
- [yarn](https://yarnpkg.com/)

## Stack

This repo uses the following stack across its packages:

- Yarn to manage packages (https://yarnpkg.com/)
- Typescript (https://www.typescriptlang.org/);
- React (https://react.dev/);
- Rollup to bundle the different common packages (https://rollupjs.org/);
- Vite for development (https://vitejs.dev/);
- Vitest for unit tests (https://vitest.dev/);

## Install dependencies

```bash
make setup
```

## Run in development mode

```bash
make dev
```

## Build application for production

```bash
make build
```
39 changes: 39 additions & 0 deletions ui/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
services:
pmm-server:
container_name: pmm-server
# Temporary till we have arm builds
platform: linux/amd64
image: ${PMM_SERVER_IMAGE:-perconalab/pmm-server:3-dev-container}
ports:
- 80:9080
- 443:8443
volumes:
- ./pmm-dev.conf:/etc/nginx/conf.d/pmm-dev.conf:ro

# Uncomment to use custom (FE) grafana code
#- '../../grafana/public:/usr/share/grafana/public'
#- '../../grafana/conf/grafana.local-dev.ini:/usr/share/grafana/conf/defaults.ini'
environment:
- PMM_DEBUG=1
- PERCONA_PORTAL_URL=https://portal-dev.percona.com
- PMM_DEV_PERCONA_PLATFORM_ADDRESS=https://check-dev.percona.com:443
- PMM_DEV_PERCONA_PLATFORM_PUBLIC_KEY=RWTkF7Snv08FCboTne4djQfN5qbrLfAjb8SY3/wwEP+X5nUrkxCEvUDJ

mysql:
image: percona:5.7.30
platform: linux/amd64
container_name: pmm-agent_mysql
command: >
--sql-mode="ANSI_QUOTES"
--performance-schema --innodb_monitor_enable=all
--slow_query_log --log_slow_rate_limit=1 --log_slow_admin_statements --log_slow_slave_statements --slow_query_log_file=/mysql/slowlogs/slow.log --long_query_time=0
ports:
- '3306:3306'
environment:
- MYSQL_ROOT_PASSWORD=ps
- MYSQL_USER=pmm-agent
- MYSQL_PASSWORD=pmm%*&agent-password
- UMASK=0777 # for slowlog file
volumes:
- ./testdata/mysql:/mysql
14 changes: 14 additions & 0 deletions ui/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PMM</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
54 changes: 54 additions & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "ui",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"format": "prettier . --write",
"preview": "vite preview",
"test": "vitest run",
"test:watch": "vitest"
},
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@mui/icons-material": "^5.15.18",
"@mui/material": "^5.15.18",
"@mui/x-date-pickers": "^7.5.0",
"@percona/design": "^1.0.0",
"@percona/ui-lib": "^1.0.0",
"axios": "^1.7.0",
"axios-case-converter": "^1.1.1",
"date-fns": "^2.30.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-query": "^3.39.3",
"react-router-dom": "^6.23.1"
},
"devDependencies": {
"@percona/eslint-config-react": "^1.0.0",
"@percona/prettier-config": "^1.0.0",
"@percona/tsconfig": "^1.0.0",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^15.0.7",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0",
"@vitejs/plugin-react-swc": "^3.6.0",
"eslint": "^9.3.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"jsdom": "^24.0.0",
"prettier": "^3.2.5",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^1.6.0"
},
"prettier": "@percona/prettier-config"
}
20 changes: 20 additions & 0 deletions ui/pmm-dev.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# PMM UI
server {
listen 9080;
server_name _;

# proxy requests during development to vite dev server
location /pmm-ui {
proxy_pass http://host.docker.internal:5173/pmm-ui;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
Binary file added ui/public/favicon.ico
Binary file not shown.
Loading
Loading