bfg-common 1.5.847 → 1.5.848

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,170 +1,176 @@
1
- <template>
2
- <div class="">
3
- <atoms-stack-block :has-children="false">
4
- <template #stackBlockKey>
5
- {{ localization.common.schedulingAffinity }}
6
- </template>
7
- <template #stackBlockContent>
8
- <div class="flex-space-between">
9
- <div class="flex-align-center">
10
- <atoms-tooltip-error
11
- :has-error="!!errorText"
12
- selector="#sa-edit-setting-input"
13
- @remove="onRemoveValidationError"
14
- >
15
- <template #elem>
16
- <input
17
- id="sa-edit-setting-input"
18
- v-model="schedulingAffinity"
19
- data-id="sa-edit-setting-input"
20
- type="text"
21
- class="edit-setting-input"
22
- @blur="onBlur"
23
- />
24
- </template>
25
- <template #content>{{ errorText }}</template>
26
- </atoms-tooltip-error>
27
- </div>
28
-
29
- <div id="sa-help-icon">
30
- <atoms-the-icon
31
- fill="#0072a3"
32
- width="24px"
33
- height="24px"
34
- name="info-circle"
35
- data-id="show-sa-help-icon"
36
- @click.stop="isShowSaHelp = !isShowSaHelp"
37
- />
38
- <Teleport to="body">
39
- <atoms-tooltip-signpost
40
- v-if="isShowSaHelp"
41
- elem-id="sa-help-icon"
42
- @hide="isShowSaHelp = false"
43
- >
44
- <h3 class="sa-help-title">
45
- {{ localization.mainNavigation.help }}
46
- </h3>
47
-
48
- <p class="sa-help-text">
49
- {{ localization.common.schedulingAffinityHelpDescription1 }}
50
- </p>
51
- <p class="sa-help-text">
52
- {{ localization.common.schedulingAffinityHelpDescription2 }}
53
- </p>
54
- <p class="sa-help-text">
55
- {{ localization.common.schedulingAffinityHelpDescription3 }}
56
- </p>
57
- <p class="sa-help-text">
58
- <strong
59
- >{{ localization.common.hyperthreadingStatus }}:
60
- </strong>
61
- {{ localization.common.inactive }}
62
- </p>
63
- <!-- <p class="sa-help-text">-->
64
- <!-- <strong>{{ localization.common.availableCpus }}: </strong>-->
65
- <!-- 8({{ localization.common.physicalCpus }})-->
66
- <!-- </p>-->
67
- <div
68
- v-for="item in numsLocal"
69
- :key="item.label"
70
- class="sa-help-text"
71
- >
72
- <strong>{{ item.label }} </strong>
73
- <p>{{ item.value }}</p>
74
- </div>
75
- </atoms-tooltip-signpost>
76
- </Teleport>
77
- </div>
78
- </div>
79
- </template>
80
- </atoms-stack-block>
81
- </div>
82
- </template>
83
-
84
- <script setup lang="ts">
85
- import type { UI_I_Localization } from '~/lib/models/interfaces'
86
- import { validateAffinityInput } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/sa/lib/utils/validation'
87
- import { groupConsecutiveNumbers } from '~/lib/utils/nums'
88
-
89
- const localization = computed<UI_I_Localization>(() => useLocal())
90
-
91
- const schedulingAffinity = defineModel<string>({
92
- required: true,
93
- })
94
-
95
- const props = defineProps<{
96
- nums: any // для прокуратора
97
- }>()
98
- const emits = defineEmits<{
99
- (event: 'invalid', value: boolean): void
100
- (event: 'remove-error-by-title', value: string): void
101
- }>()
102
-
103
- const isShowSaHelp = ref<boolean>(false)
104
-
105
- const numsLocal = computed<any>(() => {
106
- const cpuTopology = []
107
- for (const key in props.nums.cpu) {
108
- cpuTopology.push({
109
- label: `CPU NUMA ${+key + 1}`,
110
- value:
111
- 'cores: ' +
112
- groupConsecutiveNumbers(props.nums.cpu[key]) +
113
- '; memory: ' +
114
- props.nums.ram[key],
115
- })
116
- }
117
- return cpuTopology
118
- })
119
-
120
- const errorText = ref<string>('')
121
- const onBlur = (): void => {
122
- const cpuNums = []
123
- for (const key in props.nums.cpu) {
124
- cpuNums.push(...props.nums.cpu[key])
125
- }
126
- const validation = validateAffinityInput(
127
- schedulingAffinity.value,
128
- localization.value,
129
- cpuNums
130
- )
131
-
132
- errorText.value = ''
133
-
134
- if (!validation.isValid) {
135
- errorText.value = validation.error
136
- }
137
- }
138
-
139
- const isInvalid = computed<boolean>(() => !!errorText.value)
140
- watch(
141
- isInvalid,
142
- (newValue) => {
143
- emits('invalid', newValue)
144
- },
145
- { immediate: true }
146
- )
147
-
148
- const onRemoveValidationError = (): void => {
149
- emits('remove-error-by-title', 'cpu.temp') // TODO
150
- }
151
- </script>
152
-
153
- <style scoped lang="scss">
154
- h3.sa-help-title {
155
- margin-top: 7px;
156
- font-size: 22px;
157
- color: #565656;
158
- }
159
- p.sa-help-text {
160
- width: 310px;
161
- margin-top: 24px;
162
- font-size: 14px;
163
- color: #565656;
164
- }
165
- p.sa-help-text strong {
166
- font-size: 14px;
167
- font-weight: bold;
168
- color: #565656;
169
- }
170
- </style>
1
+ <template>
2
+ <div class="">
3
+ <atoms-stack-block :has-children="false">
4
+ <template #stackBlockKey>
5
+ {{ localization.common.schedulingAffinity }}
6
+ </template>
7
+ <template #stackBlockContent>
8
+ <div class="flex-space-between">
9
+ <div class="flex-align-center">
10
+ <atoms-tooltip-error
11
+ :has-error="!!errorText"
12
+ selector="#sa-edit-setting-input"
13
+ @remove="onRemoveValidationError"
14
+ >
15
+ <template #elem>
16
+ <input
17
+ id="sa-edit-setting-input"
18
+ v-model="schedulingAffinity"
19
+ data-id="sa-edit-setting-input"
20
+ type="text"
21
+ class="edit-setting-input"
22
+ @blur="onBlur"
23
+ />
24
+ </template>
25
+ <template #content>{{ errorText }}</template>
26
+ </atoms-tooltip-error>
27
+ </div>
28
+
29
+ <div id="sa-help-icon">
30
+ <atoms-the-icon
31
+ fill="#0072a3"
32
+ width="24px"
33
+ height="24px"
34
+ name="info-circle"
35
+ data-id="show-sa-help-icon"
36
+ @click.stop="isShowSaHelp = !isShowSaHelp"
37
+ />
38
+ <Teleport to="body">
39
+ <atoms-tooltip-signpost
40
+ v-if="isShowSaHelp"
41
+ elem-id="sa-help-icon"
42
+ @hide="isShowSaHelp = false"
43
+ >
44
+ <h3 class="sa-help-title">
45
+ {{ localization.mainNavigation.help }}
46
+ </h3>
47
+
48
+ <p class="sa-help-text">
49
+ {{ localization.common.schedulingAffinityHelpDescription1 }}
50
+ </p>
51
+ <p class="sa-help-text">
52
+ {{ localization.common.schedulingAffinityHelpDescription2 }}
53
+ </p>
54
+ <p class="sa-help-text">
55
+ {{ localization.common.schedulingAffinityHelpDescription3 }}
56
+ </p>
57
+ <p class="sa-help-text">
58
+ <strong
59
+ >{{ localization.common.hyperthreadingStatus }}:
60
+ </strong>
61
+ {{ localization.common.inactive }}
62
+ </p>
63
+ <!-- <p class="sa-help-text">-->
64
+ <!-- <strong>{{ localization.common.availableCpus }}: </strong>-->
65
+ <!-- 8({{ localization.common.physicalCpus }})-->
66
+ <!-- </p>-->
67
+ <template v-if="numsLocal">
68
+ <div
69
+ v-for="item in numsLocal"
70
+ :key="item.label"
71
+ class="sa-help-text"
72
+ >
73
+ <strong>{{ item.label }} </strong>
74
+ <p>{{ item.value }}</p>
75
+ </div>
76
+ </template>
77
+ </atoms-tooltip-signpost>
78
+ </Teleport>
79
+ </div>
80
+ </div>
81
+ </template>
82
+ </atoms-stack-block>
83
+ </div>
84
+ </template>
85
+
86
+ <script setup lang="ts">
87
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
88
+ import { validateAffinityInput } from '~/components/common/vm/actions/common/customizeHardware/virtualHardware/cpu/sa/lib/utils/validation'
89
+ import { groupConsecutiveNumbers } from '~/lib/utils/nums'
90
+
91
+ const localization = computed<UI_I_Localization>(() => useLocal())
92
+
93
+ const schedulingAffinity = defineModel<string>({
94
+ required: true,
95
+ })
96
+
97
+ const props = defineProps<{
98
+ nums?: any // для прокуратора
99
+ }>()
100
+ const emits = defineEmits<{
101
+ (event: 'invalid', value: boolean): void
102
+ (event: 'remove-error-by-title', value: string): void
103
+ }>()
104
+
105
+ const isShowSaHelp = ref<boolean>(false)
106
+
107
+ const numsLocal = computed<any>(() => {
108
+ if (!props.nums) return []
109
+
110
+ const cpuTopology = []
111
+ for (const key in props.nums.cpu) {
112
+ cpuTopology.push({
113
+ label: `CPU NUMA ${+key + 1}`,
114
+ value:
115
+ 'cores: ' +
116
+ groupConsecutiveNumbers(props.nums.cpu[key]) +
117
+ '; memory: ' +
118
+ props.nums.ram[key],
119
+ })
120
+ }
121
+ return cpuTopology
122
+ })
123
+
124
+ const errorText = ref<string>('')
125
+ const onBlur = (): void => {
126
+ let cpuNums = []
127
+ if (props.nums) {
128
+ for (const key in props.nums.cpu) {
129
+ cpuNums.push(...props.nums.cpu[key])
130
+ }
131
+ }
132
+ const validation = validateAffinityInput(
133
+ schedulingAffinity.value,
134
+ localization.value,
135
+ cpuNums
136
+ )
137
+
138
+ errorText.value = ''
139
+
140
+ if (!validation.isValid) {
141
+ errorText.value = validation.error
142
+ }
143
+ }
144
+
145
+ const isInvalid = computed<boolean>(() => !!errorText.value)
146
+ watch(
147
+ isInvalid,
148
+ (newValue) => {
149
+ emits('invalid', newValue)
150
+ },
151
+ { immediate: true }
152
+ )
153
+
154
+ const onRemoveValidationError = (): void => {
155
+ emits('remove-error-by-title', 'cpu.temp') // TODO
156
+ }
157
+ </script>
158
+
159
+ <style scoped lang="scss">
160
+ h3.sa-help-title {
161
+ margin-top: 7px;
162
+ font-size: 22px;
163
+ color: #565656;
164
+ }
165
+ p.sa-help-text {
166
+ width: 310px;
167
+ margin-top: 24px;
168
+ font-size: 14px;
169
+ color: #565656;
170
+ }
171
+ p.sa-help-text strong {
172
+ font-size: 14px;
173
+ font-weight: bold;
174
+ color: #565656;
175
+ }
176
+ </style>
@@ -152,7 +152,7 @@ export const validateAffinityInput = (
152
152
  if (singleRegex.test(part)) {
153
153
  const cpuNum = parseInt(part, 10)
154
154
 
155
- if (!availableCPUSet.has(cpuNum)) {
155
+ if (!availableCPUSet.has(cpuNum) && availableCPUs.length) {
156
156
  const availableList =
157
157
  availableCPUs.length > 0
158
158
  ? groupConsecutiveNumbers(availableCPUs.sort((a, b) => a - b))
@@ -189,7 +189,7 @@ export const validateAffinityInput = (
189
189
  }
190
190
 
191
191
  // Проверяем доступность начала диапазона
192
- if (!availableCPUSet.has(start)) {
192
+ if (!availableCPUSet.has(start) && availableCPUs.length) {
193
193
  const availableList =
194
194
  availableCPUs.length > 0
195
195
  ? availableCPUs.sort((a, b) => a - b).join(', ')
@@ -204,7 +204,7 @@ export const validateAffinityInput = (
204
204
  }
205
205
 
206
206
  // Проверяем доступность конца диапазона
207
- if (!availableCPUSet.has(end)) {
207
+ if (!availableCPUSet.has(end) && availableCPUs.length) {
208
208
  const availableList =
209
209
  availableCPUs.length > 0
210
210
  ? availableCPUs.sort((a, b) => a - b).join(', ')
@@ -221,7 +221,7 @@ export const validateAffinityInput = (
221
221
  // Проверяем все процессоры в диапазоне
222
222
  let hasInvalidInRange = false
223
223
  for (let cpu = start; cpu <= end; cpu++) {
224
- if (!availableCPUSet.has(cpu)) {
224
+ if (!availableCPUSet.has(cpu) && availableCPUs.length) {
225
225
  const availableList =
226
226
  availableCPUs.length > 0
227
227
  ? availableCPUs.sort((a, b) => a - b).join(', ')
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.847",
4
+ "version": "1.5.848",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",