@7365admin1/layer-common 4.162.0 → 4.163.2
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/components/CctvEngine/Alerts.vue +15 -4
- package/components/CctvEngine/Detections.vue +11 -0
- package/components/CctvEngine/Events.vue +5 -0
- package/components/CctvEngine/Faces.vue +10 -0
- package/components/CctvEngine/HowTo.vue +61 -0
- package/components/CctvEngine/Plates.vue +10 -0
- package/components/CctvEngine/Shell.vue +6 -4
- package/components/CctvEngine/Start.vue +119 -0
- package/components/CctvEngine/Zones.vue +10 -0
- package/components/VehicleManagement.vue +19 -1
- package/composables/useCctvNav.ts +10 -0
- package/composables/useVehicle.ts +2 -1
- package/package.json +1 -1
- package/utils/cctv-engine.ts +146 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 4.163.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 836f08d: Vehicle Mgmt: a Records filter (Current / Deleted) on the toolbar, so deleted vehicles stay out of the list but can still be found and restored (IS-0864).
|
|
8
|
+
|
|
9
|
+
## 4.163.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 26537ae: CCTV Engine alerts: wording matches what the server does (the switch sends phone notifications; empty roles = everyone who can see CCTV events).
|
|
14
|
+
|
|
15
|
+
## 4.163.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- ea28ba5: CCTV Engine: Getting started page (live setup checklist + where to find results), How it works boxes on the setup pages, Events opens pre-filtered from links, clearer save message in Alerts.
|
|
20
|
+
|
|
3
21
|
## 4.162.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -3692,11 +3710,11 @@ Monthly report: a month that had patrols opens the list of that month's patrol r
|
|
|
3692
3710
|
`utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
|
|
3693
3711
|
own rule from two endpoints the console already calls, unprojected:
|
|
3694
3712
|
|
|
3695
|
-
|
|
3696
|
-
|
|
3713
|
+
GET /api/members/user/:user/app/admin the Seven365 staff membership
|
|
3714
|
+
GET /api/roles/id/:role that membership's role document
|
|
3697
3715
|
|
|
3698
|
-
|
|
3699
|
-
|
|
3716
|
+
owner = member.type === "admin" && role.type === "admin" && role.default === true
|
|
3717
|
+
staff = member.type === "admin" && role.type === "admin"
|
|
3700
3718
|
|
|
3701
3719
|
`role.default` is the marker because it is the only property of a platform
|
|
3702
3720
|
staff role no API caller can set - `role.controller.ts` validates create and
|
|
@@ -5,6 +5,17 @@
|
|
|
5
5
|
-->
|
|
6
6
|
<template>
|
|
7
7
|
<div>
|
|
8
|
+
<CctvEngineHowTo
|
|
9
|
+
id="alerts"
|
|
10
|
+
:steps="[
|
|
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
|
+
'Optional: type the objects that matter (e.g. person, car, rubbish) so not everything alerts. Empty means every object.',
|
|
13
|
+
'Optional: limit to zones or cameras, and set quiet hours. Then press Save alert settings.',
|
|
14
|
+
]"
|
|
15
|
+
results="Alerts appear in Events marked Alert, and as a notification with the picture on the phones of the roles you chose."
|
|
16
|
+
results-section="events"
|
|
17
|
+
:results-query="{ severity: 'alert' }"
|
|
18
|
+
/>
|
|
8
19
|
<v-progress-linear v-if="loading" indeterminate />
|
|
9
20
|
<CctvEngineNotice v-else-if="error" :error="error" retry @retry="load" />
|
|
10
21
|
<v-form v-else :disabled="!canEdit" @submit.prevent="save">
|
|
@@ -23,18 +34,18 @@
|
|
|
23
34
|
:items="roles"
|
|
24
35
|
item-title="name"
|
|
25
36
|
item-value="_id"
|
|
26
|
-
label="
|
|
37
|
+
label="Only notify these roles (optional)"
|
|
27
38
|
multiple
|
|
28
39
|
chips
|
|
29
40
|
closable-chips
|
|
30
41
|
density="comfortable"
|
|
31
42
|
class="mt-3"
|
|
32
43
|
:loading="rolesLoading"
|
|
33
|
-
: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.'"
|
|
34
45
|
persistent-hint
|
|
35
46
|
/>
|
|
36
47
|
|
|
37
|
-
<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" />
|
|
38
49
|
<v-switch v-model="form.createIncident" color="primary" label="Create an incident report for each alert" hide-details />
|
|
39
50
|
|
|
40
51
|
<v-switch v-model="quiet" color="primary" label="Quiet hours (no notifications between these times)" hide-details />
|
|
@@ -122,7 +133,7 @@ async function save() {
|
|
|
122
133
|
notifyGuards: form.notifyGuards,
|
|
123
134
|
quietHours: quiet.value ? { start: form.quietStart, end: form.quietEnd } : null,
|
|
124
135
|
});
|
|
125
|
-
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.";
|
|
126
137
|
} catch (e) {
|
|
127
138
|
saveError.value = e;
|
|
128
139
|
} finally {
|
|
@@ -5,6 +5,17 @@
|
|
|
5
5
|
-->
|
|
6
6
|
<template>
|
|
7
7
|
<div>
|
|
8
|
+
<CctvEngineHowTo
|
|
9
|
+
id="detections"
|
|
10
|
+
:steps="[
|
|
11
|
+
'Press New smart detection: give it a name, pick a camera and drag a box over the area to watch.',
|
|
12
|
+
'Use one result for the normal look (e.g. clean) and one for the problem (e.g. rubbish), and choose which result raises an alert.',
|
|
13
|
+
'Let it collect photos of BOTH looks (about 10 minutes each), sort at least 5 photos into each result, then press Teach.',
|
|
14
|
+
]"
|
|
15
|
+
results="Each result is saved in Events as a Smart detection with a photo. Results you chose for alerts also notify the roles set in Alerts."
|
|
16
|
+
results-section="events"
|
|
17
|
+
:results-query="{ kind: 'classification' }"
|
|
18
|
+
/>
|
|
8
19
|
<CctvEngineCameraPicker v-model:engine="engine" :site="site" no-camera />
|
|
9
20
|
|
|
10
21
|
<template v-if="engine">
|
|
@@ -56,7 +56,12 @@ const props = defineProps<{ site: string; access?: unknown }>();
|
|
|
56
56
|
const { listEvents } = useCctvEngine();
|
|
57
57
|
const { smAndDown } = useDisplay();
|
|
58
58
|
|
|
59
|
+
const route = useRoute();
|
|
59
60
|
const f = reactive<TEventFilters>({});
|
|
61
|
+
for (const k of ["kind", "severity", "camera", "label", "plate", "face", "zone"] as const) {
|
|
62
|
+
const v = route.query[k];
|
|
63
|
+
if (typeof v === "string" && v) (f as any)[k] = v;
|
|
64
|
+
}
|
|
60
65
|
const items = ref<any[]>([]);
|
|
61
66
|
const page = ref(1);
|
|
62
67
|
const pages = ref(1);
|
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
-->
|
|
6
6
|
<template>
|
|
7
7
|
<div>
|
|
8
|
+
<CctvEngineHowTo
|
|
9
|
+
id="faces"
|
|
10
|
+
:steps="[
|
|
11
|
+
'Press Add face, upload a clear front photo and type the person\'s name.',
|
|
12
|
+
'Add 2 or 3 photos of the same person for better results.',
|
|
13
|
+
'From then on, events for that person show their name.',
|
|
14
|
+
]"
|
|
15
|
+
results="Events show the name next to the person. Search Events by Face name to see when they were seen."
|
|
16
|
+
results-section="events"
|
|
17
|
+
/>
|
|
8
18
|
<v-alert type="info" variant="tonal" density="compact" class="mb-3" icon="mdi-information-outline">
|
|
9
19
|
Faces are stored on the site's engine. Only add people who know they are being recognised, and fill in who they are and why when you can.
|
|
10
20
|
Those details are optional today, but they help when rules on consent are applied later.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
"How it works" box at the top of a setup page: numbered steps, then where the results show up,
|
|
3
|
+
with a button that opens them. Can be folded away; stays folded for this viewer once closed.
|
|
4
|
+
-->
|
|
5
|
+
<template>
|
|
6
|
+
<v-alert variant="tonal" color="primary" density="compact" class="mb-4 cctv-howto">
|
|
7
|
+
<div class="d-flex align-center">
|
|
8
|
+
<strong class="flex-grow-1">How it works</strong>
|
|
9
|
+
<v-btn variant="text" size="small" :append-icon="open ? 'mdi-chevron-up' : 'mdi-chevron-down'" @click="toggle">
|
|
10
|
+
{{ open ? "Hide" : "Show" }}
|
|
11
|
+
</v-btn>
|
|
12
|
+
</div>
|
|
13
|
+
<template v-if="open">
|
|
14
|
+
<ol class="cctv-howto__list">
|
|
15
|
+
<li v-for="s in steps" :key="s">{{ s }}</li>
|
|
16
|
+
</ol>
|
|
17
|
+
<div v-if="results" class="mt-2">
|
|
18
|
+
<strong>Where to see the results:</strong> {{ results }}
|
|
19
|
+
<v-btn v-if="resultsSection" variant="text" size="small" append-icon="mdi-arrow-right" @click="go(resultsSection, resultsQuery)">
|
|
20
|
+
See results
|
|
21
|
+
</v-btn>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
</v-alert>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
import { ref } from "vue";
|
|
29
|
+
|
|
30
|
+
const props = defineProps<{
|
|
31
|
+
id: string;
|
|
32
|
+
steps: string[];
|
|
33
|
+
results?: string;
|
|
34
|
+
resultsSection?: string;
|
|
35
|
+
resultsQuery?: Record<string, string>;
|
|
36
|
+
}>();
|
|
37
|
+
const go = useCctvNav();
|
|
38
|
+
|
|
39
|
+
const key = `cctv-howto-${props.id}`;
|
|
40
|
+
const stored = (() => {
|
|
41
|
+
try {
|
|
42
|
+
return localStorage.getItem(key);
|
|
43
|
+
} catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
})();
|
|
47
|
+
const open = ref(stored !== "closed");
|
|
48
|
+
function toggle() {
|
|
49
|
+
open.value = !open.value;
|
|
50
|
+
try {
|
|
51
|
+
localStorage.setItem(key, open.value ? "open" : "closed");
|
|
52
|
+
} catch {
|
|
53
|
+
/* private window: just not remembered */
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<style scoped>
|
|
59
|
+
.cctv-howto__list { margin: 6px 0 0 18px; }
|
|
60
|
+
.cctv-howto__list li { margin: 2px 0; }
|
|
61
|
+
</style>
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
<!-- Known plates: the CCTV watch list. Not linked to resident, visitor or vehicle records. -->
|
|
2
2
|
<template>
|
|
3
3
|
<div>
|
|
4
|
+
<CctvEngineHowTo
|
|
5
|
+
id="plates"
|
|
6
|
+
:steps="[
|
|
7
|
+
'Press Add plate and type the vehicle number.',
|
|
8
|
+
'Turn on Alert when seen if you want to be told when it appears.',
|
|
9
|
+
'The engine reads plates on the cameras and matches them against this list.',
|
|
10
|
+
]"
|
|
11
|
+
results="Each time a listed plate is seen it appears in Events with the photo; with Alert when seen, the roles in Alerts are notified."
|
|
12
|
+
results-section="events"
|
|
13
|
+
/>
|
|
4
14
|
<v-alert type="info" variant="tonal" density="compact" class="mb-3" icon="mdi-information-outline">
|
|
5
15
|
This is a <strong>CCTV watch list</strong>. It is sent to the engine so it can recognise these plates, and it can raise an alert when one is seen.
|
|
6
16
|
It is <strong>separate</strong> from resident, visitor and vehicle records - adding a plate here does not register a vehicle, and registering a vehicle does not add it here.
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
<div class="cctv-shell">
|
|
9
9
|
<h2 class="hero-title">CCTV Engine</h2>
|
|
10
10
|
<p class="hero-muted mb-3">
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
AI camera analysis for this site: live view, events with photos, smart search, smart detection, plates, faces and alerts.
|
|
12
|
+
New here? Start with <strong>Getting started</strong>.
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
<v-progress-linear v-if="!resolved" indeterminate class="mb-3" />
|
|
@@ -62,13 +62,15 @@ const router = useRouter();
|
|
|
62
62
|
const { access, resolved } = useCctvEngineAccess(() => props.site);
|
|
63
63
|
|
|
64
64
|
const current = computed<TCctvSection>(() => {
|
|
65
|
-
|
|
65
|
+
// Opening the module without a section (the menu link) lands on Getting started.
|
|
66
|
+
const asked = (route.params.section ? props.section : "start") as TCctvSection | undefined;
|
|
66
67
|
if (asked && access.value.sections.some((s) => s.key === asked)) return asked;
|
|
67
68
|
return (access.value.sections[0]?.key ?? "live") as TCctvSection;
|
|
68
69
|
});
|
|
69
70
|
const sectionAllowed = computed(() => access.value.sections.some((s) => s.key === current.value));
|
|
70
71
|
|
|
71
72
|
const VIEWS: Record<TCctvSection, any> = {
|
|
73
|
+
start: resolveComponent("CctvEngineStart"),
|
|
72
74
|
live: resolveComponent("CctvEngineLive"),
|
|
73
75
|
events: resolveComponent("CctvEngineEvents"),
|
|
74
76
|
playback: resolveComponent("CctvEnginePlayback"),
|
|
@@ -83,6 +85,6 @@ const VIEWS: Record<TCctvSection, any> = {
|
|
|
83
85
|
const view = computed(() => VIEWS[current.value]);
|
|
84
86
|
|
|
85
87
|
function go(section: unknown) {
|
|
86
|
-
router.replace({ ...route, params: { ...route.params, section: String(section) } });
|
|
88
|
+
router.replace({ ...route, params: { ...route.params, section: String(section) }, query: {} });
|
|
87
89
|
}
|
|
88
90
|
</script>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Getting started: the first page of the CCTV Engine. A checklist built from what THIS site really has
|
|
3
|
+
(engine online, who gets alerts, smart detections, plates, faces) with a button to each setup page,
|
|
4
|
+
then "Where to find results" with buttons that open Events already filtered.
|
|
5
|
+
Each step and result only shows when the person may open that page.
|
|
6
|
+
-->
|
|
7
|
+
<template>
|
|
8
|
+
<div>
|
|
9
|
+
<p class="hero-muted mt-0">
|
|
10
|
+
Set up the steps below once. After that the engine works on its own: everything it sees is saved in
|
|
11
|
+
<strong>Events</strong> with a photo, and the people you choose get a phone notification for alerts.
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<v-progress-linear v-if="loading" indeterminate class="mb-3" />
|
|
15
|
+
|
|
16
|
+
<h3 class="hero-title mb-2">Set up</h3>
|
|
17
|
+
<v-card v-for="(s, i) in steps" :key="s.key" variant="outlined" class="mb-2 cctv-start__step">
|
|
18
|
+
<div class="d-flex align-start ga-3 pa-3">
|
|
19
|
+
<v-icon :color="STATE[s.state].color" :icon="STATE[s.state].icon" class="mt-1" />
|
|
20
|
+
<div class="flex-grow-1">
|
|
21
|
+
<div class="d-flex flex-wrap align-center ga-2">
|
|
22
|
+
<strong>{{ i + 1 }}. {{ s.title }}</strong>
|
|
23
|
+
<v-chip size="x-small" label :color="STATE[s.state].color">{{ STATE[s.state].label }}</v-chip>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="hero-muted">{{ s.what }}</div>
|
|
26
|
+
<div class="mt-1">{{ s.now }}</div>
|
|
27
|
+
</div>
|
|
28
|
+
<v-btn :color="s.state === 'done' || s.state === 'optional' ? undefined : 'primary'" variant="tonal" size="small" @click="go(s.section)">
|
|
29
|
+
{{ s.action }}
|
|
30
|
+
</v-btn>
|
|
31
|
+
</div>
|
|
32
|
+
</v-card>
|
|
33
|
+
|
|
34
|
+
<h3 v-if="places.length" class="hero-title mt-5 mb-2">Where to find results</h3>
|
|
35
|
+
<v-row dense>
|
|
36
|
+
<v-col v-for="p in places" :key="p.title" cols="12" sm="6" md="4">
|
|
37
|
+
<v-card variant="tonal" class="pa-3 h-100 d-flex flex-column" @click="go(p.section, p.query)">
|
|
38
|
+
<strong>{{ p.title }}</strong>
|
|
39
|
+
<div class="hero-muted flex-grow-1">{{ p.body }}</div>
|
|
40
|
+
<div class="mt-2 text-primary">Open <v-icon size="small" icon="mdi-arrow-right" /></div>
|
|
41
|
+
</v-card>
|
|
42
|
+
</v-col>
|
|
43
|
+
</v-row>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup lang="ts">
|
|
48
|
+
import { computed, ref } from "vue";
|
|
49
|
+
import { CCTV_PERMISSIONS, RESULT_PLACES, setupSteps, type TClassifier, type TSetupState } from "../../utils/cctv-engine";
|
|
50
|
+
|
|
51
|
+
const props = defineProps<{ site: string; access: { can: (p: any) => boolean; faceEnabled: boolean } }>();
|
|
52
|
+
const { listEngines, getAlertSettings, listClassifiers, listPlates, listFaces } = useCctvEngine();
|
|
53
|
+
const go = useCctvNav();
|
|
54
|
+
|
|
55
|
+
const STATE: Record<TSetupState, { icon: string; color: string; label: string }> = {
|
|
56
|
+
done: { icon: "mdi-check-circle", color: "success", label: "Done" },
|
|
57
|
+
attention: { icon: "mdi-alert-circle", color: "warning", label: "Needs your attention" },
|
|
58
|
+
todo: { icon: "mdi-circle-outline", color: "primary", label: "To do" },
|
|
59
|
+
optional: { icon: "mdi-circle-outline", color: "grey", label: "Optional" },
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const loading = ref(true);
|
|
63
|
+
const engines = ref<any[] | null>([]);
|
|
64
|
+
const alertSettings = ref<any | null>({});
|
|
65
|
+
const classifiers = ref<TClassifier[] | null>([]);
|
|
66
|
+
const plates = ref<number | null>(0);
|
|
67
|
+
const faces = ref<number | null>(0);
|
|
68
|
+
|
|
69
|
+
const can = (p: string) => props.access.can(p);
|
|
70
|
+
const steps = computed(() =>
|
|
71
|
+
setupSteps({
|
|
72
|
+
can,
|
|
73
|
+
faceEnabled: props.access.faceEnabled,
|
|
74
|
+
engines: engines.value,
|
|
75
|
+
alertSettings: alertSettings.value,
|
|
76
|
+
classifiers: classifiers.value,
|
|
77
|
+
plates: plates.value,
|
|
78
|
+
faces: faces.value,
|
|
79
|
+
}),
|
|
80
|
+
);
|
|
81
|
+
const places = computed(() => RESULT_PLACES.filter((p) => can(p.needs)));
|
|
82
|
+
|
|
83
|
+
// A list that cannot be read stays `null`, so its step says so instead of looking finished.
|
|
84
|
+
const read = async <T,>(fn: () => Promise<T>): Promise<T | null> => {
|
|
85
|
+
try {
|
|
86
|
+
return await fn();
|
|
87
|
+
} catch {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
async function load() {
|
|
93
|
+
loading.value = true;
|
|
94
|
+
const list: any = await read(() => listEngines(props.site));
|
|
95
|
+
engines.value = list ? list.items ?? [] : null;
|
|
96
|
+
const ids: string[] = (engines.value ?? []).map((e: any) => String(e._id));
|
|
97
|
+
const [alerts, cls, pl, fc] = await Promise.all([
|
|
98
|
+
can(CCTV_PERMISSIONS.manageAlerts) ? read(() => getAlertSettings(props.site)) : Promise.resolve({}),
|
|
99
|
+
can(CCTV_PERMISSIONS.manageZones)
|
|
100
|
+
? read(async () => (await Promise.all(ids.map((id) => listClassifiers(id)))).flatMap((r: any) => r?.items ?? []))
|
|
101
|
+
: Promise.resolve([]),
|
|
102
|
+
can(CCTV_PERMISSIONS.managePlates) ? read(async () => ((await listPlates(props.site)) as any)?.items?.length ?? 0) : Promise.resolve(0),
|
|
103
|
+
props.access.faceEnabled && can(CCTV_PERMISSIONS.manageFaces)
|
|
104
|
+
? read(async () => (await Promise.all(ids.map((id) => listFaces(id)))).reduce((n, r: any) => n + (r?.items?.length ?? 0), 0))
|
|
105
|
+
: Promise.resolve(0),
|
|
106
|
+
]);
|
|
107
|
+
alertSettings.value = alerts ?? null;
|
|
108
|
+
classifiers.value = (cls as TClassifier[] | null) ?? null;
|
|
109
|
+
plates.value = pl as number | null;
|
|
110
|
+
faces.value = fc as number | null;
|
|
111
|
+
loading.value = false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
load();
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<style scoped>
|
|
118
|
+
.cctv-start__step { border-radius: 10px; }
|
|
119
|
+
</style>
|
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
-->
|
|
6
6
|
<template>
|
|
7
7
|
<div>
|
|
8
|
+
<CctvEngineHowTo
|
|
9
|
+
id="zones"
|
|
10
|
+
:steps="[
|
|
11
|
+
'Pick the engine and the camera.',
|
|
12
|
+
'Choose Zone (a named area, e.g. entrance) or a Mask (an area to ignore), then click on the picture to place the corners.',
|
|
13
|
+
'Press Finish shape, then Save to the engine. Use the zone name in Alerts or in a Wrong-way rule below.',
|
|
14
|
+
]"
|
|
15
|
+
results="Events show the zone each object was in, and Alerts can be limited to a zone."
|
|
16
|
+
results-section="events"
|
|
17
|
+
/>
|
|
8
18
|
<CctvEngineCameraPicker v-model:engine="engine" v-model:camera="camera" :site="site" />
|
|
9
19
|
|
|
10
20
|
<template v-if="engine && camera">
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
</template>
|
|
41
41
|
|
|
42
42
|
<!-- Residents / Season Passes / Block Listed, on the toolbar row the way
|
|
43
|
-
the other screens draw their tabs.
|
|
43
|
+
the other screens draw their tabs. Deleted plates show only under the
|
|
44
|
+
Deleted filter. -->
|
|
44
45
|
<template #tabs>
|
|
45
46
|
<button v-for="tab in vehicleTabs" :key="tab.value" type="button" role="tab" class="app-tab"
|
|
46
47
|
:class="{ 'app-tab--active': activeTab === tab.value }" :aria-selected="activeTab === tab.value"
|
|
@@ -54,6 +55,9 @@
|
|
|
54
55
|
<v-select v-if="qrEnabled" v-model="qrStickerFilter" :items="qrStickerFilterItems" label="QR sticker"
|
|
55
56
|
density="compact" variant="outlined" hide-details class="vehicle-qr-filter" style="max-width: 190px"
|
|
56
57
|
data-test="vehicle-qr-filter" />
|
|
58
|
+
<v-select v-model="statusFilter" :items="statusFilterItems" label="Records"
|
|
59
|
+
density="compact" variant="outlined" hide-details class="vehicle-status-filter" style="max-width: 160px"
|
|
60
|
+
data-test="vehicle-status-filter" />
|
|
57
61
|
<AppField v-model="searchInput" search compact placeholder="Search" klass="app-toolbar__search" />
|
|
58
62
|
</template>
|
|
59
63
|
|
|
@@ -615,6 +619,14 @@ const qrStickerFilterItems = [
|
|
|
615
619
|
];
|
|
616
620
|
const qrStickersOn = computed(() => qrEnabled.value && props.canUpdateVehicle);
|
|
617
621
|
|
|
622
|
+
// Deleting is a soft delete and the list leaves deleted plates out unless asked
|
|
623
|
+
// for (IS-0864). "Deleted" is how one is found again - and Restored.
|
|
624
|
+
const statusFilter = ref("");
|
|
625
|
+
const statusFilterItems = [
|
|
626
|
+
{ title: "Current", value: "" },
|
|
627
|
+
{ title: "Deleted", value: "deleted" },
|
|
628
|
+
];
|
|
629
|
+
|
|
618
630
|
/**
|
|
619
631
|
* Re-issue / Undo / Link / Remove on one plate change that vehicle, so on a
|
|
620
632
|
* Block Listed plate they follow Manage Blocklist (owner, 2026-10-23) when the
|
|
@@ -983,6 +995,7 @@ const { data: getVehiclesReq, refresh: getVehiclesRefresh, pending: getVehiclesP
|
|
|
983
995
|
search: searchInput.value,
|
|
984
996
|
view: activeTab.value,
|
|
985
997
|
site: props.site,
|
|
998
|
+
status: statusFilter.value,
|
|
986
999
|
qrSticker: qrEnabled.value ? qrStickerFilter.value : "",
|
|
987
1000
|
}),
|
|
988
1001
|
{
|
|
@@ -1495,6 +1508,11 @@ watch(qrStickerFilter, () => {
|
|
|
1495
1508
|
getVehiclesRefresh();
|
|
1496
1509
|
})
|
|
1497
1510
|
|
|
1511
|
+
watch(statusFilter, () => {
|
|
1512
|
+
page.value = 1;
|
|
1513
|
+
getVehiclesRefresh();
|
|
1514
|
+
})
|
|
1515
|
+
|
|
1498
1516
|
// A new tab starts from its first page and loads straight away.
|
|
1499
1517
|
watch(activeTab, () => {
|
|
1500
1518
|
page.value = 1;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Go to another CCTV Engine section from inside one (the host page route is /[org]/[site]/cctv-engine/[[section]]).
|
|
3
|
+
* `query` pre-fills that section's filters (Events reads kind / severity / camera / label from it).
|
|
4
|
+
*/
|
|
5
|
+
export default function useCctvNav() {
|
|
6
|
+
const route = useRoute();
|
|
7
|
+
const router = useRouter();
|
|
8
|
+
return (section: string, query: Record<string, string> = {}) =>
|
|
9
|
+
router.push({ ...route, params: { ...route.params, section }, query });
|
|
10
|
+
}
|
|
@@ -12,7 +12,8 @@ export default function useVehicle() {
|
|
|
12
12
|
qrSticker = "",
|
|
13
13
|
} = {}) {
|
|
14
14
|
// `view` is the screen's tab: residents, season-passes or block-listed.
|
|
15
|
-
//
|
|
15
|
+
// Deleted vehicles come back only with `status: "deleted"`; with no
|
|
16
|
+
// `status` every other status does.
|
|
16
17
|
return await useNuxtApp().$api<Record<string, any>>("/api/vehicles", {
|
|
17
18
|
method: "GET",
|
|
18
19
|
query: { search, page, limit, order, type, category, site, status, view, qrSticker },
|
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.
|
|
5
|
+
"version": "4.163.2",
|
|
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
|
@@ -22,6 +22,7 @@ export const CCTV_PERMISSIONS = {
|
|
|
22
22
|
export type TCctvPermission = (typeof CCTV_PERMISSIONS)[keyof typeof CCTV_PERMISSIONS];
|
|
23
23
|
|
|
24
24
|
export type TCctvSection =
|
|
25
|
+
| "start"
|
|
25
26
|
| "live"
|
|
26
27
|
| "events"
|
|
27
28
|
| "playback"
|
|
@@ -34,7 +35,9 @@ export type TCctvSection =
|
|
|
34
35
|
| "detections";
|
|
35
36
|
|
|
36
37
|
/** The menu, in the order people use it. `needs` is the permission the server enforces on that screen's routes. */
|
|
37
|
-
export const CCTV_SECTIONS: { key: TCctvSection; title: string; icon: string; needs: TCctvPermission; face?: boolean }[] = [
|
|
38
|
+
export const CCTV_SECTIONS: { key: TCctvSection; title: string; icon: string; needs: TCctvPermission | null; face?: boolean }[] = [
|
|
39
|
+
// Shown to anyone who can open at least one other section; each step inside checks its own permission.
|
|
40
|
+
{ key: "start", title: "Getting started", icon: "mdi-map-marker-path", needs: null },
|
|
38
41
|
{ key: "live", title: "Live", icon: "mdi-video", needs: CCTV_PERMISSIONS.viewLive },
|
|
39
42
|
{ key: "events", title: "Events", icon: "mdi-timeline-clock-outline", needs: CCTV_PERMISSIONS.viewEvents },
|
|
40
43
|
{ key: "playback", title: "Playback & export", icon: "mdi-play-box-outline", needs: CCTV_PERMISSIONS.viewEvents },
|
|
@@ -62,8 +65,9 @@ export function cctvEngineAccess(input: {
|
|
|
62
65
|
const faceEnabled = enabled && sw?.faceRecognition === true;
|
|
63
66
|
const can = (perm: TCctvPermission) =>
|
|
64
67
|
enabled && !input.moduleDenied && input.grants(perm);
|
|
65
|
-
const
|
|
66
|
-
|
|
68
|
+
const rest = CCTV_SECTIONS.filter((s) => s.needs !== null && can(s.needs));
|
|
69
|
+
const sections = rest.length ? [CCTV_SECTIONS[0]!, ...rest] : [];
|
|
70
|
+
return { enabled, faceEnabled, can, sections, canAny: rest.length > 0 };
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
// --------------------------------------------------------------------------- events query
|
|
@@ -465,3 +469,142 @@ export function classifierStatus(
|
|
|
465
469
|
if (waiting > 0) return { key: "sorting", title: `Needs sorting (${waiting} waiting)`, color: "warning" };
|
|
466
470
|
return { key: "collecting", title: "Collecting photos", color: "default" };
|
|
467
471
|
}
|
|
472
|
+
|
|
473
|
+
// --------------------------------------------------------------------------- getting started
|
|
474
|
+
|
|
475
|
+
export type TSetupState = "done" | "attention" | "todo" | "optional";
|
|
476
|
+
export type TSetupStep = {
|
|
477
|
+
key: "engine" | "alerts" | "detections" | "zones" | "plates" | "faces";
|
|
478
|
+
title: string;
|
|
479
|
+
state: TSetupState;
|
|
480
|
+
/** What it is for, one line. */
|
|
481
|
+
what: string;
|
|
482
|
+
/** Where things stand on THIS site, one line. */
|
|
483
|
+
now: string;
|
|
484
|
+
section: TCctvSection;
|
|
485
|
+
action: string;
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* The Getting started checklist from what the site really has. A step the person may not open is left out.
|
|
490
|
+
* `null` for a list means "could not be read" and is said plainly, never shown as done.
|
|
491
|
+
*/
|
|
492
|
+
export function setupSteps(input: {
|
|
493
|
+
can: (perm: TCctvPermission) => boolean;
|
|
494
|
+
faceEnabled: boolean;
|
|
495
|
+
engines: { status?: string; name?: string }[] | null;
|
|
496
|
+
alertSettings: { notifyRoles?: string[]; notifyGuards?: boolean; labels?: string[] } | null;
|
|
497
|
+
classifiers: TClassifier[] | null;
|
|
498
|
+
plates: number | null;
|
|
499
|
+
faces: number | null;
|
|
500
|
+
}): TSetupStep[] {
|
|
501
|
+
const steps: TSetupStep[] = [];
|
|
502
|
+
const unread = "Could not be read just now. Open it to check.";
|
|
503
|
+
const plural = (n: number, one: string, many: string) => `${n} ${n === 1 ? one : many}`;
|
|
504
|
+
|
|
505
|
+
if (input.can(CCTV_PERMISSIONS.viewLive) || input.can(CCTV_PERMISSIONS.manageEngine)) {
|
|
506
|
+
const e = input.engines;
|
|
507
|
+
const online = (e ?? []).filter((x) => x.status === "online");
|
|
508
|
+
const manage = input.can(CCTV_PERMISSIONS.manageEngine);
|
|
509
|
+
steps.push({
|
|
510
|
+
key: "engine",
|
|
511
|
+
title: "Engine connected",
|
|
512
|
+
what: "The small computer at the site that watches the cameras and sends everything here.",
|
|
513
|
+
state: e === null ? "attention" : !e.length ? "todo" : online.length ? "done" : "attention",
|
|
514
|
+
now:
|
|
515
|
+
e === null ? unread
|
|
516
|
+
: !e.length ? "No engine yet. Add one and install it at the site."
|
|
517
|
+
: online.length ? `${online.map((x) => x.name || "Engine").join(", ")} is online.`
|
|
518
|
+
: "The engine is offline. Check that it has power and internet.",
|
|
519
|
+
section: manage ? "engines" : "live",
|
|
520
|
+
action: manage ? "Engines & health" : "See live",
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
if (input.can(CCTV_PERMISSIONS.manageAlerts)) {
|
|
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.
|
|
528
|
+
const roles = a?.notifyRoles?.length ?? 0;
|
|
529
|
+
const told = a?.notifyGuards === true;
|
|
530
|
+
const who = roles ? `People in ${plural(roles, "role", "roles")}` : "Everyone who can see CCTV events";
|
|
531
|
+
const every = told && !(a?.labels ?? []).length;
|
|
532
|
+
steps.push({
|
|
533
|
+
key: "alerts",
|
|
534
|
+
title: "Who gets alerts",
|
|
535
|
+
what: "Choose who gets a phone notification with the picture when something important is seen.",
|
|
536
|
+
state: a === null || !told ? "attention" : "done",
|
|
537
|
+
now:
|
|
538
|
+
a === null ? unread
|
|
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)" : ""}.`,
|
|
541
|
+
section: "alerts",
|
|
542
|
+
action: "Set up alerts",
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
if (input.can(CCTV_PERMISSIONS.manageZones)) {
|
|
547
|
+
const c = input.classifiers;
|
|
548
|
+
const trained = (c ?? []).filter((x) => x.training?.trained);
|
|
549
|
+
const pending = (c ?? []).filter((x) => !x.training?.trained);
|
|
550
|
+
steps.push({
|
|
551
|
+
key: "detections",
|
|
552
|
+
title: "Smart detection",
|
|
553
|
+
what: "Teach the engine what an area looks like, e.g. a bin area that is clean or has rubbish.",
|
|
554
|
+
state: c === null ? "attention" : !c.length ? "optional" : pending.length ? "attention" : "done",
|
|
555
|
+
now:
|
|
556
|
+
c === null ? unread
|
|
557
|
+
: !c.length ? "None yet. Optional."
|
|
558
|
+
: pending.length ? `${pending.map((x) => x.name).join(", ")}: sort the photos, then press Teach.`
|
|
559
|
+
: `${trained.map((x) => `${x.name} is watching ${x.camera ?? "its camera"}`).join("; ")}.`,
|
|
560
|
+
section: "detections",
|
|
561
|
+
action: c?.length ? "Open smart detection" : "Create one",
|
|
562
|
+
});
|
|
563
|
+
steps.push({
|
|
564
|
+
key: "zones",
|
|
565
|
+
title: "Zones",
|
|
566
|
+
what: "Name areas of a camera (e.g. entrance) to get alerts only there, or to ignore an area.",
|
|
567
|
+
state: "optional",
|
|
568
|
+
now: "Optional.",
|
|
569
|
+
section: "zones",
|
|
570
|
+
action: "Draw zones",
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
if (input.can(CCTV_PERMISSIONS.managePlates)) {
|
|
575
|
+
const n = input.plates;
|
|
576
|
+
steps.push({
|
|
577
|
+
key: "plates",
|
|
578
|
+
title: "Known plates",
|
|
579
|
+
what: "A watch list of vehicle numbers. Get told when one of them is seen.",
|
|
580
|
+
state: n === null ? "attention" : n > 0 ? "done" : "optional",
|
|
581
|
+
now: n === null ? unread : n > 0 ? `${plural(n, "plate", "plates")} on the watch list.` : "None yet. Optional.",
|
|
582
|
+
section: "plates",
|
|
583
|
+
action: "Add plates",
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
if (input.faceEnabled && input.can(CCTV_PERMISSIONS.manageFaces)) {
|
|
588
|
+
const n = input.faces;
|
|
589
|
+
steps.push({
|
|
590
|
+
key: "faces",
|
|
591
|
+
title: "Faces",
|
|
592
|
+
what: "Add photos of people (e.g. staff) so events show their name.",
|
|
593
|
+
state: n === null ? "attention" : n > 0 ? "done" : "optional",
|
|
594
|
+
now: n === null ? unread : n > 0 ? `${plural(n, "person", "people")} in the face library.` : "None yet. Optional.",
|
|
595
|
+
section: "faces",
|
|
596
|
+
action: "Add faces",
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
return steps;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/** Where each kind of result appears. `query` pre-fills the Events filters. */
|
|
603
|
+
export const RESULT_PLACES: { title: string; body: string; section: TCctvSection; query?: Record<string, string>; needs: TCctvPermission }[] = [
|
|
604
|
+
{ title: "Everything seen", body: "People, vehicles, plates, faces and smart detections, newest first, each with a photo.", section: "events", needs: CCTV_PERMISSIONS.viewEvents },
|
|
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 },
|
|
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 },
|
|
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 },
|
|
608
|
+
{ title: "Watch now", body: "The cameras, live.", section: "live", needs: CCTV_PERMISSIONS.viewLive },
|
|
609
|
+
];
|
|
610
|
+
|