bfg-common 1.0.13 → 1.0.15

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.
Files changed (84) hide show
  1. package/components/atoms/alert/Notification.vue +167 -167
  2. package/components/atoms/autocomplete/Autocomplete.vue +236 -236
  3. package/components/atoms/combobox/Combobox.vue +131 -131
  4. package/components/atoms/datepicker/Datepicker.vue +612 -612
  5. package/components/atoms/dropdown/tree/Tree.vue +134 -134
  6. package/components/atoms/list/SelectList.vue +62 -62
  7. package/components/atoms/modal/bySteps/BySteps.vue +234 -234
  8. package/components/atoms/modal/byStepsSecond/ByStepsSecond.vue +174 -174
  9. package/components/atoms/nav/NavBar.vue +116 -116
  10. package/components/atoms/nav/VerticalNavBar.vue +89 -89
  11. package/components/atoms/notificationBar/NotificationBar.vue +175 -175
  12. package/components/atoms/perPage/PerPage.vue +52 -52
  13. package/components/atoms/popup/SimplePopup.vue +90 -90
  14. package/components/atoms/step/VerticalStep.vue +104 -104
  15. package/components/atoms/switch/Switch.vue +107 -107
  16. package/components/atoms/table/dataGrid/DataGridColumnSwitch.vue +204 -204
  17. package/components/atoms/table/dataGrid/DataGridPage.vue +189 -189
  18. package/components/atoms/table/dataGrid/DataGridPagination.vue +83 -83
  19. package/components/atoms/table/dataGrid/config/itemsPerPage.ts +20 -20
  20. package/components/atoms/tabs/Tabs.vue +189 -189
  21. package/components/atoms/tooltip/Signpost.vue +224 -224
  22. package/components/common/accordion/Accordion.vue +176 -176
  23. package/components/common/accordion/Recursion.vue +195 -195
  24. package/components/common/adapterManager/AddAdapterWarningModal.vue +82 -82
  25. package/components/common/adapterManager/NoActiveAdaptersModal.vue +62 -62
  26. package/components/common/adapterManager/NoConnectedActiveAdaptersModal.vue +62 -62
  27. package/components/common/browse/Browse.vue +182 -182
  28. package/components/common/browse/blocks/Title.vue +66 -66
  29. package/components/common/diagramMain/Header.vue +160 -160
  30. package/components/common/diagramMain/adapter/AdapterItem.vue +227 -227
  31. package/components/common/diagramMain/adapter/AdapterItems.vue +57 -57
  32. package/components/common/diagramMain/modals/ManagePhysicalAdaptersModal.vue +236 -236
  33. package/components/common/diagramMain/modals/editSettings/tabs/Security.vue +178 -178
  34. package/components/common/diagramMain/modals/editSettings/tabs/TrafficShaping.vue +392 -392
  35. package/components/common/diagramMain/modals/editSettings/tabs/port/IpvFourSettings.vue +339 -339
  36. package/components/common/diagramMain/modals/editSettings/tabs/port/PortProperties.vue +202 -202
  37. package/components/common/diagramMain/modals/remove/RemoveModal.vue +226 -226
  38. package/components/common/diagramMain/modals/viewSettings/Info.vue +94 -94
  39. package/components/common/diagramMain/network/Contents.vue +238 -238
  40. package/components/common/feedback/Buttons.vue +232 -232
  41. package/components/common/feedback/Message.vue +468 -468
  42. package/components/common/feedback/VisitPortal.vue +54 -54
  43. package/components/common/modals/Rename.vue +165 -165
  44. package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/Form.vue +388 -388
  45. package/components/common/monitor/models/interfaces.ts +1 -0
  46. package/components/common/perPage/PerPage.vue +51 -51
  47. package/components/common/recursionTree/RecursionTree.vue +201 -201
  48. package/components/common/vm/actions/add/Add.vue +687 -687
  49. package/components/common/vm/actions/add/FolderTreeView.vue +83 -83
  50. package/components/common/vm/actions/add/config/capabilities.ts +670 -670
  51. package/components/common/vm/actions/add/customizeHardware/CustomizeHardware.vue +1 -1
  52. package/components/common/vm/actions/add/customizeHardware/virtualHardware/VirtualHardware.vue +1 -1
  53. package/components/common/vm/actions/add/customizeHardware/virtualHardware/browseView/BrowseView.vue +203 -203
  54. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cdDvdDrive/media/Media.vue +55 -55
  55. package/components/common/vm/actions/add/customizeHardware/virtualHardware/cpu/Sa.vue +102 -102
  56. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/NewHardDisk.vue +447 -447
  57. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newHardDisk/limitIops/LimitIops.vue +147 -147
  58. package/components/common/vm/actions/add/customizeHardware/virtualHardware/newNetwork/adapterType/AdapterType.vue +86 -86
  59. package/components/common/vm/actions/add/customizeHardware/vmoptions/generalOptions/GeneralOptions.vue +114 -114
  60. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/keymap/Keymap.vue +50 -50
  61. package/components/common/vm/actions/add/customizeHardware/vmoptions/remoteConsoleOptions/mouseMode/MouseMode.vue +52 -52
  62. package/components/common/vm/actions/add/select/compatibility/Compatibility.vue +151 -151
  63. package/components/common/vm/actions/add/select/computeResource/ComputeResource.vue +170 -170
  64. package/components/common/vm/actions/add/select/computeResource/TreeView.vue +126 -126
  65. package/components/common/vm/actions/add/select/name/Name.vue +173 -173
  66. package/components/common/vm/actions/add/select/os/os.vue +221 -221
  67. package/components/common/vm/actions/add/utils.ts +118 -118
  68. package/components/common/wizards/datastore/add/nfs/accessibility/tablesView/TablesView.vue +141 -141
  69. package/components/common/wizards/datastore/add/nfs/configuration/Configuration.vue +373 -373
  70. package/components/common/wizards/datastore/add/nfs/configuration/serversList/ServersList.vue +123 -123
  71. package/components/common/wizards/datastore/add/nfs/kerberosAuthentication/KerberosAuthentication.vue +54 -54
  72. package/components/common/wizards/datastore/add/sharedStorm/deviceSelection/hostTable/HostTable.vue +131 -131
  73. package/components/common/wizards/datastore/add/sharedStorm/partitionConfiguration/PartitionConfiguration.vue +230 -230
  74. package/models/store/storage/interfaces.ts +32 -32
  75. package/package.json +1 -1
  76. package/plugins/recursion.ts +230 -230
  77. package/public/spice-console/application/codec.js +257 -257
  78. package/public/spice-console/lib/rasterEngine.js +907 -907
  79. package/public/spice-console-minify/lib/decoder/dixie.min.js +4 -4
  80. package/public/spice-console-minify/lib/jgestures.min.js +24 -24
  81. package/public/spice-console-minify/lib/jquery-2.0.3.min.js +24 -24
  82. package/public/spice-console-minify/lib/jquery-mousewheel.min.js +11 -11
  83. package/public/spice-console-minify/lib/jquery-visibility.min.js +1 -1
  84. package/public/spice-console-minify/lib/lodash.4.0.0.min.js +5 -5
