@7365admin1/layer-common 4.35.1-staging.378 → 4.35.1-staging.379

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.
@@ -161,14 +161,21 @@
161
161
  </v-col>
162
162
 
163
163
  <v-col v-if="isANPR" cols="12">
164
- <InputLabel class="text-capitalize" title="Password" required />
164
+ <!-- Write-only: the saved password is never sent to the browser, so
165
+ on edit a blank field keeps it. Required only for a new camera. -->
166
+ <InputLabel
167
+ class="text-capitalize"
168
+ title="Password"
169
+ :required="!isEdit"
170
+ />
165
171
  <v-text-field
166
172
  v-model.trim="camera.password"
167
173
  type="password"
174
+ autocomplete="new-password"
168
175
  class="filter-field"
169
176
  density="comfortable"
170
- :rules="[requiredRule]"
171
- placeholder="Enter password"
177
+ :rules="isEdit ? [] : [requiredRule]"
178
+ :placeholder="isEdit ? 'Saved · leave blank to keep' : 'Enter password'"
172
179
  />
173
180
  </v-col>
174
181
 
@@ -419,8 +426,12 @@ const camera = ref<TSiteCamera>({
419
426
 
420
427
  camera.value.site = prop.site;
421
428
 
422
- if (prop.mode === "edit") {
429
+ const isEdit = prop.mode === "edit";
430
+
431
+ if (isEdit) {
423
432
  camera.value = JSON.parse(JSON.stringify(prop.camera));
433
+ // Never pre-filled: blank means "keep the saved password".
434
+ camera.value.password = "";
424
435
  }
425
436
  camera.value.site = prop.site;
426
437
  camera.value.type = prop.type;
@@ -576,7 +587,9 @@ const hasChanges = computed(() => {
576
587
  return (
577
588
  camera.value.host !== prop.camera.host ||
578
589
  camera.value.username !== prop.camera.username ||
579
- camera.value.password !== prop.camera.password ||
590
+ // A typed password is a change; blank keeps the saved one.
591
+ !!camera.value.password ||
592
+ camera.value.status !== prop.camera.status ||
580
593
  camera.value.category !== prop.camera.category ||
581
594
  camera.value.guardPost !== prop.camera.guardPost ||
582
595
  camera.value.direction !== prop.camera.direction ||
@@ -895,7 +908,8 @@ async function save(
895
908
  const res = await updateSiteCamera(camera.value._id ?? "", {
896
909
  ...addressPayload(),
897
910
  username: camera.value.username,
898
- password: camera.value.password,
911
+ // Sent only when typed; left out, the server keeps the saved one.
912
+ ...(camera.value.password ? { password: camera.value.password } : {}),
899
913
  category: camera.value.category,
900
914
  guardPost: camera.value.guardPost,
901
915
  direction: camera.value.direction,
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.35.1-staging.378",
5
+ "version": "4.35.1-staging.379",
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.",