@controleonline/ui-common 1.2.124 → 1.2.126

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.
@@ -1,13 +1,13 @@
1
1
  {
2
- "version": "1.2.121",
3
- "rc": 1,
4
- "branch": "rc/1.2.121-rc.1",
2
+ "version": "1.2.126",
3
+ "rc": 2,
4
+ "branch": "rc/1.2.126-rc.2",
5
5
  "baseMaster": "662ffc0f2a40a414b3b7ba2b249e15ca62f2cb93",
6
6
  "tasks": [
7
- 133
7
+ 138
8
8
  ],
9
9
  "frozen": true,
10
10
  "repositories": {
11
- "ControleOnline/ui-common": "f66e2112a9e5298fd232ba20526d0d7729b9e836"
11
+ "ControleOnline/ui-common": "eef80ebeacbfea966826b7071cc03427eac60f4e"
12
12
  }
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@controleonline/ui-common",
3
- "version": "1.2.124",
3
+ "version": "1.2.126",
4
4
  "author": "ControleOnline",
5
5
  "description": "ControleOnline Common Quasar UI Component",
6
6
  "license": "MIT",
@@ -14,6 +14,7 @@ import {
14
14
  parseConfigsObject,
15
15
  } from '@controleonline/ui-common/src/react/config/deviceConfigBootstrap';
16
16
  import {
17
+ formatRuntimeFooterIdentifier,
17
18
  getRuntimeFooterDebugInfo,
18
19
  getRuntimeFooterPrimaryText,
19
20
  getRuntimeFooterRotationEntries,
@@ -258,7 +259,7 @@ const RuntimeInfoFooter = ({
258
259
  shouldRotate
259
260
  ? rotationEntries[activeIndex]
260
261
  : inlineText
261
- ) || primaryText || device?.id || '';
262
+ ) || primaryText || formatRuntimeFooterIdentifier(device?.id) || '';
262
263
  const backgroundColor = colors?.footerBackground;
263
264
  const homeSpacing = resolveHomeFooterSpacing(appearance, Platform.OS, insets.bottom);
264
265
  const borderColor = colors?.footerBorder;
@@ -299,7 +300,7 @@ const RuntimeInfoFooter = ({
299
300
  <RuntimeFooterMarqueeText
300
301
  text={
301
302
  showDebugInfo
302
- ? inlineText || primaryText || device?.id || '--'
303
+ ? inlineText || primaryText || formatRuntimeFooterIdentifier(device?.id) || '--'
303
304
  : displayedText
304
305
  }
305
306
  color={textColor}
@@ -130,22 +130,43 @@ const formatRuntimeFooterVersion = version => {
130
130
 
131
131
  const IPV4_PATTERN = /^(\d{1,3}\.){3}\d{1,3}$/;
132
132
 
133
- // IPv4 is shown in full; other ':'-separated ids (IPv6/MAC-like) are shortened
134
- // to an ellipsis plus the last two blocks, e.g. "…46f4:eb0b".
133
+ const HEX_IDENTIFIER_PATTERN = /^[0-9a-f]+$/i;
134
+ const HEX_IDENTIFIER_TAIL_LENGTH = 8;
135
+
136
+ // IPv4 is shown in full. ':'-separated ids (IPv6/MAC-like) are shortened to an
137
+ // ellipsis plus the last two blocks, e.g. "…46f4:eb0b". Plain hex ids (optionally
138
+ // '-' separated, e.g. UUID) are shortened to an ellipsis plus the last 8
139
+ // characters in two ':'-separated blocks of 4, e.g. "…e5f6:a7b8". Anything else
140
+ // (hostnames, short ids) is returned untouched.
135
141
  const formatRuntimeFooterIdentifier = value => {
136
142
  const identifier = safeTrim(value);
137
143
 
138
- if (!identifier || IPV4_PATTERN.test(identifier) || !identifier.includes(':')) {
144
+ if (!identifier || IPV4_PATTERN.test(identifier)) {
139
145
  return identifier;
140
146
  }
141
147
 
142
- const blocks = identifier.split(':').filter(Boolean);
148
+ if (identifier.includes(':')) {
149
+ const blocks = identifier.split(':').filter(Boolean);
143
150
 
144
- if (blocks.length <= 2) {
151
+ if (blocks.length <= 2) {
152
+ return identifier;
153
+ }
154
+
155
+ return `…${blocks.slice(-2).join(':')}`;
156
+ }
157
+
158
+ const hex = identifier.replace(/-/g, '');
159
+
160
+ if (
161
+ !HEX_IDENTIFIER_PATTERN.test(hex) ||
162
+ hex.length <= HEX_IDENTIFIER_TAIL_LENGTH
163
+ ) {
145
164
  return identifier;
146
165
  }
147
166
 
148
- return `…${blocks.slice(-2).join(':')}`;
167
+ const tail = hex.slice(-HEX_IDENTIFIER_TAIL_LENGTH);
168
+
169
+ return `…${tail.slice(0, 4)}:${tail.slice(4)}`;
149
170
  };
150
171
 
151
172
  const getRuntimeFooterWebHost = () => {
@@ -217,7 +217,7 @@ test('reads the persisted config-version for non-web runtimes', () => {
217
217
  },
218
218
  },
219
219
  }),
220
- 'PDV (229252771069b294) / v1.3.7',
220
+ 'PDV (…1069:b294) / v1.3.7',
221
221
  )
222
222
  })
223
223
 
@@ -245,7 +245,7 @@ test('prefers the backend device identifier used by the devices page', () => {
245
245
  },
246
246
  },
247
247
  }),
248
- 'PDV (229252771069b294) / v1.3.7',
248
+ 'PDV (…1069:b294) / v1.3.7',
249
249
  )
