bfg-common 1.5.682 → 1.5.684

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,226 +1,231 @@
1
- <template>
2
- <div class="device-selection-step">
3
- <atoms-alert
4
- v-show="props.alertMessages?.length"
5
- :test-id="errorAlertDataId"
6
- :items="props.alertMessages"
7
- status="alert-danger"
8
- class="device-selection-step__alert-error"
9
- @remove="onHideAlert"
10
- />
11
-
12
- <div class="clr-form-control clr-row">
13
- <label for="" class="clr-control-label clr-col-md-2">
14
- {{ localization.common.name }}
15
- </label>
16
-
17
- <div :class="['clr-control-container', nameErrorText && 'clr-error']">
18
- <div class="flex-align-center">
19
- <input
20
- id="device-selection-input"
21
- v-model="formModelLocal.name"
22
- data-id="device-selection-input"
23
- type="text"
24
- class="clr-input"
25
- @blur="initValidation(true)"
26
- @input="initValidation(false)"
27
- />
28
- <atoms-the-icon class="error-icon" name="info-circle" />
29
- </div>
30
-
31
- <div class="clr-subtext" data-id="storm-datastore-name-field-require">
32
- {{ nameErrorText }}
33
- </div>
34
- </div>
35
- </div>
36
-
37
- <atoms-alert
38
- v-if="isShowInfoAlert && !props.hostId"
39
- :items="[localization.common.nameAndDeviceSelectionAlertInfo]"
40
- test-id="device-selection-information-alert"
41
- class="device-selection-step__alert-info"
42
- status="alert-info mb-1"
43
- @remove="isShowInfoAlert = false"
44
- />
45
-
46
- <div
47
- v-if="props.isShowSelectHost"
48
- class="clr-form-control clr-row mb-1 mt-0"
49
- >
50
- <label class="clr-control-label clr-col-12 clr-col-md-2">
51
- {{ localization.common.selectHost }}
52
- </label>
53
-
54
- <div>
55
- <div class="clr-select-wrapper">
56
- <select
57
- id="device-host-select"
58
- v-model="formModelLocal.hosts"
59
- data-id="device-host-select"
60
- class="dropdown-toggle"
61
- @change="emits('select-host')"
62
- >
63
- <option :value="[]" disabled>
64
- {{ localization.common.selectHost }}
65
- </option>
66
- <option
67
- v-for="(item, index) in hostOptions"
68
- :key="index"
69
- :value="[item.value]"
70
- :disabled="item.disabled"
71
- >
72
- {{ item.text }}
73
- </option>
74
- </select>
75
- </div>
76
- <div class="clr-subtext">
77
- {{ localization.common.selectHostToViewAccessible }}
78
- </div>
79
- </div>
80
- </div>
81
-
82
- <div class="device-selection-step__disk-list">
83
- <common-wizards-datastore-add-steps-name-and-device-table
84
- v-model="formModelLocal.dev_names"
85
- :lun-disks-data="props.lunDisksData"
86
- :pagination="props.pagination"
87
- :loading="props.loading"
88
- :is-main-filter="props.isMainFilter"
89
- @sort="emits('sort', $event)"
90
- @main-filter="emits('main-filter', $event)"
91
- />
92
- </div>
93
- </div>
94
- </template>
95
-
96
- <script lang="ts" setup>
97
- import type { UI_I_ErrorFields } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
98
- import type {
99
- UI_I_Localization,
100
- UI_I_ArbitraryObject,
101
- } from '~/lib/models/interfaces'
102
- import type { UI_I_Pagination } from '~/lib/models/table/interfaces'
103
- import type { UI_I_SelectHostOptions } from '~/components/common/wizards/datastore/add/steps/nameAndDevice/lib/models/interfaces'
104
- import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
105
- import type { UI_I_CreateStorageLunDisks } from '~/components/common/wizards/datastore/add/steps/nameAndDevice/table/lib/models/interfaces'
106
- import { validateNameAndGenerateDataId } from '~/components/common/wizards/datastore/add/lib/utils'
107
- import { dynamicSteps } from '~/components/common/wizards/datastore/add/lib/config/steps'
108
-
109
- const formModelLocal = defineModel<UI_I_CreateDatastoreForm>({ required: true })
110
- const isShowInfoAlert = defineModel<boolean>('isShowInfoAlert', {
111
- required: true,
112
- })
113
- const props = withDefaults(
114
- defineProps<{
115
- lunDisksData: UI_I_CreateStorageLunDisks | null
116
- hostOptions: UI_I_SelectHostOptions[]
117
- alertMessages: string[]
118
- messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
119
- pagination: UI_I_Pagination
120
- loading: boolean
121
- isShowSelectHost: boolean
122
- hostId?: string
123
- isMainFilter?: boolean
124
- }>(),
125
- {
126
- hostId: undefined,
127
- isMainFilter: undefined,
128
- }
129
- )
130
- const emits = defineEmits<{
131
- (event: 'select-host'): void
132
- (event: 'hide-alert', value: number): void
133
- (event: 'main-filter', value: string): void
134
- (event: 'sort', value: string): void
135
- }>()
136
-
137
- const localization = computed<UI_I_Localization>(() => useLocal())
138
-
139
- const isInitDatastoreNameValidation = ref<boolean>(false)
140
- const initValidation = (onlyBlur: boolean): void => {
141
- onlyBlur && (isInitDatastoreNameValidation.value = true)
142
- }
143
-
144
- const nameErrorText = computed<string>(() => {
145
- if (
146
- props.messagesFields?.datastoreName?.field &&
147
- !formModelLocal.value.name
148
- ) {
149
- return props.messagesFields.datastoreName.field
150
- }
151
-
152
- if (!isInitDatastoreNameValidation.value) return ''
153
- return !formModelLocal.value.name
154
- ? localization.value.common.specifyDatastoreName
155
- : ''
156
- })
157
-
158
- const defaultDataId = ref<string>('device-selection-alert-error')
159
- const errorAlertDataId = computed<string>(() => {
160
- if (!props.alertMessages?.length) return
161
-
162
- return !formModelLocal.value.dev_names.length
163
- ? `${defaultDataId.value}-not-selected-lundisk`
164
- : validateNameAndGenerateDataId(
165
- formModelLocal.value.name,
166
- props.alertMessages[0],
167
- defaultDataId.value
168
- )
169
- })
170
-
171
- const onHideAlert = (): void => {
172
- emits('hide-alert', dynamicSteps.nameAndDevice)
173
- }
174
- </script>
175
-
176
- <style lang="scss" scoped>
177
- .device-selection-step {
178
- display: flex;
179
- flex-direction: column;
180
- height: inherit;
181
- overflow-y: auto;
182
- overflow-x: hidden;
183
- &__alert-info {
184
- :deep(.alert-text) {
185
- font-size: 11px;
186
- letter-spacing: normal;
187
- }
188
- }
189
- &__alert-error {
190
- :deep(.alert-text) {
191
- word-break: break-word;
192
- }
193
- }
194
- .dropdown-toggle {
195
- min-width: 160px;
196
- }
197
- .clr-form-control {
198
- display: flex;
199
- flex-direction: row;
200
-
201
- .clr-control-container {
202
- min-height: 48px;
203
- &.clr-error {
204
- .clr-subtext,
205
- .error-icon {
206
- display: block;
207
- }
208
- }
209
- .clr-subtext,
210
- .error-icon {
211
- display: none;
212
- }
213
- .error-icon {
214
- fill: #db2100;
215
- width: 24px;
216
- height: 24px;
217
- }
218
- }
219
- }
220
- &__disk-list {
221
- display: flex;
222
- flex-direction: column;
223
- height: 100%;
224
- }
225
- }
226
- </style>
1
+ <template>
2
+ <div class="device-selection-step">
3
+ <atoms-alert
4
+ v-show="props.alertMessages?.length"
5
+ :test-id="errorAlertDataId"
6
+ :items="props.alertMessages"
7
+ status="alert-danger"
8
+ class="device-selection-step__alert-error"
9
+ @remove="onHideAlert"
10
+ />
11
+
12
+ <div class="clr-form-control clr-row">
13
+ <label for="" class="clr-control-label clr-col-md-2">
14
+ {{ localization.common.name }}
15
+ </label>
16
+
17
+ <div :class="['clr-control-container', nameErrorText && 'clr-error']">
18
+ <div class="flex-align-center">
19
+ <input
20
+ id="device-selection-input"
21
+ v-model="formModelLocal.name"
22
+ data-id="device-selection-input"
23
+ type="text"
24
+ class="clr-input"
25
+ @blur="initValidation(true)"
26
+ @input="initValidation(false)"
27
+ />
28
+ <atoms-the-icon class="error-icon" name="info-circle" />
29
+ </div>
30
+
31
+ <div class="clr-subtext" data-id="storm-datastore-name-field-require">
32
+ {{ nameErrorText }}
33
+ </div>
34
+ </div>
35
+ </div>
36
+
37
+ <atoms-alert
38
+ v-if="isShowInfoAlert && !props.hostId"
39
+ :items="[localization.common.nameAndDeviceSelectionAlertInfo]"
40
+ test-id="device-selection-information-alert"
41
+ class="device-selection-step__alert-info"
42
+ status="alert-info mb-1"
43
+ @remove="isShowInfoAlert = false"
44
+ />
45
+
46
+ <div
47
+ v-if="props.isShowSelectHost"
48
+ class="clr-form-control clr-row mb-1 mt-0"
49
+ >
50
+ <label class="clr-control-label clr-col-12 clr-col-md-2">
51
+ {{ localization.common.selectHost }}
52
+ </label>
53
+
54
+ <div>
55
+ <div class="clr-select-wrapper">
56
+ <select
57
+ id="device-host-select"
58
+ v-model="formModelLocal.hosts"
59
+ data-id="device-host-select"
60
+ class="dropdown-toggle"
61
+ @change="emits('select-host')"
62
+ >
63
+ <option :value="[]" disabled>
64
+ {{ localization.common.selectHost }}
65
+ </option>
66
+ <option
67
+ v-for="(item, index) in hostOptions"
68
+ :key="index"
69
+ :value="[item.value]"
70
+ :disabled="item.disabled"
71
+ >
72
+ {{ item.text }}
73
+ </option>
74
+ </select>
75
+ </div>
76
+ <div class="clr-subtext">
77
+ {{ localization.common.selectHostToViewAccessible }}
78
+ </div>
79
+ </div>
80
+ </div>
81
+
82
+ <div class="device-selection-step__disk-list">
83
+ <common-wizards-datastore-add-steps-name-and-device-table
84
+ v-model="formModelLocal.dev_names"
85
+ :lun-disks-data="props.lunDisksData"
86
+ :pagination="props.pagination"
87
+ :loading="props.loading"
88
+ :is-main-filter="props.isMainFilter"
89
+ @sort="emits('sort', $event)"
90
+ @main-filter="emits('main-filter', $event)"
91
+ />
92
+ </div>
93
+
94
+ <common-wizards-datastore-add-steps-name-and-device-advanced-options
95
+ v-model="formModelLocal.level"
96
+ :dev-names-count="formModelLocal.dev_names.length"
97
+ />
98
+ </div>
99
+ </template>
100
+
101
+ <script lang="ts" setup>
102
+ import type { UI_I_ErrorFields } from '~/node_modules/bfg-uikit/components/ui/wizard/lib/models/interfaces'
103
+ import type {
104
+ UI_I_Localization,
105
+ UI_I_ArbitraryObject,
106
+ } from '~/lib/models/interfaces'
107
+ import type { UI_I_Pagination } from '~/lib/models/table/interfaces'
108
+ import type { UI_I_SelectHostOptions } from '~/components/common/wizards/datastore/add/steps/nameAndDevice/lib/models/interfaces'
109
+ import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
110
+ import type { UI_I_CreateStorageLunDisks } from '~/components/common/wizards/datastore/add/steps/nameAndDevice/table/lib/models/interfaces'
111
+ import { validateNameAndGenerateDataId } from '~/components/common/wizards/datastore/add/lib/utils'
112
+ import { dynamicSteps } from '~/components/common/wizards/datastore/add/lib/config/steps'
113
+
114
+ const formModelLocal = defineModel<UI_I_CreateDatastoreForm>({ required: true })
115
+ const isShowInfoAlert = defineModel<boolean>('isShowInfoAlert', {
116
+ required: true,
117
+ })
118
+ const props = withDefaults(
119
+ defineProps<{
120
+ lunDisksData: UI_I_CreateStorageLunDisks | null
121
+ hostOptions: UI_I_SelectHostOptions[]
122
+ alertMessages: string[]
123
+ messagesFields: UI_I_ArbitraryObject<UI_I_ErrorFields>
124
+ pagination: UI_I_Pagination
125
+ loading: boolean
126
+ isShowSelectHost: boolean
127
+ hostId?: string
128
+ isMainFilter?: boolean
129
+ }>(),
130
+ {
131
+ hostId: undefined,
132
+ isMainFilter: undefined,
133
+ }
134
+ )
135
+ const emits = defineEmits<{
136
+ (event: 'select-host'): void
137
+ (event: 'hide-alert', value: number): void
138
+ (event: 'main-filter', value: string): void
139
+ (event: 'sort', value: string): void
140
+ }>()
141
+
142
+ const localization = computed<UI_I_Localization>(() => useLocal())
143
+
144
+ const isInitDatastoreNameValidation = ref<boolean>(false)
145
+ const initValidation = (onlyBlur: boolean): void => {
146
+ onlyBlur && (isInitDatastoreNameValidation.value = true)
147
+ }
148
+
149
+ const nameErrorText = computed<string>(() => {
150
+ if (
151
+ props.messagesFields?.datastoreName?.field &&
152
+ !formModelLocal.value.name
153
+ ) {
154
+ return props.messagesFields.datastoreName.field
155
+ }
156
+
157
+ if (!isInitDatastoreNameValidation.value) return ''
158
+ return !formModelLocal.value.name
159
+ ? localization.value.common.specifyDatastoreName
160
+ : ''
161
+ })
162
+
163
+ const defaultDataId = ref<string>('device-selection-alert-error')
164
+ const errorAlertDataId = computed<string>(() => {
165
+ if (!props.alertMessages?.length) return
166
+
167
+ return !formModelLocal.value.dev_names.length
168
+ ? `${defaultDataId.value}-not-selected-lundisk`
169
+ : validateNameAndGenerateDataId(
170
+ formModelLocal.value.name,
171
+ props.alertMessages[0],
172
+ defaultDataId.value
173
+ )
174
+ })
175
+
176
+ const onHideAlert = (): void => {
177
+ emits('hide-alert', dynamicSteps.nameAndDevice)
178
+ }
179
+ </script>
180
+
181
+ <style lang="scss" scoped>
182
+ .device-selection-step {
183
+ display: flex;
184
+ flex-direction: column;
185
+ height: inherit;
186
+ overflow-y: auto;
187
+ overflow-x: hidden;
188
+ &__alert-info {
189
+ :deep(.alert-text) {
190
+ font-size: 11px;
191
+ letter-spacing: normal;
192
+ }
193
+ }
194
+ &__alert-error {
195
+ :deep(.alert-text) {
196
+ word-break: break-word;
197
+ }
198
+ }
199
+ .dropdown-toggle {
200
+ min-width: 160px;
201
+ }
202
+ .clr-form-control {
203
+ display: flex;
204
+ flex-direction: row;
205
+
206
+ .clr-control-container {
207
+ min-height: 48px;
208
+ &.clr-error {
209
+ .clr-subtext,
210
+ .error-icon {
211
+ display: block;
212
+ }
213
+ }
214
+ .clr-subtext,
215
+ .error-icon {
216
+ display: none;
217
+ }
218
+ .error-icon {
219
+ fill: #db2100;
220
+ width: 24px;
221
+ height: 24px;
222
+ }
223
+ }
224
+ }
225
+ &__disk-list {
226
+ display: flex;
227
+ flex-direction: column;
228
+ height: 100%;
229
+ }
230
+ }
231
+ </style>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <component
3
+ :is="currentComponent"
4
+ v-model="model"
5
+ :dev-names-count="props.devNamesCount"
6
+ />
7
+ </template>
8
+
9
+ <script setup lang="ts">
10
+ import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
11
+
12
+ const { $store }: any = useNuxtApp()
13
+
14
+ const model = defineModel<UI_I_CreateDatastoreForm['level']>({ required: true })
15
+
16
+ const props = defineProps<{
17
+ devNamesCount: number
18
+ }>()
19
+
20
+ const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
21
+ const currentComponent = computed(() =>
22
+ isNewView.value
23
+ ? defineAsyncComponent(() => import('./New.vue'))
24
+ : defineAsyncComponent(() => import('./Old.vue'))
25
+ )
26
+
27
+ watch(
28
+ () => props.devNamesCount,
29
+ (newValue) => {
30
+ if (newValue < 2) {
31
+ if (model.value !== 'linear') model.value = 'linear'
32
+ } else if (newValue < 3) {
33
+ if (!['linear', 'raid0', 'raid1'].includes(model.value))
34
+ model.value = 'linear'
35
+ } else if (newValue < 4) {
36
+ if (!['linear', 'raid0', 'raid1', 'raid5'].includes(model.value))
37
+ model.value = 'linear'
38
+ }
39
+ }
40
+ )
41
+ </script>
42
+
43
+ <style scoped lang="scss"></style>
@@ -0,0 +1,101 @@
1
+ <template>
2
+ <div class="advanced-options-wrap clr-form-control">
3
+ <b class="advanced-options-label">
4
+ {{ localization.common.advancedOptions }}
5
+ </b>
6
+ <div class="advanced-options compact">
7
+ <div class="radio">
8
+ <input
9
+ v-model="model"
10
+ id="advanced-option-liner"
11
+ data-id="advanced-option-liner"
12
+ type="radio"
13
+ value="linear"
14
+ />
15
+ <label for="advanced-option-liner"> Linear </label>
16
+ </div>
17
+ <div :class="['radio', { disabled: props.devNamesCount < 2 }]">
18
+ <input
19
+ v-model="model"
20
+ id="advanced-option-raid0"
21
+ :disabled="props.devNamesCount < 2"
22
+ data-id="advanced-option-raid0"
23
+ type="radio"
24
+ value="raid0"
25
+ />
26
+ <label for="advanced-option-raid0"> Raid0 </label>
27
+ </div>
28
+ <div :class="['radio', { disabled: props.devNamesCount < 2 }]">
29
+ <input
30
+ v-model="model"
31
+ id="advanced-option-raid1"
32
+ :disabled="props.devNamesCount < 2"
33
+ data-id="advanced-option-raid1"
34
+ type="radio"
35
+ value="raid1"
36
+ />
37
+ <label for="advanced-option-raid1"> Raid1 </label>
38
+ </div>
39
+ <div :class="['radio', { disabled: props.devNamesCount < 3 }]">
40
+ <input
41
+ v-model="model"
42
+ id="advanced-option-raid5"
43
+ :disabled="props.devNamesCount < 3"
44
+ data-id="advanced-option-raid5"
45
+ type="radio"
46
+ value="raid5"
47
+ />
48
+ <label for="advanced-option-raid5"> Raid5 </label>
49
+ </div>
50
+ <div :class="['radio', { disabled: props.devNamesCount < 4 }]">
51
+ <input
52
+ v-model="model"
53
+ id="advanced-option-raid6"
54
+ :disabled="props.devNamesCount < 4"
55
+ data-id="advanced-option-raid6"
56
+ type="radio"
57
+ value="raid6"
58
+ />
59
+ <label for="advanced-option-raid6"> Raid6 </label>
60
+ </div>
61
+ <div :class="['radio', { disabled: props.devNamesCount < 4 }]">
62
+ <input
63
+ v-model="model"
64
+ id="advanced-option-raid10"
65
+ :disabled="props.devNamesCount < 4"
66
+ data-id="advanced-option-raid10"
67
+ type="radio"
68
+ value="raid10"
69
+ />
70
+ <label for="advanced-option-raid10"> Raid10 </label>
71
+ </div>
72
+ </div>
73
+ </div>
74
+ </template>
75
+
76
+ <script setup lang="ts">
77
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
78
+ import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
79
+
80
+ const model = defineModel<UI_I_CreateDatastoreForm['level']>({ required: true })
81
+
82
+ const props = defineProps<{
83
+ devNamesCount: number
84
+ }>()
85
+
86
+ const localization = computed<UI_I_Localization>(() => useLocal())
87
+ </script>
88
+
89
+ <style scoped lang="scss">
90
+ .advanced-options-wrap {
91
+ display: flex;
92
+ gap: 10px;
93
+ .radio {
94
+ margin-bottom: 5px;
95
+ }
96
+ input[type='radio']:focus:checked + label::before,
97
+ input[type='radio']:focus + label::before {
98
+ box-shadow: inset 0 0 0 0.25rem #0094d2;
99
+ }
100
+ }
101
+ </style>