@7365admin1/layer-common 4.156.0 → 4.157.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,11 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.157.0
4
+
5
+ ### Minor Changes
6
+
7
+ - fb36f4d: Robots: OneWay V1.4 - Pause / Resume show for a brand with its own pause (no second "Resume patrol" while paused); live view gets Centre camera / Zoom + / Zoom − for brands with `cameraControl` (people who may command the robot); Super Admin setup shows only the forms the brand's setup returns, with the brand's own note (OneWay go-to-charge level); an empty setting box is no change.
8
+
3
9
  ## 4.156.0
4
10
 
5
11
  ### Minor Changes
@@ -3626,11 +3632,11 @@ Monthly report: a month that had patrols opens the list of that month's patrol r
3626
3632
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
3627
3633
  own rule from two endpoints the console already calls, unprojected:
3628
3634
 
3629
- GET /api/members/user/:user/app/admin the Seven365 staff membership
3630
- GET /api/roles/id/:role that membership's role document
3635
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
3636
+ GET /api/roles/id/:role that membership's role document
3631
3637
 
3632
- owner = member.type === "admin" && role.type === "admin" && role.default === true
3633
- staff = member.type === "admin" && role.type === "admin"
3638
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
3639
+ staff = member.type === "admin" && role.type === "admin"
3634
3640
 
3635
3641
  `role.default` is the marker because it is the only property of a platform
3636
3642
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -80,7 +80,15 @@
80
80
  <!-- Above the fold: camera | map, with the commands under the map they act on. -->
81
81
  <div v-if="!noInterface" class="hero-detail__main" :class="{ 'hero-detail__main--single': !hasCamera }">
82
82
  <section v-if="hasCamera" class="hero-detail__cam" aria-label="Camera">
83
- <RobotLiveView v-if="caps?.liveVideo === true" ref="livePanel" panel :robot-id="robotId" :name="record?.name" :offline="!online" />
83
+ <RobotLiveView
84
+ v-if="caps?.liveVideo === true"
85
+ ref="livePanel"
86
+ panel
87
+ :robot-id="robotId"
88
+ :name="record?.name"
89
+ :offline="!online"
90
+ :camera-control="cmdOk === true && caps?.cameraControl === true && online"
91
+ />
84
92
  <p v-if="caps?.liveVideo === true && reportsPosition" class="hero-muted hero-detail__lag">{{ VIDEO_LAG_NOTE }}</p>
85
93
  <div v-if="canDrive" class="hero-detail__video">
86
94
  <v-btn variant="outlined" @click="driveOpen = true">Manual control</v-btn>
@@ -53,9 +53,15 @@
53
53
  </template>
54
54
  </div>
55
55
 
56
+ <div v-if="camError" class="hero-notice" role="alert">{{ camError }}</div>
56
57
  <div v-if="on || !panel" class="hero-dialog__actions">
57
58
  <v-btn v-if="error && !offline" variant="outlined" size="small" @click="restart">Retry</v-btn>
58
59
  <v-btn v-if="url && plays && !error" variant="outlined" size="small" @click="fullScreen">Full screen</v-btn>
60
+ <span v-if="cameraControl && !offline" class="hero-live__cam" role="group" aria-label="Camera">
61
+ <v-btn variant="outlined" size="small" :disabled="camBusy" @click="camera('center')">Centre camera</v-btn>
62
+ <v-btn variant="outlined" size="small" :disabled="camBusy" aria-label="Zoom in" @click="camera('zoom-in')">Zoom +</v-btn>
63
+ <v-btn variant="outlined" size="small" :disabled="camBusy" aria-label="Zoom out" @click="camera('zoom-out')">Zoom −</v-btn>
64
+ </span>
59
65
  <a v-if="url && !plays && kind !== 'rtmp'" class="hero-live__open" :href="url" target="_blank" rel="noopener noreferrer">Open in new tab</a>
60
66
  <span class="hero-head__spacer" />
61
67
  <v-btn v-if="!panel" variant="outlined" @click="emit('close')">Close</v-btn>
@@ -79,9 +85,26 @@ import {
79
85
  writeLivePref,
80
86
  } from "../../utils/robot-control";
81
87
 
82
- const props = defineProps<{ robotId: string; name?: string; panel?: boolean; offline?: boolean }>();
88
+ // `cameraControl`: the brand turns / zooms its camera (OneWay) AND this person may command the robot.
89
+ const props = defineProps<{ robotId: string; name?: string; panel?: boolean; offline?: boolean; cameraControl?: boolean }>();
83
90
  const emit = defineEmits<{ close: [] }>();
