@7365admin1/layer-common 4.165.0 → 4.167.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.167.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6114c1a: CCTV Engine Engines & health: read-only camera settings (Settings button per camera for engine managers).
8
+
9
+ ## 4.166.0
10
+
11
+ ### Minor Changes
12
+
13
+ - d26c7c7: CCTV Engine Events: show the event's written description (from the site engine, when it has one) in the event list and event detail.
14
+
3
15
  ## 4.165.0
4
16
 
5
17
  ### Minor Changes
@@ -3760,11 +3772,11 @@ Monthly report: a month that had patrols opens the list of that month's patrol r
3760
3772
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
3761
3773
  own rule from two endpoints the console already calls, unprojected:
3762
3774
 
3763
- GET /api/members/user/:user/app/admin the Seven365 staff membership
3764
- GET /api/roles/id/:role that membership's role document
3775
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
3776
+ GET /api/roles/id/:role that membership's role document
3765
3777
 
3766
- owner = member.type === "admin" && role.type === "admin" && role.default === true
3767
- staff = member.type === "admin" && role.type === "admin"
3778
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
3779
+ staff = member.type === "admin" && role.type === "admin"
3768
3780
 
3769
3781
  `role.default` is the marker because it is the only property of a platform
3770
3782
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -0,0 +1,69 @@
1
+ <!--
2
+ Read-only settings of one engine camera (what it detects, how often, zones, snapshots, motion sensitivity).
3
+ The server sends only these safe fields; stream addresses and passwords never reach the browser. Nothing can be saved here.
4
+ -->
5
+ <template>
6
+ <v-dialog :model-value="!!camera" max-width="560" scrollable @update:model-value="(v: boolean) => !v && emit('close')">
7
+ <v-card>
8
+ <v-card-title>Camera settings - {{ camera }}</v-card-title>
9
+ <v-card-text>
10
+ <p class="hero-muted">These are the settings the engine is using for this camera. They are shown for checking only; changes are made on the engine by Seven365.</p>
11
+ <v-progress-linear v-if="loading" indeterminate />
12
+ <CctvEngineNotice v-else-if="error" :error="error" retry @retry="load" />
13
+ <v-table v-else-if="s" density="compact" data-test="camera-settings">
14
+ <tbody>
15
+ <tr><th>Camera</th><td>{{ onOff(s.enabled) }}</td></tr>
16
+ <tr><th>Object detection</th><td>{{ onOff(s.detect?.enabled) }}</td></tr>
17
+ <tr><th>Pictures checked</th><td>{{ s.detect?.fps == null ? NOT_SET : `${s.detect.fps} per second` }}</td></tr>
18
+ <tr><th>Picture size checked</th><td>{{ s.detect?.width && s.detect?.height ? `${s.detect.width} x ${s.detect.height}` : NOT_SET }}</td></tr>
19
+ <tr><th>Objects watched</th><td>{{ list(s.trackedObjects) }}</td></tr>
20
+ <tr><th>Objects that are alerts</th><td>{{ list(s.alertObjects) }}</td></tr>
21
+ <tr><th>Zones</th><td>{{ list(s.zones) }}</td></tr>
22
+ <tr><th>Snapshots</th><td>{{ onOff(s.snapshots?.enabled) }}<template v-if="s.snapshots?.keepDays != null"> (kept {{ s.snapshots.keepDays }} days on the engine)</template></td></tr>
23
+ <tr><th>Motion sensitivity</th><td>{{ s.motion?.threshold == null ? NOT_SET : `${s.motion.threshold} (lower = more sensitive)` }}</td></tr>
24
+ <tr><th>Smallest movement noticed</th><td>{{ s.motion?.contourArea ?? NOT_SET }}</td></tr>
25
+ <tr><th>Face recognition</th><td>{{ onOff(s.faceRecognition) }}</td></tr>
26
+ <tr><th>Number plate reading</th><td>{{ onOff(s.plateReading) }}</td></tr>
27
+ <tr><th>Sound detection</th><td>{{ onOff(s.audio) }}</td></tr>
28
+ </tbody>
29
+ </v-table>
30
+ </v-card-text>
31
+ <v-card-actions>
32
+ <v-spacer />
33
+ <v-btn variant="text" @click="emit('close')">Close</v-btn>
34
+ </v-card-actions>
35
+ </v-card>
36
+ </v-dialog>
37
+ </template>
38
+
39
+ <script setup lang="ts">
40
+ import { ref, watch } from "vue";
41
+
42
+ const props = defineProps<{ engineId: string; camera: string | null }>();
43
+ const emit = defineEmits<{ (e: "close"): void }>();
44
+
45
+ const { getCameraSettings } = useCctvEngine();
46
+ const NOT_SET = "Not reported";
47
+ const onOff = (v: boolean | null | undefined) => (v === true ? "On" : v === false ? "Off" : NOT_SET);
48
+ const list = (v?: string[] | null) => (v?.length ? v.join(", ") : "None");
49
+
50
+ const s = ref<any>(null);
51
+ const loading = ref(false);
52
+ const error = ref<unknown>(null);
53
+
54
+ async function load() {
55
+ s.value = null;
56
+ error.value = null;
57
+ if (!props.camera) return;
58
+ loading.value = true;
59
+ try {
60
+ s.value = await getCameraSettings(props.engineId, props.camera);
61
+ } catch (e) {
62
+ error.value = e;
63
+ } finally {
64
+ loading.value = false;
65
+ }
66
+ }
67
+
68
+ watch(() => [props.engineId, props.camera], load, { immediate: true });
69
+ </script>
@@ -42,14 +42,15 @@
42
42
  <v-col cols="6" sm="3"><div class="hero-muted">Storage</div><strong>{{ storageText(health[e._id].data.storage) }}</strong></v-col>