@@ -1,151 +1,151 @@
1
- <template>
2
- <div class="select-compatibility">
3
- <p class="select-compatibility-block">
4
- {{
5
- localization.hostSupportsMoreVirtualMachineVersionSelectCompatibilityVirtualMachine
6
- }}
7
- </p>
8
- <div class="select-compatibility-block version-select-wrap">
9
- <label for="version-select">{{ localization.compatibleWith }}:</label>
10
-
11
- <atoms-tooltip-error
12
- :has-error="!!apiError"
13
- selector="#vm-wizard-version-select"
14
- @remove="onRemoveValidationError"
15
- >
16
- <template #elem>
17
- <select id="vm-wizard-version-select" v-model="selectedVersion">
18
- <option v-for="(item, key) in versions" :key="key" :value="item">
19
- {{ item.text }}
20
- </option>
21
- </select>
22
- </template>
23
- <template #content>{{ apiError }}</template>
24
- </atoms-tooltip-error>
25
- <div id="version-select-help-icon" class="flex-align-center relative">
26
- <atoms-the-icon
27
- fill="#0072a3"
28
- width="24px"
29
- height="24px"
30
- name="info-circle"
31
- @click="isShowHelp = !isShowHelp"
32
- />
33
- <atoms-tooltip-signpost
34
- v-if="isShowHelp"
35
- elem-id="version-select-help-icon"
36
- @hide="isShowHelp = false"
37
- >
38
- <h3 class="help-title">{{ localization.help }}</h3>
39
-
40
- <p>
41
- {{
42
- localization.eachVirtualMachineCompatibilitySettingIncludesHardwareAvailableVirtualMachine
43
- }}
44
- </p>
45
-
46
- <a id="more-information-link" class="pointer">{{
47
- localization.moreInformation
48
- }}</a>
49
- </atoms-tooltip-signpost>
50
- </div>
51
- </div>
52
- <p class="select-compatibility-block">
53
- {{ versionDescription }}
54
- </p>
55
- </div>
56
- </template>
57
-
58
- <script setup lang="ts">
59
- import { UI_I_Localization } from '~/models/interfaces'
60
- import { UI_I_ErrorValidationField } from '~/models/store/interfaces'
61
- import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
62
-
63
- const props = defineProps<{
64
- options: UI_I_OptionItem[]
65
- errorValidationFields: UI_I_ErrorValidationField<string>[]
66
- }>()
67
- const emits = defineEmits<{
68
- (event: 'change', value: UI_I_OptionItem): void
69
- (event: 'remove-error-by-title', value: string): void
70
- }>()
71
-
72
- const localization = computed<UI_I_Localization>(() => useLocal())
73
-
74
- const versions = ref<UI_I_OptionItem[]>(props.options)
75
- const selectedVersion = ref<UI_I_OptionItem | null>(null)
76
- watch(
77
- () => props.options,
78
- (val) => {
79
- versions.value = [...val]
80
- selectedVersion.value = val[0]
81
- },
82
- { immediate: true }
83
- )
84
-
85
- const versionDescription = computed<string>(() => {
86
- if (!selectedVersion.value) return ''
87
-
88
- const version = selectedVersion.value.value.split('-')[1]
89
- const text = selectedVersion.value.text
90
-
91
- if (selectedVersion.value === versions.value.at(-1)) {
92
- return localization.value.virtualMachineUsesHardwareVersionAvailable
93
- .replace('{0}', version)
94
- .replace('{1}', text)
95
- }
96
-
97
- return localization.value.virtualMachineUsesHardwareVersionUnavailable
98
- .replace('{0}', version)
99
- .replace('{1}', text)
100
- })
101
-
102
- watch(
103
- selectedVersion,
104
- (val) => {
105
- if (!val) return
106
- emits('change', val)
107
- },
108
- { immediate: true }
109
- )
110
-
111
- const isShowHelp = ref(false)
112
-
113
- const apiError = computed<string>(() => {
114
- return (
115
- props.errorValidationFields?.find(
116
- (message) => message.field === 'compatibility'
117
- )?.error_message || ''
118
- )
119
- })
120
-
121
- const onRemoveValidationError = (): void => {
122
- emits('remove-error-by-title', 'compatibility')
123
- }
124
- </script>
125
-
126
- <style scoped lang="scss">
127
- .select-compatibility-block {
128
- margin-top: 12px;
129
- font-size: 13px;
130
-
131
- &.version-select-wrap {
132
- display: flex;
133
- align-items: center;
134
- gap: 6px;
135
-
136
- #version-select-help-icon {
137
- .help-title {
138
- font-size: 22px;
139
- }
140
-
141
- p {
142
- width: 200px;
143
- }
144
-
145
- a {
146
- color: #0072a3;
147
- }
148
- }
149
- }
150
- }
151
- </style>
1
+ <template>
2
+ <div class="select-compatibility">
3
+ <p class="select-compatibility-block">
4
+ {{
5
+ localization.hostSupportsMoreVirtualMachineVersionSelectCompatibilityVirtualMachine
6
+ }}
7
+ </p>
8
+ <div class="select-compatibility-block version-select-wrap">
9
+ <label for="version-select">{{ localization.compatibleWith }}:</label>
10
+
11
+ <atoms-tooltip-error
12
+ :has-error="!!apiError"
13
+ selector="#vm-wizard-version-select"
14
+ @remove="onRemoveValidationError"
15
+ >
16
+ <template #elem>
17
+ <select id="vm-wizard-version-select" v-model="selectedVersion">
18
+ <option v-for="(item, key) in versions" :key="key" :value="item">
19
+ {{ item.text }}
20
+ </option>
21
+ </select>
22
+ </template>
23
+ <template #content>{{ apiError }}</template>
24
+ </atoms-tooltip-error>
25
+ <div id="version-select-help-icon" class="flex-align-center relative">
26
+ <atoms-the-icon
27
+ fill="#0072a3"
28
+ width="24px"
29
+ height="24px"
30
+ name="info-circle"
31
+ @click="isShowHelp = !isShowHelp"
32
+ />
33
+ <atoms-tooltip-signpost
34
+ v-if="isShowHelp"
35
+ elem-id="version-select-help-icon"
36
+ @hide="isShowHelp = false"
37
+ >
38
+ <h3 class="help-title">{{ localization.help }}</h3>
39
+
40
+ <p>
41
+ {{
42
+ localization.eachVirtualMachineCompatibilitySettingIncludesHardwareAvailableVirtualMachine
43
+ }}
44
+ </p>
45
+
46
+ <a id="more-information-link" class="pointer">{{
47
+ localization.moreInformation
48
+ }}</a>
49
+ </atoms-tooltip-signpost>
50
+ </div>
51
+ </div>
52
+ <p class="select-compatibility-block">
53
+ {{ versionDescription }}
54
+ </p>
55
+ </div>
56
+ </template>
57
+
58
+ <script setup lang="ts">
59
+ import { UI_I_Localization } from '~/models/interfaces'
60
+ import { UI_I_ErrorValidationField } from '~/models/store/interfaces'
61
+ import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
62
+
63
+ const props = defineProps<{
64
+ options: UI_I_OptionItem[]
65
+ errorValidationFields: UI_I_ErrorValidationField<string>[]
66
+ }>()
67
+ const emits = defineEmits<{
68
+ (event: 'change', value: UI_I_OptionItem): void
69
+ (event: 'remove-error-by-title', value: string): void
70
+ }>()
71
+
72
+ const localization = computed<UI_I_Localization>(() => useLocal())
73
+
74
+ const versions = ref<UI_I_OptionItem[]>(props.options)
75
+ const selectedVersion = ref<UI_I_OptionItem | null>(null)
76
+ watch(
77
+ () => props.options,
78
+ (val) => {
79
+ versions.value = [...val]
80
+ selectedVersion.value = val[0]
81
+ },
82
+ { immediate: true }
83
+ )
84
+
85
+ const versionDescription = computed<string>(() => {
86
+ if (!selectedVersion.value) return ''
87
+
88
+ const version = selectedVersion.value.value.split('-')[1]
89
+ const text = selectedVersion.value.text
90
+
91
+ if (selectedVersion.value === versions.value.at(-1)) {
92
+ return localization.value.virtualMachineUsesHardwareVersionAvailable
93
+ .replace('{0}', version)
94
+ .replace('{1}', text)
95
+ }
96
+
97
+ return localization.value.virtualMachineUsesHardwareVersionUnavailable
98
+ .replace('{0}', version)
99
+ .replace('{1}', text)
100
+ })
101
+
102
+ watch(
103
+ selectedVersion,
104
+ (val) => {
105
+ if (!val) return
106
+ emits('change', val)
107
+ },
108
+ { immediate: true }
109
+ )
110
+
111
+ const isShowHelp = ref(false)
112
+
113
+ const apiError = computed<string>(() => {
114
+ return (
115
+ props.errorValidationFields?.find(
116
+ (message) => message.field === 'compatibility'
117
+ )?.error_message || ''
118
+ )
119
+ })
120
+
121
+ const onRemoveValidationError = (): void => {
122
+ emits('remove-error-by-title', 'compatibility')
123
+ }
124
+ </script>
125
+
126
+ <style scoped lang="scss">
127
+ .select-compatibility-block {
128
+ margin-top: 12px;
129
+ font-size: 13px;
130
+
131
+ &.version-select-wrap {
132
+ display: flex;
133
+ align-items: center;
134
+ gap: 6px;
135
+
136
+ #version-select-help-icon {
137
+ .help-title {
138
+ font-size: 22px;
139
+ }
140
+
141
+ p {
142
+ width: 200px;
143
+ }
144
+
145
+ a {
146
+ color: #0072a3;
147
+ }
148
+ }
149
+ }
150
+ }
151
+ </style>
@@ -1,170 +1,170 @@
1
- <template>
2
- <div class="select-compute-resource">
3
- <atoms-alert
4
- v-show="errors.length"
5
- status="alert-danger"
6
- test-id="computed-resource-alert"
7
- :items="errors"
8
- @remove="removeValidationErrors"
9
- />
10
-
11
- <div class="tree-view-wrap mt-1">
12
- <common-vm-actions-add-select-compute-resource-tree-view
13
- v-model="selectedNode"
14
- :data-center="props.dataCenter"
15
- :compute-resource="props.computeResource"
16
- :compute-resource-tree="props.computeResourceTree"
17
- @get-compute-resource-tree="emits('get-compute-resource-tree', $event)"
18
- @show-compute-resource-tree="
19
- emits('show-compute-resource-tree', $event)
20
- "
21
- @select-compute-resource-tree="
22
- emits('select-compute-resource-tree', $event)
23
- "
24
- @clear-compute-resource-tree="
25
- emits('clear-compute-resource-tree', $event)
26
- "
27
- />
28
- </div>
29
-
30
- <div class="compatibility-wrap">
31
- <p class="compatibility">
32
- {{ localization.compatibility }}
33
- </p>
34
- <div class="compatibility-message flex-align-center">
35
- <template v-if="compatibilityText[1]">
36
- <atoms-the-icon
37
- v-show="!compatibilityText[0]"
38
- width="20"
39
- name="exclamation-circle"
40
- />
41
- <div v-show="compatibilityText[0]" class="icon-status-ok" />
42
- <span>{{ compatibilityText[1] }}</span>
43
- </template>
44
- </div>
45
- </div>
46
- </div>
47
- </template>
48
-
49
- <script setup lang="ts">
50
- import { UI_I_Localization } from '~/models/interfaces'
51
- import { UI_I_TreeNode } from '~/components/common/recursionTree/models/interfaces'
52
-
53
- const props = defineProps<{
54
- computeResourceSubmit: number
55
- dataCenter: UI_I_TreeNode | null
56
- computeResource: UI_I_TreeNode
57
- computeResourceTree: UI_I_TreeNode[]
58
- modelValue: UI_I_TreeNode | null
59
- }>()
60
-
61
- const emits = defineEmits<{
62
- (event: 'submit', value: UI_I_TreeNode): void
63
- (event: 'update:model-value', value: UI_I_TreeNode | null): void
64
- (
65
- event: 'get-compute-resource-tree',
66
- value: { id: string | number; cb: () => void }
67
- ): void
68
- (event: 'show-compute-resource-tree', value: UI_I_TreeNode): void
69
- (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void
70
- (event: 'clear-compute-resource-tree'): void
71
- }>()
72
-
73
- const localization = computed<UI_I_Localization>(() => useLocal())
74
-
75
- watch(
76
- () => props.computeResourceSubmit,
77
- () => {
78
- submit()
79
- }
80
- )
81
- const submit = (): void => {
82
- if (
83
- !selectedNode.value ||
84
- !compatibilityText.value[1] ||
85
- selectedNode.value.type === 'datacenter' ||
86
- selectedNode.value.type === 'folder' ||
87
- (selectedNode.value.type === 'cluster' && !selectedNode.value.nodes.length)
88
- ) {
89
- showValidationErrors(
90
- localization.value.specifyValidClusterOrHostDestination
91
- )
92
- return
93
- }
94
-
95
- removeValidationErrors()
96
- emits('submit', selectedNode.value)
97
- }
98
-
99
- const errors = ref<string[]>([])
100
- const showValidationErrors = (text: string): void => {
101
- errors.value = [text]
102
- }
103
- const removeValidationErrors = (): void => {
104
- errors.value = []
105
- }
106
-
107
- const selectedNode = computed<UI_I_TreeNode | null>({
108
- get() {
109
- return props.modelValue
110
- },
111
- set(newValue) {
112
- emits('update:model-value', newValue)
113
- },
114
- })
115
-
116
- const compatibilityText = computed<[boolean, string]>(() => {
117
- if (!selectedNode.value) return [true, '']
118
-
119
- let res: [boolean, string] = [
120
- true,
121
- localization.value.compatibilityChecksSucceeded,
122
- ]
123
-
124
- if (
125
- selectedNode.value.type === 'datacenter' ||
126
- selectedNode.value.type === 'folder'
127
- ) {
128
- res = [false, localization.value.selectValidClusterOrHostDestination]
129
- }
130
- if (selectedNode.value.type === 'cluster') {
131
- const hasHost = !!selectedNode.value.nodes.length
132
- if (!hasHost) {
133
- res = [false, localization.value.clusterNotContainAnyHosts]
134
- }
135
- }
136
-
137
- if (selectedNode.value.type === 'host') {
138
- if (selectedNode.value.state === 'Error') {
139
- // TODO check Maintenance Mode
140
- res = [false, localization.value.selectedHostDisconnectedMaintenanceMode]
141
- }
142
- }
143
-
144
- return res
145
- })
146
- </script>
147
-
148
- <style scoped lang="scss">
149
- .select-compute-resource {
150
- .tree-view-wrap {
151
- max-height: 300px;
152
- min-height: 200px;
153
- position: relative;
154
- border: 1px solid #000;
155
- padding: 5px 0 0 5px;
156
- overflow: auto;
157
- }
158
-
159
- .compatibility-wrap {
160
- padding-top: 10px;
161
-
162
- .compatibility-message {
163
- border: 1px solid #000;
164
- padding-top: 5px;
165
- padding-left: 5px;
166
- overflow: auto;
167
- }
168
- }
169
- }
170
- </style>
1
+ <template>
2
+ <div class="select-compute-resource">
3
+ <atoms-alert
4
+ v-show="errors.length"
5
+ status="alert-danger"
6
+ test-id="computed-resource-alert"
7
+ :items="errors"
8
+ @remove="removeValidationErrors"
9
+ />
10
+
11
+ <div class="tree-view-wrap mt-1">
12
+ <common-vm-actions-add-select-compute-resource-tree-view
13
+ v-model="selectedNode"
14
+ :data-center="props.dataCenter"
15
+ :compute-resource="props.computeResource"
16
+ :compute-resource-tree="props.computeResourceTree"
17
+ @get-compute-resource-tree="emits('get-compute-resource-tree', $event)"
18
+ @show-compute-resource-tree="
19
+ emits('show-compute-resource-tree', $event)
20
+ "
21
+ @select-compute-resource-tree="
22
+ emits('select-compute-resource-tree', $event)
23
+ "
24
+ @clear-compute-resource-tree="
25
+ emits('clear-compute-resource-tree', $event)
26
+ "
27
+ />
28
+ </div>
29
+
30
+ <div class="compatibility-wrap">
31
+ <p class="compatibility">
32
+ {{ localization.compatibility }}
33
+ </p>
34
+ <div class="compatibility-message flex-align-center">
35
+ <template v-if="compatibilityText[1]">
36
+ <atoms-the-icon
37
+ v-show="!compatibilityText[0]"
38
+ width="20"
39
+ name="exclamation-circle"
40
+ />
41
+ <div v-show="compatibilityText[0]" class="icon-status-ok" />
42
+ <span>{{ compatibilityText[1] }}</span>
43
+ </template>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </template>
48
+
49
+ <script setup lang="ts">
50
+ import { UI_I_Localization } from '~/models/interfaces'
51
+ import { UI_I_TreeNode } from '~/components/common/recursionTree/models/interfaces'
52
+
53
+ const props = defineProps<{
54
+ computeResourceSubmit: number
55
+ dataCenter: UI_I_TreeNode | null
56
+ computeResource: UI_I_TreeNode
57
+ computeResourceTree: UI_I_TreeNode[]
58
+ modelValue: UI_I_TreeNode | null
59
+ }>()
60
+
61
+ const emits = defineEmits<{
62
+ (event: 'submit', value: UI_I_TreeNode): void
63
+ (event: 'update:model-value', value: UI_I_TreeNode | null): void
64
+ (
65
+ event: 'get-compute-resource-tree',
66
+ value: { id: string | number; cb: () => void }
67
+ ): void
68
+ (event: 'show-compute-resource-tree', value: UI_I_TreeNode): void
69
+ (event: 'select-compute-resource-tree', value: UI_I_TreeNode): void
70
+ (event: 'clear-compute-resource-tree'): void
71
+ }>()
72
+
73
+ const localization = computed<UI_I_Localization>(() => useLocal())
74
+
75
+ watch(
76
+ () => props.computeResourceSubmit,
77
+ () => {
78
+ submit()
79
+ }
80
+ )
81
+ const submit = (): void => {
82
+ if (
83
+ !selectedNode.value ||
84
+ !compatibilityText.value[1] ||
85
+ selectedNode.value.type === 'datacenter' ||
86
+ selectedNode.value.type === 'folder' ||
87
+ (selectedNode.value.type === 'cluster' && !selectedNode.value.nodes.length)
88
+ ) {
89
+ showValidationErrors(
90
+ localization.value.specifyValidClusterOrHostDestination
91
+ )
92
+ return
93
+ }
94
+
95
+ removeValidationErrors()
96
+ emits('submit', selectedNode.value)
97
+ }
98
+
99
+ const errors = ref<string[]>([])
100
+ const showValidationErrors = (text: string): void => {
101
+ errors.value = [text]
102
+ }
103
+ const removeValidationErrors = (): void => {
104
+ errors.value = []
105
+ }
106
+
107
+ const selectedNode = computed<UI_I_TreeNode | null>({
108
+ get() {
109
+ return props.modelValue
110
+ },
111
+ set(newValue) {
112
+ emits('update:model-value', newValue)
113
+ },
114
+ })
115
+
116
+ const compatibilityText = computed<[boolean, string]>(() => {
117
+ if (!selectedNode.value) return [true, '']
118
+
119
+ let res: [boolean, string] = [
120
+ true,
121
+ localization.value.compatibilityChecksSucceeded,
122
+ ]
123
+
124
+ if (
125
+ selectedNode.value.type === 'datacenter' ||
126
+ selectedNode.value.type === 'folder'
127
+ ) {
128
+ res = [false, localization.value.selectValidClusterOrHostDestination]
129
+ }
130
+ if (selectedNode.value.type === 'cluster') {
131
+ const hasHost = !!selectedNode.value.nodes.length
132
+ if (!hasHost) {
133
+ res = [false, localization.value.clusterNotContainAnyHosts]
134
+ }
135
+ }
136
+
137
+ if (selectedNode.value.type === 'host') {
138
+ if (selectedNode.value.state === 'Error') {
139
+ // TODO check Maintenance Mode
140
+ res = [false, localization.value.selectedHostDisconnectedMaintenanceMode]
141
+ }
142
+ }
143
+
144
+ return res
145
+ })
146
+ </script>
147
+
148
+ <style scoped lang="scss">
149
+ .select-compute-resource {
150
+ .tree-view-wrap {
151
+ max-height: 300px;
152
+ min-height: 200px;
153
+ position: relative;
154
+ border: 1px solid #000;
155
+ padding: 5px 0 0 5px;
156
+ overflow: auto;
157
+ }
158
+
159
+ .compatibility-wrap {
160
+ padding-top: 10px;
161
+
162
+ .compatibility-message {
163
+ border: 1px solid #000;
164
+ padding-top: 5px;
165
+ padding-left: 5px;
166
+ overflow: auto;
167
+ }
168
+ }
169
+ }
170
+ </style>