bfg-common 1.5.756 → 1.5.757

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.
@@ -251,10 +251,12 @@ const globalPermissions = computed<any>(
251
251
 
252
252
  // Step's content data (connectionType)
253
253
  const connectionType = ref<string>(
254
- !globalPermissions.value['Networks.CreateSysx'] &&
255
- !globalPermissions.value['Networks.CreatePortGroup']
254
+ globalPermissions.value === undefined
255
+ ? '0'
256
+ : !globalPermissions.value?.['Networks.CreateSysx'] &&
257
+ !globalPermissions.value?.['Networks.CreatePortGroup']
256
258
  ? '2'
257
- : !globalPermissions.value['Networks.CreateSysx']
259
+ : !globalPermissions.value?.['Networks.CreateSysx']
258
260
  ? '1'
259
261
  : '0'
260
262
  )
@@ -291,7 +293,7 @@ const onChangeAdapterStatus = (adapterStatusNew: UI_I_AdapterStatus): void => {
291
293
  // Step's content data and changers (targetDevice)
292
294
  const targetDevice = ref<UI_I_TargetDevice>(
293
295
  useDeepCopy(
294
- targetDeviceInitialFunc(globalPermissions.value['Networks.UpdateSwitch'])
296
+ targetDeviceInitialFunc(globalPermissions.value?.['Networks.UpdateSwitch'])
295
297
  )
296
298
  )
297
299
  const mtuFromSwitch = ref<number>(1500)
@@ -385,7 +387,8 @@ watch(
385
387
  : (targetDevice.value.selected = '0')
386
388
  newCT === '1' && (targetDevice.value.selected = '1')
387
389
  newCT === '2' &&
388
- (globalPermissions.value['Networks.UpdateSwitch']
390
+ (globalPermissions.value === undefined ||
391
+ globalPermissions.value?.['Networks.UpdateSwitch']
389
392
  ? (targetDevice.value.selected = '2')
390
393
  : (targetDevice.value.selected = '3'))
391
394
  }
@@ -515,7 +518,7 @@ const reset = (): void => {
515
518
  wizard.reset()
516
519
  connectionTypeLocal.value = '0'
517
520
  targetDevice.value = useDeepCopy(
518
- targetDeviceInitialFunc(globalPermissions.value['Networks.UpdateSwitch'])
521
+ targetDeviceInitialFunc(globalPermissions.value?.['Networks.UpdateSwitch'])
519
522
  )
520
523
  connectionSettings.value = useDeepCopy(connectionSettingsInitial)
521
524
  portProperties.value = useDeepCopy(portPropertiesInitial)
@@ -25,7 +25,8 @@ export const servicesInitial: UI_I_Services = {
25
25
  export const targetDeviceInitialFunc = (
26
26
  updateSwitchPermission: boolean
27
27
  ): UI_I_TargetDevice => ({
28
- selected: updateSwitchPermission ? '1' : '3',
28
+ selected:
29
+ updateSwitchPermission === undefined || updateSwitchPermission ? '1' : '3',
29
30
  network: '',
30
31
  switch: '',
31
32
  standardSwitch: '',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.756",
4
+ "version": "1.5.757",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",
package/plugins/time.ts CHANGED
@@ -1,58 +1,58 @@
1
- import { defineNuxtPlugin } from '#app'
2
- import type { UI_T_LangValue } from '~/lib/models/types'
3
- export default defineNuxtPlugin(() => {
4
- const time = function (): any {
5
- const self: any = {}
6
- self.millisecondsToHour = function (ms: number): number {
7
- return ~~(ms / 1000 / 60 / 60 / 24)
8
- }
9
- self.formatTime = (
10
- seconds: number,
11
- lang: UI_T_LangValue = 'ru_RU'
12
- ): string => {
13
- const units = {
14
- en_US: { s: 's', m: 'm', h: 'h' },
15
- ru_RU: { s: 'с', m: 'м', h: 'ч' },
16
- hy_AM: { s: 'վ', m: 'ր', h: 'ժ' },
17
- be_BY: { s: 'с', m: 'хв', h: 'г' },
18
- kk_KZ: { s: 'сек', m: 'мин', h: 'сағ' },
19
- zh_CHS: { s: '秒', m: '分', h: '时' },
20
- BROWSER: { s: 's', m: 'm', h: 'h' },
21
- }
22
-
23
- const unit = units[lang] || units.en_US
24
-
25
- if (seconds < 60) {
26
- return `${seconds}${unit.s}`
27
- }
28
-
29
- const hours = Math.floor(seconds / 3600)
30
- const minutes = Math.floor((seconds % 3600) / 60)
31
- const secs = seconds % 60
32
-
33
- let result = ''
34
-
35
- if (hours > 0) {
36
- result += `${hours}${unit.h} `
37
- }
38
-
39
- if (minutes > 0) {
40
- result += `${minutes}${unit.m} `
41
- }
42
-
43
- if (secs > 0) {
44
- result += `${secs}${unit.s}`
45
- }
46
-
47
- return result.trim()
48
- }
49
-
50
- return self
51
- }.call({})
52
-
53
- return {
54
- provide: {
55
- time,
56
- },
57
- }
58
- })
1
+ import { defineNuxtPlugin } from '#app'
2
+ import type { UI_T_LangValue } from '~/lib/models/types'
3
+ export default defineNuxtPlugin(() => {
4
+ const time = function (): any {
5
+ const self: any = {}
6
+ self.millisecondsToHour = function (ms: number): number {
7
+ return ~~(ms / 1000 / 60 / 60 / 24)
8
+ }
9
+ self.formatTime = (
10
+ seconds: number,
11
+ lang: UI_T_LangValue = 'ru_RU'
12
+ ): string => {
13
+ const units = {
14
+ en_US: { s: 's', m: 'm', h: 'h' },
15
+ ru_RU: { s: 'с', m: 'м', h: 'ч' },
16
+ hy_AM: { s: 'վ', m: 'ր', h: 'ժ' },
17
+ be_BY: { s: 'с', m: 'хв', h: 'г' },
18
+ kk_KZ: { s: 'сек', m: 'мин', h: 'сағ' },
19
+ zh_CHS: { s: '秒', m: '分', h: '时' },
20
+ BROWSER: { s: 's', m: 'm', h: 'h' },
21
+ }
22
+
23
+ const unit = units[lang] || units.en_US
24
+
25
+ if (seconds < 60) {
26
+ return `${seconds}${unit.s}`
27
+ }
28
+
29
+ const hours = Math.floor(seconds / 3600)
30
+ const minutes = Math.floor((seconds % 3600) / 60)
31
+ const secs = seconds % 60
32
+
33
+ let result = ''
34
+
35
+ if (hours > 0) {
36
+ result += `${hours}${unit.h} `
37
+ }
38
+
39
+ if (minutes > 0) {
40
+ result += `${minutes}${unit.m} `
41
+ }
42
+
43
+ if (secs > 0) {
44
+ result += `${secs}${unit.s}`
45
+ }
46
+
47
+ return result.trim()
48
+ }
49
+
50
+ return self
51
+ }.call({})
52
+
53
+ return {
54
+ provide: {
55
+ time,
56
+ },
57
+ }
58
+ })