84
- const { getLiveVideo } = useRobots();
91
+ const { getLiveVideo, sendRobotCommand } = useRobots();
92
+
93
+ /** One camera step (centre / zoom), sent once per press; the robot cloud's refusal is shown as it said it. */
94
+ const camBusy = ref(false);
95
+ const camError = ref("");
96
+ async function camera(action: "center" | "zoom-in" | "zoom-out") {
97
+ if (camBusy.value) return;
98
+ camBusy.value = true;
99
+ camError.value = "";
100
+ try {
101
+ await sendRobotCommand(props.robotId, { kind: "camera", action });
102
+ } catch (e: any) {
103
+ camError.value = e?.data?.message || e?.message || "The camera did not move.";
104
+ } finally {
105
+ camBusy.value = false;
106
+ }
107
+ }
85
108
 
86
109
  const titleId = `hero-live-title-${Math.random().toString(36).slice(2, 8)}`;
87
110
  // "Always show live view": one choice per browser, like a dashboard layout. ponytail: localStorage, no table.
@@ -97,20 +97,20 @@
97
97
 
98
98
  <!-- Names, dock, floor, settings (Ounitech) -->
99
99
  <section v-if="caps.setupSettings === true" class="hero-setup__section" aria-label="Robot settings">
100
- <div class="hero-section__title">Names, dock and floor</div>
101
- <div class="hero-setup__form">
100
+ <div v-if="setup.robotName !== undefined || setup.sceneName !== undefined || setup.docked !== undefined" class="hero-section__title">Names, dock and floor</div>
101
+ <div v-if="setup.robotName !== undefined" class="hero-setup__form">
102
102
  <label>Name in the Ounitech app <input v-model="names.robot" class="hero-input" maxlength="40" /></label>
103
103
  <v-btn size="small" variant="outlined" :disabled="busy || !names.robot.trim() || names.robot.trim() === setup.robotName" @click="ask({ action: 'robot-name', name: names.robot.trim() })">Rename robot</v-btn>
104
104
  </div>
105
- <div class="hero-setup__form">
105
+ <div v-if="setup.sceneName !== undefined" class="hero-setup__form">
106
106
  <label>Ounitech site name <input v-model="names.scene" class="hero-input" maxlength="40" /></label>
107
107
  <v-btn size="small" variant="outlined" :disabled="busy || !names.scene.trim() || names.scene.trim() === setup.sceneName" @click="ask({ action: 'scene-name', name: names.scene.trim() })">Rename site</v-btn>
108
108
  </div>
109
- <div v-if="currentMap" class="hero-setup__form">
109
+ <div v-if="currentMap && setup.robotName !== undefined" class="hero-setup__form">
110
110
  <label>Name of map shown ({{ currentMap.name }}) <input v-model="names.map" class="hero-input" maxlength="40" /></label>
111
111
  <v-btn size="small" variant="outlined" :disabled="busy || !names.map.trim() || names.map.trim() === currentMap.name" @click="ask({ action: 'map-name', mapId: currentMap.mapId, name: names.map.trim() }, { map: currentMap.name })">Rename map</v-btn>
112
112
  </div>
113
- <div class="hero-setup__form">
113
+ <div v-if="setup.docked !== undefined" class="hero-setup__form">
114
114
  <span>Dock: {{ setup.docked ? "the robot is on its dock and charging now." : "push the robot onto its dock (it must show Charging) to save the dock from here." }}</span>
115
115
  <v-btn size="small" variant="outlined" :disabled="busy || !setup.docked" @click="ask({ action: 'dock-here' })">Save dock where the robot is</v-btn>
116
116
  </div>
@@ -123,7 +123,8 @@
123
123
  </div>
124
124
 
125
125
  <div class="hero-section__title">Settings</div>
126
- <p class="hero-muted">Only settings we can name are listed. Safety sensors, the time zone and Wi-Fi stay in the Ounitech app. Speeds can only be lowered here.</p>
126
+ <p v-if="setup.settingsNote" class="hero-muted">{{ setup.settingsNote }}</p>
127
+ <p v-else class="hero-muted">Only settings we can name are listed. Safety sensors, the time zone and Wi-Fi stay in the Ounitech app. Speeds can only be lowered here.</p>
127
128
  <div v-if="setup.settings?.error" class="hero-notice hero-notice--error">{{ setup.settings.error }}</div>
128
129
  <div v-for="s in settings" :key="s.key" class="hero-sched__row hero-setup__row">
129
130
  <b>{{ s.label }}</b>
@@ -135,10 +136,10 @@
135
136
  </div>
136
137
  <v-btn v-if="settings.length" size="small" color="primary" variant="flat" :disabled="busy || !Object.keys(changedSettings).length" @click="ask({ action: 'settings', values: changedSettings })">Save settings</v-btn>
