8e6f73a921
Operator portal now wears its real chrome instead of placeholder spans.
Sidebar + topbar + page header all rendered against the carbon palette
from tokens.css.
Components ported from the source design (operator-app.jsx,
platform-ui.jsx, operator-screens.jsx) as Vue 3 SFCs in
apps/operator/components/:
Foundation: NodeMark (copied from portal), UiIcon (expanded to 31 icons
covering sidebar/topbar/sort/arrows)
Primitives: Card (3 surface variants), UiButton (primary / secondary /
ghost / dark / danger × sm / md / lg), DataTable (header + rows),
Badge (7 tones), Avatar (deterministic palette by name hash), Mono,
Eyebrow, StatusDot, PageHeader (with actions slot)
Shell: OpSidebar (collapsible 232<->56px, 12 nav items in 4 sections,
active-row highlight from route, badge slot, brand + user footer);
OpTopbar (env badge with prod/staging/dev variants, palette trigger
stub for the ⌘K work in O.8, on-call pill, bell, avatar)
Layouts: layouts/default.vue wires sidebar + topbar + slot; layouts/blank.vue
is used by the login page (definePageMeta layout:'blank'). app.vue now
wraps NuxtPage in NuxtLayout (the missing piece — without it Nuxt warns
"Your project has layouts but the <NuxtLayout /> component has not been
used" and renders nothing chrome-wise).
Composable composables/useSidebar.ts holds the collapsed state shared
between OpSidebar's toggle button and layouts/default.vue's ⌘[ keyboard
shortcut.
Verified in the browser:
- Sidebar renders all 12 nav links with section dividers, env badge shows
PROD, PageHeader resolves to the user's display name from
useOidcAuth().user
- Collapse toggle flips sidebar width 232↔56; nav rows become icon-only
- Smoke test on the placeholder home still returns 409 for the seeded
test-partner (token forwarding survives the layout refactor)
Gotcha documented in the plan: Vite 7.3 added a strict
server.allowedHosts check that returns plaintext 403 for any host header
that isn't the dev origin. The customer portal pre-dates this Vite
version; operator needs allowedHosts: ['operator.dezky.local'] in
nuxt.config.ts under vite.server.
Pages/index.vue replaces the bare HTML placeholder from O.3 with the
new PageHeader + Card primitives — same smoke-test functionality, much
better visual fidelity.
Real screen content (Tenants, Partners, Infrastructure, etc.) lands in
O.5+. This commit is the chrome, the smoke test, and the verification
that the design system primitives compose correctly.
138 lines
4.0 KiB
Vue
138 lines
4.0 KiB
Vue
<script setup lang="ts">
|
|
// O.4 deliverable: real shell wrapping the placeholder dashboard. The smoke
|
|
// test from O.3 stays so we can keep verifying the audience chain after
|
|
// every restart. Real Overview content lands in O.7.
|
|
|
|
const { user } = useOidcAuth()
|
|
const smokeResult = ref<string | null>(null)
|
|
const smokeBusy = ref(false)
|
|
|
|
async function createTestPartner() {
|
|
smokeBusy.value = true
|
|
smokeResult.value = null
|
|
try {
|
|
const res = await $fetch('/api/operator-smoke-test', { method: 'POST' })
|
|
smokeResult.value = `200 ${JSON.stringify(res).slice(0, 200)}`
|
|
} catch (err: unknown) {
|
|
const e = err as { data?: { message?: string; data?: { message?: string } }; statusCode?: number }
|
|
const code = e.statusCode ?? '?'
|
|
const msg = e.data?.data?.message ?? e.data?.message ?? String(err)
|
|
smokeResult.value = `${code} ${msg}`
|
|
} finally {
|
|
smokeBusy.value = false
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<PageHeader
|
|
eyebrow="Overview"
|
|
:title="`Hi, ${user?.userInfo?.name || user?.userName || 'operator'}.`"
|
|
subtitle="O.4 scaffolding · sidebar + topbar + design tokens wired up. Real dashboard tiles, metrics and incident panel land in O.7."
|
|
>
|
|
<template #actions>
|
|
<UiButton variant="secondary">
|
|
<template #leading><UiIcon name="external" :size="13" /></template>
|
|
Docs
|
|
</UiButton>
|
|
<UiButton variant="primary">
|
|
<template #leading><UiIcon name="plus" :size="13" /></template>
|
|
New tenant
|
|
</UiButton>
|
|
</template>
|
|
</PageHeader>
|
|
|
|
<div class="stage">
|
|
<Card>
|
|
<div class="row">
|
|
<div>
|
|
<h2>Smoke test · POST /partners</h2>
|
|
<p>
|
|
Forwards your access token to platform-api. Operator-scoped tokens succeed
|
|
(200 first time, 409 thereafter). Customer-portal tokens return 403.
|
|
</p>
|
|
</div>
|
|
<UiButton variant="primary" :disabled="smokeBusy" @click="createTestPartner">
|
|
{{ smokeBusy ? 'Calling…' : 'Create partner' }}
|
|
</UiButton>
|
|
</div>
|
|
<pre v-if="smokeResult" class="result">{{ smokeResult }}</pre>
|
|
</Card>
|
|
|
|
<Card>
|
|
<h2 class="cap">Session</h2>
|
|
<div class="meta">
|
|
<div class="kv"><Eyebrow>subject</Eyebrow><Mono>{{ user?.userName }}</Mono></div>
|
|
<div class="kv"><Eyebrow>email</Eyebrow><Mono>{{ user?.userInfo?.email }}</Mono></div>
|
|
<div class="kv">
|
|
<Eyebrow>groups</Eyebrow>
|
|
<span class="groups">
|
|
<Badge
|
|
v-for="g in (user?.userInfo as { groups?: string[] } | undefined)?.groups || []"
|
|
:key="g"
|
|
:tone="g === 'dezky-platform-admins' ? 'accent' : 'neutral'"
|
|
>{{ g }}</Badge>
|
|
</span>
|
|
</div>
|
|
<div class="kv"><Eyebrow>token aud</Eyebrow><Badge tone="invert">dezky-operator</Badge></div>
|
|
</div>
|
|
</Card>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.stage {
|
|
padding: 24px 40px 64px 40px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 20px;
|
|
max-width: 1100px;
|
|
}
|
|
|
|
.row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
|
|
|
|
h2 {
|
|
font-family: var(--font-display);
|
|
font-weight: 600;
|
|
font-size: 17px;
|
|
letter-spacing: -0.01em;
|
|
margin: 0 0 6px 0;
|
|
}
|
|
|
|
p {
|
|
margin: 0;
|
|
color: var(--text-mute);
|
|
font-size: 13px;
|
|
line-height: 1.55;
|
|
max-width: 560px;
|
|
}
|
|
|
|
.result {
|
|
margin: 16px 0 0 0;
|
|
padding: 12px;
|
|
background: var(--bg);
|
|
border: 1px solid var(--border);
|
|
border-radius: 6px;
|
|
font-family: var(--font-mono);
|
|
font-size: 11.5px;
|
|
color: var(--text-dim);
|
|
white-space: pre-wrap;
|
|
word-break: break-all;
|
|
}
|
|
|
|
.cap {
|
|
font-family: var(--font-display);
|
|
font-weight: 600;
|
|
font-size: 17px;
|
|
letter-spacing: -0.01em;
|
|
margin: 0 0 14px 0;
|
|
}
|
|
|
|
.meta { display: flex; flex-direction: column; gap: 12px; }
|
|
.kv { display: flex; align-items: center; gap: 16px; }
|
|
.kv :first-child { width: 110px; flex-shrink: 0; }
|
|
.groups { display: flex; gap: 6px; flex-wrap: wrap; }
|
|
</style>
|