@7365admin1/layer-common 4.97.1-staging.635 → 4.97.1-staging.637
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.
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
<CctvEngineHowTo
|
|
9
9
|
id="alerts"
|
|
10
10
|
:steps="[
|
|
11
|
-
'
|
|
11
|
+
'Turn on Send phone notifications. Leave the roles empty to tell everyone who can see CCTV events at this site, or choose roles to tell only them.',
|
|
12
12
|
'Optional: type the objects that matter (e.g. person, car, rubbish) so not everything alerts. Empty means every object.',
|
|
13
13
|
'Optional: limit to zones or cameras, and set quiet hours. Then press Save alert settings.',
|
|
14
14
|
]"
|
|
15
|
-
results="Alerts appear in Events marked Alert
|
|
15
|
+
results="Alerts appear in Events marked Alert. With Send phone notifications on, people also get a notification with the picture."
|
|
16
16
|
results-section="events"
|
|
17
17
|
:results-query="{ severity: 'alert' }"
|
|
18
18
|
/>
|
|
@@ -34,18 +34,18 @@
|
|
|
34
34
|
:items="roles"
|
|
35
35
|
item-title="name"
|
|
36
36
|
item-value="_id"
|
|
37
|
-
label="
|
|
37
|
+
label="Only notify these roles (optional)"
|
|
38
38
|
multiple
|
|
39
39
|
chips
|
|
40
40
|
closable-chips
|
|
41
41
|
density="comfortable"
|
|
42
42
|
class="mt-3"
|
|
43
43
|
:loading="rolesLoading"
|
|
44
|
-
:hint="rolesProblem || '
|
|
44
|
+
:hint="rolesProblem || 'Empty = everyone who can see CCTV events at this site. Notifications are only sent when Send phone notifications is on.'"
|
|
45
45
|
persistent-hint
|
|
46
46
|
/>
|
|
47
47
|
|
|
48
|
-
<v-switch v-model="form.notifyGuards" color="primary" label="
|
|
48
|
+
<v-switch v-model="form.notifyGuards" color="primary" label="Send phone notifications (with the picture)" hide-details class="mt-2" />
|
|
49
49
|
<v-switch v-model="form.createIncident" color="primary" label="Create an incident report for each alert" hide-details />
|
|
50
50
|
|
|
51
51
|
<v-switch v-model="quiet" color="primary" label="Quiet hours (no notifications between these times)" hide-details />
|
|
@@ -133,7 +133,7 @@ async function save() {
|
|
|
133
133
|
notifyGuards: form.notifyGuards,
|
|
134
134
|
quietHours: quiet.value ? { start: form.quietStart, end: form.quietEnd } : null,
|
|
135
135
|
});
|
|
136
|
-
msg.value = "Saved.
|
|
136
|
+
msg.value = form.notifyGuards ? "Saved. Alerts appear in Events marked Alert, and a phone notification with the picture is sent." : "Saved. Alerts appear in Events marked Alert. Phone notifications are off.";
|
|
137
137
|
} catch (e) {
|
|
138
138
|
saveError.value = e;
|
|
139
139
|
} finally {
|
|
@@ -4,9 +4,14 @@
|
|
|
4
4
|
Offline engine / failures are shown on the tile in plain words with a Try again button.
|
|
5
5
|
-->
|
|
6
6
|
<template>
|
|
7
|
-
<div
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
<div
|
|
8
|
+
class="cctv-tile"
|
|
9
|
+
:class="{ 'cctv-tile--big': big, 'cctv-tile--natural': natural }"
|
|
10
|
+
:style="shape && !natural ? { aspectRatio: shape } : undefined"
|
|
11
|
+
data-test="cctv-tile"
|
|
12
|
+
>
|
|
13
|
+
<video v-show="mode === 'live'" ref="video" autoplay muted playsinline class="cctv-tile__media" @loadedmetadata="fit($event)" @resize="fit($event)" />
|
|
14
|
+
<img v-if="mode === 'still' && still" :src="still" :alt="`Latest picture from ${camera}`" class="cctv-tile__media" @load="fit($event)" />
|
|
10
15
|
|
|
11
16
|
<div v-if="mode === 'connecting'" class="cctv-tile__msg" role="status">
|
|
12
17
|
<v-progress-circular indeterminate size="22" /> <span>Connecting to {{ camera }}...</span>
|
|
@@ -47,6 +52,15 @@ const still = ref("");
|
|
|
47
52
|
const failure = ref<unknown>(null);
|
|
48
53
|
const video = ref<HTMLVideoElement | null>(null);
|
|
49
54
|
const notice = computed(() => cctvNotice(failure.value));
|
|
55
|
+
// The box takes the camera's own shape once the first picture arrives (many recorders send 4:3 or 704x480),
|
|
56
|
+
// so the picture fills it instead of sitting between black bars; 16:9 until then.
|
|
57
|
+
const shape = ref<string | null>(null);
|
|
58
|
+
function fit(e: Event) {
|
|
59
|
+
const el = e.target as HTMLVideoElement & HTMLImageElement;
|
|
60
|
+
const w = el.videoWidth || el.naturalWidth;
|
|
61
|
+
const h = el.videoHeight || el.naturalHeight;
|
|
62
|
+
if (w > 0 && h > 0) shape.value = `${w} / ${h}`;
|
|
63
|
+
}
|
|
50
64
|
|
|
51
65
|
let pc: RTCPeerConnection | null = null;
|
|
52
66
|
let timer: ReturnType<typeof setTimeout> | null = null;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.97.1-staging.
|
|
5
|
+
"version": "4.97.1-staging.637",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
package/utils/cctv-engine.ts
CHANGED
|
@@ -523,10 +523,11 @@ export function setupSteps(input: {
|
|
|
523
523
|
|
|
524
524
|
if (input.can(CCTV_PERMISSIONS.manageAlerts)) {
|
|
525
525
|
const a = input.alertSettings;
|
|
526
|
+
// Server rule (core onAlert / NotificationService.cctvAlert): the `notifyGuards` switch turns phone notifications on;
|
|
527
|
+
// they go to everyone at the site holding cctv-engine:view-events, or only to `notifyRoles` when some are chosen.
|
|
526
528
|
const roles = a?.notifyRoles?.length ?? 0;
|
|
527
|
-
const
|
|
528
|
-
const
|
|
529
|
-
const who = [roles ? plural(roles, "role", "roles") : "", guards ? "guards on duty" : ""].filter(Boolean).join(" and ");
|
|
529
|
+
const told = a?.notifyGuards === true;
|
|
530
|
+
const who = roles ? `People in ${plural(roles, "role", "roles")}` : "Everyone who can see CCTV events";
|
|
530
531
|
const every = told && !(a?.labels ?? []).length;
|
|
531
532
|
steps.push({
|
|
532
533
|
key: "alerts",
|
|
@@ -535,8 +536,8 @@ export function setupSteps(input: {
|
|
|
535
536
|
state: a === null || !told ? "attention" : "done",
|
|
536
537
|
now:
|
|
537
538
|
a === null ? unread
|
|
538
|
-
: !told ? "
|
|
539
|
-
: `${who} will
|
|
539
|
+
: !told ? "Phone notifications are off. Everything is still saved in Events."
|
|
540
|
+
: `${who} will get a phone notification${every ? " for every object seen (add objects to narrow it)" : ""}.`,
|
|
540
541
|
section: "alerts",
|
|
541
542
|
action: "Set up alerts",
|
|
542
543
|
});
|
|
@@ -601,7 +602,7 @@ export function setupSteps(input: {
|
|
|
601
602
|
/** Where each kind of result appears. `query` pre-fills the Events filters. */
|
|
602
603
|
export const RESULT_PLACES: { title: string; body: string; section: TCctvSection; query?: Record<string, string>; needs: TCctvPermission }[] = [
|
|
603
604
|
{ title: "Everything seen", body: "People, vehicles, plates, faces and smart detections, newest first, each with a photo.", section: "events", needs: CCTV_PERMISSIONS.viewEvents },
|
|
604
|
-
{ title: "Alerts only", body: "The events that raised an alert.
|
|
605
|
+
{ title: "Alerts only", body: "The events that raised an alert. With phone notifications on, people were also told on their phones.", section: "events", query: { severity: "alert" }, needs: CCTV_PERMISSIONS.viewEvents },
|
|
605
606
|
{ title: "Smart detection results", body: "What your smart detections saw (e.g. rubbish), with the photo and time.", section: "events", query: { kind: "classification" }, needs: CCTV_PERMISSIONS.viewEvents },
|
|
606
607
|
{ title: "Find a past moment", body: "Describe it in words, e.g. person in orange shirt, and pick the dates.", section: "search", needs: CCTV_PERMISSIONS.viewEvents },
|
|
607
608
|
{ title: "Watch now", body: "The cameras, live.", section: "live", needs: CCTV_PERMISSIONS.viewLive },
|