137
138
 
138
- <div class="hero-section__title">Parts replaced</div>
139
- <p class="hero-muted">After a brush, mop, filter or bag is replaced, reset its hours so the wear count starts again.</p>
139
+ <div v-if="setup.parts !== undefined" class="hero-section__title">Parts replaced</div>
140
+ <p v-if="setup.parts !== undefined" class="hero-muted">After a brush, mop, filter or bag is replaced, reset its hours so the wear count starts again.</p>
140
141
  <div v-if="setup.parts?.error" class="hero-notice hero-notice--error">{{ setup.parts.error }}</div>
141
- <div v-else-if="!parts.length" class="hero-sched__empty">The robot reports no parts.</div>
142
+ <div v-else-if="setup.parts !== undefined && !parts.length" class="hero-sched__empty">The robot reports no parts.</div>
142
143
  <div v-for="p in parts" :key="p.code" class="hero-sched__row hero-setup__row">
143
144
  <b>{{ p.part }}</b>
144
145
  <span>{{ p.hours != null ? `${p.hours} h` : "hours not reported" }}{{ p.days != null ? ` · ${p.days} days` : "" }}</span>
@@ -284,6 +284,7 @@ export default function useRobots() {
284
284
  | { kind: "area"; areas: string[]; cleanTimes?: number; modeFlag?: number; subModeFlag?: number; levelFlag?: number }
285
285
  | { kind: "spot"; points: Array<{ x: number; y: number }>; cleanTimes?: number; modeFlag?: number; subModeFlag?: number; levelFlag?: number }
286
286
  | { kind: "pause" | "resume" | "cancel" | "patrol-resume" }
287
+ | { kind: "camera"; action: "center" | "zoom-in" | "zoom-out" }
287
288
  | { kind: "navigate"; x: number; y: number; theta?: number }
288
289
  | { kind: "relocalize"; floorNo: number; x: number; y: number; theta: number },
289
290
  ) {
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.156.0",
5
+ "version": "4.157.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.",
@@ -66,6 +66,8 @@ export function settingsDiff(loaded: Array<{ key: string; value: unknown }> | nu
66
66
  for (const s of loaded ?? []) {
67
67
  if (!(s.key in edited)) continue;
68
68
  const v = edited[s.key];
69
+ // An empty box is no change (a setting the robot does not report back starts empty).
70
+ if (v === null || v === undefined || v === "") continue;
69
71
  const want = typeof s.value === "boolean" ? v === true : Number(v);
70
72
  if (typeof want === "number" && !Number.isFinite(want)) continue;
71
73
  if (want !== s.value) out[s.key] = want;
@@ -317,6 +317,7 @@ const COMMAND_NEEDS: Readonly<Record<string, string>> = {
317
317
  cancel: "pauseProcess",
318
318
  navigate: "navigateToPoint",
319
319
  relocalize: "relocalize",
320
+ // Not `camera` (cameraControl): a live-view step, not a job - it does not move the badge.
320
321
  };
321
322
 
322
323
  /** Telemetry a brand may declare - reporting only, never a command. */
@@ -461,7 +462,8 @@ export function visibleCommands(input: {
461
462
  const caps = input.capabilities ?? {};
462
463
  const patrol = input.type === "security" && caps.patrolControl === true;
463
464
  return COMMANDS.filter((c) => {
464
- if (c.kind === "patrol-resume") return patrol && (input.mode === "PAUSED" || (input.resumable === true && input.mode !== "WORKING" && input.mode !== "IN_TRANSIT"));
465
+ // A brand with its own Resume (OneWay §4.14) carries on from where it paused: no second "Resume patrol" then.
466
+ if (c.kind === "patrol-resume") return patrol && ((input.mode === "PAUSED" && caps.pauseResume !== true) || (input.resumable === true && input.mode !== "WORKING" && input.mode !== "IN_TRANSIT" && input.mode !== "PAUSED"));
465
467
  if (caps[COMMAND_NEEDS[c.kind]!] !== true) return false;
466
468
  if (c.kind === "pause" && input.mode !== "WORKING") return false;
467
469
  if (c.kind === "resume" && input.mode !== "PAUSED") return false;
@@ -1721,6 +1723,7 @@ export function robotAbilities(input: {
1721
1723
  on("relocalize") && "can be told where it is",
1722
1724
  on("sendToDock") && "returns to its charger",
1723
1725
  on("liveVideo") && "streams live video",
1726
+ on("cameraControl") && "centres and zooms its camera",
1724
1727
  on("manualDrive") && "can be driven by hand",
1725
1728
  on("emergencyStop") && "stops at once with Emergency stop",
1726
1729
  ].filter(Boolean) as string[];