mirror of
https://github.com/yibaiba/hideck.git
synced 2026-12-06 16:01:13 +00:00
[dashboard-prototype-migration-DASH-02] rebuild connection focus stage
This commit is contained in:
1 parent
c2b624b108
commit
e80f0dac96
4 files changed
+264
-110
No files matched your search
@@ -0,0 +1,231 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import {
|
||||
Checkmark12Regular,
|
||||
Dismiss12Regular,
|
||||
Open20Regular,
|
||||
Subtract12Regular
|
||||
} from '@vicons/fluent'
|
||||
import type { DashboardDevice } from '../types/api'
|
||||
import {
|
||||
canAnimateDashboardConnection,
|
||||
createDashboardDevicePresentation
|
||||
} from '../utils/dashboardPresentation'
|
||||
|
||||
const props = defineProps<{
|
||||
device: DashboardDevice
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(event: 'open', deviceID: string): void
|
||||
}>()
|
||||
|
||||
const presentation = computed(() => createDashboardDevicePresentation(props.device))
|
||||
const showsConnectionPath = computed(() => props.device.vowifi_active === true)
|
||||
const pathIsFlowing = computed(() => canAnimateDashboardConnection(props.device))
|
||||
|
||||
function stageStatusLabel(ready: boolean | undefined): string {
|
||||
if (ready === true) return '已就绪'
|
||||
if (ready === false) return '失败'
|
||||
return '等待状态'
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="connection-stage" aria-label="当前设备连接焦点">
|
||||
<div class="connection-stage-main">
|
||||
<header class="connection-stage-heading">
|
||||
<span class="dashboard-eyebrow">ACTIVE DEVICE</span>
|
||||
<span
|
||||
class="focus-device-status"
|
||||
:class="device.healthy ? 'is-online' : 'is-offline'"
|
||||
>
|
||||
<i aria-hidden="true" />
|
||||
{{ presentation.statusLabel }}
|
||||
</span>
|
||||
</header>
|
||||
|
||||
<h2>{{ presentation.connectionTitle }}</h2>
|
||||
<strong>{{ presentation.connectionState }}</strong>
|
||||
<p>{{ presentation.displayName }} · {{ device.id }}</p>
|
||||
|
||||
<div
|
||||
v-if="showsConnectionPath"
|
||||
class="connection-path"
|
||||
:class="{ 'is-flowing': pathIsFlowing }"
|
||||
aria-label="VoWiFi 服务链路"
|
||||
>
|
||||
<div class="connection-path-track" aria-hidden="true">
|
||||
<span class="connection-signal" />
|
||||
</div>
|
||||
<div
|
||||
v-for="stage in presentation.stages"
|
||||
:key="stage.key"
|
||||
class="connection-path-step"
|
||||
:class="{
|
||||
'is-ready': stage.ready === true,
|
||||
'is-failed': stage.ready === false
|
||||
}"
|
||||
:aria-label="`${stage.key}:${stageStatusLabel(stage.ready)}`"
|
||||
>
|
||||
<span aria-hidden="true">
|
||||
<Checkmark12Regular v-if="stage.ready === true" />
|
||||
<Dismiss12Regular v-else-if="stage.ready === false" />
|
||||
<Subtract12Regular v-else />
|
||||
</span>
|
||||
<small>{{ stage.key }}</small>
|
||||
<em>{{ stageStatusLabel(stage.ready) }}</em>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else class="cellular-focus">
|
||||
<span>{{ presentation.connectionType }}</span>
|
||||
<strong>{{ presentation.signal }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<aside class="connection-stage-aside" aria-label="当前设备网络事实">
|
||||
<dl>
|
||||
<div>
|
||||
<dt>连接类型</dt>
|
||||
<dd>{{ presentation.connectionType }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>运营商</dt>
|
||||
<dd>{{ presentation.operator }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>信号</dt>
|
||||
<dd class="is-tabular">{{ presentation.signal }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>公网 IPv4</dt>
|
||||
<dd class="is-address" :title="presentation.ipv4">{{ presentation.ipv4 }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>公网 IPv6</dt>
|
||||
<dd class="is-address" :title="presentation.ipv6">{{ presentation.ipv6 }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<button type="button" class="focus-open-button" @click="emit('open', device.id)">
|
||||
<span>打开设备工作区</span>
|
||||
<Open20Regular aria-hidden="true" />
|
||||
</button>
|
||||
</aside>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.connection-stage {
|
||||
position: relative;
|
||||
min-height: 410px;
|
||||
margin-bottom: 18px;
|
||||
padding: clamp(28px, 4vw, 52px);
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(270px, 320px);
|
||||
gap: clamp(32px, 4vw, 56px);
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--ui-border);
|
||||
border-radius: 24px;
|
||||
background:
|
||||
radial-gradient(circle at 56% 51%, color-mix(in srgb, var(--ui-primary) 13%, transparent), transparent 31%),
|
||||
linear-gradient(132deg, var(--ui-surface) 0 48%, color-mix(in srgb, var(--ui-surface) 90%, #06120e) 100%);
|
||||
box-shadow: var(--ui-shadow-sm);
|
||||
}
|
||||
|
||||
.connection-stage::before {
|
||||
position: absolute;
|
||||
inset: 0 27% 0 37%;
|
||||
opacity: .34;
|
||||
background-image: radial-gradient(circle, color-mix(in srgb, var(--ui-primary) 44%, transparent) 1px, transparent 1.4px);
|
||||
background-size: 18px 18px;
|
||||
mask-image: radial-gradient(ellipse, #000, transparent 70%);
|
||||
pointer-events: none;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.connection-stage-main,
|
||||
.connection-stage-aside { position: relative; z-index: 1; min-width: 0; }
|
||||
.connection-stage-heading { display: flex; align-items: center; gap: 12px; }
|
||||
.dashboard-eyebrow { color: var(--ui-primary); font: 700 10px "v-mono", monospace; letter-spacing: .14em; }
|
||||
.focus-device-status { display: inline-flex; align-items: center; gap: 7px; color: var(--ui-text-muted); font-size: 11px; }
|
||||
.focus-device-status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
|
||||
.focus-device-status.is-online { color: var(--ui-success); }
|
||||
.focus-device-status.is-offline { color: var(--ui-danger); }
|
||||
.focus-device-status.is-online i { animation: online-pulse 2.4s var(--ui-ease-in-out) infinite; }
|
||||
.connection-stage h2 { margin: 26px 0 4px; color: var(--ui-text); font-size: clamp(40px, 5.4vw, 76px); font-weight: 560; letter-spacing: -.045em; line-height: .98; }
|
||||
.connection-stage-main > strong { color: var(--ui-primary); font-size: clamp(23px, 3vw, 36px); font-weight: 540; }
|
||||
.connection-stage-main > p { margin: 14px 0 0; color: var(--ui-text-muted); font-size: 13px; overflow-wrap: anywhere; }
|
||||
|
||||
.connection-path {
|
||||
position: relative;
|
||||
width: min(100%, 620px);
|
||||
margin-top: 58px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
container-type: inline-size;
|
||||
}
|
||||
.connection-path-track { position: absolute; top: 18px; right: 9%; left: 9%; height: 1px; background: var(--ui-border); }
|
||||
.connection-path.is-flowing .connection-path-track { background: linear-gradient(90deg, color-mix(in srgb, var(--ui-primary) 34%, var(--ui-border)), var(--ui-primary), color-mix(in srgb, var(--ui-primary) 34%, var(--ui-border))); }
|
||||
.connection-signal { position: absolute; top: -3px; left: 0; width: 7px; height: 7px; border-radius: 50%; opacity: 0; background: var(--ui-primary); box-shadow: 0 0 14px var(--ui-primary); }
|
||||
.connection-path.is-flowing .connection-signal { animation: connection-signal 2.4s linear infinite; }
|
||||
.connection-path-step { position: relative; z-index: 1; min-width: 0; display: grid; place-items: center; gap: 7px; color: var(--ui-text-muted); }
|
||||
.connection-path-step > span { width: 37px; height: 37px; display: grid; place-items: center; border: 1px solid var(--ui-border); border-radius: 50%; background: var(--ui-surface-strong); color: inherit; }
|
||||
.connection-path-step svg { width: 15px; height: 15px; }
|
||||
.connection-path-step small { font-size: 10px; }
|
||||
.connection-path-step em { max-width: 100%; overflow: hidden; font-size: 9px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.connection-path-step.is-ready { color: var(--ui-primary); }
|
||||
.connection-path-step.is-ready > span { border-color: var(--ui-primary); box-shadow: 0 0 22px color-mix(in srgb, var(--ui-primary) 18%, transparent); }
|
||||
.connection-path-step.is-failed { color: var(--ui-danger); }
|
||||
.connection-path-step.is-failed > span { border-color: var(--ui-danger); }
|
||||
|
||||
.cellular-focus { width: min(100%, 520px); margin-top: 64px; padding-top: 24px; display: flex; align-items: end; justify-content: space-between; gap: 20px; border-top: 1px solid var(--ui-border); color: var(--ui-text-muted); }
|
||||
.cellular-focus strong { color: var(--ui-text); font: 34px/1 "v-mono", monospace; text-align: right; }
|
||||
.connection-stage-aside { padding: 18px 20px; display: flex; flex-direction: column; border: 1px solid var(--ui-border); border-radius: 17px; background: color-mix(in srgb, var(--ui-surface-strong) 82%, transparent); }
|
||||
.connection-stage-aside dl { margin: 0; }
|
||||
.connection-stage-aside dl > div { padding: 10px 0; display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; border-bottom: 1px solid var(--ui-border-muted); }
|
||||
.connection-stage-aside dt { color: var(--ui-text-muted); font-size: 11px; }
|
||||
.connection-stage-aside dd { min-width: 0; margin: 0; color: var(--ui-text); font-size: 14px; font-weight: 560; text-align: right; overflow-wrap: anywhere; }
|
||||
.connection-stage-aside .is-tabular,
|
||||
.connection-stage-aside .is-address { font-family: "v-mono", monospace; font-variant-numeric: tabular-nums; }
|
||||
.connection-stage-aside .is-address { font-size: 11px; line-height: 1.45; }
|
||||
.focus-open-button { min-height: 44px; margin-top: auto; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid color-mix(in srgb, var(--ui-primary) 48%, var(--ui-border)); border-radius: 11px; background: color-mix(in srgb, var(--ui-primary) 8%, transparent); color: var(--ui-primary); cursor: pointer; transition: border-color 160ms var(--ui-ease-out), background-color 160ms var(--ui-ease-out), transform 140ms var(--ui-ease-out); }
|
||||
.focus-open-button svg { width: 18px; height: 18px; }
|
||||
.focus-open-button:active { transform: scale(.97); }
|
||||
|
||||
@keyframes connection-signal {
|
||||
0% { opacity: 0; transform: translateX(0); }
|
||||
12%, 88% { opacity: 1; }
|
||||
100% { opacity: 0; transform: translateX(calc(82cqw - 7px)); }
|
||||
}
|
||||
@keyframes online-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
|
||||
|
||||
@media (hover: hover) and (pointer: fine) {
|
||||
.focus-open-button:hover { border-color: var(--ui-primary); background: color-mix(in srgb, var(--ui-primary) 13%, transparent); }
|
||||
}
|
||||
|
||||
@media (max-width: 1050px) {
|
||||
.connection-stage { grid-template-columns: minmax(0, 1fr) 250px; gap: 28px; }
|
||||
.connection-stage-aside { padding: 14px 16px; }
|
||||
.connection-stage-aside dl > div { grid-template-columns: 76px minmax(0, 1fr); }
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.connection-stage { min-height: 0; padding: 24px 20px; grid-template-columns: minmax(0, 1fr); }
|
||||
.connection-stage::before { inset: 0; }
|
||||
.connection-stage h2 { font-size: clamp(36px, 12vw, 54px); }
|
||||
.connection-path { margin-top: 42px; }
|
||||
.connection-path-step em { display: none; }
|
||||
.cellular-focus { margin-top: 42px; }
|
||||
.cellular-focus strong { font-size: 25px; }
|
||||
.connection-stage-aside { gap: 16px; }
|
||||
.focus-open-button { margin-top: 4px; }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.focus-device-status.is-online i,
|
||||
.connection-path.is-flowing .connection-signal { animation: none; }
|
||||
.connection-path.is-flowing .connection-signal { opacity: .7; transform: none; }
|
||||
.focus-open-button { transition-duration: 0ms; }
|
||||
}
|
||||
</style>
|
||||
@@ -53,6 +53,11 @@ export function createDashboardStages(
|
||||
])
|
||||
}
|
||||
|
||||
export function canAnimateDashboardConnection(device: DashboardDevice): boolean {
|
||||
if (!device.healthy || device.vowifi_active !== true) return false
|
||||
return !createDashboardStages(device.vowifi_runtime).some(stage => stage.ready === false)
|
||||
}
|
||||
|
||||
export function createDashboardDevicePresentation(
|
||||
device: DashboardDevice
|
||||
): DashboardDevicePresentation {
|
||||
|
||||
+11
-108
@@ -3,6 +3,7 @@ import { onMounted, ref, computed } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useRouter } from 'vue-router'
|
||||
import DeviceCard from '../components/DeviceCard.vue'
|
||||
import ConnectionFocusStage from '../components/ConnectionFocusStage.vue'
|
||||
import PageHeader from '../components/PageHeader.vue'
|
||||
import EmptyState from '../components/EmptyState.vue'
|
||||
import ListSkeleton from '../components/ListSkeleton.vue'
|
||||
@@ -58,31 +59,6 @@ const selectedDevice = computed(() => {
|
||||
|| devices.value.find((device) => device.healthy)
|
||||
|| devices.value[0]
|
||||
})
|
||||
const selectedDeviceIP = computed(() => selectedDevice.value?.public_ipv6 || selectedDevice.value?.public_ip || '')
|
||||
const selectedRuntime = computed(() => selectedDevice.value?.vowifi_runtime)
|
||||
const selectedConnectionTitle = computed(() => {
|
||||
const device = selectedDevice.value
|
||||
if (!device) return '等待设备'
|
||||
if (!device.healthy) return '设备离线'
|
||||
if (device.vowifi_active) return 'Wi-Fi Calling'
|
||||
return device.operator || '网络检测中'
|
||||
})
|
||||
const selectedConnectionState = computed(() => {
|
||||
const device = selectedDevice.value
|
||||
if (!device) return '没有可用设备'
|
||||
if (!device.healthy) return '当前设备不可用'
|
||||
return device.vowifi_active ? '已连接' : ([device.network_duplex, device.network_mode].filter(Boolean).join(' ') || '控制面在线')
|
||||
})
|
||||
const selectedStages = computed(() => {
|
||||
const runtime = selectedRuntime.value
|
||||
return [
|
||||
{ key: 'SIM', ready: runtime?.sim_ready },
|
||||
{ key: 'Access', ready: runtime?.access_ready },
|
||||
{ key: 'Tunnel', ready: runtime?.tunnel_ready },
|
||||
{ key: 'IMS', ready: runtime?.ims_ready },
|
||||
{ key: 'SMS', ready: runtime?.sms_ready }
|
||||
]
|
||||
})
|
||||
|
||||
async function fetchDevices() {
|
||||
await dashboard.fetchDevices()
|
||||
@@ -146,54 +122,12 @@ onMounted(() => {
|
||||
</PageHeader>
|
||||
|
||||
<Transition name="focus-swap" mode="out-in">
|
||||
<section v-if="selectedDevice" :key="selectedDevice.id" class="connection-stage" aria-label="当前设备连接焦点">
|
||||
<div class="connection-stage-main">
|
||||
<div class="connection-stage-heading">
|
||||
<span class="dashboard-eyebrow">ACTIVE DEVICE</span>
|
||||
<span class="focus-device-status" :class="selectedDevice.healthy ? 'is-online' : 'is-offline'">
|
||||
{{ selectedDevice.healthy ? '在线' : '离线' }}
|
||||
</span>
|
||||
</div>
|
||||
<h2>{{ selectedConnectionTitle }}</h2>
|
||||
<strong>{{ selectedConnectionState }}</strong>
|
||||
<p>{{ selectedDevice.name || selectedDevice.id }} · {{ selectedDevice.id }}</p>
|
||||
|
||||
<div v-if="selectedDevice.vowifi_active" class="connection-path" aria-label="VoWiFi 服务链路">
|
||||
<div class="connection-path-line" aria-hidden="true" />
|
||||
<div
|
||||
v-for="stage in selectedStages"
|
||||
:key="stage.key"
|
||||
class="connection-path-step"
|
||||
:class="{ 'is-ready': stage.ready === true, 'is-failed': stage.ready === false }"
|
||||
>
|
||||
<span>{{ stage.ready === true ? '✓' : stage.ready === false ? '×' : '·' }}</span>
|
||||
<small>{{ stage.key }}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="cellular-focus">
|
||||
<span>{{ [selectedDevice.network_duplex, selectedDevice.network_mode].filter(Boolean).join(' ') || '未驻网' }}</span>
|
||||
<strong>{{ selectedDevice.signal_dbm || '--' }}<small v-if="selectedDevice.signal_dbm"> dBm</small></strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<aside class="connection-stage-aside">
|
||||
<div class="focus-stat">
|
||||
<span>连接类型</span>
|
||||
<strong>{{ selectedDevice.vowifi_active ? 'VoWiFi' : (selectedDevice.network_mode || '--') }}</strong>
|
||||
</div>
|
||||
<div class="focus-stat">
|
||||
<span>运营商</span>
|
||||
<strong>{{ selectedDevice.operator || '--' }}</strong>
|
||||
</div>
|
||||
<div class="focus-stat focus-stat-ip">
|
||||
<span>公网 IP</span>
|
||||
<strong :title="selectedDeviceIP">{{ selectedDeviceIP || '--' }}</strong>
|
||||
</div>
|
||||
<button type="button" class="focus-open-button" @click="openDeviceOverview(selectedDevice.id)">
|
||||
打开设备工作区
|
||||
</button>
|
||||
</aside>
|
||||
</section>
|
||||
<ConnectionFocusStage
|
||||
v-if="selectedDevice"
|
||||
:key="selectedDevice.id"
|
||||
:device="selectedDevice"
|
||||
@open="openDeviceOverview"
|
||||
/>
|
||||
</Transition>
|
||||
|
||||
<section class="fleet-summary" aria-label="设备状态摘要">
|
||||
@@ -299,37 +233,7 @@ onMounted(() => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.dashboard-eyebrow, .section-kicker { color: var(--ui-primary); font: 700 10px "v-mono", monospace; letter-spacing: .14em; }
|
||||
.connection-stage { position: relative; min-height: 410px; margin-bottom: 18px; padding: clamp(26px, 4vw, 54px); display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 44px; overflow: hidden; border: 1px solid var(--ui-border); border-radius: 26px; background: radial-gradient(circle at 54% 52%, color-mix(in srgb, var(--ui-primary) 15%, transparent), transparent 30%), linear-gradient(125deg, var(--ui-surface) 0 48%, color-mix(in srgb, var(--ui-surface) 88%, #06120e) 100%); }
|
||||
.connection-stage::before, .connection-stage::after { position: absolute; pointer-events: none; content: ""; }
|
||||
.connection-stage::before { inset: 0 24% 0 36%; opacity: .42; background-image: radial-gradient(circle, color-mix(in srgb, var(--ui-primary) 48%, transparent) 1px, transparent 1.4px); background-size: 20px 20px; mask-image: radial-gradient(ellipse, #000, transparent 69%); }
|
||||
.connection-stage::after { top: 50%; left: 42%; width: 38%; height: 1px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ui-primary) 48%, transparent), transparent); box-shadow: 0 -38px 0 color-mix(in srgb, var(--ui-primary) 10%, transparent), 0 38px 0 color-mix(in srgb, var(--ui-primary) 10%, transparent); }
|
||||
.connection-stage-main, .connection-stage-aside { position: relative; z-index: 1; }
|
||||
.connection-stage-heading { display: flex; align-items: center; gap: 12px; }
|
||||
.focus-device-status { display: inline-flex; align-items: center; gap: 6px; color: var(--ui-text-muted); font-size: 11px; }
|
||||
.focus-device-status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
|
||||
.focus-device-status.is-online { color: var(--ui-success); }
|
||||
.focus-device-status.is-offline { color: var(--ui-danger); }
|
||||
.connection-stage h2 { margin: 26px 0 4px; color: var(--ui-text); font-size: clamp(40px, 5.6vw, 76px); font-weight: 520; letter-spacing: -.045em; line-height: .98; }
|
||||
.connection-stage-main > strong { color: var(--ui-primary); font-size: clamp(23px, 3vw, 36px); font-weight: 520; }
|
||||
.connection-stage-main > p { margin: 14px 0 0; color: var(--ui-text-muted); font-size: 13px; }
|
||||
.connection-path { position: relative; width: min(100%, 620px); margin-top: 62px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
|
||||
.connection-path-line { position: absolute; top: 18px; right: 9%; left: 9%; height: 1px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ui-primary) 72%, transparent), transparent); }
|
||||
.connection-path-line::after { position: absolute; top: -3px; left: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--ui-primary); box-shadow: 0 0 14px var(--ui-primary); content: ""; animation: connection-signal 2.4s linear infinite; }
|
||||
.connection-path-step { position: relative; z-index: 1; display: grid; place-items: center; gap: 9px; }
|
||||
.connection-path-step span { width: 37px; height: 37px; display: grid; place-items: center; border: 1px solid var(--ui-border); border-radius: 50%; background: var(--ui-surface-strong); color: var(--ui-text-muted); }
|
||||
.connection-path-step small { color: var(--ui-text-muted); font-size: 10px; }
|
||||
.connection-path-step.is-ready span { border-color: var(--ui-primary); color: var(--ui-primary); box-shadow: 0 0 22px color-mix(in srgb, var(--ui-primary) 18%, transparent); }
|
||||
.connection-path-step.is-failed span { border-color: var(--ui-danger); color: var(--ui-danger); }
|
||||
.cellular-focus { width: min(100%, 520px); margin-top: 64px; padding-top: 24px; display: flex; align-items: end; justify-content: space-between; border-top: 1px solid var(--ui-border); color: var(--ui-text-muted); }
|
||||
.cellular-focus > strong { color: var(--ui-text); font: 42px/1 "v-mono", monospace; }
|
||||
.cellular-focus small { font-size: 13px; }
|
||||
.connection-stage-aside { padding-left: 28px; display: flex; flex-direction: column; border-left: 1px solid var(--ui-border); }
|
||||
.focus-stat { padding: 19px 0; display: grid; gap: 6px; border-bottom: 1px solid var(--ui-border); }
|
||||
.focus-stat span { color: var(--ui-text-muted); font-size: 11px; }
|
||||
.focus-stat strong { color: var(--ui-text); font-size: 20px; font-weight: 520; }
|
||||
.focus-stat-ip strong { overflow: hidden; font: 14px "v-mono", monospace; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.focus-open-button { min-height: 44px; margin-top: auto; border: 1px solid color-mix(in srgb, var(--ui-primary) 52%, var(--ui-border)); border-radius: 12px; background: color-mix(in srgb, var(--ui-primary) 9%, transparent); color: var(--ui-primary); cursor: pointer; }
|
||||
.section-kicker { color: var(--ui-primary); font: 700 10px "v-mono", monospace; letter-spacing: .14em; }
|
||||
.fleet-summary { margin-bottom: 28px; padding: 16px 22px; display: flex; align-items: center; justify-content: space-between; gap: 30px; border: 1px solid var(--ui-border); border-radius: 16px; background: var(--ui-surface); }
|
||||
.fleet-summary-copy { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
|
||||
.fleet-summary-copy > strong { color: var(--ui-text); font: 24px "v-mono", monospace; }
|
||||
@@ -349,9 +253,8 @@ onMounted(() => {
|
||||
.focus-swap-leave-active { transition: opacity 120ms var(--ui-ease-out), transform 120ms var(--ui-ease-out); }
|
||||
.focus-swap-enter-from { opacity: 0; transform: translateY(10px) scale(.992); }
|
||||
.focus-swap-leave-to { opacity: 0; transform: translateY(-4px) scale(.996); }
|
||||
@keyframes connection-signal { from { opacity: 0; transform: translateX(0); } 12% { opacity: 1; } 88% { opacity: 1; } to { opacity: 0; transform: translateX(min(510px, 50vw)); } }
|
||||
@keyframes device-card-enter { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
|
||||
@media (prefers-reduced-motion: reduce) { .connection-path-line::after { animation: none; opacity: .7; } .device-status-grid :deep(.device-card) { animation: device-card-fade 160ms ease both; } .focus-swap-enter-from, .focus-swap-leave-to { transform: none; } @keyframes device-card-fade { from { opacity: 0; } to { opacity: 1; } } }
|
||||
@media (max-width: 1050px) { .connection-stage { grid-template-columns: minmax(0, 1fr) 240px; } .fleet-summary { align-items: stretch; flex-direction: column; } .fleet-metrics { width: 100%; } .fleet-metric:first-child { border-left: 0; } }
|
||||
@media (max-width: 760px) { .connection-stage { min-height: 0; grid-template-columns: minmax(0, 1fr); } .connection-stage-aside { padding: 12px 0 0; border-top: 1px solid var(--ui-border); border-left: 0; } .focus-open-button { margin-top: 18px; } .fleet-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fleet-metric:nth-child(3) { border-left: 0; } .fleet-metric { padding: 10px 12px; } .device-overview-toolbar { align-items: stretch; flex-direction: column; } .device-filter-controls { width: 100%; grid-template-columns: minmax(0, 1fr); } }
|
||||
@media (prefers-reduced-motion: reduce) { .device-status-grid :deep(.device-card) { animation: device-card-fade 160ms ease both; } .focus-swap-enter-from, .focus-swap-leave-to { transform: none; } @keyframes device-card-fade { from { opacity: 0; } to { opacity: 1; } } }
|
||||
@media (max-width: 1050px) { .fleet-summary { align-items: stretch; flex-direction: column; } .fleet-metrics { width: 100%; } .fleet-metric:first-child { border-left: 0; } }
|
||||
@media (max-width: 760px) { .fleet-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fleet-metric:nth-child(3) { border-left: 0; } .fleet-metric { padding: 10px 12px; } .device-overview-toolbar { align-items: stretch; flex-direction: column; } .device-filter-controls { width: 100%; grid-template-columns: minmax(0, 1fr); } }
|
||||
</style>
|
||||
@@ -2,6 +2,7 @@ import assert from 'node:assert/strict'
|
||||
import test from 'node:test'
|
||||
import type { DashboardDevice } from '../src/types/api.ts'
|
||||
import {
|
||||
canAnimateDashboardConnection,
|
||||
createDashboardDevicePresentation,
|
||||
formatDashboardNetworkType,
|
||||
formatDashboardSignal,
|
||||
@@ -70,16 +71,30 @@ test('uses explicit missing-value copy without mutating API data', () => {
|
||||
})
|
||||
|
||||
test('keeps offline state distinct from a failed or unknown VoWiFi stage', () => {
|
||||
const presentation = createDashboardDevicePresentation(createDevice({
|
||||
const device = createDevice({
|
||||
healthy: false,
|
||||
vowifi_active: true,
|
||||
vowifi_runtime: { sim_ready: false }
|
||||
}))
|
||||
})
|
||||
const presentation = createDashboardDevicePresentation(device)
|
||||
|
||||
assert.equal(presentation.statusLabel, '离线')
|
||||
assert.equal(presentation.connectionTitle, '设备离线')
|
||||
assert.equal(presentation.connectionState, '当前设备不可用')
|
||||
assert.deepEqual(presentation.stages.map(stage => stage.ready), [false, undefined, undefined, undefined, undefined])
|
||||
assert.equal(canAnimateDashboardConnection(device), false)
|
||||
})
|
||||
|
||||
test('animates the service path only for active VoWiFi without failed stages', () => {
|
||||
assert.equal(canAnimateDashboardConnection(createDevice({
|
||||
vowifi_active: true,
|
||||
vowifi_runtime: { sim_ready: true, access_ready: true }
|
||||
})), true)
|
||||
assert.equal(canAnimateDashboardConnection(createDevice({
|
||||
vowifi_active: true,
|
||||
vowifi_runtime: { tunnel_ready: false }
|
||||
})), false)
|
||||
assert.equal(canAnimateDashboardConnection(createDevice({ vowifi_active: false })), false)
|
||||
})
|
||||
|
||||
test('formats cellular connection and validates signal sentinels', () => {
|
||||
|
||||
Reference in new issue
Block a user