43
43
  </v-row>
44
44
  <v-table density="compact" class="mt-3">
45
- <thead><tr><th>Camera</th><th>Picture rate</th><th>Detection rate</th><th>State</th></tr></thead>
45
+ <thead><tr><th>Camera</th><th>Picture rate</th><th>Detection rate</th><th>State</th><th v-if="canEdit"><span class="d-sr-only">Settings</span></th></tr></thead>
46
46
  <tbody>
47
- <tr v-if="!health[e._id].data.cameras.length"><td colspan="4" class="hero-muted">The engine has not reported any cameras yet. Reports come every minute while it is Online.</td></tr>
47
+ <tr v-if="!health[e._id].data.cameras.length"><td :colspan="canEdit ? 5 : 4" class="hero-muted">The engine has not reported any cameras yet. Reports come every minute while it is Online.</td></tr>
48
48
  <tr v-for="c in health[e._id].data.cameras" :key="c.name">
49
49
  <td>{{ c.name }}</td>
50
50
  <td>{{ c.fps == null ? "Not reported" : `${c.fps} fps` }}</td>
51
51
  <td>{{ c.detectFps == null ? "Not reported" : `${c.detectFps} fps` }}</td>
52
52
  <td><v-chip v-if="c.online != null" size="x-small" label :color="c.online ? 'success' : 'error'">{{ c.online ? "Receiving" : "No picture" }}</v-chip></td>
53
+ <td v-if="canEdit"><v-btn size="x-small" variant="text" prepend-icon="mdi-cog-outline" :data-test="`camera-settings-${c.name}`" @click="settingsFor = { engine: e._id, camera: c.name }">Settings</v-btn></td>
53
54
  </tr>
54
55
  </tbody>
55
56
  </v-table>
@@ -62,6 +63,8 @@
62
63
  </v-expansion-panel>
63
64
  </v-expansion-panels>
64
65
 
66
+ <CctvEngineCameraSettings :engine-id="settingsFor?.engine ?? ''" :camera="settingsFor?.camera ?? null" @close="settingsFor = null" />
67
+
65
68
  <!-- Add-engine wizard -->
