Skip to content

Commit b2e1856

Browse files
authored
Merge pull request #6 from net0well/fase-6/painel-vue
Fase 6: painel Vue embutido e usedByPipelines (specs 008 e 007)
2 parents 9186beb + e331eac commit b2e1856

117 files changed

Lines changed: 20221 additions & 36 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.editorconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ indent_size = 2
1414
[*.md]
1515
trim_trailing_whitespace = false
1616

17+
# Painel Vue (panel/): convenção do ecossistema JavaScript.
18+
[panel/**.{ts,mts,mjs,js,vue,css,html}]
19+
indent_size = 2
20+
1721
[*.cs]
1822
# Namespaces and usings
1923
csharp_style_namespace_declarations = file_scoped:warning

‎.github/workflows/ci.yml‎

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ jobs:
3535
# The integration tests build the psrunner wheel and create real Python environments with uv.
3636
- uses: astral-sh/setup-uv@v10.3.0
3737

38+
# The Release build embeds the Vue panel (npm ci + npm run build in panel/; D-155).
39+
- uses: actions/setup-node@v7
40+
with:
41+
node-version-file: panel/.nvmrc
42+
cache: npm
43+
cache-dependency-path: panel/package-lock.json
44+
3845
- name: Restore
3946
run: dotnet restore
4047

@@ -46,12 +53,25 @@ jobs:
4653
if: runner.os == 'Linux'
4754
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libpango-1.0-0 libpangoft2-1.0-0 libharfbuzz0b fonts-dejavu-core
4855

49-
# The persistence, queue and worker tests start PostgreSQL 16, RabbitMQ 3.13 and Mailpit with Testcontainers
50-
# (Docker); GitHub's Windows runners cannot run Linux containers, so Windows runs the Core tests only.
56+
# The panel E2E tests drive Chromium with Playwright (spec 008; D-149, D-156).
57+
- name: Install Chromium
58+
if: runner.os == 'Linux'
59+
run: pwsh tests/PythonScriptRunner.Panel.E2E.Tests/bin/Release/net10.0/playwright.ps1 install --with-deps chromium
60+
61+
# The persistence, queue, worker, dashboard and panel tests start PostgreSQL 16, RabbitMQ 3.13 and Mailpit with
62+
# Testcontainers (Docker); GitHub's Windows runners cannot run Linux containers, so Windows runs the Core tests only.
5163
- name: Test
5264
if: runner.os == 'Linux'
5365
run: dotnet test --no-build --configuration Release
5466

67+
- name: Upload Playwright traces
68+
if: failure() && runner.os == 'Linux'
69+
uses: actions/upload-artifact@v7
70+
with:
71+
name: playwright-traces
72+
path: tests/PythonScriptRunner.Panel.E2E.Tests/bin/Release/net10.0/TestResults/traces/
73+
if-no-files-found: ignore
74+
5575
- name: Test (Core)
5676
if: runner.os == 'Windows'
5777
run: dotnet test --no-build --configuration Release --project tests/PythonScriptRunner.Core.Tests
@@ -69,6 +89,41 @@ jobs:
6989
- name: Verify formatting
7090
run: dotnet format --verify-no-changes
7191

92+
panel:
93+
name: Panel (Vue)
94+
runs-on: ubuntu-latest
95+
defaults:
96+
run:
97+
working-directory: panel
98+
steps:
99+
- uses: actions/checkout@v7
100+
101+
- uses: actions/setup-node@v7
102+
with:
103+
node-version-file: panel/.nvmrc
104+
cache: npm
105+
cache-dependency-path: panel/package-lock.json
106+
107+
- name: Install
108+
run: npm ci --no-audit --no-fund
109+
110+
- name: Lint
111+
run: npm run lint
112+
113+
- name: Type check
114+
run: npm run typecheck
115+
116+
# The TypeScript types are generated from the versioned OpenAPI snapshot of the Dashboard tests (D-137).
117+
- name: API types up to date
118+
run: npm run api:check
119+
120+
- name: Test
121+
run: npm test
122+
123+
# vue-tsc + vite build + the initial bundle budget (≤ 500 KB gzip; spec 008).
124+
- name: Build
125+
run: npm run build
126+
72127
python-sdk:
73128
name: psrunner (${{ matrix.os }}, Python ${{ matrix.python }})
74129
strategy:

‎Directory.Packages.props‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
</PropertyGroup>
55
<ItemGroup>
66
<PackageVersion Include="Cronos" Version="0.13.0" />
7+
<PackageVersion Include="Deque.AxeCore.Playwright" Version="4.13.0" />
78
<PackageVersion Include="JsonSchema.Net" Version="9.4.1" />
89
<PackageVersion Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="10.0.13" />
910
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.13" />
@@ -25,6 +26,7 @@
2526
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.13" />
2627
<PackageVersion Include="Microsoft.Extensions.Options" Version="10.0.13" />
2728
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="10.11.0" />
29+
<PackageVersion Include="Microsoft.Playwright" Version="1.63.0" />
2830
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.3" />
2931
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.20.1" />
3032
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.20.1" />

‎PythonScriptRunner.slnx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<Project Path="tests/PythonScriptRunner.Core.Tests/PythonScriptRunner.Core.Tests.csproj" />
1818
<Project Path="tests/PythonScriptRunner.Dashboard.Tests/PythonScriptRunner.Dashboard.Tests.csproj" />
1919
<Project Path="tests/PythonScriptRunner.EntityFrameworkCore.Tests/PythonScriptRunner.EntityFrameworkCore.Tests.csproj" />
20+
<Project Path="tests/PythonScriptRunner.Panel.E2E.Tests/PythonScriptRunner.Panel.E2E.Tests.csproj" />
2021
<Project Path="tests/PythonScriptRunner.RabbitMQ.Tests/PythonScriptRunner.RabbitMQ.Tests.csproj" />
2122
<Project Path="tests/PythonScriptRunner.Worker.Tests/PythonScriptRunner.Worker.Tests.csproj" />
2223
</Folder>

‎README.md‎

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ cron e painel Vue opcional.
66

77
> Projeto em desenvolvimento. Esta versão entrega o **Core Runner** (execução síncrona de Stages e de
88
> trilhas), o SDK Python **`psrunner`**, a **persistência em PostgreSQL** (catálogo versionado e histórico), a
9-
> **execução assíncrona** com RabbitMQ, worker e agendamento cron e o **painel embutível** (API, tempo real e acesso
10-
> configurável; a interface Vue chega numa próxima versão).
9+
> **execução assíncrona** com RabbitMQ, worker e agendamento cron e o **painel embutível** (interface Vue, API, tempo
10+
> real e acesso configurável).
1111
1212
## Como funciona
1313

@@ -159,7 +159,12 @@ O host `hosts/PythonScriptRunner.WorkerHost` é um worker pronto, configurado po
159159
## Painel (Dashboard)
160160

161161
Com `PythonScriptRunner.Dashboard`, o painel é embutido na sua aplicação, no estilo do Hangfire: API interna, atualizações
162-
em tempo real (SignalR) e a interface servida no prefixo escolhido. Sem `MapPythonScriptRunnerDashboard` não existe painel.
162+
em tempo real (SignalR) e a interface Vue servida no prefixo escolhido. Sem `MapPythonScriptRunnerDashboard` não existe painel.
163+
164+
A interface (em pt-BR, tema claro/escuro) cobre a visão geral, Etapas (editor Monaco com construtor de campos, testar
165+
pela fila e publicar), Trilhas (editor visual com *handles* tipados, ou lista editável, testar e publicar), execuções ao
166+
vivo (fluxo por status, logs, arquivos, linha do tempo, cancelar e reprocessar), agendamentos com prévia do cron,
167+
auditoria e administração. Ela vai dentro do pacote: não há nada para hospedar à parte.
163168

164169
```csharp
165170
builder.Services
@@ -222,6 +227,7 @@ O host `hosts/PythonScriptRunner.DashboardHost` é um painel pronto: login fixo
222227
- .NET 10 SDK
223228
- [uv](https://docs.astral.sh/uv/) no PATH (cria e cacheia um ambiente Python por conjunto de dependências)
224229
- PostgreSQL 16+ apenas para o pacote de persistência e RabbitMQ 3.13+ para a fila (os testes usam Docker/Testcontainers)
230+
- Node.js 24 só para compilar em Release ou empacotar o `PythonScriptRunner.Dashboard` (o build embute o painel de `panel/`)
225231

226232
## Estrutura
227233

@@ -233,11 +239,12 @@ O host `hosts/PythonScriptRunner.DashboardHost` é um painel pronto: login fixo
233239
| `src/PythonScriptRunner.RabbitMQ` | topologia, relay do outbox, `IRunQueue`, comando público, eventos e assinaturas |
234240
| `src/PythonScriptRunner.Worker` | execução dos passos enfileirados, *lease*, retry, cancelamento, cron |
235241
| `src/PythonScriptRunner.Dashboard` | painel embutível: API interna, hub SignalR, modos de acesso (login fixo, filtro, host, local) |
242+
| `panel` | interface do painel: Vue 3, Vuetify 4, Vue Flow e Monaco (TypeScript, Vite, Vitest) |
236243
| `src/PythonScriptRunner.Tool` | dotnet tool `psr` (`psr hash-password`) |
237244
| `hosts` | `WorkerHost`, `DashboardHost` e `ServiceDefaults` (Serilog, OpenTelemetry, health checks) |
238245
| `python/psrunner` | SDK Python (`@stage`, `Context`, `File`, `StageError`, `psrunner.testing`, CLI) |
239246
| `schemas` | JSON Schemas do `stage.json`, do `*.pipeline.json` e das mensagens públicas |
240-
| `tests` | testes .NET (unitários e de integração com Python real) e fixtures de trilha |
247+
| `tests` | testes .NET (unitários, de integração com Python real e E2E do painel com Playwright) e fixtures de trilha |
241248

242249
## Desenvolvimento
243250

@@ -254,6 +261,30 @@ uv sync
254261
uv run pytest
255262
```
256263

264+
O painel fica em `panel/` (Node 24). Os builds em Debug embutem uma página provisória; em Release (ou com
265+
`-p:PsrBuildPanel=true`) o MSBuild roda `npm ci` e `npm run build` e embute `panel/dist`.
266+
267+
```bash
268+
cd panel
269+
npm ci
270+
npm run dev # Vite em http://localhost:5173/; /api e /hubs vão para o DashboardHost em PSR_DASHBOARD_URL (padrão http://localhost:5080, prefixo /psr)
271+
npm test # Vitest
272+
npm run lint # ESLint + Prettier
273+
npm run build # checagem de tipos, build e orçamento do bundle inicial (≤ 500 KB gzip)
274+
npm run api # regera src/api/schema.d.ts a partir do snapshot OpenAPI
275+
```
276+
277+
Os testes E2E do painel sobem o `DashboardHost` com 4 usuários de login fixo, um worker, PostgreSQL e RabbitMQ e dirigem
278+
o Chromium com Playwright (precisam de Docker e do painel embutido):
279+
280+
```bash
281+
dotnet build tests/PythonScriptRunner.Panel.E2E.Tests -p:PsrBuildPanel=true
282+
dotnet test --project tests/PythonScriptRunner.Panel.E2E.Tests --no-build # PSR_E2E_HEADED=1 mostra o navegador
283+
```
284+
285+
Quando um teste falha, o *trace* do Playwright fica em `TestResults/traces` ao lado do assembly de testes
286+
(`npx playwright show-trace <arquivo>.zip`).
287+
257288
O teste de desempenho do painel usa ~200 mil execuções; `PSR_PERF_RUNS_PER_DAY=50000` roda o volume médio completo (90 dias).
258289
O documento OpenAPI do painel é comparado com `tests/PythonScriptRunner.Dashboard.Tests/Snapshots/openapi-v1.verified.json`;
259290
depois de revisar uma mudança intencional, `PSR_ACCEPT_SNAPSHOTS=1` atualiza o snapshot.

‎panel/.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
dist/

‎panel/.nvmrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24

‎panel/.prettierignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dist
2+
node_modules
3+
src/api/schema.d.ts
4+
package-lock.json

‎panel/.prettierrc.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"printWidth": 130,
5+
"endOfLine": "lf",
6+
"tabWidth": 2
7+
}

‎panel/eslint.config.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import pluginVue from 'eslint-plugin-vue'
2+
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
3+
import prettier from 'eslint-config-prettier'
4+
5+
export default defineConfigWithVueTs(
6+
{ ignores: ['dist/**', 'node_modules/**', 'src/api/schema.d.ts'] },
7+
pluginVue.configs['flat/recommended'],
8+
vueTsConfigs.recommended,
9+
prettier,
10+
{
11+
rules: {
12+
'vue/multi-word-component-names': 'off',
13+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
14+
},
15+
},
16+
)

0 commit comments

Comments
 (0)