@saasicat/ui-vue 0.2.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 +202 -0
- package/README.md +47 -0
- package/dist/index.cjs +3776 -0
- package/dist/index.d.cts +2395 -0
- package/dist/index.d.ts +2395 -0
- package/dist/index.js +3659 -0
- package/dist/testing-e2e/admin-pages-suite.cjs +134 -0
- package/dist/testing-e2e/admin-pages-suite.d.cts +37 -0
- package/dist/testing-e2e/admin-pages-suite.d.ts +37 -0
- package/dist/testing-e2e/admin-pages-suite.js +109 -0
- package/package.json +87 -0
- package/src/action-registry.ts +110 -0
- package/src/batch-column-fetcher.ts +152 -0
- package/src/boot-loader.ts +60 -0
- package/src/components/BundleVersionPublishDialog.vue +359 -0
- package/src/components/BusinessTypeVersionEditorDialog.vue +417 -0
- package/src/components/BusinessTypeVersionPublishDialog.vue +258 -0
- package/src/components/FeatureGate.vue +56 -0
- package/src/components/KpiCard.vue +53 -0
- package/src/components/KvBlock.vue +36 -0
- package/src/components/MarketingPromotionsTab.vue +861 -0
- package/src/components/MfaPromptDialog.vue +104 -0
- package/src/components/TenantActionConfirmDialog.vue +252 -0
- package/src/components/VersionDiffPreview.vue +150 -0
- package/src/components/bundle-editor/BundleCreatePanel.vue +681 -0
- package/src/components/bundle-editor/BundleFeaturesEditor.vue +215 -0
- package/src/components/bundle-editor/BundlePlanCompatPicker.vue +316 -0
- package/src/components/bundle-editor/BundleQuotasEditor.vue +219 -0
- package/src/components/bundle-editor/BundleStatusBanner.vue +189 -0
- package/src/components/bundle-editor/BundleVersionInlineEditor.vue +659 -0
- package/src/components/bundle-editor/BundleVersionStrip.vue +207 -0
- package/src/components/bundle-editor/bundle-version-status.ts +164 -0
- package/src/components/bundle-editor/catalog-i18n.ts +85 -0
- package/src/components/dialogs/PilotCreateDialog.vue +780 -0
- package/src/components/dialogs/PilotEditDialog.vue +548 -0
- package/src/components/dialogs/PromoCodeCreateDialog.vue +737 -0
- package/src/components/dialogs/PromoCodeEditDialog.vue +859 -0
- package/src/components/dialogs/types.ts +126 -0
- package/src/components/plan/PlanCycleToggle.vue +99 -0
- package/src/components/plan/PlanGrid.vue +211 -0
- package/src/components/plan/PriceSummary.vue +293 -0
- package/src/components/plan/PromoCodeInput.vue +192 -0
- package/src/components/plan/PublicBundleGrid.vue +287 -0
- package/src/components/plan-cockpit/PlanCockpit.vue +993 -0
- package/src/components/plan-cockpit/PlanCockpitAuditLog.vue +65 -0
- package/src/components/plan-cockpit/PlanCockpitDiffPanel.vue +91 -0
- package/src/components/plan-cockpit/PlanCockpitHeader.vue +98 -0
- package/src/components/plan-cockpit/PlanCockpitImpactPanel.vue +99 -0
- package/src/components/plan-cockpit/PlanCockpitKpis.vue +57 -0
- package/src/components/plan-cockpit/PlanCockpitVersions.vue +226 -0
- package/src/components/plan-cockpit/types.ts +72 -0
- package/src/components/plan-create-dialog/PlanCreateDialog.vue +508 -0
- package/src/components/plan-detail/PlanAuditLog.vue +59 -0
- package/src/components/plan-detail/PlanDetail.vue +1195 -0
- package/src/components/plan-detail/PlanDetailHeader.vue +185 -0
- package/src/components/plan-detail/PlanDetailKpis.vue +57 -0
- package/src/components/plan-detail/PlanTerminateDialog.vue +76 -0
- package/src/components/plan-detail/PlanVersionDiffPanel.vue +149 -0
- package/src/components/plan-detail/PlanVersionsPanel.vue +255 -0
- package/src/components/plan-detail/types.ts +59 -0
- package/src/components/plan-list/PlanList.vue +1067 -0
- package/src/components/plan-matrix/PlanMatrix.vue +1113 -0
- package/src/components/plan-review/PlanReview.vue +742 -0
- package/src/components/plan-version-editor/PlanCatalogPreview.vue +184 -0
- package/src/components/plan-version-editor/PlanComponentPool.vue +272 -0
- package/src/components/plan-version-editor/PlanVersionBasket.vue +281 -0
- package/src/components/plan-version-editor/PlanVersionDiffDialog.vue +84 -0
- package/src/components/plan-version-editor/PlanVersionEditor.vue +1728 -0
- package/src/components/plan-version-editor/PlanVersionEditorHeader.vue +94 -0
- package/src/components/plan-version-editor/types.ts +96 -0
- package/src/components/wizard-stepper/WizardStepper.vue +107 -0
- package/src/create-admin-routes.ts +68 -0
- package/src/create-super-admin-app.ts +345 -0
- package/src/entitlement-provider.ts +36 -0
- package/src/feature-router-guard.ts +77 -0
- package/src/http-json.ts +62 -0
- package/src/index.ts +98 -0
- package/src/manifest-loader.ts +139 -0
- package/src/manifest-store-factory.ts +114 -0
- package/src/nav-builder.ts +274 -0
- package/src/pages-standard/AdminLayout.vue +411 -0
- package/src/pages-standard/AdminManifestErrorPage.vue +79 -0
- package/src/pages-standard/AuditPage.vue +223 -0
- package/src/pages-standard/BundlesPage.vue +910 -0
- package/src/pages-standard/BusinessTypesPage.vue +662 -0
- package/src/pages-standard/DashboardPage.vue +595 -0
- package/src/pages-standard/DiscoveryPage.vue +663 -0
- package/src/pages-standard/EmailHistoryPage.vue +576 -0
- package/src/pages-standard/MarketingCatalogPage.vue +1771 -0
- package/src/pages-standard/PilotsPage.vue +577 -0
- package/src/pages-standard/PlanVersionsPage.vue +216 -0
- package/src/pages-standard/PlansPage.vue +1222 -0
- package/src/pages-standard/PlatformEmailPage.vue +434 -0
- package/src/pages-standard/PromoCodeDetailPage.vue +331 -0
- package/src/pages-standard/PromoCodesPage.vue +589 -0
- package/src/pages-standard/SubscriptionsPage.vue +159 -0
- package/src/pages-standard/SuperAdminLoginPage.vue +299 -0
- package/src/pages-standard/SuperAdminSetupWizard.vue +405 -0
- package/src/pages-standard/TenantDetailPage.vue +432 -0
- package/src/pages-standard/TenantsPage.vue +732 -0
- package/src/pages-standard/UsersPage.vue +504 -0
- package/src/pages-standard/bundles-page/BundleAccordionList.vue +116 -0
- package/src/pages-standard/bundles-page/BundleDetailPanel.vue +193 -0
- package/src/pages-standard/bundles-page/BundlesFilterBar.vue +48 -0
- package/src/pages-standard/bundles-page/BundlesHeader.vue +67 -0
- package/src/pages-standard/bundles-page/BundlesKpis.vue +39 -0
- package/src/pages-standard/bundles-page/types.ts +15 -0
- package/src/pages-standard/discovery-page/CatalogEntryTransPanel.vue +246 -0
- package/src/pages-standard/discovery-page/DiscoveryCapList.vue +171 -0
- package/src/pages-standard/discovery-page/DiscoveryFeatureCard.vue +410 -0
- package/src/pages-standard/discovery-page/DiscoveryHeader.vue +31 -0
- package/src/pages-standard/discovery-page/DiscoveryKpis.vue +47 -0
- package/src/pages-standard/discovery-page/DiscoveryMetaBanner.vue +26 -0
- package/src/pages-standard/discovery-page/DiscoveryQuotaCard.vue +247 -0
- package/src/pages-standard/discovery-page/DiscoveryStatusControl.vue +73 -0
- package/src/pages-standard/discovery-page/discovery-ui.ts +166 -0
- package/src/pages-standard/email-history.types.ts +48 -0
- package/src/pages-standard/marketing-catalog/MarketingCatalogAdmin.vue +448 -0
- package/src/pages-standard/marketing-catalog/MarketingCatalogHeader.vue +93 -0
- package/src/pages-standard/marketing-catalog/MarketingCatalogPreview.vue +138 -0
- package/src/pages-standard/marketing-catalog/MarketingCatalogToolbar.vue +58 -0
- package/src/pages-standard/marketing-catalog/types.ts +43 -0
- package/src/pages-standard/plan-versions/PlanDiffCard.vue +132 -0
- package/src/pages-standard/plan-versions/PlanVersionHeader.vue +293 -0
- package/src/pages-standard/plan-versions/PlanVersionStatusBadge.vue +48 -0
- package/src/pages-standard/plan-versions/PlanVersionsAudit.vue +307 -0
- package/src/pages-standard/plan-versions/PlanVersionsDiff.vue +269 -0
- package/src/pages-standard/plan-versions/PlanVersionsKpi.vue +65 -0
- package/src/pages-standard/plan-versions/PlanVersionsList.vue +292 -0
- package/src/pages-standard/plan-versions/PlanVersionsMatrix.vue +261 -0
- package/src/pages-standard/plan-versions/PlanVersionsTimeline.vue +300 -0
- package/src/pages-standard/plan-versions/VersionDiffPreview.vue +167 -0
- package/src/pages-standard/plan-versions/format.ts +53 -0
- package/src/pages-standard/plan-versions/types.ts +33 -0
- package/src/pages-standard/plans-page/PlanArchiveDialog.vue +50 -0
- package/src/pages-standard/plans-page/PlanBundleOverview.vue +147 -0
- package/src/pages-standard/plans-page/PlanDiscardDraftDialog.vue +46 -0
- package/src/pages-standard/plans-page/PlanPublishDialog.vue +106 -0
- package/src/pages-standard/plans-page/PlansPageToast.vue +69 -0
- package/src/pages-standard/plans-page/types.ts +18 -0
- package/src/pages-standard/platform-email.types.ts +41 -0
- package/src/pages-standard/sa-theme.css +223 -0
- package/src/pages-standard/tenants/StatusPill.vue +62 -0
- package/src/pages-standard/tenants/format.ts +38 -0
- package/src/pages-tenant/LimitsRow.vue +67 -0
- package/src/pages-tenant/MySubscriptionBundlesPage.vue +604 -0
- package/src/pages-tenant/OnboardingConfigurator.vue +417 -0
- package/src/pages-tenant/PackageSnapshotPanel.vue +241 -0
- package/src/pages-tenant/PendingVersionBanner.vue +126 -0
- package/src/pages-tenant/PlanChangeWizard.vue +630 -0
- package/src/pages-tenant/TenantPlanSection.vue +729 -0
- package/src/pages-tenant/UsageBar.vue +107 -0
- package/src/pages-tenant/default-i18n.ts +280 -0
- package/src/pages-tenant/tenant-plan-section/BundlePreviewDialog.vue +304 -0
- package/src/pages-tenant/tenant-plan-section/TenantBundleStore.vue +323 -0
- package/src/pages-tenant/tenant-plan-section/TenantFeatureMatrix.vue +122 -0
- package/src/pages-tenant/tenant-plan-section/TenantPlanCardHeader.vue +67 -0
- package/src/pages-tenant/tenant-plan-section/TenantUsageGrid.vue +31 -0
- package/src/plan-versions-catalog.ts +368 -0
- package/src/platform-loaders.ts +68 -0
- package/src/project-page-host.ts +108 -0
- package/src/testing-e2e/admin-pages-suite.ts +187 -0
- package/src/types.ts +58 -0
- package/src/use-actions.ts +25 -0
- package/src/use-api-list.ts +151 -0
- package/src/use-audit-entries.ts +48 -0
- package/src/use-batch-columns.ts +59 -0
- package/src/use-bulk-publish.ts +150 -0
- package/src/use-bundle-versions-map.ts +112 -0
- package/src/use-bundles.ts +297 -0
- package/src/use-business-types.ts +269 -0
- package/src/use-catalog-entries.ts +243 -0
- package/src/use-discovery.ts +158 -0
- package/src/use-entitlement.ts +87 -0
- package/src/use-live-plan-versions.ts +126 -0
- package/src/use-manifest.ts +57 -0
- package/src/use-marketing-projections.ts +160 -0
- package/src/use-nav.ts +33 -0
- package/src/use-plan-editor.ts +162 -0
- package/src/use-plan-versions.ts +83 -0
- package/src/use-plans.ts +375 -0
- package/src/use-platform-tenant-actions.ts +286 -0
- package/src/use-promotions.ts +126 -0
- package/src/use-public-boot.ts +40 -0
- package/src/use-subscription-draft.ts +355 -0
- package/src/use-super-admin-context.ts +93 -0
- package/src/use-tenant-action-flow.ts +238 -0
- package/src/use-tenant-billing-catalog.ts +160 -0
- package/src/use-tenant-billing.ts +453 -0
- package/src/use-tenant-manifest.ts +94 -0
- package/src/use-tenant-subscription-bundles.ts +148 -0
- package/src/use-tenants.ts +61 -0
- package/src/version.ts +10 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="sa-pv-status-badge" :class="`sa-pv-status-badge--${status.toLowerCase()}`">
|
|
3
|
+
<q-icon :name="cfg.icon" size="12px" />
|
|
4
|
+
{{ cfg.label }}
|
|
5
|
+
</span>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { computed } from 'vue';
|
|
10
|
+
|
|
11
|
+
type Status = 'DRAFT' | 'ACTIVE' | 'ARCHIVED';
|
|
12
|
+
const props = defineProps<{ status: Status }>();
|
|
13
|
+
|
|
14
|
+
const STATUS_CFG: Record<Status, { label: string; icon: string }> = {
|
|
15
|
+
DRAFT: { label: 'DRAFT', icon: 'edit_note' },
|
|
16
|
+
ACTIVE: { label: 'AKTIV', icon: 'check_circle' },
|
|
17
|
+
ARCHIVED: { label: 'ARCHIV', icon: 'archive' },
|
|
18
|
+
};
|
|
19
|
+
const cfg = computed(() => STATUS_CFG[props.status]);
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<style scoped>
|
|
23
|
+
.sa-pv-status-badge {
|
|
24
|
+
display: inline-flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: 4px;
|
|
27
|
+
padding: 3px 9px;
|
|
28
|
+
border-radius: 6px;
|
|
29
|
+
font-size: 10.5px;
|
|
30
|
+
font-weight: 700;
|
|
31
|
+
letter-spacing: 0.06em;
|
|
32
|
+
}
|
|
33
|
+
.sa-pv-status-badge--draft {
|
|
34
|
+
background: #fef3c7;
|
|
35
|
+
color: #92400e;
|
|
36
|
+
}
|
|
37
|
+
.sa-pv-status-badge--active {
|
|
38
|
+
background: #d1fae5;
|
|
39
|
+
color: #065f46;
|
|
40
|
+
}
|
|
41
|
+
.sa-pv-status-badge--archived {
|
|
42
|
+
background: #f1f5f9;
|
|
43
|
+
color: #64748b;
|
|
44
|
+
}
|
|
45
|
+
.sa-pv-status-badge :deep(.q-icon) {
|
|
46
|
+
color: inherit;
|
|
47
|
+
}
|
|
48
|
+
</style>
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sa-pv-audit">
|
|
3
|
+
<div class="sa-pv-audit__card">
|
|
4
|
+
<header class="sa-pv-audit__head">
|
|
5
|
+
<q-icon name="history" size="18px" class="sa-pv-audit__head-icon" />
|
|
6
|
+
<h3>Aktivität</h3>
|
|
7
|
+
<span class="sa-pv-audit__count">{{ events.length }} Events</span>
|
|
8
|
+
<q-space />
|
|
9
|
+
<button v-if="!loading" type="button" class="sa-pv-audit__refresh" @click="reload">
|
|
10
|
+
<q-icon name="refresh" size="14px" /> Neu laden
|
|
11
|
+
</button>
|
|
12
|
+
</header>
|
|
13
|
+
<div v-if="loading" class="sa-pv-audit__loading">
|
|
14
|
+
<q-spinner size="20px" /> Audit-Trail wird geladen…
|
|
15
|
+
</div>
|
|
16
|
+
<div v-else-if="events.length === 0" class="sa-pv-audit__empty">
|
|
17
|
+
Keine Plan-/Add-on-Events im Audit-Log gefunden.
|
|
18
|
+
</div>
|
|
19
|
+
<div v-else class="sa-pv-audit__list">
|
|
20
|
+
<div
|
|
21
|
+
v-for="(e, i) in events"
|
|
22
|
+
:key="e.id"
|
|
23
|
+
class="sa-pv-audit__item"
|
|
24
|
+
:class="{ 'sa-pv-audit__item--last': i === events.length - 1 }"
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
class="sa-pv-audit__icon"
|
|
28
|
+
:style="{ background: `${meta(e.action).color}14` }"
|
|
29
|
+
>
|
|
30
|
+
<q-icon
|
|
31
|
+
:name="meta(e.action).icon"
|
|
32
|
+
size="17px"
|
|
33
|
+
:style="{ color: meta(e.action).color }"
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="sa-pv-audit__body">
|
|
37
|
+
<div class="sa-pv-audit__title-row">
|
|
38
|
+
<span class="sa-pv-audit__title">{{ meta(e.action).label }}</span>
|
|
39
|
+
<span class="sa-pv-audit__entity">{{ entityLabel(e) }}</span>
|
|
40
|
+
</div>
|
|
41
|
+
<div class="sa-pv-audit__detail">{{ detail(e) }}</div>
|
|
42
|
+
<div class="sa-pv-audit__meta">
|
|
43
|
+
<span
|
|
44
|
+
><q-icon name="schedule" size="12px" />
|
|
45
|
+
{{ formatTsDe(e.createdAt) }}</span
|
|
46
|
+
>
|
|
47
|
+
<span v-if="actorEmail(e)">
|
|
48
|
+
<q-icon name="person" size="12px" /> {{ actorEmail(e) }}
|
|
49
|
+
</span>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script setup lang="ts">
|
|
59
|
+
import { onMounted, ref, watch } from 'vue';
|
|
60
|
+
import type { CatalogSnapshot } from '../../plan-versions-catalog.js';
|
|
61
|
+
import { formatTsDe } from './format.js';
|
|
62
|
+
|
|
63
|
+
// PlanVersionsAudit — data-agnostic. Consumers pass in a `loadAudit` loader
|
|
64
|
+
// that supplies events; the component filters them to match the current
|
|
65
|
+
// snapshot (drafts/active = everything ≤ 50, historical = ≤ asOf).
|
|
66
|
+
//
|
|
67
|
+
// The action meta map can be extended per app so that additional actions
|
|
68
|
+
// (e.g. app-specific audit keys) get their own icons and labels.
|
|
69
|
+
|
|
70
|
+
interface AuditRow {
|
|
71
|
+
id: string;
|
|
72
|
+
createdAt: string;
|
|
73
|
+
action: string;
|
|
74
|
+
entity: string;
|
|
75
|
+
entityId: string;
|
|
76
|
+
changes: Record<string, unknown> | null;
|
|
77
|
+
/** Legacy style: nested user object with email. */
|
|
78
|
+
user?: { email: string; firstName?: string; lastName?: string } | null;
|
|
79
|
+
/** Platform style: flat userEmail field. */
|
|
80
|
+
userEmail?: string | null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface ActionMeta {
|
|
84
|
+
icon: string;
|
|
85
|
+
color: string;
|
|
86
|
+
label: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const props = withDefaults(
|
|
90
|
+
defineProps<{
|
|
91
|
+
snapshot: CatalogSnapshot;
|
|
92
|
+
loadAudit: () => Promise<AuditRow[]>;
|
|
93
|
+
actionMeta?: Record<string, ActionMeta>;
|
|
94
|
+
}>(),
|
|
95
|
+
{
|
|
96
|
+
actionMeta: () => ({}),
|
|
97
|
+
},
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const loading = ref(false);
|
|
101
|
+
const events = ref<AuditRow[]>([]);
|
|
102
|
+
|
|
103
|
+
const DEFAULT_ACTION_META: Record<string, ActionMeta> = {
|
|
104
|
+
PLAN_VERSION_PUBLISH: {
|
|
105
|
+
icon: 'rocket_launch',
|
|
106
|
+
color: '#047857',
|
|
107
|
+
label: 'Plan publiziert',
|
|
108
|
+
},
|
|
109
|
+
PLAN_VERSION_DRAFT_CREATE: {
|
|
110
|
+
icon: 'edit_note',
|
|
111
|
+
color: '#b45309',
|
|
112
|
+
label: 'Plan-Draft angelegt',
|
|
113
|
+
},
|
|
114
|
+
PLAN_VERSION_DRAFT_UPDATE: { icon: 'edit', color: '#3f6bff', label: 'Plan-Draft geändert' },
|
|
115
|
+
PLAN_VERSION_DRAFT_DELETE: {
|
|
116
|
+
icon: 'delete',
|
|
117
|
+
color: '#dc2626',
|
|
118
|
+
label: 'Plan-Draft gelöscht',
|
|
119
|
+
},
|
|
120
|
+
PLAN_CATALOG_UPDATE: {
|
|
121
|
+
icon: 'rocket_launch',
|
|
122
|
+
color: '#047857',
|
|
123
|
+
label: 'Catalog publiziert',
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
function meta(action: string): ActionMeta {
|
|
128
|
+
return (
|
|
129
|
+
props.actionMeta[action] ??
|
|
130
|
+
DEFAULT_ACTION_META[action] ?? {
|
|
131
|
+
icon: 'circle',
|
|
132
|
+
color: '#64748b',
|
|
133
|
+
label: action,
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function entityLabel(e: AuditRow): string {
|
|
139
|
+
const c = (e.changes ?? {}) as {
|
|
140
|
+
planId?: string;
|
|
141
|
+
key?: string;
|
|
142
|
+
featureKey?: string;
|
|
143
|
+
version?: number;
|
|
144
|
+
};
|
|
145
|
+
const versionPart = c.version != null ? ` v${c.version}` : '';
|
|
146
|
+
if (c.planId) return `${c.planId}${versionPart}`;
|
|
147
|
+
if (c.key) return `${c.key}${versionPart}`;
|
|
148
|
+
if (c.featureKey) return `${c.featureKey}${versionPart}`;
|
|
149
|
+
return e.entity;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function detail(e: AuditRow): string {
|
|
153
|
+
const c = (e.changes ?? {}) as {
|
|
154
|
+
changeNote?: string;
|
|
155
|
+
nonRegressive?: boolean;
|
|
156
|
+
changes?: unknown;
|
|
157
|
+
};
|
|
158
|
+
if (c.changeNote) return c.changeNote;
|
|
159
|
+
if (c.nonRegressive === false) return 'Mit mindestens einer Verschlechterung publiziert.';
|
|
160
|
+
if (Array.isArray(c.changes)) return `${c.changes.length} Felder geändert.`;
|
|
161
|
+
return e.action;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function actorEmail(e: AuditRow): string | null {
|
|
165
|
+
return e.user?.email ?? e.userEmail ?? null;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
onMounted(reload);
|
|
169
|
+
watch(() => props.snapshot.id, reload);
|
|
170
|
+
|
|
171
|
+
async function reload(): Promise<void> {
|
|
172
|
+
loading.value = true;
|
|
173
|
+
try {
|
|
174
|
+
const merged = await props.loadAudit();
|
|
175
|
+
events.value = filterForSnapshot(merged);
|
|
176
|
+
} finally {
|
|
177
|
+
loading.value = false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function filterForSnapshot(rows: AuditRow[]): AuditRow[] {
|
|
182
|
+
if (props.snapshot.kind !== 'historical' || !props.snapshot.asOf) return rows.slice(0, 50);
|
|
183
|
+
const asOfMs = Date.parse(props.snapshot.asOf);
|
|
184
|
+
return rows.filter((r) => Date.parse(r.createdAt) <= asOfMs).slice(0, 50);
|
|
185
|
+
}
|
|
186
|
+
</script>
|
|
187
|
+
|
|
188
|
+
<style scoped>
|
|
189
|
+
.sa-pv-audit {
|
|
190
|
+
padding: 20px 28px;
|
|
191
|
+
}
|
|
192
|
+
.sa-pv-audit__card {
|
|
193
|
+
background: #fff;
|
|
194
|
+
border: 1px solid var(--sa-border, #e2e8f0);
|
|
195
|
+
border-radius: 12px;
|
|
196
|
+
overflow: hidden;
|
|
197
|
+
}
|
|
198
|
+
.sa-pv-audit__head {
|
|
199
|
+
padding: 14px 18px;
|
|
200
|
+
border-bottom: 1px solid var(--sa-border, #e2e8f0);
|
|
201
|
+
display: flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
gap: 8px;
|
|
204
|
+
}
|
|
205
|
+
.sa-pv-audit__head h3 {
|
|
206
|
+
margin: 0;
|
|
207
|
+
font-family: var(--sa-font-head, system-ui, sans-serif);
|
|
208
|
+
font-size: 15px;
|
|
209
|
+
font-weight: 700;
|
|
210
|
+
color: var(--sa-heading, #0f172a);
|
|
211
|
+
}
|
|
212
|
+
.sa-pv-audit__head-icon {
|
|
213
|
+
color: var(--sa-primary, #3f6bff);
|
|
214
|
+
}
|
|
215
|
+
.sa-pv-audit__count {
|
|
216
|
+
font-size: 12px;
|
|
217
|
+
color: var(--sa-muted, #64748b);
|
|
218
|
+
}
|
|
219
|
+
.sa-pv-audit__refresh {
|
|
220
|
+
background: #fff;
|
|
221
|
+
border: 1px solid var(--sa-border, #e2e8f0);
|
|
222
|
+
border-radius: 6px;
|
|
223
|
+
padding: 4px 10px;
|
|
224
|
+
font-size: 11.5px;
|
|
225
|
+
font-weight: 600;
|
|
226
|
+
color: var(--sa-body, #1e293b);
|
|
227
|
+
cursor: pointer;
|
|
228
|
+
display: inline-flex;
|
|
229
|
+
align-items: center;
|
|
230
|
+
gap: 4px;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.sa-pv-audit__loading,
|
|
234
|
+
.sa-pv-audit__empty {
|
|
235
|
+
padding: 24px;
|
|
236
|
+
color: var(--sa-muted, #64748b);
|
|
237
|
+
display: flex;
|
|
238
|
+
align-items: center;
|
|
239
|
+
gap: 12px;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.sa-pv-audit__list {
|
|
243
|
+
padding: 8px 0;
|
|
244
|
+
}
|
|
245
|
+
.sa-pv-audit__item {
|
|
246
|
+
display: flex;
|
|
247
|
+
align-items: flex-start;
|
|
248
|
+
gap: 14px;
|
|
249
|
+
padding: 12px 18px;
|
|
250
|
+
border-bottom: 1px solid var(--sa-border-soft, #f1f5f9);
|
|
251
|
+
}
|
|
252
|
+
.sa-pv-audit__item--last {
|
|
253
|
+
border-bottom: none;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.sa-pv-audit__icon {
|
|
257
|
+
width: 32px;
|
|
258
|
+
height: 32px;
|
|
259
|
+
border-radius: 8px;
|
|
260
|
+
display: flex;
|
|
261
|
+
align-items: center;
|
|
262
|
+
justify-content: center;
|
|
263
|
+
flex-shrink: 0;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.sa-pv-audit__body {
|
|
267
|
+
flex: 1;
|
|
268
|
+
min-width: 0;
|
|
269
|
+
}
|
|
270
|
+
.sa-pv-audit__title-row {
|
|
271
|
+
display: flex;
|
|
272
|
+
align-items: center;
|
|
273
|
+
gap: 8px;
|
|
274
|
+
}
|
|
275
|
+
.sa-pv-audit__title {
|
|
276
|
+
font-size: 13px;
|
|
277
|
+
font-weight: 600;
|
|
278
|
+
color: var(--sa-heading, #0f172a);
|
|
279
|
+
}
|
|
280
|
+
.sa-pv-audit__entity {
|
|
281
|
+
font-family: var(--sa-font-mono, ui-monospace, monospace);
|
|
282
|
+
font-size: 10.5px;
|
|
283
|
+
font-weight: 600;
|
|
284
|
+
color: var(--sa-muted, #64748b);
|
|
285
|
+
background: #f1f5f9;
|
|
286
|
+
padding: 1px 6px;
|
|
287
|
+
border-radius: 4px;
|
|
288
|
+
}
|
|
289
|
+
.sa-pv-audit__detail {
|
|
290
|
+
font-size: 12.5px;
|
|
291
|
+
color: var(--sa-body, #1e293b);
|
|
292
|
+
margin-top: 3px;
|
|
293
|
+
line-height: 1.4;
|
|
294
|
+
}
|
|
295
|
+
.sa-pv-audit__meta {
|
|
296
|
+
font-size: 11px;
|
|
297
|
+
color: var(--sa-muted, #64748b);
|
|
298
|
+
margin-top: 4px;
|
|
299
|
+
display: flex;
|
|
300
|
+
gap: 10px;
|
|
301
|
+
}
|
|
302
|
+
.sa-pv-audit__meta span {
|
|
303
|
+
display: inline-flex;
|
|
304
|
+
align-items: center;
|
|
305
|
+
gap: 4px;
|
|
306
|
+
}
|
|
307
|
+
</style>
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sa-pv-diff">
|
|
3
|
+
<div class="sa-pv-diff__overview">
|
|
4
|
+
<div class="sa-pv-diff__hero">
|
|
5
|
+
<q-icon name="compare_arrows" size="22px" color="white" />
|
|
6
|
+
</div>
|
|
7
|
+
<div>
|
|
8
|
+
<div class="sa-pv-diff__legend">Vergleich</div>
|
|
9
|
+
<div class="sa-pv-diff__title">
|
|
10
|
+
{{ from.label }} <span class="sa-pv-diff__sep">→</span> {{ to.label }}
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="sa-pv-diff__spacer" />
|
|
14
|
+
<div class="sa-pv-diff__stats">
|
|
15
|
+
<div class="sa-pv-diff__stat">
|
|
16
|
+
<div class="sa-pv-diff__stat-label">Pakete geändert</div>
|
|
17
|
+
<div class="sa-pv-diff__stat-value sa-pv-diff__stat-value--warn">
|
|
18
|
+
{{ planChangedCount }}
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<div v-if="regressionCount > 0" class="sa-pv-diff__stat">
|
|
22
|
+
<div class="sa-pv-diff__stat-label">Regressionen</div>
|
|
23
|
+
<div class="sa-pv-diff__stat-value sa-pv-diff__stat-value--bad">
|
|
24
|
+
{{ regressionCount }}
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<h2 class="sa-pv-diff__section">Pakete</h2>
|
|
31
|
+
<PlanDiffCard
|
|
32
|
+
v-for="d in planDiffs"
|
|
33
|
+
:key="d.id"
|
|
34
|
+
:title="d.id"
|
|
35
|
+
:version-old="d.versionOld"
|
|
36
|
+
:version-new="d.versionNew"
|
|
37
|
+
:accent="planAccent(d.id)"
|
|
38
|
+
:changes="d.changes"
|
|
39
|
+
:field-labels="fieldLabels"
|
|
40
|
+
/>
|
|
41
|
+
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script setup lang="ts">
|
|
46
|
+
import { computed } from 'vue';
|
|
47
|
+
import type { VersionChange } from '@saasicat/types';
|
|
48
|
+
import type { CatalogSnapshot, ResolvedPlan } from '../../plan-versions-catalog.js';
|
|
49
|
+
import PlanDiffCard from './PlanDiffCard.vue';
|
|
50
|
+
|
|
51
|
+
interface SnapshotEntityDiff {
|
|
52
|
+
id: string;
|
|
53
|
+
versionOld: number | null;
|
|
54
|
+
versionNew: number | null;
|
|
55
|
+
changes: VersionChange[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const props = defineProps<{
|
|
59
|
+
from: CatalogSnapshot;
|
|
60
|
+
to: CatalogSnapshot;
|
|
61
|
+
/** Accent color per plan ID (for the diff card icons). */
|
|
62
|
+
planAccents?: Record<string, string>;
|
|
63
|
+
/** Field label overrides (e.g. `{ maxVehicles: 'Max. Fahrzeuge' }`). */
|
|
64
|
+
fieldLabels?: Record<string, string>;
|
|
65
|
+
}>();
|
|
66
|
+
|
|
67
|
+
function planAccent(planId: string): string {
|
|
68
|
+
return props.planAccents?.[planId] ?? '#3f6bff';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const planDiffs = computed<SnapshotEntityDiff[]>(() => {
|
|
72
|
+
const out: SnapshotEntityDiff[] = [];
|
|
73
|
+
const ids = uniqueIds(
|
|
74
|
+
props.from.plans.map((p) => p.planId),
|
|
75
|
+
props.to.plans.map((p) => p.planId),
|
|
76
|
+
);
|
|
77
|
+
for (const id of ids) {
|
|
78
|
+
const a = props.from.plans.find((p) => p.planId === id) ?? null;
|
|
79
|
+
const b = props.to.plans.find((p) => p.planId === id) ?? null;
|
|
80
|
+
out.push({
|
|
81
|
+
id,
|
|
82
|
+
versionOld: a?.version ?? null,
|
|
83
|
+
versionNew: b?.version ?? null,
|
|
84
|
+
changes: diffPlan(a, b),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return out;
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const planChangedCount = computed(() => planDiffs.value.filter((d) => d.changes.length > 0).length);
|
|
91
|
+
const regressionCount = computed(() =>
|
|
92
|
+
planDiffs.value.reduce(
|
|
93
|
+
(sum, d) => sum + d.changes.filter((c) => c.direction === 'REGRESSION').length,
|
|
94
|
+
0,
|
|
95
|
+
),
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
function uniqueIds(a: string[], b: string[]): string[] {
|
|
99
|
+
return Array.from(new Set([...a, ...b]));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function diffPlan(a: ResolvedPlan | null, b: ResolvedPlan | null): VersionChange[] {
|
|
103
|
+
if (!a && b)
|
|
104
|
+
return [
|
|
105
|
+
{ field: 'plan.added', oldValue: null, newValue: b.planId, direction: 'IMPROVEMENT' },
|
|
106
|
+
];
|
|
107
|
+
if (a && !b)
|
|
108
|
+
return [
|
|
109
|
+
{ field: 'plan.removed', oldValue: a.planId, newValue: null, direction: 'REGRESSION' },
|
|
110
|
+
];
|
|
111
|
+
if (!a || !b) return [];
|
|
112
|
+
const out: VersionChange[] = [];
|
|
113
|
+
pushFeatures(out, a.features, b.features);
|
|
114
|
+
// Quotas: compare all known keys from both snapshots.
|
|
115
|
+
const quotaKeys = new Set<string>([...Object.keys(a.quotas), ...Object.keys(b.quotas)]);
|
|
116
|
+
for (const key of quotaKeys) {
|
|
117
|
+
pushNumber(out, `quotas.${key}`, a.quotas[key] ?? 0, b.quotas[key] ?? 0, 'higher');
|
|
118
|
+
}
|
|
119
|
+
pushDecimal(out, 'monthlyNet', a.monthlyNet, b.monthlyNet, 'lower');
|
|
120
|
+
pushDecimal(out, 'yearlyNet', a.yearlyNet, b.yearlyNet, 'lower');
|
|
121
|
+
return out;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function pushFeatures(
|
|
125
|
+
out: VersionChange[],
|
|
126
|
+
oldF: readonly string[],
|
|
127
|
+
newF: readonly string[],
|
|
128
|
+
): void {
|
|
129
|
+
const oldSet = new Set(oldF);
|
|
130
|
+
const newSet = new Set(newF);
|
|
131
|
+
const removed = oldF.filter((f) => !newSet.has(f));
|
|
132
|
+
const added = newF.filter((f) => !oldSet.has(f));
|
|
133
|
+
if (removed.length > 0) {
|
|
134
|
+
out.push({
|
|
135
|
+
field: 'features.removed',
|
|
136
|
+
oldValue: removed,
|
|
137
|
+
newValue: [],
|
|
138
|
+
direction: 'REGRESSION',
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (added.length > 0) {
|
|
142
|
+
out.push({
|
|
143
|
+
field: 'features.added',
|
|
144
|
+
oldValue: [],
|
|
145
|
+
newValue: added,
|
|
146
|
+
direction: 'IMPROVEMENT',
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function pushNumber(
|
|
152
|
+
out: VersionChange[],
|
|
153
|
+
field: string,
|
|
154
|
+
oldV: number,
|
|
155
|
+
newV: number,
|
|
156
|
+
polarity: 'higher' | 'lower',
|
|
157
|
+
): void {
|
|
158
|
+
if (oldV === newV) return;
|
|
159
|
+
out.push({
|
|
160
|
+
field,
|
|
161
|
+
oldValue: oldV,
|
|
162
|
+
newValue: newV,
|
|
163
|
+
direction: directionFor(newV - oldV, polarity),
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function pushDecimal(
|
|
168
|
+
out: VersionChange[],
|
|
169
|
+
field: string,
|
|
170
|
+
oldV: number,
|
|
171
|
+
newV: number,
|
|
172
|
+
polarity: 'higher' | 'lower',
|
|
173
|
+
): void {
|
|
174
|
+
if (oldV === newV) return;
|
|
175
|
+
out.push({
|
|
176
|
+
field,
|
|
177
|
+
oldValue: oldV.toFixed(2),
|
|
178
|
+
newValue: newV.toFixed(2),
|
|
179
|
+
direction: directionFor(newV - oldV, polarity),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function directionFor(delta: number, polarity: 'higher' | 'lower'): VersionChange['direction'] {
|
|
184
|
+
if (delta === 0) return 'NEUTRAL';
|
|
185
|
+
const positive = delta > 0;
|
|
186
|
+
if (polarity === 'higher') return positive ? 'IMPROVEMENT' : 'REGRESSION';
|
|
187
|
+
return positive ? 'REGRESSION' : 'IMPROVEMENT';
|
|
188
|
+
}
|
|
189
|
+
</script>
|
|
190
|
+
|
|
191
|
+
<style scoped>
|
|
192
|
+
.sa-pv-diff {
|
|
193
|
+
padding: 20px 28px;
|
|
194
|
+
}
|
|
195
|
+
.sa-pv-diff__overview {
|
|
196
|
+
background: #fff;
|
|
197
|
+
border: 1px solid var(--sa-border, #e2e8f0);
|
|
198
|
+
border-radius: 12px;
|
|
199
|
+
padding: 16px 20px;
|
|
200
|
+
margin-bottom: 18px;
|
|
201
|
+
display: flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
gap: 18px;
|
|
204
|
+
}
|
|
205
|
+
.sa-pv-diff__hero {
|
|
206
|
+
width: 44px;
|
|
207
|
+
height: 44px;
|
|
208
|
+
border-radius: 10px;
|
|
209
|
+
background: linear-gradient(135deg, #f59e0b, #d97706);
|
|
210
|
+
display: flex;
|
|
211
|
+
align-items: center;
|
|
212
|
+
justify-content: center;
|
|
213
|
+
}
|
|
214
|
+
.sa-pv-diff__legend {
|
|
215
|
+
font-size: 11px;
|
|
216
|
+
font-weight: 700;
|
|
217
|
+
letter-spacing: 0.08em;
|
|
218
|
+
color: var(--sa-muted, #64748b);
|
|
219
|
+
text-transform: uppercase;
|
|
220
|
+
}
|
|
221
|
+
.sa-pv-diff__title {
|
|
222
|
+
font-family: var(--sa-font-head, system-ui, sans-serif);
|
|
223
|
+
font-weight: 700;
|
|
224
|
+
font-size: 18px;
|
|
225
|
+
color: var(--sa-heading, #0f172a);
|
|
226
|
+
}
|
|
227
|
+
.sa-pv-diff__sep {
|
|
228
|
+
color: var(--sa-muted, #64748b);
|
|
229
|
+
font-weight: 500;
|
|
230
|
+
}
|
|
231
|
+
.sa-pv-diff__spacer {
|
|
232
|
+
flex: 1;
|
|
233
|
+
}
|
|
234
|
+
.sa-pv-diff__stats {
|
|
235
|
+
display: flex;
|
|
236
|
+
gap: 14px;
|
|
237
|
+
}
|
|
238
|
+
.sa-pv-diff__stat {
|
|
239
|
+
text-align: right;
|
|
240
|
+
}
|
|
241
|
+
.sa-pv-diff__stat-label {
|
|
242
|
+
font-size: 10.5px;
|
|
243
|
+
font-weight: 700;
|
|
244
|
+
letter-spacing: 0.08em;
|
|
245
|
+
color: var(--sa-muted, #64748b);
|
|
246
|
+
text-transform: uppercase;
|
|
247
|
+
}
|
|
248
|
+
.sa-pv-diff__stat-value {
|
|
249
|
+
font-family: var(--sa-font-head, system-ui, sans-serif);
|
|
250
|
+
font-weight: 700;
|
|
251
|
+
font-size: 22px;
|
|
252
|
+
}
|
|
253
|
+
.sa-pv-diff__stat-value--warn {
|
|
254
|
+
color: var(--sa-warning, #b45309);
|
|
255
|
+
}
|
|
256
|
+
.sa-pv-diff__stat-value--bad {
|
|
257
|
+
color: var(--sa-negative, #dc2626);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.sa-pv-diff__section {
|
|
261
|
+
margin: 22px 0 10px;
|
|
262
|
+
font-family: var(--sa-font-head, system-ui, sans-serif);
|
|
263
|
+
font-size: 14px;
|
|
264
|
+
font-weight: 700;
|
|
265
|
+
color: var(--sa-muted, #64748b);
|
|
266
|
+
text-transform: uppercase;
|
|
267
|
+
letter-spacing: 0.08em;
|
|
268
|
+
}
|
|
269
|
+
</style>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="sa-pv-kpi">
|
|
3
|
+
<div class="sa-pv-kpi__icon"><q-icon :name="icon" size="18px" /></div>
|
|
4
|
+
<div>
|
|
5
|
+
<div class="sa-pv-kpi__label">{{ label }}</div>
|
|
6
|
+
<div class="sa-pv-kpi__value">
|
|
7
|
+
{{ value }}
|
|
8
|
+
<span v-if="sub" class="sa-pv-kpi__sub">{{ sub }}</span>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script setup lang="ts">
|
|
15
|
+
defineProps<{
|
|
16
|
+
label: string;
|
|
17
|
+
value: number | string;
|
|
18
|
+
icon: string;
|
|
19
|
+
sub?: string;
|
|
20
|
+
}>();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<style scoped>
|
|
24
|
+
.sa-pv-kpi {
|
|
25
|
+
background: #fff;
|
|
26
|
+
border: 1px solid var(--sa-border, #e2e8f0);
|
|
27
|
+
border-radius: 10px;
|
|
28
|
+
padding: 12px 14px;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: 12px;
|
|
32
|
+
}
|
|
33
|
+
.sa-pv-kpi__icon {
|
|
34
|
+
width: 36px;
|
|
35
|
+
height: 36px;
|
|
36
|
+
border-radius: 9px;
|
|
37
|
+
background: var(--sa-primary-soft, rgba(63, 107, 255, 0.08));
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
}
|
|
42
|
+
.sa-pv-kpi__icon :deep(.q-icon) {
|
|
43
|
+
color: var(--sa-primary, #3f6bff);
|
|
44
|
+
}
|
|
45
|
+
.sa-pv-kpi__label {
|
|
46
|
+
font-size: 10.5px;
|
|
47
|
+
font-weight: 700;
|
|
48
|
+
letter-spacing: 0.08em;
|
|
49
|
+
color: var(--sa-muted, #64748b);
|
|
50
|
+
text-transform: uppercase;
|
|
51
|
+
}
|
|
52
|
+
.sa-pv-kpi__value {
|
|
53
|
+
font-family: var(--sa-font-head, system-ui, sans-serif);
|
|
54
|
+
font-weight: 700;
|
|
55
|
+
font-size: 20px;
|
|
56
|
+
color: var(--sa-heading, #0f172a);
|
|
57
|
+
line-height: 1.1;
|
|
58
|
+
margin-top: 2px;
|
|
59
|
+
}
|
|
60
|
+
.sa-pv-kpi__sub {
|
|
61
|
+
font-size: 12px;
|
|
62
|
+
font-weight: 500;
|
|
63
|
+
color: var(--sa-muted, #64748b);
|
|
64
|
+
}
|
|
65
|
+
</style>
|