250
250
 
251
251
  const debugInfo = getRuntimeFooterDebugInfo({
@@ -272,8 +272,8 @@ test('prefers the backend device identifier used by the devices page', () => {
272
272
  })
273
273
 
274
274
  assert.equal(debugInfo.versionLabel, 'v1.3.7')
275
- assert.equal(debugInfo.displayName, 'PDV (229252771069b294)')
276
- assert.equal(debugInfo.runtimeDetail, '229252771069b294')
275
+ assert.equal(debugInfo.displayName, 'PDV (…1069:b294)')
276
+ assert.equal(debugInfo.runtimeDetail, '…1069:b294')
277
277
  assert.equal(debugInfo.runtimeDetailSource, 'device_config.device.device')
278
278
  assert.equal(debugInfo.versionCandidates[0]?.source, 'device_config.device.metadata.app.version')
279
279
  assert.equal(debugInfo.rawValues.deviceId, 'd41ac8afb9f178eb')
@@ -384,8 +384,8 @@ test('does not invent a fallback label when the operation mode translation is mi
384
384
  })
385
385
 
386
386
  assert.equal(debugInfo.operationModeLabel, '')
387
- assert.equal(debugInfo.displayName, 'PDV (229252771069b294)')
388
- assert.equal(debugInfo.primaryText, 'PDV (229252771069b294) / v1.3.7')
387
+ assert.equal(debugInfo.displayName, 'PDV (…1069:b294)')
388
+ assert.equal(debugInfo.primaryText, 'PDV (…1069:b294) / v1.3.7')
389
389
  })
390
390
 
391
391
  test('renders totem mode in the runtime footer', () => {
@@ -500,6 +500,14 @@ test('formats runtime identifier: IPv4 full, non-IPv4 shortened to last two bloc
500
500
  assert.equal(formatRuntimeFooterIdentifier('abc'), 'abc')
501
501
  assert.equal(formatRuntimeFooterIdentifier(''), '')
502
502
  assert.equal(formatRuntimeFooterIdentifier(null), '')
503
+ assert.equal(formatRuntimeFooterIdentifier('a1b2c3d4e5f6a7b8'), '…e5f6:a7b8')
504
+ assert.equal(
505
+ formatRuntimeFooterIdentifier('3f2b8c1e-9d4a-4c7b-b1c2-0a9e4f7ab1c2'),
506
+ '…4f7a:b1c2',
507
+ )
508
+ assert.equal(formatRuntimeFooterIdentifier('A1B2C3D4E5F6'), '…C3D4:E5F6')
509
+ assert.equal(formatRuntimeFooterIdentifier('a1b2c3d4'), 'a1b2c3d4')
510
+ assert.equal(formatRuntimeFooterIdentifier('admin.lave-go.com'), 'admin.lave-go.com')
503
511
  })
504
512
 
505
513
  test('primary text shortens IPv6 public ip', () => {