@origen-ui/admin-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +17 -0
- package/bin/og-admin.mjs +131 -0
- package/package.json +28 -0
- package/templates/current/clean/.codebuddy/AGENTS.md +18 -0
- package/templates/current/clean/.codebuddy/rules/01-feature-architecture.md +12 -0
- package/templates/current/clean/.codebuddy/rules/02-vue-typescript.md +12 -0
- package/templates/current/clean/.codebuddy/rules/03-component-policy.md +30 -0
- package/templates/current/clean/.codebuddy/rules/04-api-auth-router.md +12 -0
- package/templates/current/clean/.codebuddy/rules/05-style.md +12 -0
- package/templates/current/clean/.codebuddy/rules/06-quality.md +12 -0
- package/templates/current/clean/.codebuddy/skills/build-admin-feature/SKILL.md +17 -0
- package/templates/current/clean/.codebuddy/skills/style-og-origen-ui/SKILL.md +14 -0
- package/templates/current/clean/.codebuddy/skills/use-og-dialog/SKILL.md +15 -0
- package/templates/current/clean/.codebuddy/skills/use-og-editor/SKILL.md +28 -0
- package/templates/current/clean/.codebuddy/skills/use-og-form/SKILL.md +15 -0
- package/templates/current/clean/.codebuddy/skills/use-og-form-table/SKILL.md +28 -0
- package/templates/current/clean/.codebuddy/skills/use-og-http/SKILL.md +16 -0
- package/templates/current/clean/.codebuddy/skills/use-og-router-tabs/SKILL.md +14 -0
- package/templates/current/clean/.codebuddy/skills/use-og-search/SKILL.md +17 -0
- package/templates/current/clean/.codebuddy/skills/use-og-table/SKILL.md +19 -0
- package/templates/current/clean/.codebuddy/skills/use-og-upload/SKILL.md +28 -0
- package/templates/current/clean/.codex/AGENTS.md +15 -0
- package/templates/current/clean/.codex/rules/01-feature-architecture.md +6 -0
- package/templates/current/clean/.codex/rules/02-vue-typescript.md +6 -0
- package/templates/current/clean/.codex/rules/03-component-policy.md +24 -0
- package/templates/current/clean/.codex/rules/04-api-auth-router.md +6 -0
- package/templates/current/clean/.codex/rules/05-style.md +6 -0
- package/templates/current/clean/.codex/rules/06-quality.md +6 -0
- package/templates/current/clean/.codex/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/clean/.codex/skills/build-admin-feature/references/component-selection.md +25 -0
- package/templates/current/clean/.codex/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/clean/.codex/skills/style-og-origen-ui/agents/openai.yaml +4 -0
- package/templates/current/clean/.codex/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/clean/.codex/skills/use-og-dialog/agents/openai.yaml +4 -0
- package/templates/current/clean/.codex/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/clean/.codex/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/clean/.codex/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/clean/.codex/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/clean/.codex/skills/use-og-http/agents/openai.yaml +4 -0
- package/templates/current/clean/.codex/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/clean/.codex/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/clean/.codex/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/clean/.codex/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/clean/.cursor/AGENTS.md +18 -0
- package/templates/current/clean/.cursor/rules/01-feature-architecture.mdc +12 -0
- package/templates/current/clean/.cursor/rules/02-vue-typescript.mdc +12 -0
- package/templates/current/clean/.cursor/rules/03-component-policy.mdc +30 -0
- package/templates/current/clean/.cursor/rules/04-api-auth-router.mdc +12 -0
- package/templates/current/clean/.cursor/rules/05-style.mdc +12 -0
- package/templates/current/clean/.cursor/rules/06-quality.mdc +12 -0
- package/templates/current/clean/.cursor/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/clean/.cursor/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/clean/.cursor/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/clean/.cursor/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/clean/.cursor/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/clean/.cursor/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/clean/.cursor/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/clean/.cursor/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/clean/.cursor/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/clean/.cursor/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/clean/.cursor/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/clean/.env.example +7 -0
- package/templates/current/clean/.env.production.example +31 -0
- package/templates/current/clean/.qoder/AGENTS.md +15 -0
- package/templates/current/clean/.qoder/rules/01-feature-architecture.md +12 -0
- package/templates/current/clean/.qoder/rules/02-vue-typescript.md +12 -0
- package/templates/current/clean/.qoder/rules/03-component-policy.md +30 -0
- package/templates/current/clean/.qoder/rules/04-api-auth-router.md +12 -0
- package/templates/current/clean/.qoder/rules/05-style.md +12 -0
- package/templates/current/clean/.qoder/rules/06-quality.md +12 -0
- package/templates/current/clean/.qoder/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/clean/.qoder/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/clean/.qoder/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/clean/.qoder/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/clean/.qoder/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/clean/.qoder/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/clean/.qoder/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/clean/.qoder/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/clean/.qoder/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/clean/.qoder/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/clean/.qoder/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/clean/AGENTS.md +16 -0
- package/templates/current/clean/README.md +116 -0
- package/templates/current/clean/component-catalog.json +765 -0
- package/templates/current/clean/e2e/admin-shell.spec.ts +150 -0
- package/templates/current/clean/e2e/demo-shell.spec.ts +328 -0
- package/templates/current/clean/evals/component-selection.json +29 -0
- package/templates/current/clean/gitignore +3 -0
- package/templates/current/clean/index.html +13 -0
- package/templates/current/clean/openapi.json +1623 -0
- package/templates/current/clean/package.json +65 -0
- package/templates/current/clean/playwright.config.ts +31 -0
- package/templates/current/clean/playwright.demo.config.ts +25 -0
- package/templates/current/clean/recipes/README.md +7 -0
- package/templates/current/clean/recipes/remote-crud-dialog-form.json +15 -0
- package/templates/current/clean/recipes/remote-crud-dialog-form.vue +66 -0
- package/templates/current/clean/scaffold.lock.json +12 -0
- package/templates/current/clean/scripts/check-admin-bundle.mjs +214 -0
- package/templates/current/clean/scripts/check-admin-scaffold.mjs +168 -0
- package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +26 -0
- package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +26 -0
- package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +26 -0
- package/templates/current/clean/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +32 -0
- package/templates/current/clean/scripts/clean-overlay/src/main.ts +91 -0
- package/templates/current/clean/scripts/clean-overlay/src/router/componentRegistry.ts +25 -0
- package/templates/current/clean/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +47 -0
- package/templates/current/clean/scripts/clean-overlay/src/router/staticRoutes.ts +63 -0
- package/templates/current/clean/scripts/demo-api.ts +797 -0
- package/templates/current/clean/scripts/generate-api.ts +27 -0
- package/templates/current/clean/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +38 -0
- package/templates/current/clean/scripts/remove-examples.mjs +54 -0
- package/templates/current/clean/src/App.vue +67 -0
- package/templates/current/clean/src/api/client.spec.ts +66 -0
- package/templates/current/clean/src/api/client.ts +72 -0
- package/templates/current/clean/src/api/generated/data-contracts.ts +268 -0
- package/templates/current/clean/src/api/generated/http-client.ts +266 -0
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/206/205/345/256/271/346/226/207/347/253/240.ts +147 -0
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/256/241/350/256/241.ts +53 -0
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/346/226/207/344/273/266/344/270/212/344/274/240.ts +66 -0
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/347/224/250/346/210/267.ts +171 -0
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/217/234/345/215/225.ts +181 -0
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/247/222/350/211/262.ts +169 -0
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/256/242/345/215/225/350/215/211/347/250/277.ts +170 -0
- package/templates/current/clean/src/api/generated//350/256/244/350/257/201.ts +98 -0
- package/templates/current/clean/src/api/http-adapter.spec.ts +33 -0
- package/templates/current/clean/src/api/http-adapter.ts +83 -0
- package/templates/current/clean/src/api/index.ts +41 -0
- package/templates/current/clean/src/app/createAdminUi.spec.ts +110 -0
- package/templates/current/clean/src/app/createAdminUi.ts +78 -0
- package/templates/current/clean/src/app/menu.spec.ts +255 -0
- package/templates/current/clean/src/app/menu.ts +268 -0
- package/templates/current/clean/src/app/menuTypes.ts +17 -0
- package/templates/current/clean/src/app/origenUiLocale.spec.ts +14 -0
- package/templates/current/clean/src/app/origenUiLocale.ts +65 -0
- package/templates/current/clean/src/app/permission.ts +9 -0
- package/templates/current/clean/src/app/runtimeConfig.ts +77 -0
- package/templates/current/clean/src/demo-api.spec.ts +167 -0
- package/templates/current/clean/src/env.d.ts +14 -0
- package/templates/current/clean/src/features/appearance/components/ThemePanel.vue +200 -0
- package/templates/current/clean/src/features/appearance/composables/useTheme.ts +17 -0
- package/templates/current/clean/src/features/appearance/store/theme.ts +140 -0
- package/templates/current/clean/src/features/auth/pages/Login.vue +159 -0
- package/templates/current/clean/src/features/auth/store/auth.spec.ts +131 -0
- package/templates/current/clean/src/features/auth/store/auth.ts +210 -0
- package/templates/current/clean/src/features/errors/pages/Forbidden.vue +26 -0
- package/templates/current/clean/src/features/errors/pages/NotFound.vue +26 -0
- package/templates/current/clean/src/features/errors/pages/ServerError.vue +26 -0
- package/templates/current/clean/src/features/errors/pages/error-pages.spec.ts +32 -0
- package/templates/current/clean/src/features/security/components/DevtoolsProtectionOverlay.vue +56 -0
- package/templates/current/clean/src/features/security/devtoolsProtection.spec.ts +211 -0
- package/templates/current/clean/src/features/security/devtoolsProtection.ts +242 -0
- package/templates/current/clean/src/features/shell/components/AdminWatermark.spec.ts +90 -0
- package/templates/current/clean/src/features/shell/components/AdminWatermark.vue +47 -0
- package/templates/current/clean/src/features/shell/components/RouteProgress.vue +68 -0
- package/templates/current/clean/src/features/shell/composables/useRouteProgress.spec.ts +95 -0
- package/templates/current/clean/src/features/shell/composables/useRouteProgress.ts +52 -0
- package/templates/current/clean/src/features/shell/store/sidebar.ts +55 -0
- package/templates/current/clean/src/features/system/access/api/admin-repository.ts +279 -0
- package/templates/current/clean/src/features/system/access/api/rbac.spec.ts +72 -0
- package/templates/current/clean/src/features/system/access/api/rbac.ts +272 -0
- package/templates/current/clean/src/features/system/access/composables/useAuthorizationRefresh.ts +15 -0
- package/templates/current/clean/src/features/workspace/pages/Empty.vue +18 -0
- package/templates/current/clean/src/features/workspace/pages/Profile.vue +183 -0
- package/templates/current/clean/src/layouts/AdminLayout.vue +61 -0
- package/templates/current/clean/src/layouts/BreadcrumbBar.vue +27 -0
- package/templates/current/clean/src/layouts/SideMenu.vue +119 -0
- package/templates/current/clean/src/layouts/TopBar.vue +301 -0
- package/templates/current/clean/src/layouts/WorkspaceTabs.vue +44 -0
- package/templates/current/clean/src/layouts/topBarMenuSearch.spec.ts +31 -0
- package/templates/current/clean/src/layouts/topBarMenuSearch.ts +21 -0
- package/templates/current/clean/src/locales/en-US.ts +55 -0
- package/templates/current/clean/src/locales/index.ts +119 -0
- package/templates/current/clean/src/locales/messages.spec.ts +23 -0
- package/templates/current/clean/src/locales/zh-CN.ts +55 -0
- package/templates/current/clean/src/locales/zh-TW.ts +44 -0
- package/templates/current/clean/src/main.ts +91 -0
- package/templates/current/clean/src/router/bootstrap.ts +76 -0
- package/templates/current/clean/src/router/componentRegistry.ts +25 -0
- package/templates/current/clean/src/router/dynamicRoutes.spec.ts +47 -0
- package/templates/current/clean/src/router/dynamicRoutes.ts +162 -0
- package/templates/current/clean/src/router/guards.ts +5 -0
- package/templates/current/clean/src/router/queryEncryption.spec.ts +82 -0
- package/templates/current/clean/src/router/queryEncryption.ts +133 -0
- package/templates/current/clean/src/router/routeQuery.spec.ts +11 -0
- package/templates/current/clean/src/router/routeQuery.ts +3 -0
- package/templates/current/clean/src/router/runtimeErrorRecovery.spec.ts +161 -0
- package/templates/current/clean/src/router/runtimeErrorRecovery.ts +108 -0
- package/templates/current/clean/src/router/staticRoutes.ts +63 -0
- package/templates/current/clean/src/router/useRouteQueryDefaults.spec.ts +90 -0
- package/templates/current/clean/src/router/useRouteQueryDefaults.ts +51 -0
- package/templates/current/clean/src/router/useRouteQueryDefaults.types.ts +19 -0
- package/templates/current/clean/src/store/index.ts +3 -0
- package/templates/current/clean/src/styles/element/index.scss +33 -0
- package/templates/current/clean/src/styles/index.css +39 -0
- package/templates/current/clean/src/styles/layout.css +115 -0
- package/templates/current/clean/src/styles/shell.css +196 -0
- package/templates/current/clean/src/styles/source-package-style-compat.css +1 -0
- package/templates/current/clean/src/templates/og-form.ts +48 -0
- package/templates/current/clean/src/templates/og-table.ts +212 -0
- package/templates/current/clean/src/templates/router.ts +51 -0
- package/templates/current/clean/src/templates/templates.spec.ts +90 -0
- package/templates/current/clean/src/theme/index.ts +7 -0
- package/templates/current/clean/src/utils/__tests__/color-mix.spec.ts +39 -0
- package/templates/current/clean/src/utils/color-mix.ts +76 -0
- package/templates/current/clean/src/utils/permissions.ts +6 -0
- package/templates/current/clean/tsconfig.json +40 -0
- package/templates/current/clean/tsconfig.node.json +9 -0
- package/templates/current/clean/vite.build-policy.ts +405 -0
- package/templates/current/clean/vite.config.ts +37 -0
- package/templates/current/examples/.codebuddy/AGENTS.md +18 -0
- package/templates/current/examples/.codebuddy/rules/01-feature-architecture.md +12 -0
- package/templates/current/examples/.codebuddy/rules/02-vue-typescript.md +12 -0
- package/templates/current/examples/.codebuddy/rules/03-component-policy.md +30 -0
- package/templates/current/examples/.codebuddy/rules/04-api-auth-router.md +12 -0
- package/templates/current/examples/.codebuddy/rules/05-style.md +12 -0
- package/templates/current/examples/.codebuddy/rules/06-quality.md +12 -0
- package/templates/current/examples/.codebuddy/skills/build-admin-feature/SKILL.md +17 -0
- package/templates/current/examples/.codebuddy/skills/style-og-origen-ui/SKILL.md +14 -0
- package/templates/current/examples/.codebuddy/skills/use-og-dialog/SKILL.md +15 -0
- package/templates/current/examples/.codebuddy/skills/use-og-editor/SKILL.md +28 -0
- package/templates/current/examples/.codebuddy/skills/use-og-form/SKILL.md +15 -0
- package/templates/current/examples/.codebuddy/skills/use-og-form-table/SKILL.md +28 -0
- package/templates/current/examples/.codebuddy/skills/use-og-http/SKILL.md +16 -0
- package/templates/current/examples/.codebuddy/skills/use-og-router-tabs/SKILL.md +14 -0
- package/templates/current/examples/.codebuddy/skills/use-og-search/SKILL.md +17 -0
- package/templates/current/examples/.codebuddy/skills/use-og-table/SKILL.md +19 -0
- package/templates/current/examples/.codebuddy/skills/use-og-upload/SKILL.md +28 -0
- package/templates/current/examples/.codex/AGENTS.md +15 -0
- package/templates/current/examples/.codex/rules/01-feature-architecture.md +6 -0
- package/templates/current/examples/.codex/rules/02-vue-typescript.md +6 -0
- package/templates/current/examples/.codex/rules/03-component-policy.md +24 -0
- package/templates/current/examples/.codex/rules/04-api-auth-router.md +6 -0
- package/templates/current/examples/.codex/rules/05-style.md +6 -0
- package/templates/current/examples/.codex/rules/06-quality.md +6 -0
- package/templates/current/examples/.codex/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/examples/.codex/skills/build-admin-feature/references/component-selection.md +25 -0
- package/templates/current/examples/.codex/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/examples/.codex/skills/style-og-origen-ui/agents/openai.yaml +4 -0
- package/templates/current/examples/.codex/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/examples/.codex/skills/use-og-dialog/agents/openai.yaml +4 -0
- package/templates/current/examples/.codex/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/examples/.codex/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/examples/.codex/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/examples/.codex/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/examples/.codex/skills/use-og-http/agents/openai.yaml +4 -0
- package/templates/current/examples/.codex/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/examples/.codex/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/examples/.codex/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/examples/.codex/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/examples/.cursor/AGENTS.md +18 -0
- package/templates/current/examples/.cursor/rules/01-feature-architecture.mdc +12 -0
- package/templates/current/examples/.cursor/rules/02-vue-typescript.mdc +12 -0
- package/templates/current/examples/.cursor/rules/03-component-policy.mdc +30 -0
- package/templates/current/examples/.cursor/rules/04-api-auth-router.mdc +12 -0
- package/templates/current/examples/.cursor/rules/05-style.mdc +12 -0
- package/templates/current/examples/.cursor/rules/06-quality.mdc +12 -0
- package/templates/current/examples/.cursor/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/examples/.cursor/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/examples/.cursor/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/examples/.cursor/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/examples/.cursor/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/examples/.cursor/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/examples/.cursor/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/examples/.cursor/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/examples/.cursor/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/examples/.cursor/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/examples/.cursor/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/examples/.env.example +7 -0
- package/templates/current/examples/.env.production.example +31 -0
- package/templates/current/examples/.qoder/AGENTS.md +15 -0
- package/templates/current/examples/.qoder/rules/01-feature-architecture.md +12 -0
- package/templates/current/examples/.qoder/rules/02-vue-typescript.md +12 -0
- package/templates/current/examples/.qoder/rules/03-component-policy.md +30 -0
- package/templates/current/examples/.qoder/rules/04-api-auth-router.md +12 -0
- package/templates/current/examples/.qoder/rules/05-style.md +12 -0
- package/templates/current/examples/.qoder/rules/06-quality.md +12 -0
- package/templates/current/examples/.qoder/skills/build-admin-feature/SKILL.md +14 -0
- package/templates/current/examples/.qoder/skills/style-og-origen-ui/SKILL.md +11 -0
- package/templates/current/examples/.qoder/skills/use-og-dialog/SKILL.md +12 -0
- package/templates/current/examples/.qoder/skills/use-og-editor/SKILL.md +25 -0
- package/templates/current/examples/.qoder/skills/use-og-form/SKILL.md +12 -0
- package/templates/current/examples/.qoder/skills/use-og-form-table/SKILL.md +25 -0
- package/templates/current/examples/.qoder/skills/use-og-http/SKILL.md +13 -0
- package/templates/current/examples/.qoder/skills/use-og-router-tabs/SKILL.md +11 -0
- package/templates/current/examples/.qoder/skills/use-og-search/SKILL.md +14 -0
- package/templates/current/examples/.qoder/skills/use-og-table/SKILL.md +16 -0
- package/templates/current/examples/.qoder/skills/use-og-upload/SKILL.md +25 -0
- package/templates/current/examples/AGENTS.md +16 -0
- package/templates/current/examples/README.md +116 -0
- package/templates/current/examples/component-catalog.json +765 -0
- package/templates/current/examples/e2e/admin-shell.spec.ts +150 -0
- package/templates/current/examples/e2e/demo-shell.spec.ts +328 -0
- package/templates/current/examples/evals/component-selection.json +29 -0
- package/templates/current/examples/gitignore +3 -0
- package/templates/current/examples/index.html +13 -0
- package/templates/current/examples/openapi.json +1623 -0
- package/templates/current/examples/package.json +65 -0
- package/templates/current/examples/playwright.config.ts +31 -0
- package/templates/current/examples/playwright.demo.config.ts +25 -0
- package/templates/current/examples/recipes/README.md +7 -0
- package/templates/current/examples/recipes/remote-crud-dialog-form.json +15 -0
- package/templates/current/examples/recipes/remote-crud-dialog-form.vue +66 -0
- package/templates/current/examples/scaffold.lock.json +12 -0
- package/templates/current/examples/scripts/check-admin-bundle.mjs +214 -0
- package/templates/current/examples/scripts/check-admin-scaffold.mjs +168 -0
- package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/Forbidden.vue +26 -0
- package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/NotFound.vue +26 -0
- package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/ServerError.vue +26 -0
- package/templates/current/examples/scripts/clean-overlay/src/features/errors/pages/error-pages.spec.ts +32 -0
- package/templates/current/examples/scripts/clean-overlay/src/main.ts +91 -0
- package/templates/current/examples/scripts/clean-overlay/src/router/componentRegistry.ts +25 -0
- package/templates/current/examples/scripts/clean-overlay/src/router/dynamicRoutes.spec.ts +47 -0
- package/templates/current/examples/scripts/clean-overlay/src/router/staticRoutes.ts +63 -0
- package/templates/current/examples/scripts/demo-api.ts +797 -0
- package/templates/current/examples/scripts/generate-api.ts +27 -0
- package/templates/current/examples/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +38 -0
- package/templates/current/examples/scripts/remove-examples.mjs +54 -0
- package/templates/current/examples/src/App.vue +67 -0
- package/templates/current/examples/src/api/client.spec.ts +66 -0
- package/templates/current/examples/src/api/client.ts +72 -0
- package/templates/current/examples/src/api/generated/data-contracts.ts +268 -0
- package/templates/current/examples/src/api/generated/http-client.ts +266 -0
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/206/205/345/256/271/346/226/207/347/253/240.ts +147 -0
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/256/241/350/256/241.ts +53 -0
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/346/226/207/344/273/266/344/270/212/344/274/240.ts +66 -0
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/347/224/250/346/210/267.ts +171 -0
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/217/234/345/215/225.ts +181 -0
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/247/222/350/211/262.ts +169 -0
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/256/242/345/215/225/350/215/211/347/250/277.ts +170 -0
- package/templates/current/examples/src/api/generated//350/256/244/350/257/201.ts +98 -0
- package/templates/current/examples/src/api/http-adapter.spec.ts +33 -0
- package/templates/current/examples/src/api/http-adapter.ts +83 -0
- package/templates/current/examples/src/api/index.ts +41 -0
- package/templates/current/examples/src/app/createAdminUi.spec.ts +110 -0
- package/templates/current/examples/src/app/createAdminUi.ts +78 -0
- package/templates/current/examples/src/app/menu.spec.ts +255 -0
- package/templates/current/examples/src/app/menu.ts +268 -0
- package/templates/current/examples/src/app/menuTypes.ts +17 -0
- package/templates/current/examples/src/app/origenUiLocale.spec.ts +14 -0
- package/templates/current/examples/src/app/origenUiLocale.ts +65 -0
- package/templates/current/examples/src/app/permission.ts +9 -0
- package/templates/current/examples/src/app/runtimeConfig.ts +77 -0
- package/templates/current/examples/src/demo-api.spec.ts +167 -0
- package/templates/current/examples/src/env.d.ts +14 -0
- package/templates/current/examples/src/features/appearance/components/ThemePanel.vue +200 -0
- package/templates/current/examples/src/features/appearance/composables/useTheme.ts +17 -0
- package/templates/current/examples/src/features/appearance/store/theme.ts +140 -0
- package/templates/current/examples/src/features/auth/pages/Login.vue +159 -0
- package/templates/current/examples/src/features/auth/store/auth.spec.ts +131 -0
- package/templates/current/examples/src/features/auth/store/auth.ts +210 -0
- package/templates/current/examples/src/features/errors/pages/Forbidden.vue +26 -0
- package/templates/current/examples/src/features/errors/pages/NotFound.vue +26 -0
- package/templates/current/examples/src/features/errors/pages/ServerError.vue +26 -0
- package/templates/current/examples/src/features/errors/pages/error-pages.spec.ts +32 -0
- package/templates/current/examples/src/features/feature-composables.spec.ts +208 -0
- package/templates/current/examples/src/features/security/components/DevtoolsProtectionOverlay.vue +56 -0
- package/templates/current/examples/src/features/security/devtoolsProtection.spec.ts +211 -0
- package/templates/current/examples/src/features/security/devtoolsProtection.ts +242 -0
- package/templates/current/examples/src/features/shell/components/AdminWatermark.spec.ts +90 -0
- package/templates/current/examples/src/features/shell/components/AdminWatermark.vue +47 -0
- package/templates/current/examples/src/features/shell/components/RouteProgress.vue +68 -0
- package/templates/current/examples/src/features/shell/composables/useRouteProgress.spec.ts +95 -0
- package/templates/current/examples/src/features/shell/composables/useRouteProgress.ts +52 -0
- package/templates/current/examples/src/features/shell/store/sidebar.ts +55 -0
- package/templates/current/examples/src/features/system/access/api/admin-repository.ts +279 -0
- package/templates/current/examples/src/features/system/access/api/rbac.spec.ts +72 -0
- package/templates/current/examples/src/features/system/access/api/rbac.ts +272 -0
- package/templates/current/examples/src/features/system/access/composables/useAuthorizationRefresh.ts +15 -0
- package/templates/current/examples/src/features/system/audit/composables/useAuditManagement.ts +117 -0
- package/templates/current/examples/src/features/system/audit/pages/AuditList.vue +20 -0
- package/templates/current/examples/src/features/system/menus/components/MenuEditorForm.vue +189 -0
- package/templates/current/examples/src/features/system/menus/composables/useMenuManagement.ts +327 -0
- package/templates/current/examples/src/features/system/menus/pages/MenuList.vue +49 -0
- package/templates/current/examples/src/features/system/roles/components/RoleEditorForm.vue +112 -0
- package/templates/current/examples/src/features/system/roles/composables/useRoleManagement.ts +198 -0
- package/templates/current/examples/src/features/system/roles/pages/RoleList.vue +45 -0
- package/templates/current/examples/src/features/system/users/components/UserEditorForm.vue +101 -0
- package/templates/current/examples/src/features/system/users/composables/useUserManagement.ts +233 -0
- package/templates/current/examples/src/features/system/users/pages/UserList.vue +49 -0
- package/templates/current/examples/src/features/workspace/pages/Dashboard.spec.ts +32 -0
- package/templates/current/examples/src/features/workspace/pages/Dashboard.vue +297 -0
- package/templates/current/examples/src/features/workspace/pages/Empty.vue +18 -0
- package/templates/current/examples/src/features/workspace/pages/Profile.vue +183 -0
- package/templates/current/examples/src/layouts/AdminLayout.vue +61 -0
- package/templates/current/examples/src/layouts/BreadcrumbBar.vue +27 -0
- package/templates/current/examples/src/layouts/SideMenu.vue +119 -0
- package/templates/current/examples/src/layouts/TopBar.vue +301 -0
- package/templates/current/examples/src/layouts/WorkspaceTabs.vue +44 -0
- package/templates/current/examples/src/layouts/topBarMenuSearch.spec.ts +31 -0
- package/templates/current/examples/src/layouts/topBarMenuSearch.ts +21 -0
- package/templates/current/examples/src/locales/en-US.ts +55 -0
- package/templates/current/examples/src/locales/index.ts +119 -0
- package/templates/current/examples/src/locales/messages.spec.ts +23 -0
- package/templates/current/examples/src/locales/zh-CN.ts +55 -0
- package/templates/current/examples/src/locales/zh-TW.ts +44 -0
- package/templates/current/examples/src/main.ts +91 -0
- package/templates/current/examples/src/router/bootstrap.ts +76 -0
- package/templates/current/examples/src/router/componentRegistry.ts +83 -0
- package/templates/current/examples/src/router/dynamicRoutes.spec.ts +109 -0
- package/templates/current/examples/src/router/dynamicRoutes.ts +162 -0
- package/templates/current/examples/src/router/guards.ts +5 -0
- package/templates/current/examples/src/router/queryEncryption.spec.ts +82 -0
- package/templates/current/examples/src/router/queryEncryption.ts +133 -0
- package/templates/current/examples/src/router/routeQuery.spec.ts +11 -0
- package/templates/current/examples/src/router/routeQuery.ts +3 -0
- package/templates/current/examples/src/router/runtimeErrorRecovery.spec.ts +161 -0
- package/templates/current/examples/src/router/runtimeErrorRecovery.ts +108 -0
- package/templates/current/examples/src/router/staticRoutes.ts +63 -0
- package/templates/current/examples/src/router/useRouteQueryDefaults.spec.ts +90 -0
- package/templates/current/examples/src/router/useRouteQueryDefaults.ts +51 -0
- package/templates/current/examples/src/router/useRouteQueryDefaults.types.ts +19 -0
- package/templates/current/examples/src/store/index.ts +3 -0
- package/templates/current/examples/src/styles/element/index.scss +33 -0
- package/templates/current/examples/src/styles/index.css +39 -0
- package/templates/current/examples/src/styles/layout.css +115 -0
- package/templates/current/examples/src/styles/shell.css +196 -0
- package/templates/current/examples/src/styles/source-package-style-compat.css +1 -0
- package/templates/current/examples/src/templates/og-form.ts +48 -0
- package/templates/current/examples/src/templates/og-table.ts +212 -0
- package/templates/current/examples/src/templates/router.ts +51 -0
- package/templates/current/examples/src/templates/templates.spec.ts +90 -0
- package/templates/current/examples/src/theme/index.ts +7 -0
- package/templates/current/examples/src/utils/__tests__/color-mix.spec.ts +39 -0
- package/templates/current/examples/src/utils/color-mix.ts +76 -0
- package/templates/current/examples/src/utils/permissions.ts +6 -0
- package/templates/current/examples/tsconfig.json +40 -0
- package/templates/current/examples/tsconfig.node.json +9 -0
- package/templates/current/examples/vite.build-policy.ts +405 -0
- package/templates/current/examples/vite.config.ts +37 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { Page } from '@playwright/test'
|
|
2
|
+
import { expect, test } from '@playwright/test'
|
|
3
|
+
|
|
4
|
+
const permissions = [
|
|
5
|
+
'workspace:dashboard:read',
|
|
6
|
+
'system:user:read',
|
|
7
|
+
'system:role:read',
|
|
8
|
+
'system:menu:read',
|
|
9
|
+
'system:audit:read',
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
const menus = [
|
|
13
|
+
{
|
|
14
|
+
code: 'dashboard',
|
|
15
|
+
path: '/dashboard',
|
|
16
|
+
title: '工作台',
|
|
17
|
+
componentKey: 'dashboard',
|
|
18
|
+
icon: 'dashboard',
|
|
19
|
+
permissions: ['workspace:dashboard:read'],
|
|
20
|
+
menu: true,
|
|
21
|
+
cache: true,
|
|
22
|
+
order: 10,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
code: 'system',
|
|
26
|
+
path: '/system',
|
|
27
|
+
title: '系统管理',
|
|
28
|
+
componentKey: 'outlet',
|
|
29
|
+
icon: 'system',
|
|
30
|
+
menu: true,
|
|
31
|
+
order: 20,
|
|
32
|
+
children: [
|
|
33
|
+
{
|
|
34
|
+
code: 'users',
|
|
35
|
+
path: 'users',
|
|
36
|
+
title: '用户管理',
|
|
37
|
+
componentKey: 'user-list',
|
|
38
|
+
permissions: ['system:user:read'],
|
|
39
|
+
menu: true,
|
|
40
|
+
order: 10,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
code: 'roles',
|
|
44
|
+
path: 'roles',
|
|
45
|
+
title: '角色管理',
|
|
46
|
+
componentKey: 'role-list',
|
|
47
|
+
permissions: ['system:role:read'],
|
|
48
|
+
menu: true,
|
|
49
|
+
order: 20,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
code: 'menus',
|
|
53
|
+
path: 'menus',
|
|
54
|
+
title: '菜单管理',
|
|
55
|
+
componentKey: 'menu-list',
|
|
56
|
+
permissions: ['system:menu:read'],
|
|
57
|
+
menu: true,
|
|
58
|
+
order: 30,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
code: 'audit',
|
|
62
|
+
path: 'audit',
|
|
63
|
+
title: '审计日志',
|
|
64
|
+
componentKey: 'audit-list',
|
|
65
|
+
permissions: ['system:audit:read'],
|
|
66
|
+
menu: true,
|
|
67
|
+
order: 40,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
function envelope(data: unknown): { code: number, data: unknown, message: string } {
|
|
74
|
+
return { code: 0, data, message: 'ok' }
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async function mockBackend(page: Page): Promise<{ login: number, menus: number, profile: number }> {
|
|
78
|
+
const calls = { login: 0, menus: 0, profile: 0 }
|
|
79
|
+
await page.route('**/api/auth/login', async (route) => {
|
|
80
|
+
calls.login += 1
|
|
81
|
+
await route.fulfill({
|
|
82
|
+
json: envelope({
|
|
83
|
+
accessToken: 'production-e2e-token',
|
|
84
|
+
user: { id: 'admin-1', username: 'admin', displayName: 'E2E 管理员' },
|
|
85
|
+
permissions,
|
|
86
|
+
roleIds: ['role-admin'],
|
|
87
|
+
authorizationRevision: 7,
|
|
88
|
+
}),
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
await page.route('**/api/auth/profile', async (route) => {
|
|
92
|
+
calls.profile += 1
|
|
93
|
+
await route.fulfill({
|
|
94
|
+
json: envelope({
|
|
95
|
+
user: { id: 'admin-1', username: 'admin', displayName: 'E2E 管理员' },
|
|
96
|
+
permissions,
|
|
97
|
+
roleIds: ['role-admin'],
|
|
98
|
+
authorizationRevision: 7,
|
|
99
|
+
}),
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
await page.route('**/api/system/menus*', async (route) => {
|
|
103
|
+
calls.menus += 1
|
|
104
|
+
await route.fulfill({ json: envelope(menus) })
|
|
105
|
+
})
|
|
106
|
+
return calls
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function signIn(page: Page): Promise<void> {
|
|
110
|
+
await page.goto('/login')
|
|
111
|
+
await page.getByLabel('账号').fill('admin')
|
|
112
|
+
await page.getByLabel('密码').fill('secure-password')
|
|
113
|
+
await page.getByRole('button', { name: '登录' }).click()
|
|
114
|
+
await expect(page).toHaveURL(/\/dashboard$/)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const adapterError = 'No @origen-ui/router adapter has been installed on this application.'
|
|
118
|
+
|
|
119
|
+
test.describe('admin production shell', () => {
|
|
120
|
+
test('loads authentication, profile, and menus through remote API contracts', async ({
|
|
121
|
+
page,
|
|
122
|
+
}) => {
|
|
123
|
+
const pageErrors: string[] = []
|
|
124
|
+
page.on('pageerror', (error) => {
|
|
125
|
+
pageErrors.push(error.message)
|
|
126
|
+
})
|
|
127
|
+
await page.addInitScript(() => {
|
|
128
|
+
sessionStorage.setItem('og-admin-devtools-unlocked', 'true')
|
|
129
|
+
})
|
|
130
|
+
const calls = await mockBackend(page)
|
|
131
|
+
|
|
132
|
+
await signIn(page)
|
|
133
|
+
await page.reload()
|
|
134
|
+
|
|
135
|
+
await expect(page.locator('.admin-shell')).toBeVisible()
|
|
136
|
+
if (test.info().project.name === 'mobile-chromium')
|
|
137
|
+
await page.locator('.top-bar__icon-btn').first().click()
|
|
138
|
+
await expect(page.getByRole('navigation', { name: '应用导航' })).toHaveCount(1)
|
|
139
|
+
await expect(page.locator('.breadcrumb-bar')).toBeVisible()
|
|
140
|
+
await expect(page.locator('.workspace-tabs')).toBeVisible()
|
|
141
|
+
await expect(page.locator('.admin-shell__route-view')).toBeVisible()
|
|
142
|
+
await expect(page.locator('.dashboard-page')).toBeVisible()
|
|
143
|
+
await expect(page.locator('.page-header')).toHaveCount(0)
|
|
144
|
+
|
|
145
|
+
expect(calls.login).toBe(1)
|
|
146
|
+
expect(calls.profile).toBeGreaterThanOrEqual(1)
|
|
147
|
+
expect(calls.menus).toBeGreaterThanOrEqual(1)
|
|
148
|
+
expect(pageErrors).not.toContain(adapterError)
|
|
149
|
+
})
|
|
150
|
+
})
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import type { APIRequestContext } from '@playwright/test'
|
|
2
|
+
import { expect, test } from '@playwright/test'
|
|
3
|
+
|
|
4
|
+
test.setTimeout(120_000)
|
|
5
|
+
|
|
6
|
+
interface Envelope<T> {
|
|
7
|
+
code: number
|
|
8
|
+
message: string
|
|
9
|
+
data: T
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface DemoLogin {
|
|
13
|
+
accessToken: string
|
|
14
|
+
permissions: string[]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface DemoRecord {
|
|
18
|
+
id: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface DemoSummary {
|
|
22
|
+
userCount: number
|
|
23
|
+
roleCount: number
|
|
24
|
+
menuCount: number
|
|
25
|
+
auditCount: number
|
|
26
|
+
revision: number
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function demoRequest<T>(
|
|
30
|
+
request: APIRequestContext,
|
|
31
|
+
method: 'GET' | 'POST',
|
|
32
|
+
path: string,
|
|
33
|
+
token?: string,
|
|
34
|
+
data?: unknown,
|
|
35
|
+
): Promise<T> {
|
|
36
|
+
const response = await request.fetch(path, {
|
|
37
|
+
method,
|
|
38
|
+
data,
|
|
39
|
+
headers: token ? { Authorization: `Bearer ${token}` } : undefined,
|
|
40
|
+
})
|
|
41
|
+
expect(response.status()).toBe(200)
|
|
42
|
+
|
|
43
|
+
const body = (await response.json()) as Envelope<T>
|
|
44
|
+
expect(body.code).toBe(0)
|
|
45
|
+
return body.data
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
test('admin demo logs in, registers remote routes, and persists mutations for this session', async ({
|
|
49
|
+
page,
|
|
50
|
+
request,
|
|
51
|
+
}) => {
|
|
52
|
+
const login = await demoRequest<DemoLogin>(request, 'POST', '/api/auth/login', undefined, {
|
|
53
|
+
username: 'admin',
|
|
54
|
+
password: 'admin123',
|
|
55
|
+
})
|
|
56
|
+
expect(login.permissions).toContain('system:user:write')
|
|
57
|
+
|
|
58
|
+
await page.goto('/login')
|
|
59
|
+
const loginInputs = page.locator('.login-page input')
|
|
60
|
+
await loginInputs.nth(0).fill('admin')
|
|
61
|
+
await loginInputs.nth(1).fill('admin123')
|
|
62
|
+
await Promise.all([
|
|
63
|
+
page.waitForURL('**/dashboard'),
|
|
64
|
+
page.locator('button.login-card__submit').click(),
|
|
65
|
+
])
|
|
66
|
+
|
|
67
|
+
await expect(page.locator('.admin-shell')).toBeVisible({ timeout: 15_000 })
|
|
68
|
+
await page.setViewportSize({ width: 1920, height: 1080 })
|
|
69
|
+
await expect(page.locator('.dashboard-page')).toBeVisible()
|
|
70
|
+
await page.getByRole('button', { name: '简体中文', exact: true }).click()
|
|
71
|
+
await page.getByText('English', { exact: true }).last().click()
|
|
72
|
+
await expect(page.locator('.top-bar__search .el-select__placeholder')).toHaveText(
|
|
73
|
+
'Search menus or pages',
|
|
74
|
+
)
|
|
75
|
+
await expect(page.locator('html')).toHaveAttribute('lang', 'en-US')
|
|
76
|
+
await page.getByRole('button', { name: 'English', exact: true }).click()
|
|
77
|
+
await page.getByText('繁體中文', { exact: true }).last().click()
|
|
78
|
+
await expect(page.locator('.top-bar__search .el-select__placeholder')).toHaveText(
|
|
79
|
+
'搜尋選單或頁面',
|
|
80
|
+
)
|
|
81
|
+
await expect(page.locator('html')).toHaveAttribute('lang', 'zh-TW')
|
|
82
|
+
await page.getByRole('button', { name: '繁體中文', exact: true }).click()
|
|
83
|
+
await page.getByText('简体中文', { exact: true }).last().click()
|
|
84
|
+
await expect(page.locator('.top-bar__search .el-select__placeholder')).toHaveText(
|
|
85
|
+
'搜索菜单或页面',
|
|
86
|
+
)
|
|
87
|
+
await expect(page.getByRole('button', { name: '消息' })).toHaveCount(0)
|
|
88
|
+
const documentNavigations: string[] = []
|
|
89
|
+
const runtimeWarnings: string[] = []
|
|
90
|
+
page.on('request', (request) => {
|
|
91
|
+
if (request.isNavigationRequest() && request.frame() === page.mainFrame())
|
|
92
|
+
documentNavigations.push(request.url())
|
|
93
|
+
})
|
|
94
|
+
page.on('console', (message) => {
|
|
95
|
+
if (message.type() === 'warning' || message.type() === 'error')
|
|
96
|
+
runtimeWarnings.push(message.text())
|
|
97
|
+
})
|
|
98
|
+
const menuSearch = page.locator('.top-bar__search input')
|
|
99
|
+
await menuSearch.fill('Users')
|
|
100
|
+
await page.locator('.el-select-dropdown__item').filter({ hasText: 'System / Users' }).click()
|
|
101
|
+
await expect(page).toHaveURL(/\/system\/users$/)
|
|
102
|
+
await menuSearch.fill('Dashboard')
|
|
103
|
+
await page.locator('.el-select-dropdown__item').filter({ hasText: 'Dashboard' }).click()
|
|
104
|
+
await expect(page).toHaveURL(/\/dashboard$/)
|
|
105
|
+
await page.getByText('System', { exact: true }).click()
|
|
106
|
+
await expect(page.getByRole('menuitem', { name: 'Users', exact: true })).toBeVisible()
|
|
107
|
+
await page.getByRole('menuitem', { name: 'Users', exact: true }).click()
|
|
108
|
+
await expect(page).toHaveURL(/\/system\/users$/)
|
|
109
|
+
await expect(page.locator('.table-page')).toBeVisible()
|
|
110
|
+
await expect(page.locator('.page-header')).toHaveCount(0)
|
|
111
|
+
const breadcrumbBox = await page.locator('.breadcrumb-bar').boundingBox()
|
|
112
|
+
const tableBox = await page.locator('.table-page > .table').boundingBox()
|
|
113
|
+
const routeViewBox = await page.locator('.admin-shell__route-view').boundingBox()
|
|
114
|
+
expect(breadcrumbBox).not.toBeNull()
|
|
115
|
+
expect(tableBox).not.toBeNull()
|
|
116
|
+
expect(routeViewBox).not.toBeNull()
|
|
117
|
+
expect(breadcrumbBox!.y + breadcrumbBox!.height).toBeLessThanOrEqual(tableBox!.y)
|
|
118
|
+
expect(tableBox!.height).toBeGreaterThan(routeViewBox!.height * 0.8)
|
|
119
|
+
await expect(page.locator('.top-bar__badge')).toHaveCount(0)
|
|
120
|
+
await expect(page.locator('.search')).toHaveAttribute('data-search-columns', '4')
|
|
121
|
+
const searchGridBox = await page.locator('.search__grid').boundingBox()
|
|
122
|
+
const searchFieldBox = await page.locator('[data-search-field="keyword"]').boundingBox()
|
|
123
|
+
expect(searchGridBox).not.toBeNull()
|
|
124
|
+
expect(searchFieldBox).not.toBeNull()
|
|
125
|
+
expect(searchFieldBox!.width).toBeLessThan(searchGridBox!.width * 0.3)
|
|
126
|
+
await expect(
|
|
127
|
+
page.locator('#main-content').getByText('Demo Administrator', { exact: true }),
|
|
128
|
+
).toBeVisible()
|
|
129
|
+
|
|
130
|
+
await menuSearch.fill('Menus')
|
|
131
|
+
await page.locator('.el-select-dropdown__item').filter({ hasText: 'System / Menus' }).click()
|
|
132
|
+
await expect(page).toHaveURL(/\/system\/menus$/)
|
|
133
|
+
const updatedHeader = page
|
|
134
|
+
.locator('.el-table__header th.el-table__cell.is-sortable')
|
|
135
|
+
.filter({ hasText: '最近更新' })
|
|
136
|
+
const updatedHeaderContent = updatedHeader.locator('.table__header-content')
|
|
137
|
+
const updatedCaret = updatedHeader.locator('.caret-wrapper')
|
|
138
|
+
await expect(updatedHeaderContent).toBeVisible()
|
|
139
|
+
await expect(updatedCaret).toBeVisible()
|
|
140
|
+
const [updatedContentBox, updatedCaretBox] = await Promise.all([
|
|
141
|
+
updatedHeaderContent.boundingBox(),
|
|
142
|
+
updatedCaret.boundingBox(),
|
|
143
|
+
])
|
|
144
|
+
expect(updatedContentBox).not.toBeNull()
|
|
145
|
+
expect(updatedCaretBox).not.toBeNull()
|
|
146
|
+
expect(updatedCaretBox!.y).toBeLessThan(updatedContentBox!.y + updatedContentBox!.height)
|
|
147
|
+
expect(updatedCaretBox!.y + updatedCaretBox!.height).toBeGreaterThan(updatedContentBox!.y)
|
|
148
|
+
const ascendingSortRequest = page.waitForRequest((request) => {
|
|
149
|
+
const url = new URL(request.url())
|
|
150
|
+
return (
|
|
151
|
+
request.method() === 'GET' &&
|
|
152
|
+
url.pathname.endsWith('/api/system/menus') &&
|
|
153
|
+
url.searchParams.get('sortBy') === 'updatedAt' &&
|
|
154
|
+
url.searchParams.get('sortOrder') === 'ascending'
|
|
155
|
+
)
|
|
156
|
+
})
|
|
157
|
+
await updatedHeader.click()
|
|
158
|
+
await ascendingSortRequest
|
|
159
|
+
const systemMenuRow = page.locator('.el-table__body tr').filter({ hasText: 'System' }).first()
|
|
160
|
+
const systemExpand = systemMenuRow.locator('.el-table__expand-icon')
|
|
161
|
+
await expect(systemExpand).toBeVisible()
|
|
162
|
+
await systemExpand.click()
|
|
163
|
+
await expect(page.locator('.el-table__body tr').filter({ hasText: 'Users' })).toBeHidden()
|
|
164
|
+
await systemExpand.click()
|
|
165
|
+
await expect(page.locator('.el-table__body tr').filter({ hasText: 'Users' })).toBeVisible()
|
|
166
|
+
expect(documentNavigations).toHaveLength(0)
|
|
167
|
+
expect(runtimeWarnings).not.toEqual(
|
|
168
|
+
expect.arrayContaining([
|
|
169
|
+
expect.stringContaining('injection "Symbol(og-table)" not found'),
|
|
170
|
+
expect.stringContaining('Failed to resolve directive: loading'),
|
|
171
|
+
]),
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
const tabs = page.locator('.workspace-tabs [role="tab"]')
|
|
175
|
+
expect(await tabs.count()).toBeGreaterThanOrEqual(2)
|
|
176
|
+
await expect(page.locator('.workspace-tabs .og-tabs__bar')).toHaveCSS('display', 'flex')
|
|
177
|
+
const tabTops = await tabs.evaluateAll((elements) =>
|
|
178
|
+
elements.map((element) => Math.round(element.getBoundingClientRect().top)),
|
|
179
|
+
)
|
|
180
|
+
expect(new Set(tabTops).size).toBe(1)
|
|
181
|
+
|
|
182
|
+
const keywordField = page.locator('[data-search-field="keyword"]')
|
|
183
|
+
const keywordLabel = keywordField.locator('.el-form-item__label')
|
|
184
|
+
const keywordInput = keywordField.locator('input')
|
|
185
|
+
const labelBox = await keywordLabel.boundingBox()
|
|
186
|
+
const inputBox = await keywordInput.boundingBox()
|
|
187
|
+
expect(labelBox).not.toBeNull()
|
|
188
|
+
expect(inputBox).not.toBeNull()
|
|
189
|
+
expect(labelBox!.x + labelBox!.width).toBeLessThanOrEqual(inputBox!.x)
|
|
190
|
+
|
|
191
|
+
await page.setViewportSize({ width: 600, height: 900 })
|
|
192
|
+
await expect(page.locator('.workspace-tabs .og-tabs__bar')).toHaveCSS('display', 'flex')
|
|
193
|
+
const narrowTabTops = await tabs.evaluateAll((elements) =>
|
|
194
|
+
elements.map((element) => Math.round(element.getBoundingClientRect().top)),
|
|
195
|
+
)
|
|
196
|
+
expect(new Set(narrowTabTops).size).toBe(1)
|
|
197
|
+
const rowActions = page.locator('.table-row-actions').first()
|
|
198
|
+
await expect(rowActions.locator('.table-row-actions__action')).toHaveCount(1)
|
|
199
|
+
await expect(rowActions.locator('.table-row-actions__more')).toBeVisible()
|
|
200
|
+
await expect(
|
|
201
|
+
page.locator('.table-page > .table--bordered.table--no-pagination .table__body'),
|
|
202
|
+
).toHaveCSS('margin-bottom', '10px')
|
|
203
|
+
await rowActions.locator('.table-row-actions__action').click()
|
|
204
|
+
const mobileDialog = page.locator('.el-dialog.dialog__surface')
|
|
205
|
+
await expect(mobileDialog).toBeVisible()
|
|
206
|
+
for (const width of [600, 375]) {
|
|
207
|
+
await page.setViewportSize({ width, height: 900 })
|
|
208
|
+
const dialogBox = await mobileDialog.boundingBox()
|
|
209
|
+
expect(dialogBox).not.toBeNull()
|
|
210
|
+
expect(dialogBox!.x).toBeGreaterThanOrEqual(0)
|
|
211
|
+
expect(dialogBox!.x + dialogBox!.width).toBeLessThanOrEqual(width)
|
|
212
|
+
expect(
|
|
213
|
+
await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth),
|
|
214
|
+
).toBe(true)
|
|
215
|
+
}
|
|
216
|
+
await page.keyboard.press('Escape')
|
|
217
|
+
await expect(mobileDialog).toBeHidden()
|
|
218
|
+
|
|
219
|
+
async function assertEditorFormDoesNotOverflow(
|
|
220
|
+
menu: string,
|
|
221
|
+
createButton: string,
|
|
222
|
+
): Promise<void> {
|
|
223
|
+
await page.goto(`/system/${menu.toLowerCase()}`)
|
|
224
|
+
await expect(page).toHaveURL(new RegExp(`/system/${menu.toLowerCase()}$`))
|
|
225
|
+
await page.getByRole('button', { name: createButton, exact: true }).click()
|
|
226
|
+
|
|
227
|
+
const dialog = page
|
|
228
|
+
.locator('.el-dialog.dialog__surface')
|
|
229
|
+
.filter({ has: page.locator('.form-container') })
|
|
230
|
+
const body = dialog.locator('.el-dialog__body')
|
|
231
|
+
await expect(dialog).toBeVisible()
|
|
232
|
+
await expect(body).toBeVisible()
|
|
233
|
+
expect(await body.evaluate((element) => element.scrollWidth <= element.clientWidth)).toBe(true)
|
|
234
|
+
|
|
235
|
+
const label = dialog.locator('.el-form-item__label').first()
|
|
236
|
+
await expect(label).toHaveCSS('align-items', 'center')
|
|
237
|
+
const labelMetrics = await label.evaluate((element) => {
|
|
238
|
+
const style = getComputedStyle(element)
|
|
239
|
+
return {
|
|
240
|
+
height: element.getBoundingClientRect().height,
|
|
241
|
+
lineHeight: Number.parseFloat(style.lineHeight),
|
|
242
|
+
}
|
|
243
|
+
})
|
|
244
|
+
expect(labelMetrics.lineHeight).toBeLessThan(labelMetrics.height)
|
|
245
|
+
|
|
246
|
+
await page.keyboard.press('Escape')
|
|
247
|
+
await expect(dialog).toBeHidden()
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
for (const viewport of [
|
|
251
|
+
{ width: 1280, height: 900 },
|
|
252
|
+
{ width: 375, height: 900 },
|
|
253
|
+
]) {
|
|
254
|
+
await page.setViewportSize(viewport)
|
|
255
|
+
await assertEditorFormDoesNotOverflow('Users', '新增成员')
|
|
256
|
+
await assertEditorFormDoesNotOverflow('Roles', '新增角色')
|
|
257
|
+
await assertEditorFormDoesNotOverflow('Menus', '新增菜单')
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
await page.setViewportSize({ width: 600, height: 900 })
|
|
261
|
+
|
|
262
|
+
const suffix = `${Date.now()}`
|
|
263
|
+
const role = await demoRequest<DemoRecord>(
|
|
264
|
+
request,
|
|
265
|
+
'POST',
|
|
266
|
+
'/api/system/roles',
|
|
267
|
+
login.accessToken,
|
|
268
|
+
{
|
|
269
|
+
name: `Demo smoke role ${suffix}`,
|
|
270
|
+
code: `demo_smoke_${suffix}`,
|
|
271
|
+
description: 'Created by the local demo Playwright smoke test.',
|
|
272
|
+
permissions: ['system:audit:read'],
|
|
273
|
+
status: 'active',
|
|
274
|
+
},
|
|
275
|
+
)
|
|
276
|
+
expect(role.id).toMatch(/^role-/)
|
|
277
|
+
|
|
278
|
+
const user = await demoRequest<DemoRecord>(
|
|
279
|
+
request,
|
|
280
|
+
'POST',
|
|
281
|
+
'/api/system/users',
|
|
282
|
+
login.accessToken,
|
|
283
|
+
{
|
|
284
|
+
name: `Demo smoke user ${suffix}`,
|
|
285
|
+
email: `demo-smoke-${suffix}@example.test`,
|
|
286
|
+
department: 'Platform',
|
|
287
|
+
roleIds: [role.id],
|
|
288
|
+
status: 'active',
|
|
289
|
+
},
|
|
290
|
+
)
|
|
291
|
+
expect(user.id).toMatch(/^user-/)
|
|
292
|
+
|
|
293
|
+
const menu = await demoRequest<DemoRecord>(
|
|
294
|
+
request,
|
|
295
|
+
'POST',
|
|
296
|
+
'/api/system/menus',
|
|
297
|
+
login.accessToken,
|
|
298
|
+
{
|
|
299
|
+
parentId: 'menu-system',
|
|
300
|
+
kind: 'page',
|
|
301
|
+
code: `demo-smoke-${suffix}`,
|
|
302
|
+
title: `Demo smoke menu ${suffix}`,
|
|
303
|
+
path: `demo-smoke-${suffix}`,
|
|
304
|
+
componentKey: 'audit-list',
|
|
305
|
+
icon: 'audit',
|
|
306
|
+
order: 90,
|
|
307
|
+
status: 'active',
|
|
308
|
+
visible: true,
|
|
309
|
+
cache: false,
|
|
310
|
+
tabHidden: true,
|
|
311
|
+
},
|
|
312
|
+
)
|
|
313
|
+
expect(menu.id).toMatch(/^menu-/)
|
|
314
|
+
|
|
315
|
+
const summary = await demoRequest<DemoSummary>(
|
|
316
|
+
request,
|
|
317
|
+
'GET',
|
|
318
|
+
'/api/system/rbac/summary',
|
|
319
|
+
login.accessToken,
|
|
320
|
+
)
|
|
321
|
+
expect(summary).toMatchObject({
|
|
322
|
+
userCount: 3,
|
|
323
|
+
roleCount: 3,
|
|
324
|
+
menuCount: 7,
|
|
325
|
+
auditCount: 3,
|
|
326
|
+
revision: 4,
|
|
327
|
+
})
|
|
328
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"cases": [
|
|
4
|
+
{
|
|
5
|
+
"id": "remote-user-crud",
|
|
6
|
+
"prompt": "Implement a permissioned remote user CRUD page with filters, paging, and an edit dialog.",
|
|
7
|
+
"required": ["OgTableWithSearch", "OgForm", "OgDialog", "@origen-ui/http"],
|
|
8
|
+
"forbidden": ["ElTable", "ElForm", "ElDialog", "axios"]
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "rich-text",
|
|
12
|
+
"prompt": "Implement a rich-text article editor and a safe read-only preview.",
|
|
13
|
+
"required": ["OgEditor", "OgEditorViewer"],
|
|
14
|
+
"forbidden": ["v-html"]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "line-items",
|
|
18
|
+
"prompt": "Implement an editable order line-item field inside a schema form.",
|
|
19
|
+
"required": ["OgForm", "OgFormTable"],
|
|
20
|
+
"forbidden": ["ElTable"]
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "file-upload",
|
|
24
|
+
"prompt": "Implement validated attachment upload and project the result to a URL field.",
|
|
25
|
+
"required": ["OgUpload"],
|
|
26
|
+
"forbidden": ["ElUpload"]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<meta name="theme-color" content="#f5f7fb" />
|
|
7
|
+
<title>@origen-ui/admin</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|