@7365admin1/layer-common 4.22.0 → 4.22.1-staging.353
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 +4 -4
- package/components/AccessCardAddForm.vue +5 -4
- package/components/AccessCardAssignToUnitForm.vue +3 -2
- package/components/AccessCardPreviewDialog.vue +4 -3
- package/components/Dialog/UpdateMoreAction.vue +11 -1
- package/components/DocumentForm.vue +407 -112
- package/components/DocumentManagement.vue +213 -12
- package/components/EntryPass/QrTemplatePreview.vue +21 -25
- package/components/EntryPassInformation.vue +119 -24
- package/components/Facility/BookingSetup.vue +63 -0
- package/components/HidAccessLogDashboard.vue +29 -5
- package/components/HidAccessPermissions.vue +424 -0
- package/components/HidIntercomManagement.vue +148 -14
- package/components/HidProfileQrCode.vue +323 -0
- package/components/HidReaderManagement.vue +26 -0
- package/components/HidReaderUserRoster.vue +32 -2
- package/components/HidUserEnrollment.vue +833 -152
- package/components/InvitationClientForm.vue +19 -1
- package/components/Robot/Fleet.vue +712 -0
- package/components/Robot/Form.vue +256 -0
- package/components/Robot/Map3D.vue +1145 -0
- package/components/Robot/Plans.vue +63 -0
- package/components/Robot/SpotClean.vue +174 -0
- package/components/VisitorManagement.vue +267 -5
- package/composables/useAccessManagement.ts +5 -0
- package/composables/useDocument.ts +7 -0
- package/composables/useFacility.ts +11 -0
- package/composables/useHidAmico.ts +117 -0
- package/composables/useHidNavigation.ts +25 -1
- package/composables/usePeople.ts +19 -0
- package/composables/useRobots.ts +324 -0
- package/composables/useSiteCategory.ts +45 -0
- package/composables/useSiteEntryPassSettings.ts +26 -0
- package/composables/useWebUsb.ts +14 -11
- package/package.json +2 -2
- 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-qr-code/index.vue +23 -0
- package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
- package/types/document.d.ts +14 -0
- package/types/facility.d.ts +4 -0
- package/types/people.d.ts +28 -1
- package/utils/building-map.ts +537 -0
- package/utils/hid-permission-assignments.ts +190 -0
- package/utils/occupancy-role.ts +109 -0
- package/utils/robot-display.ts +212 -0
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-card width="100%">
|
|
3
|
+
<v-toolbar density="comfortable" class="pl-4 py-2">
|
|
4
|
+
<span class="font-weight-medium text-h6">
|
|
5
|
+
{{ editing ? `Edit ${robot?.name ?? "robot"}` : `Add ${typeLabel} robot` }}
|
|
6
|
+
</span>
|
|
7
|
+
</v-toolbar>
|
|
8
|
+
|
|
9
|
+
<v-card-text class="pa-0" style="max-height: 70vh; overflow-y: auto">
|
|
10
|
+
<v-form ref="form" @submit.prevent="submit">
|
|
11
|
+
<v-row no-gutters class="px-6 pt-4">
|
|
12
|
+
<v-col cols="12" class="mb-2">
|
|
13
|
+
<p v-if="editing" class="text-body-2 text-medium-emphasis">
|
|
14
|
+
Rename the robot or set its serial. To change its brand or its app
|
|
15
|
+
key and token, remove the robot and add it again.
|
|
16
|
+
</p>
|
|
17
|
+
<p v-else class="text-body-2 text-medium-emphasis">
|
|
18
|
+
The app key and token come from your robot supplier. They are used
|
|
19
|
+
to talk to the robot and are never shown again once saved.
|
|
20
|
+
</p>
|
|
21
|
+
</v-col>
|
|
22
|
+
|
|
23
|
+
<v-col cols="12">
|
|
24
|
+
<InputLabel class="font-weight-bold" title="Name" required />
|
|
25
|
+
<v-text-field
|
|
26
|
+
v-model="name"
|
|
27
|
+
density="comfortable"
|
|
28
|
+
placeholder="e.g. Cleaner 02"
|
|
29
|
+
:rules="[requiredRule]"
|
|
30
|
+
:disabled="saving"
|
|
31
|
+
/>
|
|
32
|
+
</v-col>
|
|
33
|
+
|
|
34
|
+
<v-col v-if="!editing" cols="12">
|
|
35
|
+
<InputLabel class="font-weight-bold" title="Brand" required />
|
|
36
|
+
<AppSelect
|
|
37
|
+
v-model="brand"
|
|
38
|
+
:items="brands"
|
|
39
|
+
item-title="label"
|
|
40
|
+
item-value="brand"
|
|
41
|
+
density="comfortable"
|
|
42
|
+
:loading="loadingBrands"
|
|
43
|
+
:rules="[requiredRule]"
|
|
44
|
+
:disabled="saving"
|
|
45
|
+
/>
|
|
46
|
+
<p class="text-caption text-medium-emphasis mt-n3 mb-2">
|
|
47
|
+
{{ brandHint }}
|
|
48
|
+
</p>
|
|
49
|
+
</v-col>
|
|
50
|
+
|
|
51
|
+
<v-col v-if="!editing" cols="12">
|
|
52
|
+
<InputLabel class="font-weight-bold" title="App key" required />
|
|
53
|
+
<v-text-field
|
|
54
|
+
v-model="appKey"
|
|
55
|
+
density="comfortable"
|
|
56
|
+
autocomplete="off"
|
|
57
|
+
:rules="[requiredRule]"
|
|
58
|
+
:disabled="saving"
|
|
59
|
+
/>
|
|
60
|
+
</v-col>
|
|
61
|
+
|
|
62
|
+
<v-col v-if="!editing" cols="12">
|
|
63
|
+
<InputLabel class="font-weight-bold" title="App token" required />
|
|
64
|
+
<!--
|
|
65
|
+
Masked like a password because that is what it is: this token signs
|
|
66
|
+
every command sent to the estate's robots. It is never returned by
|
|
67
|
+
any read, so it cannot be recovered from the screen later either.
|
|
68
|
+
-->
|
|
69
|
+
<v-text-field
|
|
70
|
+
v-model="appToken"
|
|
71
|
+
density="comfortable"
|
|
72
|
+
autocomplete="off"
|
|
73
|
+
:type="reveal ? 'text' : 'password'"
|
|
74
|
+
:append-inner-icon="reveal ? 'mdi-eye-off-outline' : 'mdi-eye-outline'"
|
|
75
|
+
:rules="[requiredRule]"
|
|
76
|
+
:disabled="saving"
|
|
77
|
+
@click:append-inner="reveal = !reveal"
|
|
78
|
+
/>
|
|
79
|
+
</v-col>
|
|
80
|
+
|
|
81
|
+
<v-col cols="12">
|
|
82
|
+
<InputLabel class="font-weight-bold" title="Serial number" />
|
|
83
|
+
<v-text-field
|
|
84
|
+
v-model="robotSn"
|
|
85
|
+
density="comfortable"
|
|
86
|
+
placeholder="Optional — found automatically if left blank"
|
|
87
|
+
:disabled="saving"
|
|
88
|
+
/>
|
|
89
|
+
<p class="text-caption text-medium-emphasis mt-n3 mb-2">
|
|
90
|
+
Leave this blank unless the same key covers more than one robot.
|
|
91
|
+
</p>
|
|
92
|
+
</v-col>
|
|
93
|
+
|
|
94
|
+
<v-col cols="12" v-if="error">
|
|
95
|
+
<v-alert type="error" variant="tonal" class="mb-3" :text="error" />
|
|
96
|
+
</v-col>
|
|
97
|
+
</v-row>
|
|
98
|
+
</v-form>
|
|
99
|
+
</v-card-text>
|
|
100
|
+
|
|
101
|
+
<v-toolbar density="compact">
|
|
102
|
+
<v-row no-gutters>
|
|
103
|
+
<v-col cols="6">
|
|
104
|
+
<v-btn
|
|
105
|
+
tile block variant="flat" size="48"
|
|
106
|
+
class="text-none" color="#EFEFEF"
|
|
107
|
+
:disabled="saving"
|
|
108
|
+
@click="$emit('cancel')"
|
|
109
|
+
>
|
|
110
|
+
Close
|
|
111
|
+
</v-btn>
|
|
112
|
+
</v-col>
|
|
113
|
+
<v-col cols="6">
|
|
114
|
+
<v-btn
|
|
115
|
+
tile block variant="flat" size="48"
|
|
116
|
+
class="text-none" color="primary"
|
|
117
|
+
:loading="saving"
|
|
118
|
+
@click="submit"
|
|
119
|
+
>
|
|
120
|
+
{{ editing ? "Save" : "Add robot" }}
|
|
121
|
+
</v-btn>
|
|
122
|
+
</v-col>
|
|
123
|
+
</v-row>
|
|
124
|
+
</v-toolbar>
|
|
125
|
+
</v-card>
|
|
126
|
+
</template>
|
|
127
|
+
|
|
128
|
+
<script lang="ts" setup>
|
|
129
|
+
/**
|
|
130
|
+
* Register a robot against a site.
|
|
131
|
+
*
|
|
132
|
+
* The credential pair travels up once and is never returned by any read, so
|
|
133
|
+
* there is deliberately no edit-credentials path here: a wrong key is fixed by
|
|
134
|
+
* removing the robot and adding it again, which is honest about the fact that
|
|
135
|
+
* the old value is gone.
|
|
136
|
+
*
|
|
137
|
+
* The serial is optional because the supplier's Add-Robot flow has never asked
|
|
138
|
+
* for one. When it is blank the server finds it from the robot cloud — and
|
|
139
|
+
* refuses rather than guessing if the key covers more than one machine, which is
|
|
140
|
+
* exactly when the person filling this in should type it themselves.
|
|
141
|
+
*/
|
|
142
|
+
import { robotErrorMessage } from "../../utils/robot-display";
|
|
143
|
+
|
|
144
|
+
const props = withDefaults(
|
|
145
|
+
defineProps<{
|
|
146
|
+
organization: string;
|
|
147
|
+
site: string;
|
|
148
|
+
type?: "cleaning" | "security";
|
|
149
|
+
/** When given, the form edits this robot instead of adding one. */
|
|
150
|
+
robot?: Record<string, any> | null;
|
|
151
|
+
}>(),
|
|
152
|
+
{ type: "cleaning", robot: null },
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
const emit = defineEmits<{ cancel: []; created: []; saved: [] }>();
|
|
156
|
+
|
|
157
|
+
const { createRobot, updateRobot, getRobotBrands } = useRobots();
|
|
158
|
+
const editing = computed(() => !!props.robot?._id);
|
|
159
|
+
const { requiredRule } = useUtils();
|
|
160
|
+
|
|
161
|
+
const form = ref();
|
|
162
|
+
const name = ref(props.robot?.name ?? "");
|
|
163
|
+
const brand = ref("");
|
|
164
|
+
const brands = ref<Array<Record<string, any>>>([]);
|
|
165
|
+
const loadingBrands = ref(false);
|
|
166
|
+
const appKey = ref("");
|
|
167
|
+
const appToken = ref("");
|
|
168
|
+
const robotSn = ref(props.robot?.robotSn ?? "");
|
|
169
|
+
const reveal = ref(false);
|
|
170
|
+
const saving = ref(false);
|
|
171
|
+
const error = ref("");
|
|
172
|
+
|
|
173
|
+
const typeLabel = computed(() => (props.type === "security" ? "security" : "cleaning"));
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* What each brand's protocol will actually allow, in plain words.
|
|
177
|
+
*
|
|
178
|
+
* The tier comes from Open-RMF's published categories, so this is not a Seven365
|
|
179
|
+
* opinion - and somebody choosing a brand should know before they commit that
|
|
180
|
+
* one of them cannot be paused or told where to go.
|
|
181
|
+
*/
|
|
182
|
+
const TIER_HINT: Record<string, string> = {
|
|
183
|
+
"full-control": "Full control — position, battery, navigation, pause and resume.",
|
|
184
|
+
"traffic-light": "Position, battery, and pause/resume. No navigation to a point.",
|
|
185
|
+
"read-only": "Position only. This brand cannot be given jobs through its API.",
|
|
186
|
+
"no-interface":
|
|
187
|
+
"Limited: the published API does not yet report battery or progress. Cleaning and return-to-dock work.",
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const brandHint = computed(() => {
|
|
191
|
+
const chosen = brands.value.find((b) => b.brand === brand.value);
|
|
192
|
+
return chosen ? TIER_HINT[chosen.tier] ?? "" : "Which robot this is. Ask your supplier if unsure.";
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
async function loadBrands() {
|
|
196
|
+
loadingBrands.value = true;
|
|
197
|
+
try {
|
|
198
|
+
const res = await getRobotBrands();
|
|
199
|
+
brands.value = (res?.items ?? []).map((b: any) => ({
|
|
200
|
+
...b,
|
|
201
|
+
label: b.displayName ?? b.brand,
|
|
202
|
+
}));
|
|
203
|
+
// Only preselect when there is no choice to make. Guessing a brand is how a
|
|
204
|
+
// robot ends up being sent commands in a protocol it does not speak.
|
|
205
|
+
if (brands.value.length === 1) brand.value = brands.value[0].brand;
|
|
206
|
+
} catch {
|
|
207
|
+
brands.value = [];
|
|
208
|
+
} finally {
|
|
209
|
+
loadingBrands.value = false;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
onMounted(() => {
|
|
214
|
+
if (!editing.value) loadBrands();
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
async function submit() {
|
|
218
|
+
const { valid } = await form.value?.validate?.() ?? { valid: false };
|
|
219
|
+
if (!valid) return;
|
|
220
|
+
|
|
221
|
+
saving.value = true;
|
|
222
|
+
error.value = "";
|
|
223
|
+
if (editing.value) {
|
|
224
|
+
try {
|
|
225
|
+
await updateRobot(props.robot!._id, {
|
|
226
|
+
name: name.value.trim(),
|
|
227
|
+
robotSn: robotSn.value.trim(),
|
|
228
|
+
});
|
|
229
|
+
emit("saved");
|
|
230
|
+
} catch (e) {
|
|
231
|
+
error.value = robotErrorMessage(e, "Could not save the robot.");
|
|
232
|
+
} finally {
|
|
233
|
+
saving.value = false;
|
|
234
|
+
}
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
try {
|
|
238
|
+
await createRobot({
|
|
239
|
+
name: name.value.trim(),
|
|
240
|
+
brand: brand.value,
|
|
241
|
+
appKey: appKey.value.trim(),
|
|
242
|
+
appToken: appToken.value.trim(),
|
|
243
|
+
type: props.type,
|
|
244
|
+
// Sent only when the person typed one; an empty string would otherwise be
|
|
245
|
+
// stored and stop the server ever discovering the real serial.
|
|
246
|
+
...(robotSn.value.trim() ? { robotSn: robotSn.value.trim() } : {}),
|
|
247
|
+
metadata: { orgId: props.organization, siteId: props.site },
|
|
248
|
+
});
|
|
249
|
+
emit("created");
|
|
250
|
+
} catch (e) {
|
|
251
|
+
error.value = robotErrorMessage(e, "Could not add the robot.");
|
|
252
|
+
} finally {
|
|
253
|
+
saving.value = false;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
</script>
|