bfg-common 1.1.77 → 1.1.79

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,97 +1,107 @@
1
- <template>
2
- <div class="">
3
- <atoms-stack-block :has-children="false">
4
- <template #stackBlockKey>
5
- {{ localization.coresPerSocket }}
6
- </template>
7
- <template #stackBlockContent>
8
- <div class="clr-control-container">
9
- <div class="clr-select-wrapper">
10
- <atoms-tooltip-error
11
- :has-error="!!apiError"
12
- selector="#vm-wizard-core-per-socket-field"
13
- @remove="onRemoveValidationError"
14
- >
15
- <template #elem>
16
- <select
17
- id="vm-wizard-core-per-socket-field"
18
- v-model="selectedCorePerSocketLocal"
19
- :disabled="props.disabled"
20
- >
21
- <option
22
- v-for="(item, key) in socketOptions"
23
- :key="key"
24
- :value="item"
25
- >
26
- {{ item }}
27
- </option>
28
- </select>
29
- </template>
30
- <template #content>{{ apiError }}</template>
31
- </atoms-tooltip-error>
32
- </div>
33
- <div class="clr-subtext">
34
- {{ localization.sockets }}: {{ socketsCount }}
35
- </div>
36
- </div>
37
- </template>
38
- </atoms-stack-block>
39
- </div>
40
- </template>
41
-
42
- <script setup lang="ts">
43
- import { UI_I_Localization } from '~/models/interfaces'
44
- import { UI_I_ErrorValidationField } from '~/models/store/interfaces'
45
- import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
46
-
47
- const localization = computed<UI_I_Localization>(() => useLocal())
48
-
49
- const props = defineProps<{
50
- cpuOptions: UI_I_OptionItem[]
51
- selectedCpu: number
52
- selectedCorePerSocket: number
53
- isEdit: boolean
54
- disabled: boolean
55
- errorValidationFields: UI_I_ErrorValidationField[]
56
- }>()
57
- const emits = defineEmits<{
58
- (event: 'update:selected-core-per-socket', value: number): void
59
- (event: 'remove-error-by-title', value: string): void
60
- }>()
61
-
62
- const apiError = computed<string>(() => {
63
- return (
64
- props.errorValidationFields?.find(
65
- (message) => message.field === 'cpu.core_per_socket'
66
- )?.error_message || ''
67
- )
68
- })
69
-
70
- const socketOptions = computed<number[]>(() => {
71
- const result = []
72
- const cpus = props.cpuOptions[1].value
73
- for (let i = 1; i <= cpus; i++) {
74
- if (i <= props.selectedCpu && (props.selectedCpu % i === 0 || i === 1)) {
75
- result.push(i)
76
- }
77
- }
78
- return result
79
- })
80
- const socketsCount = computed<number>(() => {
81
- return props.selectedCpu / props.selectedCorePerSocket
82
- })
83
- const selectedCorePerSocketLocal = computed<number>({
84
- get() {
85
- return props.selectedCorePerSocket
86
- },
87
- set(newValue) {
88
- emits('update:selected-core-per-socket', +newValue)
89
- },
90
- })
91
-
92
- const onRemoveValidationError = (): void => {
93
- emits('remove-error-by-title', 'cpu.core_per_socket')
94
- }
95
- </script>
96
-
97
- <style scoped></style>
1
+ <template>
2
+ <div class="">
3
+ <atoms-stack-block :has-children="false">
4
+ <template #stackBlockKey>
5
+ {{ localization.coresPerSocket }}
6
+ </template>
7
+ <template #stackBlockContent>
8
+ <div class="clr-control-container">
9
+ <div class="clr-select-wrapper">
10
+ <atoms-tooltip-error
11
+ :has-error="!!apiError"
12
+ selector="#vm-wizard-core-per-socket-field"
13
+ @remove="onRemoveValidationError"
14
+ >
15
+ <template #elem>
16
+ <select
17
+ id="vm-wizard-core-per-socket-field"
18
+ v-model="selectedCorePerSocketLocal"
19
+ :disabled="props.disabled"
20
+ >
21
+ <option
22
+ v-for="(item, key) in socketOptions"
23
+ :key="key"
24
+ :value="item"
25
+ >
26
+ {{ item }}
27
+ </option>
28
+ </select>
29
+ </template>
30
+ <template #content>{{ apiError }}</template>
31
+ </atoms-tooltip-error>
32
+ </div>
33
+ <div class="clr-subtext">
34
+ {{ localization.sockets }}: {{ socketsCount }}
35
+ </div>
36
+ </div>
37
+ </template>
38
+ </atoms-stack-block>
39
+ </div>
40
+ </template>
41
+
42
+ <script setup lang="ts">
43
+ import { UI_I_Localization } from '~/models/interfaces'
44
+ import { UI_I_ErrorValidationField } from '~/models/store/interfaces'
45
+ import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
46
+
47
+ const localization = computed<UI_I_Localization>(() => useLocal())
48
+
49
+ const props = defineProps<{
50
+ cpuOptions: UI_I_OptionItem[]
51
+ selectedCpu: number[]
52
+ selectedCorePerSocket: number
53
+ isEdit: boolean
54
+ disabled: boolean
55
+ errorValidationFields: UI_I_ErrorValidationField[]
56
+ }>()
57
+ const emits = defineEmits<{
58
+ (event: 'update:selected-core-per-socket', value: number): void
59
+ (event: 'remove-error-by-title', value: string): void
60
+ }>()
61
+
62
+ const apiError = computed<string>(() => {
63
+ return (
64
+ props.errorValidationFields?.find(
65
+ (message) => message.field === 'cpu.core_per_socket'
66
+ )?.error_message || ''
67
+ )
68
+ })
69
+
70
+ const socketOptions = computed<number[]>(() => {
71
+ const result = []
72
+ const cpus = props.cpuOptions[1].value
73
+ for (let i = 1; i <= cpus; i++) {
74
+ const isCommonDivisor = props.selectedCpu.every(
75
+ (cpu) => i <= cpu && (cpu % i === 0 || i === 1)
76
+ )
77
+ if (isCommonDivisor) {
78
+ result.push(i)
79
+ }
80
+ }
81
+ return result
82
+ })
83
+ watch(
84
+ socketOptions,
85
+ () => {
86
+ selectedCorePerSocketLocal.value = 1
87
+ },
88
+ { deep: true }
89
+ )
90
+ const socketsCount = computed<number>(() => {
91
+ return props.selectedCpu[0] / props.selectedCorePerSocket
92
+ })
93
+ const selectedCorePerSocketLocal = computed<number>({
94
+ get() {
95
+ return props.selectedCorePerSocket
96
+ },
97
+ set(newValue) {
98
+ emits('update:selected-core-per-socket', +newValue)
99
+ },
100
+ })
101
+
102
+ const onRemoveValidationError = (): void => {
103
+ emits('remove-error-by-title', 'cpu.core_per_socket')
104
+ }
105
+ </script>
106
+
107
+ <style scoped></style>
@@ -43,7 +43,7 @@
43
43
  <template #stackChildren>
44
44
  <common-vm-actions-add-customize-hardware-virtual-hardware-cpu-cores-per-socket
45
45
  v-model:selected-core-per-socket="selectedCorePerSocket"
46
- :selected-cpu="selectedCpu"
46
+ :selected-cpu="enableCpuHotAdd ? [selectedCpu, selectedMaxCpu] : [selectedCpu]"
47
47
  :cpu-options="cpuOptions"
48
48
  :is-edit="props.isEdit"
49
49
  :disabled="isDisabled"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.1.77",
4
+ "version": "1.1.79",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",