66
69
  <v-dialog v-model="wizard" max-width="640" persistent scrollable>
67
70
  <v-card>
@@ -153,6 +156,8 @@ const storageText = (s?: { usedMb: number; totalMb: number } | null) =>
153
156
  !s || !(s.totalMb > 0) ? "Not reported" : `${Math.round((s.usedMb / s.totalMb) * 100)}% full`;
154
157
 
155
158
  const engines = ref<any[]>([]);
159
+ /** The camera whose read-only settings are open. */
160
+ const settingsFor = ref<{ engine: string; camera: string } | null>(null);
156
161
  const loading = ref(false);
157
162
  const error = ref<unknown>(null);
158
163
  const open = ref<string | undefined>();
@@ -32,6 +32,7 @@
32
32
  <tr v-else><th>Object</th><td>{{ event.label }}<template v-if="event.subLabel"> ({{ event.subLabel }})</template></td></tr>
33
33
  <tr v-if="event.faceName"><th>Face</th><td>{{ event.faceName }}</td></tr>
34
34
  <tr v-if="event.plate"><th>Plate</th><td>{{ event.plate }}</td></tr>
35
+ <tr v-if="event.description"><th>Description</th><td data-test="event-description">{{ event.description }}</td></tr>
35
36
  <tr v-if="!isClassification"><th>Zones</th><td>{{ (event.zones ?? []).join(", ") || "None" }}<template v-if="(event.enteredZones ?? []).length"> (entered: {{ event.enteredZones.join(" then ") }})</template></td></tr>
36
37
  <!-- A smart detection result carries no score from the engine. -->
37
38
  <tr v-if="!isClassification"><th>Confidence</th><td>{{ scoreText(event.score) }}</td></tr>
@@ -37,6 +37,7 @@
37
37
  <v-chip v-if="e.severity === 'alert'" size="small" color="error" label class="mr-1">Alert</v-chip>
38
38
  <v-chip size="small" label>{{ kindTitle(e.kind) }}</v-chip>
39
39
  </template>
40
+ <div v-if="e.description" class="hero-muted text-truncate" data-test="event-description">{{ e.description }}</div>
40
41
  </v-list-item>
41
42
  </v-list>
42
43
 
@@ -93,6 +93,8 @@ export default function useCctvEngine() {
93
93
  const getZones = (engineId: string, camera: string) => api(`${cam(engineId, camera)}/zones`, { method: "GET" });
94
94
  const saveZones = (engineId: string, camera: string, body: TZonesBody) =>
95
95
  api(`${cam(engineId, camera)}/zones`, { method: "PUT", body });
96
+ /** Read-only camera settings (allow-listed by the server). */
97
+ const getCameraSettings = (engineId: string, camera: string) => api(`${cam(engineId, camera)}/settings`, { method: "GET" });
96
98
  const listWrongWayRules = (site: string) => api("/api/cctv-wrong-way-rules", { method: "GET", query: { site } });
97
99
  const createWrongWayRule = (body: Record<string, any>) => api("/api/cctv-wrong-way-rules", { method: "POST", body });
98
100
  // The server reads the site from `?site=` on every call by id and checks the caller against it.
@@ -135,7 +137,7 @@ export default function useCctvEngine() {
135
137
  searchEvents,
136
138
  listClassifiers, createClassifier, updateClassifier, deleteClassifier, classifierPhotos, classifierPhoto,
137
139
  sortClassifierPhoto, discardClassifierPhotos, trainClassifier,
138
- getZones, saveZones, listWrongWayRules, createWrongWayRule, updateWrongWayRule, deleteWrongWayRule,
140
+ getZones, saveZones, getCameraSettings, listWrongWayRules, createWrongWayRule, updateWrongWayRule, deleteWrongWayRule,
139
141
  listPlates, createPlate, updatePlate, deletePlate,
140
142
  listFaces, enrolFace, deleteFace,
141
143
  getAlertSettings, saveAlertSettings,
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.165.0",
5
+ "version": "4.167.0",
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.",