wu-sheng opened a new pull request, #83:
URL: https://github.com/apache/skywalking-horizon-ui/pull/83

   ## Why
   
   `LayerDashboardsAdmin.vue` had grown to ~6.4k lines — one file mixing 
layer/template browsing, five per-scope config editors, the widget canvas, and 
all persistence/sync. It was effectively unreviewable and the worst offender 
against the project's "keep files small, single-responsibility" principle. This 
PR decomposes it, and adds a CI-enforced source-size guardrail so the same 
class of file can't silently grow back.
   
   ## What
   
   Two logical commits in one PR (on top of the earlier MetricDefinitionRow 
extraction already on the branch).
   
   **Guardrail + CI** (`chore(ci)`)
   
   - ESLint `max-lines` raised 1000 → 2000 lines of *code* (comments + blank 
lines excluded) across ui + bff. The old 1000 cap shredded the cohesive 
template/style blocks a dense SFC legitimately carries.
   - A comment-volume budget script (`scripts/check-source-budget.mjs`, ≤500 
comment lines/file) for the dimension ESLint can't express, wired into `pnpm 
lint` + `pnpm lint:budget`.
   - A new CI `lint` job runs both and joins the `Required` status rollup — 
per-file source size/style is CI-gated for the first time.
   
   **Decomposition** (`refactor(layer-templates)`)
   
   - `LayerDashboardsAdmin.vue` 6365 → 888 lines (now an orchestration shell), 
split into ~14 cohesive single-responsibility files under 
`apps/ui/src/features/admin/layer-templates/`:
   - `useLayerTemplateStore` — the keystone: load / source / dirty / save / 
push / import / reset, the URL⇄state sync, and the single shared reactive 
`draft`.
   - per-scope config editors (Topology, Deployment, Process, Dependency, 
ServiceList) — each owns its `draft.template` slice via `defineModel` and 
mutates it in place (never clones); `RoleMetricRow` shared across deployment 
metric rows.
   - `WidgetEditorCanvas` (widget grid + drawer + drag/resize/reorder), 
`LayerSetupEditor`, and the presentational chrome trio (`LayerHeaderBar`, 
`LayerBrowseRail`, `ScopeTabsBar`).
   - `layer-dashboards.scopes` — the scope/component/slot constants seam.
   - Clears the lone remaining grandfather exemption now the file is within 
budget.
   
   No operator-visible behavior change, so no CHANGELOG / docs entry.
   
   ## Validation
   
   - Green: `type-check`, `build-ui`, `build-bff`, `license:check` (0 invalid), 
`lint` + budget (509 files within 2000/500), `test:unit` (116 passing).
   - Reviewed for regressions: a per-component byte-faithfulness pass and a 
deeper behavioral/integration pass (0 confirmed regressions; the behavioral 
pass surfaced — and the split fixes — two latent phantom-dirty bugs the 
monolith carried).
   - Live end-to-end against the public demo OAP (live mode): every scope tab 
renders, a real topology edit dirties the store and enables Save, the widget 
canvas drawer opens — zero console errors through the whole session.
   - Validation gap (honest): the Process-topology and Deployment config 
editors aren't enabled on the demo's General Service layer (no networkProfiling 
/ deployment capability), so those two are covered by type-check + the 
adversarial reviews rather than a live render.
   
   The pre-existing unrelated working-tree changes (CHANGELOG, k8s 
template/i18n, AlarmsTimeline) are intentionally NOT part of this PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to