@7365admin1/layer-common 4.97.1-staging.746 → 4.97.1-staging.747

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.
@@ -31,6 +31,42 @@
31
31
  </v-radio-group>
32
32
  </v-col>
33
33
 
34
+ <!-- Brand decides which protocol every later field is used with, so
35
+ it is asked first. Picked once on Add and READ-ONLY on Edit
36
+ (owner, 2026-11-25): swapping a saved camera to another brand
37
+ would strand its plates on the old unit, so that is a delete and
38
+ re-add, not an edit. -->
39
+ <v-col v-if="isANPR" cols="12">
40
+ <InputLabel class="text-capitalize" title="Brand" :required="!isEdit" />
41
+
42
+ <v-select
43
+ v-if="!isEdit"
44
+ v-model="camera.brand"
45
+ :items="brandOptions"
46
+ class="filter-field"
47
+ density="comfortable"
48
+ placeholder="Select brand"
49
+ :rules="[requiredRule]"
50
+ data-test="camera-brand"
51
+ />
52
+
53
+ <template v-else>
54
+ <v-text-field
55
+ :model-value="brandLabel"
56
+ class="filter-field"
57
+ density="comfortable"
58
+ readonly
59
+ variant="solo-filled"
60
+ flat
61
+ prepend-inner-icon="mdi-lock-outline"
62
+ data-test="camera-brand"
63
+ />
64
+ <div class="text-caption text-medium-emphasis mb-2">
65
+ To change the brand, delete this camera and add it again.
66
+ </div>
67
+ </template>
68
+ </v-col>
69
+
34
70
  <template v-if="showRecorderFields">
35
71
  <v-col cols="12">
36
72
  <InputLabel
@@ -83,6 +119,8 @@
83
119
  density="comfortable"
84
120
  :rules="[requiredRule, hostRule]"
85
121
  placeholder="Enter camera URL"
122
+ :hint="addressHint"
123
+ :persistent-hint="!!addressHint"
86
124
  />
87
125
  </v-col>
88
126
 
@@ -425,6 +463,9 @@ const camera = ref<TSiteCamera>({
425
463
  username: "",
426
464
  password: "",
427
465
  type: "ip",
466
+ // Deliberately unset: on Add the person picks, because a camera saved with
467
+ // the wrong brand never talks to its device and the failure is silent.
468
+ brand: undefined,
428
469
  category: "standard",
429
470
  direction: "both",
430
471
  name: "",
@@ -465,6 +506,35 @@ const message = ref("");
465
506
  const isANPR = computed(() => prop.type === "anpr");
466
507
  const isCCTV = computed(() => prop.type === "ip");
467
508
 
509
+ /** The ANPR brands the server will accept (DV-2436). */
510
+ const brandOptions = [
511
+ { title: "Dahua", value: "dahua" },
512
+ { title: "Hikvision", value: "hikvision" },
513
+ ];
514
+
515
+ /**
516
+ * What an edited camera's brand is called on screen. A camera saved before the
517
+ * field existed has none stored, and the server reads that as Dahua, so that
518
+ * is what is shown rather than a blank box.
519
+ */
520
+ const brandLabel = computed(
521
+ () =>
522
+ brandOptions.find((option) => option.value === camera.value.brand)?.title ??
523
+ "Dahua",
524
+ );
525
+
526
+ /** Per-brand wording for the address field; nothing for CCTV. */
527
+ const addressHint = computed(() => {
528
+ if (!isANPR.value) return "";
529
+ if (camera.value.brand === "hikvision") {
530
+ return "The camera's own address, reachable from the internet - e.g. http://site.dyndns.org:7020";
531
+ }
532
+ if (camera.value.brand === "dahua") {
533
+ return "The camera's own address, reachable from the internet - e.g. http://site.dyndns.org:8080";
534
+ }
535
+ return "";
536
+ });
537
+
468
538
  const { addCamera, updateSiteCamera, testSiteCamera, getAllSiteCameras } = useSiteSettings();
469
539
 
470
540
  /**
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.746",
5
+ "version": "4.97.1-staging.747",
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/types/camera.d.ts CHANGED
@@ -24,6 +24,12 @@ declare type TSiteCamera = {
24
24
  username: string;
25
25
  password: string;
26
26
  type: "ip" | "anpr";
27
+ /**
28
+ * ANPR cameras: which vendor's protocol the camera speaks (DV-2436). Absent
29
+ * on every camera stored before the field existed, which the server reads as
30
+ * Dahua. Picked once when the camera is added and never editable after.
31
+ */
32
+ brand?: "dahua" | "hikvision";
27
33
  category: "standard" | "resident" | "visitor";
28
34
  direction: "entry" | "exit" | "both" | "none";
29
35
  name?: string;