bfg-common 1.5.78 → 1.5.80

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.
@@ -85,12 +85,18 @@ const validationFunc = async (
85
85
  ): Promise<UI_I_ValidationReturn> => {
86
86
  let stepHasError = false
87
87
 
88
- if (wizard.isValidateForStep(2, currentStep.id, nextStep.id)) {
88
+ if (
89
+ wizard.isValidateForStep(
90
+ dynamicSteps.nameAndDevice,
91
+ currentStep.id,
92
+ nextStep.id
93
+ )
94
+ ) {
89
95
  const nameValidation = await validation.checkDatastoreNameAsync(
90
96
  localization.value,
91
97
  value,
92
98
  form.value,
93
- 2,
99
+ dynamicSteps.nameAndDevice,
94
100
  'datastoreName',
95
101
  wizard,
96
102
  props.project
@@ -18,8 +18,13 @@
18
18
  >
19
19
  <template #subTitle>
20
20
  <div ref="subTitleBlock0">
21
- <div class="subtitle-block">
21
+ <div class="subtitle-block flex-row">
22
22
  <ui-wizard-subtitle :sub-title="selectedStep.subTitle" />
23
+
24
+ <common-wizards-datastore-add-steps-common-tooltip-info
25
+ id="datastore-type-subtitle-tooltip"
26
+ :description="localization.common.datastoreTypeHelpDesc"
27
+ />
23
28
  </div>
24
29
  </div>
25
30
  </template>
@@ -90,7 +95,6 @@
90
95
  v-model="formModelLocal"
91
96
  :project="props.project"
92
97
  :messages-fields="selectedStep.fields"
93
- @hide-alert="(e) => emits('hide-alert', e)"
94
98
  />
95
99
  </template>
96
100
  </ui-wizard-block>
@@ -252,6 +256,10 @@ const onCreateDatastore = (): void => emits('submit')
252
256
  border-bottom: 1px solid var(--wizard-line);
253
257
  padding-bottom: 12px;
254
258
 
259
+ &.flex-row {
260
+ flex-direction: row;
261
+ }
262
+
255
263
  :deep(&__alert) {
256
264
  padding: 10px 12px;
257
265
  }
@@ -83,14 +83,14 @@ export const checkSelectedLunDiskSync = (
83
83
  if (!lunDisk.length && name) {
84
84
  const isErrorTextForSphere =
85
85
  project === 'sphere' && !hostId && !hosts.length
86
- stepHasError = wizard.setValidation(2, 'lunDisk', {
86
+ stepHasError = wizard.setValidation(dynamicSteps.nameAndDevice, 'lunDisk', {
87
87
  fieldMessage: '',
88
88
  alertMessage: isErrorTextForSphere
89
89
  ? localization.common.selectHostToContinueAlert
90
90
  : localization.common.selectDiskToContinueAlert,
91
91
  })
92
- } else if (wizard.hasMessage(2, 'lunDisk')) {
93
- value = wizard.removeValidation(2, 'lunDisk', value)
92
+ } else if (wizard.hasMessage(dynamicSteps.nameAndDevice, 'lunDisk')) {
93
+ value = wizard.removeValidation(dynamicSteps.nameAndDevice, 'lunDisk', value)
94
94
  }
95
95
 
96
96
  return {
@@ -1,22 +1,23 @@
1
1
  <template>
2
2
  <div class="tooltip-info">
3
3
  <ui-icon
4
- :id="`task-error-info-icon-${props.id}`"
4
+ :id="`${props.id}-info-trigger`"
5
5
  name="info"
6
- width="16px"
7
- height="16px"
8
- :class="['info-icon pointer', { show: isShowInfo }]"
9
- @click.stop="emits('toggle-error', props.id)"
6
+ width="16"
7
+ height="16"
8
+ :class="['tooltip-info__icon pointer', { active: isShowInfo }]"
9
+ @click.stop="isShowInfo = !isShowInfo"
10
10
  />
11
11
  <ui-popup-window
12
12
  v-model="isShowInfo"
13
13
  top
14
14
  left
15
- :elem-id="`task-error-info-icon-${props.id}`"
15
+ width="272px"
16
+ :elem-id="`${props.id}-info-trigger`"
16
17
  >
17
18
  <div class="common-widget-info">
18
- <div class="headline justify-between flex-align-center">
19
- <div class="flex-align-center">
19
+ <div class="flex justify-between">
20
+ <div class="flex">
20
21
  <ui-icon name="info-2" width="16px" height="16px" />
21
22
  <span class="title"> {{ localization.common.information }}</span>
22
23
  </div>
@@ -25,12 +26,12 @@
25
26
  class="pointer hide-icon"
26
27
  width="16px"
27
28
  height="16px"
28
- @click.stop="emits('toggle-error', '')"
29
+ @click.stop="isShowInfo = false"
29
30
  />
30
31
  </div>
31
32
 
32
33
  <div class="common-widget-info-description">
33
- {{ props.info }}
34
+ {{ props.description }}
34
35
  </div>
35
36
  </div>
36
37
  </ui-popup-window>
@@ -40,46 +41,31 @@
40
41
  <script lang="ts" setup>
41
42
  import type { UI_I_Localization } from '~/lib/models/interfaces'
42
43
 
43
- const props = withDefaults(
44
- defineProps<{
45
- id: string
46
- info: string
47
- openedError: string
48
- }>(),
49
- {}
50
- )
44
+ const props = defineProps<{
45
+ id: string
46
+ description: string
47
+ }>()
51
48
 
52
49
  const localization = computed<UI_I_Localization>(() => useLocal())
53
50
 
54
- const emits = defineEmits<{
55
- (event: 'toggle-error', value: string): void
56
- }>()
57
-
58
- const isShowInfo = computed<boolean>({
59
- get() {
60
- return props.openedError === props.id
61
- },
62
- set() {
63
- emits('toggle-error', '')
64
- },
65
- })
51
+ const isShowInfo = ref<boolean>(false)
66
52
  </script>
67
53
 
68
54
  <style lang="scss" scoped>
55
+ @import 'assets/scss/common/mixins.scss';
69
56
  .tooltip-info {
70
- .info-icon {
57
+ @include flex($align: center);
58
+ &__icon {
71
59
  color: var(--form-icon-color);
72
-
73
60
  &:hover {
74
61
  color: var(--close-icon);
75
62
  }
76
- &.show {
63
+ &.active {
77
64
  color: var(--btn-primary-fill-bg-color);
78
65
  }
79
66
  }
80
67
 
81
68
  .common-widget-info {
82
- width: 232px;
83
69
  padding: 16px;
84
70
 
85
71
  .title {
@@ -90,15 +76,17 @@ const isShowInfo = computed<boolean>({
90
76
  margin-left: 8px;
91
77
  }
92
78
 
93
- .hide-icon {
94
- color: var(--alert-icon);
95
- }
96
-
97
79
  .common-widget-info-description {
98
80
  font-size: 13px;
99
81
  line-height: 15.73px;
100
82
  color: var(--zabbix-text-color);
101
83
  margin-top: 12px;
84
+ white-space: pre-line;
85
+ }
86
+
87
+ svg {
88
+ color: var(--alert-icon);
89
+ min-width: 16px;
102
90
  }
103
91
  }
104
92
  }
@@ -8,20 +8,66 @@
8
8
  </div>
9
9
  <div class="basics-step-row-content">
10
10
  <ui-input
11
- id="name"
11
+ id="configuration-name-input"
12
12
  v-model="formModelLocal.name"
13
- test-id="new-host-name-field"
14
- :placeholder="localization.common.hostNameOrIPAddress"
13
+ test-id="configuration-name-input"
15
14
  is-focused
16
- :error="errorText"
17
- @input="onRemoveValidationErrors"
15
+ :error="nameErrorText"
16
+ @blur="initValidation(true, ['name'])"
17
+ @input="initValidation(false, ['name'])"
18
18
  />
19
19
  </div>
20
20
  </div>
21
21
 
22
22
  <div class="basics-step-line"></div>
23
23
 
24
- {{ isShowAlertInfo }}
24
+ <div class="basics-step-row">
25
+ <div class="basics-step-row-title">
26
+ <span class="basics-step-row-title-text">
27
+ {{ localization.common.folder }}
28
+ </span>
29
+ <common-wizards-datastore-add-steps-common-tooltip-info
30
+ :id="'option.testId'"
31
+ :description="'Specify the folder path - for example, /vols/vol0/datastore-001'"
32
+ />
33
+ </div>
34
+ <div class="basics-step-row-content">
35
+ <ui-input
36
+ id="configuration-folder-input"
37
+ v-model="formModelLocal.folder"
38
+ test-id="configuration-folder-input"
39
+ placeholder="E.g: /vols/vol0/datastore-001"
40
+ :error="folderErrorText"
41
+ @blur="initValidation(true, ['folder'])"
42
+ @input="initValidation(false, ['folder'])"
43
+ />
44
+ </div>
45
+ </div>
46
+
47
+ <div class="basics-step-line"></div>
48
+
49
+ <div class="basics-step-row">
50
+ <div class="basics-step-row-title">
51
+ <span class="basics-step-row-title-text">
52
+ {{ localization.common.server }}
53
+ </span>
54
+ <common-wizards-datastore-add-steps-common-tooltip-info
55
+ :id="'option.testIdserver'"
56
+ :description="'Specify the server address - for example, nas, nas.it.com or 192.168.0.1.'"
57
+ />
58
+ </div>
59
+ <div class="basics-step-row-content">
60
+ <ui-input
61
+ id="configuration-server-input"
62
+ v-model="formModelLocal.server"
63
+ test-id="configuration-server-input"
64
+ placeholder="E.g: nas, nas.it.com or 192.168.0.1"
65
+ :error="serverErrorText"
66
+ @blur="initValidation(true, ['server'])"
67
+ @input="initValidation(false, ['server'])"
68
+ />
69
+ </div>
70
+ </div>
25
71
  </div>
26
72
  </template>
27
73
 
@@ -31,7 +77,7 @@ import type { UI_I_WizardStep } from '~/components/atoms/wizard/lib/models/inter
31
77
  import type { UI_I_CreateDatastoreForm } from '~/components/common/wizards/datastore/add/lib/models/interfaces'
32
78
 
33
79
  const formModelLocal = defineModel<UI_I_CreateDatastoreForm>({ required: true })
34
- const isShowAlertInfo = defineModel<boolean>('alertInfo', { required: true })
80
+ // const isShowAlertInfo = defineModel<boolean>('alertInfo', { required: true })
35
81
 
36
82
  const props = defineProps<{
37
83
  messagesFields: UI_I_WizardStep['fields']
@@ -42,9 +88,50 @@ const emits = defineEmits<{
42
88
 
43
89
  const localization = computed<UI_I_Localization>(() => useLocal())
44
90
 
45
- const onRemoveValidationErrors = (): void => {
46
- emits('remove-errors')
91
+ const initValidationFields = ref<UI_I_InitialValidationFields>({
92
+ name: false,
93
+ folder: false,
94
+ server: false,
95
+ })
96
+ const initValidation = (onlyBlur = false, types: string[]): void => {
97
+ onlyBlur && types.forEach((type) => (initValidationFields.value[type] = true))
47
98
  }
99
+
100
+ /* Validation error text for Name input field */
101
+ const nameErrorText = computed<string>(() => {
102
+ if (props.messagesFields?.name?.field && !formModelLocal.value.name) {
103
+ return props.messagesFields.name.field
104
+ }
105
+
106
+ if (!initValidationFields.value.name) return ''
107
+ return !formModelLocal.value.name
108
+ ? localization.value.common.specifyDatastoreName
109
+ : ''
110
+ })
111
+
112
+ /* Validation error text for Folder input field */
113
+ const folderErrorText = computed<string>(() => {
114
+ if (props.messagesFields.folder?.field && !formModelLocal.value.folder) {
115
+ return props.messagesFields.folder.field
116
+ }
117
+
118
+ if (!initValidationFields.value.folder) return ''
119
+ return !formModelLocal.value.folder
120
+ ? localization.value.common.specifyFolderName
121
+ : ''
122
+ })
123
+
124
+ /* Validation error text for Server input field */
125
+ const serverErrorText = computed<string>(() => {
126
+ if (props.messagesFields.server?.field && !formModelLocal.value.server) {
127
+ return props.messagesFields.server.field
128
+ }
129
+
130
+ if (!initValidationFields.value.server) return ''
131
+ return !formModelLocal.value.server
132
+ ? localization.value.common.specifyServerName
133
+ : ''
134
+ })
48
135
  </script>
49
136
 
50
137
  <style scoped lang="scss">
@@ -19,9 +19,7 @@
19
19
  <template #tooltip>
20
20
  <common-wizards-datastore-add-steps-common-tooltip-info
21
21
  :id="option.testId"
22
- :info="option.tooltipContent"
23
- :opened-error="openedError"
24
- @toggle-error="onToggleError"
22
+ :description="option.tooltipContent"
25
23
  />
26
24
  </template>
27
25
  </ui-radio>
@@ -39,16 +37,6 @@ const props = defineProps<{
39
37
  }>()
40
38
 
41
39
  const localization = computed<UI_I_Localization>(() => useLocal())
42
-
43
- const openedError = ref<string>('')
44
-
45
- const onToggleError = (value: string): void => {
46
- if (!value || value === openedError.value) {
47
- openedError.value = ''
48
- } else {
49
- openedError.value = value
50
- }
51
- }
52
40
  </script>
53
41
 
54
42
  <style>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.5.78",
4
+ "version": "1.5.80",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",