@7365admin1/layer-common 4.28.1-staging.359 → 4.29.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/CHANGELOG.md +22 -4
- package/assets/css/robot-hero.css +466 -0
- package/components/AccessCardAddForm.vue +4 -5
- package/components/AccessCardAssignToUnitForm.vue +2 -3
- package/components/AccessCardPreviewDialog.vue +3 -4
- package/components/Dialog/UpdateMoreAction.vue +1 -11
- package/components/DocumentForm.vue +112 -407
- package/components/DocumentManagement.vue +12 -213
- package/components/EntryPass/QrTemplatePreview.vue +25 -21
- package/components/EntryPassInformation.vue +24 -119
- package/components/Facility/BookingSetup.vue +0 -63
- package/components/HidAccessLogDashboard.vue +8 -41
- package/components/HidIntercomManagement.vue +14 -148
- package/components/HidReaderManagement.vue +0 -26
- package/components/HidReaderUserRoster.vue +3 -44
- package/components/HidUserEnrollment.vue +155 -845
- package/components/InvitationClientForm.vue +1 -19
- package/components/NotificationBell.vue +3 -39
- package/components/Robot/Battery.vue +18 -0
- package/components/Robot/CapabilityTag.vue +14 -0
- package/components/Robot/Card.vue +56 -0
- package/components/Robot/CommandBar.vue +47 -0
- package/components/Robot/CredentialField.vue +37 -0
- package/components/Robot/FaultBadge.vue +26 -0
- package/components/Robot/FloorLabel.vue +12 -0
- package/components/Robot/Hero.vue +32 -0
- package/components/Robot/LiftQueueRow.vue +28 -0
- package/components/Robot/MapToolbar.vue +53 -0
- package/components/Robot/NoMonitoring.vue +14 -0
- package/components/Robot/Reconnecting.vue +7 -0
- package/components/Robot/StatusChip.vue +15 -0
- package/components/Robot/SummaryCell.vue +64 -0
- package/components/Robot/SummaryStrip.vue +19 -0
- package/components/Robot/Table.vue +115 -0
- package/components/Robot/Toast.vue +27 -0
- package/components/Robot/ViewOnlyNotice.vue +3 -0
- package/components/RolePermissionFormCreate.vue +1 -78
- package/components/RolePermissionFormPreviewUpdate.vue +2 -83
- package/components/VehicleManagement.vue +10 -150
- package/components/VisitorManagement.vue +5 -267
- package/composables/useAccessManagement.ts +0 -5
- package/composables/useDocument.ts +0 -7
- package/composables/useFacility.ts +0 -11
- package/composables/useHidAmico.ts +0 -117
- package/composables/useHidNavigation.ts +1 -25
- package/composables/usePeople.ts +0 -19
- package/composables/useSiteEntryPassSettings.ts +0 -26
- package/composables/useWebUsb.ts +11 -14
- package/package.json +1 -1
- package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
- package/plugins/API.ts +2 -7
- package/plugins/vuetify.ts +8 -1
- package/types/document.d.ts +0 -14
- package/types/facility.d.ts +0 -4
- package/types/people.d.ts +1 -28
- package/types/vehicle.d.ts +0 -11
- package/utils/robot-display.ts +304 -0
- package/utils/theme.ts +152 -0
- package/components/HidAccessPermissions.vue +0 -424
- package/components/HidProfileQrCode.vue +0 -332
- package/composables/useHidReaderSelection.ts +0 -50
- package/composables/useSiteCategory.ts +0 -45
- package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +0 -23
- package/utils/hid-permission-assignments.ts +0 -190
- package/utils/hid-reader-selection.ts +0 -52
- package/utils/notification-target.ts +0 -75
- package/utils/occupancy-role.ts +0 -109
- package/utils/permission-refusal.ts +0 -40
|
@@ -388,27 +388,9 @@ watch(
|
|
|
388
388
|
const roles = ref<any[]>([])
|
|
389
389
|
const { getRoles } = useRole()
|
|
390
390
|
|
|
391
|
-
/*
|
|
392
|
-
* `type` is the ROLE type, not the service the client subscribes to, and the
|
|
393
|
-
* only caller (`ClientMain.vue` "Invite Client") passes no `app` prop -- so
|
|
394
|
-
* this sent `type: ""` and the endpoint applied no type filter at all. The
|
|
395
|
-
* dropdown therefore listed every org-less role of every type, which includes
|
|
396
|
-
* the platform's OWN staff roles (`type: "admin"` -- the two rows the console's
|
|
397
|
-
* `/super-admin/role-permissions` screen edits). Offering a Seven365 console
|
|
398
|
-
* staff role on a CLIENT invitation is the defect.
|
|
399
|
-
*
|
|
400
|
-
* A client admin's role is `type: "organization"`, which is what the client
|
|
401
|
-
* roles screen (`org/[organization]/roles-permissions.vue`) already lists. This
|
|
402
|
-
* narrows to exactly that. It is a narrowing of this one picker only: no role
|
|
403
|
-
* changes, no permission changes, and the org-less `organization` roles that
|
|
404
|
-
* were already being picked are all still offered.
|
|
405
|
-
*
|
|
406
|
-
* Keying off the selected service instead would empty the dropdown -- no
|
|
407
|
-
* org-less role carries a service type -- so `props.app` is not the filter.
|
|
408
|
-
*/
|
|
409
391
|
const { data: roleData, refresh: refreshRoles } = await useLazyAsyncData(
|
|
410
392
|
"roles",
|
|
411
|
-
() => getRoles({ org: org.value?._id, type:
|
|
393
|
+
() => getRoles({ org: org.value?._id, type: props.app, limit: 50 }),
|
|
412
394
|
{ watch: [() => props.app] }
|
|
413
395
|
)
|
|
414
396
|
|
|
@@ -134,7 +134,6 @@ import {
|
|
|
134
134
|
timeAgo,
|
|
135
135
|
type TInboxItem,
|
|
136
136
|
} from "../utils/notification-inbox";
|
|
137
|
-
import { notificationTarget } from "../utils/notification-target";
|
|
138
137
|
|
|
139
138
|
/**
|
|
140
139
|
* The top-bar notification feed for the web, in every signed-in app.
|
|
@@ -166,8 +165,6 @@ defineProps({
|
|
|
166
165
|
|
|
167
166
|
const { getAll, getUnreadCount, markAsRead, markAllAsRead } = useNotification();
|
|
168
167
|
const { currentUser } = useLocalAuth();
|
|
169
|
-
const route = useRoute();
|
|
170
|
-
const router = useRouter();
|
|
171
168
|
|
|
172
169
|
const open = ref(false);
|
|
173
170
|
const loading = ref(false);
|
|
@@ -272,49 +269,16 @@ function announce(fresh: TInboxItem[]) {
|
|
|
272
269
|
}
|
|
273
270
|
}
|
|
274
271
|
|
|
275
|
-
/**
|
|
276
|
-
* Clicking a row does two separate things, and the second one is why the row is
|
|
277
|
-
* a button at all: mark it read, and go to what it is about.
|
|
278
|
-
*
|
|
279
|
-
* They are kept apart deliberately. Marking read is best-effort and reverts on
|
|
280
|
-
* failure; navigation must not wait on that round trip, and must still happen
|
|
281
|
-
* for a row that was ALREADY read — a person re-opening the bell to find the
|
|
282
|
-
* order they were told about is the ordinary case, and the old early-return on
|
|
283
|
-
* `hasRead` would have sent them nowhere.
|
|
284
|
-
*/
|
|
285
272
|
async function openNotification(item: Record<string, any>) {
|
|
286
|
-
markRead(item);
|
|
287
|
-
await goToSubject(item);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
function markRead(item: Record<string, any>) {
|
|
291
273
|
if (item.hasRead) return;
|
|
292
274
|
// Marked locally first: waiting on a round trip to move the dot reads as a dead control.
|
|
293
275
|
item.hasRead = true;
|
|
294
276
|
unread.value = Math.max(0, unread.value - 1);
|
|
295
|
-
markAsRead(String(item._id), userId.value).catch(() => {
|
|
296
|
-
item.hasRead = false;
|
|
297
|
-
unread.value += 1;
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* `hasRoute` is the whole reason an org-app route name may live in the shared
|
|
303
|
-
* layer: the ten apps that have no order queue simply do not match it, and the
|
|
304
|
-
* click there stays what it always was.
|
|
305
|
-
*/
|
|
306
|
-
async function goToSubject(item: Record<string, any>) {
|
|
307
|
-
const target = notificationTarget(item as any, {
|
|
308
|
-
organization: String(route.params?.organization ?? ""),
|
|
309
|
-
});
|
|
310
|
-
if (!target) return;
|
|
311
|
-
if (typeof router.hasRoute !== "function" || !router.hasRoute(target.name)) return;
|
|
312
|
-
|
|
313
|
-
open.value = false;
|
|
314
277
|
try {
|
|
315
|
-
await
|
|
278
|
+
await markAsRead(String(item._id), userId.value);
|
|
316
279
|
} catch {
|
|
317
|
-
|
|
280
|
+
item.hasRead = false;
|
|
281
|
+
unread.value += 1;
|
|
318
282
|
}
|
|
319
283
|
}
|
|
320
284
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- No reading renders nothing - never "0%". -->
|
|
3
|
+
<span v-if="reading" class="hero-battery" role="img" :aria-label="`Battery ${reading.text}`">
|
|
4
|
+
<span class="hero-battery__case" aria-hidden="true">
|
|
5
|
+
<span class="hero-battery__fill d-block" :class="`hero-tone--${reading.tone}`" :style="{ width: `${reading.pct}%` }" />
|
|
6
|
+
</span>
|
|
7
|
+
<span aria-hidden="true">{{ reading.text }}</span>
|
|
8
|
+
</span>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import { computed } from "vue";
|
|
13
|
+
import { batteryReading } from "../../utils/robot-display";
|
|
14
|
+
|
|
15
|
+
/** `batteryPercent` from the robot's state; anything but a number renders nothing. */
|
|
16
|
+
const props = defineProps<{ value?: unknown }>();
|
|
17
|
+
const reading = computed(() => batteryReading(props.value));
|
|
18
|
+
</script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="hero-tag" :class="badge.variant === 'outline' ? 'hero-tag--outline' : 'hero-tag--neutral'">
|
|
3
|
+
<span :class="{ 'hero-tag--struck': badge.variant === 'struck' }">{{ badge.label }}</span>
|
|
4
|
+
</span>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { computed } from "vue";
|
|
9
|
+
import { capabilityBadge } from "../../utils/robot-display";
|
|
10
|
+
|
|
11
|
+
/** The brand's declared capabilities (`/robots/:id/state` or `/robots/brands`); the badge is their COMMAND level. */
|
|
12
|
+
const props = defineProps<{ capabilities?: Record<string, unknown> | null }>();
|
|
13
|
+
const badge = computed(() => capabilityBadge(props.capabilities));
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- The compact robot card (mobile-like lists, Needs attention). -->
|
|
3
|
+
<article
|
|
4
|
+
class="hero-card"
|
|
5
|
+
:class="{ 'hero-card--click': clickable }"
|
|
6
|
+
:tabindex="clickable ? 0 : undefined"
|
|
7
|
+
:role="clickable ? 'button' : undefined"
|
|
8
|
+
@click="clickable && emit('open')"
|
|
9
|
+
@keydown.enter="clickable && emit('open')"
|
|
10
|
+
>
|
|
11
|
+
<div>
|
|
12
|
+
<div class="hero-card__name">{{ name }}</div>
|
|
13
|
+
<div class="hero-card__sub">
|
|
14
|
+
<template v-if="brandName">{{ brandName }} · </template>
|
|
15
|
+
<RobotFloorLabel :floor-no="state?.floorNo" :floor-known="state?.floorKnown" />
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<RobotStatusChip :mode="state?.mode" :type="type" />
|
|
19
|
+
<div class="hero-card__row">
|
|
20
|
+
<RobotBattery :value="state?.batteryPercent" />
|
|
21
|
+
<RobotCapabilityTag v-if="capabilities !== undefined" :capabilities="capabilities" />
|
|
22
|
+
<RobotFaultBadge v-if="state?.fault" :code="state.fault.code" :message="state.fault.message" compact />
|
|
23
|
+
<span v-if="state?.online === false" class="hero-tag hero-tag--neutral">Offline</span>
|
|
24
|
+
<span v-if="lastSeen" class="hero-card__seen">{{ lastSeen }}</span>
|
|
25
|
+
</div>
|
|
26
|
+
</article>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
import RobotBattery from "./Battery.vue";
|
|
31
|
+
import RobotCapabilityTag from "./CapabilityTag.vue";
|
|
32
|
+
import RobotFaultBadge from "./FaultBadge.vue";
|
|
33
|
+
import RobotFloorLabel from "./FloorLabel.vue";
|
|
34
|
+
import RobotStatusChip from "./StatusChip.vue";
|
|
35
|
+
|
|
36
|
+
defineProps<{
|
|
37
|
+
name: string;
|
|
38
|
+
brandName?: string;
|
|
39
|
+
type?: string;
|
|
40
|
+
/** Brand's declared capabilities (null = none, "No interface"); omit to hide the capability badge. */
|
|
41
|
+
capabilities?: Record<string, unknown> | null;
|
|
42
|
+
/** The robot's live state (`/robots/:id/state`). */
|
|
43
|
+
state?: {
|
|
44
|
+
mode?: unknown;
|
|
45
|
+
online?: boolean;
|
|
46
|
+
batteryPercent?: unknown;
|
|
47
|
+
floorNo?: unknown;
|
|
48
|
+
floorKnown?: boolean;
|
|
49
|
+
fault?: { code?: string; message?: string } | null;
|
|
50
|
+
} | null;
|
|
51
|
+
/** Already formatted, e.g. "2 min ago". */
|
|
52
|
+
lastSeen?: string;
|
|
53
|
+
clickable?: boolean;
|
|
54
|
+
}>();
|
|
55
|
+
const emit = defineEmits<{ open: [] }>();
|
|
56
|
+
</script>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--
|
|
3
|
+
Only brand-declared commands, only for a Manager, only while online.
|
|
4
|
+
Anything else is HIDDEN, never greyed; with nothing to offer there is no bar.
|
|
5
|
+
-->
|
|
6
|
+
<div v-if="commands.length" class="hero-cmds" role="toolbar" aria-label="Robot commands">
|
|
7
|
+
<v-btn
|
|
8
|
+
v-for="c in commands"
|
|
9
|
+
:key="c.kind"
|
|
10
|
+
:variant="c.primary ? 'flat' : 'outlined'"
|
|
11
|
+
:color="c.primary ? 'primary' : undefined"
|
|
12
|
+
:loading="busy === c.kind"
|
|
13
|
+
:disabled="!!busy && busy !== c.kind"
|
|
14
|
+
@click="emit('command', c.kind)"
|
|
15
|
+
>
|
|
16
|
+
{{ c.label }}
|
|
17
|
+
</v-btn>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import { computed } from "vue";
|
|
23
|
+
import { visibleCommands, type TRobotCommandKind } from "../../utils/robot-display";
|
|
24
|
+
|
|
25
|
+
const props = defineProps<{
|
|
26
|
+
/** The brand's declared capabilities (`/robots/brands`). */
|
|
27
|
+
capabilities?: Record<string, unknown> | null;
|
|
28
|
+
/** Manager role - the app's command permission. */
|
|
29
|
+
canCommand?: boolean;
|
|
30
|
+
online?: boolean;
|
|
31
|
+
mode?: unknown;
|
|
32
|
+
type?: string;
|
|
33
|
+
/** The command in flight, if any. */
|
|
34
|
+
busy?: TRobotCommandKind | null;
|
|
35
|
+
}>();
|
|
36
|
+
const emit = defineEmits<{ command: [kind: TRobotCommandKind] }>();
|
|
37
|
+
|
|
38
|
+
const commands = computed(() =>
|
|
39
|
+
visibleCommands({
|
|
40
|
+
capabilities: props.capabilities,
|
|
41
|
+
canCommand: props.canCommand,
|
|
42
|
+
online: props.online,
|
|
43
|
+
mode: props.mode,
|
|
44
|
+
type: props.type,
|
|
45
|
+
}),
|
|
46
|
+
);
|
|
47
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--
|
|
3
|
+
Write-only. The stored value is never sent to the browser, so it is never
|
|
4
|
+
shown: once saved the field only says so. Typing replaces it on save.
|
|
5
|
+
-->
|
|
6
|
+
<div class="hero-field">
|
|
7
|
+
<label :for="id">{{ label }}</label>
|
|
8
|
+
<input
|
|
9
|
+
:id="id"
|
|
10
|
+
class="hero-input"
|
|
11
|
+
type="password"
|
|
12
|
+
autocomplete="new-password"
|
|
13
|
+
spellcheck="false"
|
|
14
|
+
:placeholder="credentialPlaceholder(saved)"
|
|
15
|
+
:value="modelValue"
|
|
16
|
+
@input="emit('update:modelValue', ($event.target as HTMLInputElement).value)"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup lang="ts">
|
|
22
|
+
import { useId } from "vue";
|
|
23
|
+
import { credentialPlaceholder } from "../../utils/robot-display";
|
|
24
|
+
|
|
25
|
+
withDefaults(
|
|
26
|
+
defineProps<{
|
|
27
|
+
label: string;
|
|
28
|
+
/** True once a value is stored server-side. */
|
|
29
|
+
saved?: boolean;
|
|
30
|
+
/** Only the NEW value being typed - never the stored one. */
|
|
31
|
+
modelValue?: string;
|
|
32
|
+
}>(),
|
|
33
|
+
{ saved: false, modelValue: "" },
|
|
34
|
+
);
|
|
35
|
+
const emit = defineEmits<{ "update:modelValue": [value: string] }>();
|
|
36
|
+
const id = useId();
|
|
37
|
+
</script>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span v-if="typeof count === 'number' && count > 0" class="hero-fault hero-fault--count">
|
|
3
|
+
{{ count }} {{ count === 1 ? "fault" : "faults" }}
|
|
4
|
+
</span>
|
|
5
|
+
<span
|
|
6
|
+
v-else-if="code || message"
|
|
7
|
+
class="hero-fault"
|
|
8
|
+
:class="{ 'hero-fault--compact': compact }"
|
|
9
|
+
:title="compact ? message : undefined"
|
|
10
|
+
>
|
|
11
|
+
{{ code || message }}
|
|
12
|
+
<span v-if="!compact && code && message" class="hero-fault__msg">{{ message }}</span>
|
|
13
|
+
</span>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
defineProps<{
|
|
18
|
+
/** The robot's fault code, e.g. E-204. */
|
|
19
|
+
code?: string;
|
|
20
|
+
message?: string;
|
|
21
|
+
/** A count instead of one fault ("3 faults"). */
|
|
22
|
+
count?: number;
|
|
23
|
+
/** Code only - for table cells and cards. */
|
|
24
|
+
compact?: boolean;
|
|
25
|
+
}>();
|
|
26
|
+
</script>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span :class="{ 'hero-floor--unknown': unknown }">{{ label }}</span>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import { computed } from "vue";
|
|
7
|
+
import { floorLabel } from "../../utils/robot-display";
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{ floorNo?: unknown; floorKnown?: boolean }>();
|
|
10
|
+
const label = computed(() => floorLabel({ floorNo: props.floorNo, floorKnown: props.floorKnown }));
|
|
11
|
+
const unknown = computed(() => label.value === "Floor unknown");
|
|
12
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--
|
|
3
|
+
The HERO scope. Everything inside draws in the robot fleet's look
|
|
4
|
+
(Archivo, square corners, red accent); nothing outside changes. The theme
|
|
5
|
+
follows the app's own light/dark setting.
|
|
6
|
+
-->
|
|
7
|
+
<v-theme-provider :theme="themeName" with-background class="hero">
|
|
8
|
+
<slot />
|
|
9
|
+
</v-theme-provider>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import { computed, onMounted } from "vue";
|
|
14
|
+
import { useTheme } from "vuetify";
|
|
15
|
+
import { heroThemeName } from "../../utils/robot-display";
|
|
16
|
+
import "../../assets/css/robot-hero.css";
|
|
17
|
+
|
|
18
|
+
const theme = useTheme();
|
|
19
|
+
const themeName = computed(() => heroThemeName(theme.current.value.dark));
|
|
20
|
+
|
|
21
|
+
// Archivo is requested the first time a HERO scope mounts, so the rest of the
|
|
22
|
+
// product never downloads it (Manrope stays in nuxt.config for everything else).
|
|
23
|
+
const FONT_ID = "hero-archivo-font";
|
|
24
|
+
onMounted(() => {
|
|
25
|
+
if (document.getElementById(FONT_ID)) return;
|
|
26
|
+
const link = document.createElement("link");
|
|
27
|
+
link.id = FONT_ID;
|
|
28
|
+
link.rel = "stylesheet";
|
|
29
|
+
link.href = "https://fonts.googleapis.com/css2?family=Archivo:wght@400;600;800&display=swap";
|
|
30
|
+
document.head.appendChild(link);
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="hero-lift-row">
|
|
3
|
+
<span class="hero-lift-row__n">{{ n }}</span>
|
|
4
|
+
<div>
|
|
5
|
+
<b>{{ robot }}</b><span class="hero-lift-row__route"> · {{ from }} → {{ to }}</span>
|
|
6
|
+
</div>
|
|
7
|
+
<span class="hero-lift-row__wait">{{ wait }}</span>
|
|
8
|
+
<span class="hero-chip" :class="`hero-tone--${ls.tone}`">{{ ls.label }}</span>
|
|
9
|
+
<span v-if="ls.stripe !== 'none'" class="hero-lift-row__stripe" :class="`hero-lift-row__stripe--${ls.stripe}`" aria-hidden="true" />
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { computed } from "vue";
|
|
15
|
+
import { liftState } from "../../utils/robot-display";
|
|
16
|
+
|
|
17
|
+
const props = defineProps<{
|
|
18
|
+
n: number | string;
|
|
19
|
+
robot: string;
|
|
20
|
+
from: string;
|
|
21
|
+
to: string;
|
|
22
|
+
/** Already formatted: "24 s", "on board", "done". */
|
|
23
|
+
wait?: string;
|
|
24
|
+
/** requested · riding · released · timed out */
|
|
25
|
+
state: string;
|
|
26
|
+
}>();
|
|
27
|
+
const ls = computed(() => liftState(props.state));
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="hero-maptools">
|
|
3
|
+
<div class="hero-seg" role="toolbar" aria-label="Map editor tools">
|
|
4
|
+
<button
|
|
5
|
+
v-for="t in MAP_TOOLS"
|
|
6
|
+
:key="t.id"
|
|
7
|
+
type="button"
|
|
8
|
+
class="hero-seg__opt"
|
|
9
|
+
:aria-pressed="modelValue === t.id"
|
|
10
|
+
@click="emit('update:modelValue', t.id)"
|
|
11
|
+
>
|
|
12
|
+
{{ t.label }}
|
|
13
|
+
</button>
|
|
14
|
+
<button type="button" class="hero-seg__opt hero-seg__opt--gap" :disabled="!canUndo" @click="emit('undo')">
|
|
15
|
+
Undo ⌃Z
|
|
16
|
+
</button>
|
|
17
|
+
<button type="button" class="hero-seg__opt hero-seg__opt--save" :disabled="saving" @click="emit('save')">
|
|
18
|
+
Save
|
|
19
|
+
</button>
|
|
20
|
+
</div>
|
|
21
|
+
<div v-if="modelValue === 'zone'" class="hero-field">
|
|
22
|
+
<input
|
|
23
|
+
class="hero-input"
|
|
24
|
+
style="width: 180px"
|
|
25
|
+
aria-label="Zone name"
|
|
26
|
+
placeholder="Zone name"
|
|
27
|
+
:value="zoneName"
|
|
28
|
+
@input="emit('update:zoneName', ($event.target as HTMLInputElement).value)"
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script setup lang="ts">
|
|
35
|
+
import { MAP_TOOLS } from "../../utils/robot-display";
|
|
36
|
+
|
|
37
|
+
withDefaults(
|
|
38
|
+
defineProps<{
|
|
39
|
+
/** The active tool id: wall · zone · door · lift · move · delete. */
|
|
40
|
+
modelValue?: string;
|
|
41
|
+
zoneName?: string;
|
|
42
|
+
canUndo?: boolean;
|
|
43
|
+
saving?: boolean;
|
|
44
|
+
}>(),
|
|
45
|
+
{ modelValue: "wall", zoneName: "", canUndo: true, saving: false },
|
|
46
|
+
);
|
|
47
|
+
const emit = defineEmits<{
|
|
48
|
+
"update:modelValue": [tool: string];
|
|
49
|
+
"update:zoneName": [name: string];
|
|
50
|
+
undo: [];
|
|
51
|
+
save: [];
|
|
52
|
+
}>();
|
|
53
|
+
</script>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- A no-interface brand: listed with its details, no live status, no controls. -->
|
|
3
|
+
<div class="hero-notice hero-notice--panel" role="note">
|
|
4
|
+
<div class="hero-notice__title">Monitoring not available for this model</div>
|
|
5
|
+
<div class="hero-notice__body">
|
|
6
|
+
<template v-if="brandName">{{ brandName }}<template v-if="model"> · {{ model }}</template> has no interface yet. </template>
|
|
7
|
+
Details are listed; live status and commands will appear when the brand integration ships.
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
defineProps<{ brandName?: string; model?: string }>();
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="hero-chip" :class="`hero-tone--${status.tone}`">
|
|
3
|
+
<span class="hero-chip__dot" :class="{ 'hero-chip__dot--blink': status.blink }" aria-hidden="true" />
|
|
4
|
+
{{ status.label }}
|
|
5
|
+
</span>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { computed } from "vue";
|
|
10
|
+
import { robotStatus } from "../../utils/robot-display";
|
|
11
|
+
|
|
12
|
+
/** `mode` is the API's state mode; `type` "security" turns Working into Patrolling. */
|
|
13
|
+
const props = defineProps<{ mode?: unknown; type?: string }>();
|
|
14
|
+
const status = computed(() => robotStatus(props.mode, props.type));
|
|
15
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="hero-cell" :class="{ 'hero-cell--alert': alert }">
|
|
3
|
+
<span class="hero-cell__corner hero-cell__corner--tl" aria-hidden="true" />
|
|
4
|
+
<span class="hero-cell__corner hero-cell__corner--br" aria-hidden="true" />
|
|
5
|
+
<div class="hero-cell__label"><span class="hero-cell__square" aria-hidden="true" />{{ label }}</div>
|
|
6
|
+
<div class="hero-cell__value" :aria-label="`${label}: ${value}`">{{ shown }}</div>
|
|
7
|
+
<div class="hero-cell__ticks" aria-hidden="true">
|
|
8
|
+
<span
|
|
9
|
+
v-for="i in 20"
|
|
10
|
+
:key="i"
|
|
11
|
+
class="hero-cell__tick"
|
|
12
|
+
:class="{ 'hero-cell__tick--on': i <= filled, 'hero-cell__tick--shown': i <= filled && progress >= i / 20 }"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
<div v-if="split" class="hero-cell__split">{{ split }}</div>
|
|
16
|
+
<span class="hero-cell__shimmer" aria-hidden="true" />
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
22
|
+
import { countUpValue, summaryAlert, summaryTicks } from "../../utils/robot-display";
|
|
23
|
+
|
|
24
|
+
const props = withDefaults(
|
|
25
|
+
defineProps<{
|
|
26
|
+
label: string;
|
|
27
|
+
value: number;
|
|
28
|
+
/** What the tick bar is a ratio of. */
|
|
29
|
+
total?: number;
|
|
30
|
+
/** "faults" / "offline" turn accent when above zero. */
|
|
31
|
+
kind?: string;
|
|
32
|
+
split?: string;
|
|
33
|
+
duration?: number;
|
|
34
|
+
}>(),
|
|
35
|
+
{ total: 0, kind: "", split: "", duration: 900 },
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const filled = computed(() => summaryTicks(props.value, props.total));
|
|
39
|
+
const alert = computed(() => summaryAlert(props.kind, props.value));
|
|
40
|
+
|
|
41
|
+
// The count-up and the tick reveal share one clock.
|
|
42
|
+
const elapsed = ref(0);
|
|
43
|
+
const shown = computed(() => countUpValue(props.value, elapsed.value, props.duration));
|
|
44
|
+
const progress = computed(() => Math.min(1, elapsed.value / props.duration));
|
|
45
|
+
|
|
46
|
+
let frame = 0;
|
|
47
|
+
function run() {
|
|
48
|
+
cancelAnimationFrame(frame);
|
|
49
|
+
if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) {
|
|
50
|
+
elapsed.value = props.duration;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const start = performance.now();
|
|
54
|
+
elapsed.value = 0;
|
|
55
|
+
const step = (now: number) => {
|
|
56
|
+
elapsed.value = now - start;
|
|
57
|
+
if (elapsed.value < props.duration) frame = requestAnimationFrame(step);
|
|
58
|
+
};
|
|
59
|
+
frame = requestAnimationFrame(step);
|
|
60
|
+
}
|
|
61
|
+
onMounted(run);
|
|
62
|
+
watch(() => props.value, run);
|
|
63
|
+
onBeforeUnmount(() => cancelAnimationFrame(frame));
|
|
64
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="hero-summary" role="group" :aria-label="label">
|
|
3
|
+
<slot>
|
|
4
|
+
<RobotSummaryCell v-for="c in cells" :key="c.label" v-bind="c" />
|
|
5
|
+
</slot>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import RobotSummaryCell from "./SummaryCell.vue";
|
|
11
|
+
|
|
12
|
+
withDefaults(
|
|
13
|
+
defineProps<{
|
|
14
|
+
cells?: Array<{ label: string; value: number; total?: number; kind?: string; split?: string }>;
|
|
15
|
+
label?: string;
|
|
16
|
+
}>(),
|
|
17
|
+
{ cells: () => [], label: "Fleet summary" },
|
|
18
|
+
);
|
|
19
|
+
</script>
|