bfg-common 1.5.417 → 1.5.419
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.
- package/components/common/modals/confirmation/ConfirmationNew.vue +1 -1
- package/components/common/pages/backups/Backups.vue +102 -0
- package/components/common/pages/backups/DetailView.vue +52 -0
- package/components/common/pages/backups/lib/models/interfaces.ts +24 -0
- package/components/common/pages/backups/lib/models/types.ts +7 -0
- package/components/common/pages/backups/modals/Modals.vue +229 -0
- package/components/common/pages/backups/modals/createBackup/CreateBackup.vue +371 -0
- package/components/common/pages/backups/modals/createBackup/configuration/Configuration.vue +29 -0
- package/components/common/pages/backups/modals/createBackup/configuration/backupWindow/BackupWindow.vue +26 -0
- package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/MaxBandwidth.vue +65 -0
- package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options.ts +6 -0
- package/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/models/types.ts +1 -0
- package/components/common/pages/backups/modals/createBackup/configuration/strategy/Strategy.vue +36 -0
- package/components/common/pages/backups/modals/createBackup/datastores/Datastores.vue +58 -0
- package/components/common/pages/backups/modals/createBackup/datastores/tableView/TableView.vue +94 -0
- package/components/common/pages/backups/modals/createBackup/datastores/tableView/lib/config/keys.ts +14 -0
- package/components/common/pages/backups/modals/createBackup/datastores/tableView/lib/config/table.ts +117 -0
- package/components/common/pages/backups/modals/createBackup/datastores/tableView/lib/models/types.ts +10 -0
- package/components/common/pages/backups/modals/createBackup/disks/Disks.vue +28 -0
- package/components/common/pages/backups/modals/createBackup/disks/tableView/TableView.vue +105 -0
- package/components/common/pages/backups/modals/createBackup/disks/tableView/lib/config/keys.ts +12 -0
- package/components/common/pages/backups/modals/createBackup/disks/tableView/lib/config/table.ts +117 -0
- package/components/common/pages/backups/modals/createBackup/disks/tableView/lib/models/interfaces.ts +4 -0
- package/components/common/pages/backups/modals/createBackup/disks/tableView/lib/models/types.ts +10 -0
- package/components/common/pages/backups/modals/createBackup/general/General.vue +48 -0
- package/components/common/pages/backups/modals/createBackup/lib/config/createBackup.ts +14 -0
- package/components/common/pages/backups/modals/createBackup/lib/config/steps.ts +117 -0
- package/components/common/pages/backups/modals/createBackup/lib/config/strategyOptions.ts +12 -0
- package/components/common/pages/backups/modals/createBackup/lib/models/interfaces.ts +8 -0
- package/components/common/pages/backups/modals/createBackup/readyToComplete/ReadyToComplete.vue +15 -0
- package/components/common/pages/backups/modals/lib/config/createBackup.ts +16 -0
- package/components/common/pages/backups/modals/lib/config/restore.ts +115 -0
- package/components/common/pages/backups/modals/lib/models/interfaces.ts +164 -0
- package/components/common/pages/backups/modals/restore/Restore.vue +388 -0
- package/components/common/pages/backups/modals/restore/disks/Disks.vue +28 -0
- package/components/common/pages/backups/modals/restore/disks/tableView/TableView.vue +101 -0
- package/components/common/pages/backups/modals/restore/disks/tableView/lib/config/keys.ts +14 -0
- package/components/common/pages/backups/modals/restore/disks/tableView/lib/config/table.ts +114 -0
- package/components/common/pages/backups/modals/restore/disks/tableView/lib/models/interfaces.ts +4 -0
- package/components/common/pages/backups/modals/restore/disks/tableView/lib/models/types.ts +10 -0
- package/components/common/pages/backups/modals/restore/lib/config/steps.ts +92 -0
- package/components/common/pages/backups/modals/restore/name/Name.vue +159 -0
- package/components/common/pages/backups/modals/restore/networks/Networks.vue +67 -0
- package/components/common/pages/backups/modals/restore/networks/table/Table.vue +216 -0
- package/components/common/pages/backups/modals/restore/networks/table/adapterType/AdapterType.vue +32 -0
- package/components/common/pages/backups/modals/restore/networks/table/adapterType/lib/config/options.ts +8 -0
- package/components/common/pages/backups/modals/restore/networks/table/lib/config/networkTable.ts +82 -0
- package/components/common/pages/backups/modals/restore/networks/table/lib/config/tableKeys.ts +10 -0
- package/components/common/pages/backups/modals/restore/networks/table/lib/models/types.ts +6 -0
- package/components/common/pages/backups/modals/restore/types/Types.vue +61 -0
- package/components/common/pages/backups/modals/restore/types/lib/config/descriptions.ts +7 -0
- package/components/common/pages/backups/modals/restore/types/lib/config/typeOptions.ts +24 -0
- package/components/common/pages/backups/tools/Tools.vue +75 -0
- package/components/common/pages/backups/tools/lib/config/tabs.ts +36 -0
- package/components/common/pages/scheduledTasks/lib/models/interfaces.ts +35 -0
- package/components/common/pages/scheduledTasks/lib/models/types.ts +16 -0
- package/components/common/pages/scheduledTasks/lib/utils/utils.ts +84 -0
- package/components/common/treeView/TreeView.vue +52 -0
- package/lib/models/interfaces.ts +1 -1
- package/package.json +1 -1
- /package/components/common/{backup/actions → pages/backups/modals}/deleteBackup/DeleteBackup.vue +0 -0
@@ -0,0 +1,371 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="create-backup">
|
3
|
+
<atoms-wizard
|
4
|
+
show
|
5
|
+
:wizard="wizard"
|
6
|
+
:selected-scheme="selectedScheme"
|
7
|
+
:title="title"
|
8
|
+
:localization="localization"
|
9
|
+
:test-id="testId"
|
10
|
+
@change-steps="onChangeSteps"
|
11
|
+
@hide="onHideModal"
|
12
|
+
@submit="onFinish"
|
13
|
+
>
|
14
|
+
<template #modalBody="{ selectedStep }">
|
15
|
+
<atoms-alert
|
16
|
+
v-show="errors.length"
|
17
|
+
status="alert-danger"
|
18
|
+
:items="errors"
|
19
|
+
test-id="create-backup-alert"
|
20
|
+
@remove="onRemoveValidationErrors"
|
21
|
+
/>
|
22
|
+
|
23
|
+
<common-pages-scheduled-tasks-modals-common-new-task-form
|
24
|
+
v-show="selectedStep.id === dynamicSteps.schedulingOptions"
|
25
|
+
v-model="modelSchedulerTask"
|
26
|
+
:target="props.selectedVmName"
|
27
|
+
class="new-task-form"
|
28
|
+
/>
|
29
|
+
|
30
|
+
<common-pages-backups-modals-create-backup-general
|
31
|
+
v-show="selectedStep.id === dynamicSteps.general"
|
32
|
+
v-model="model"
|
33
|
+
/>
|
34
|
+
|
35
|
+
<common-pages-backups-modals-create-backup-disks
|
36
|
+
v-show="selectedStep.id === dynamicSteps.disks"
|
37
|
+
v-model="model"
|
38
|
+
:disks="props.disks"
|
39
|
+
:disks-loading="props.disksLoading"
|
40
|
+
/>
|
41
|
+
|
42
|
+
<common-pages-backups-modals-create-backup-datastores
|
43
|
+
v-show="selectedStep.id === dynamicSteps.datastores"
|
44
|
+
v-model="model"
|
45
|
+
:datastore-table="props.datastoreTable"
|
46
|
+
:datastore-table-loading="props.datastoreTableLoading"
|
47
|
+
@change="onChangeDatastore"
|
48
|
+
/>
|
49
|
+
|
50
|
+
<common-pages-backups-modals-create-backup-configuration
|
51
|
+
v-show="selectedStep.id === dynamicSteps.configuration"
|
52
|
+
v-model="model"
|
53
|
+
/>
|
54
|
+
|
55
|
+
<common-ready-to-complete
|
56
|
+
v-show="selectedStep.id === dynamicSteps.readyComplete"
|
57
|
+
:data="readyToCompleteInfo"
|
58
|
+
/>
|
59
|
+
</template>
|
60
|
+
</atoms-wizard>
|
61
|
+
</div>
|
62
|
+
</template>
|
63
|
+
|
64
|
+
<script setup lang="ts">
|
65
|
+
// TODO move to common
|
66
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
67
|
+
import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
|
68
|
+
import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
|
69
|
+
import type {
|
70
|
+
UI_I_WizardStep,
|
71
|
+
UI_I_ValidationReturn,
|
72
|
+
} from '~/components/atoms/wizard/lib/models/interfaces'
|
73
|
+
import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
|
74
|
+
import type {
|
75
|
+
UI_I_CreateBackupForm,
|
76
|
+
UI_I_CreateBackupFormDiskDevice
|
77
|
+
} from '~/components/common/pages/backups/modals/lib/models/interfaces'
|
78
|
+
import type { UI_I_DynamicSteps } from '~/components/common/pages/backups/modals/createBackup/lib/models/interfaces'
|
79
|
+
import Wizard from '~/components/atoms/wizard/lib/utils/utils'
|
80
|
+
import {
|
81
|
+
stepsSchemeInitial,
|
82
|
+
stepsFunc, dynamicSteps,
|
83
|
+
} from '~/components/common/pages/backups/modals/createBackup/lib/config/steps'
|
84
|
+
import { strategyOptionsFunc } from '~/components/common/pages/backups/modals/createBackup/lib/config/strategyOptions'
|
85
|
+
|
86
|
+
const model = defineModel<UI_I_CreateBackupForm>({ required: true })
|
87
|
+
const modelSchedulerTask = defineModel<UI_I_ScheduleNewTasksForm>(
|
88
|
+
'schedulerForm',
|
89
|
+
{ required: true }
|
90
|
+
)
|
91
|
+
|
92
|
+
const props = defineProps<{
|
93
|
+
isEdit: boolean
|
94
|
+
target: string
|
95
|
+
isScheduledTasks: boolean
|
96
|
+
isEditScheduledTasks: boolean
|
97
|
+
selectedVmName: string
|
98
|
+
disks: UI_I_CreateBackupFormDiskDevice[]
|
99
|
+
disksLoading: boolean
|
100
|
+
datastoreTable: any // ??
|
101
|
+
datastoreTableLoading: boolean
|
102
|
+
}>()
|
103
|
+
|
104
|
+
const emits = defineEmits<{
|
105
|
+
(event: 'change-step-create-backup', value: UI_I_WizardStep[]): void
|
106
|
+
(event: 'finish'): void
|
107
|
+
(event: 'hide'): void
|
108
|
+
}>()
|
109
|
+
|
110
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
111
|
+
const { $binary }: any = useNuxtApp()
|
112
|
+
|
113
|
+
const title = computed<string>(() => {
|
114
|
+
const { createBackup, updateBackup, scheduleNewTasks, scheduleTaskEdit } =
|
115
|
+
localization.value.common
|
116
|
+
let result = props.isEdit ? updateBackup : createBackup
|
117
|
+
if (props.isScheduledTasks) {
|
118
|
+
const schedulerMode = props.isEditScheduledTasks
|
119
|
+
? scheduleTaskEdit
|
120
|
+
: scheduleNewTasks
|
121
|
+
|
122
|
+
result = `${schedulerMode} (${createBackup})`
|
123
|
+
}
|
124
|
+
|
125
|
+
return result
|
126
|
+
})
|
127
|
+
|
128
|
+
const testId = ref<string>(props.isEdit ? 'update-backup' : 'create-backup')
|
129
|
+
|
130
|
+
const wizard: Wizard = new Wizard(
|
131
|
+
stepsFunc(localization.value),
|
132
|
+
stepsSchemeInitial(props.isScheduledTasks)
|
133
|
+
)
|
134
|
+
|
135
|
+
watch(
|
136
|
+
modelSchedulerTask,
|
137
|
+
(newValue: UI_I_ScheduleNewTasksForm) => {
|
138
|
+
if (props.isScheduledTasks) wizard.setDisabledNextButton(newValue.isValid)
|
139
|
+
},
|
140
|
+
{ immediate: true, deep: true }
|
141
|
+
)
|
142
|
+
|
143
|
+
const selectedScheme = computed<number[]>(() => wizard.selectedScheme.value)
|
144
|
+
const onChangeSteps = async (value: UI_I_WizardStep[]): Promise<void> => {
|
145
|
+
emits('change-step-create-backup', value)
|
146
|
+
wizard.changeSteps(value, validationFunc)
|
147
|
+
}
|
148
|
+
const validationFunc = async (
|
149
|
+
value: UI_I_WizardStep[],
|
150
|
+
currentStep: UI_I_WizardStep,
|
151
|
+
nextStep: UI_I_WizardStep
|
152
|
+
): Promise<UI_I_ValidationReturn> => {
|
153
|
+
let stepHasError = false
|
154
|
+
const stepShouldStop = {
|
155
|
+
ifOnCurrentStep: false,
|
156
|
+
ifFromAnyStep: false,
|
157
|
+
stoppageStepId: -1,
|
158
|
+
}
|
159
|
+
|
160
|
+
if (
|
161
|
+
wizard.isValidateForStep(
|
162
|
+
dynamicSteps.general,
|
163
|
+
currentStep.id,
|
164
|
+
nextStep.id
|
165
|
+
)
|
166
|
+
) {
|
167
|
+
const nameValidation = checkName(value)
|
168
|
+
|
169
|
+
value = nameValidation.newValue
|
170
|
+
stepHasError = stepHasError || nameValidation.stepHasError
|
171
|
+
}
|
172
|
+
|
173
|
+
if (
|
174
|
+
wizard.isValidateForStep(
|
175
|
+
dynamicSteps.disks,
|
176
|
+
currentStep.id,
|
177
|
+
nextStep.id
|
178
|
+
)
|
179
|
+
) {
|
180
|
+
const validation = checkDisks(value)
|
181
|
+
|
182
|
+
value = validation.newValue
|
183
|
+
stepHasError = stepHasError || validation.stepHasError
|
184
|
+
}
|
185
|
+
|
186
|
+
if (
|
187
|
+
wizard.isValidateForStep(
|
188
|
+
dynamicSteps.datastores,
|
189
|
+
currentStep.id,
|
190
|
+
nextStep.id
|
191
|
+
)
|
192
|
+
) {
|
193
|
+
const validation = checkDatastore(value)
|
194
|
+
|
195
|
+
value = validation.newValue
|
196
|
+
stepHasError = stepHasError || validation.stepHasError
|
197
|
+
}
|
198
|
+
|
199
|
+
return {
|
200
|
+
newValue: value,
|
201
|
+
stepHasError,
|
202
|
+
stepShouldStop,
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
const checkName = (value: UI_I_WizardStep[]): UI_I_ValidationReturn => {
|
207
|
+
let stepHasError = false
|
208
|
+
|
209
|
+
const isValid = !!model.value?.name
|
210
|
+
if (!isValid) {
|
211
|
+
stepHasError = wizard.setValidation(dynamicSteps.general, 'name', {
|
212
|
+
fieldMessage: localization.value.common.nameIsRequired,
|
213
|
+
alertMessage: localization.value.common.nameIsRequired,
|
214
|
+
})
|
215
|
+
showValidationErrors([localization.value.common.nameIsRequired])
|
216
|
+
} else if (wizard.hasMessage(dynamicSteps.general, 'name')) {
|
217
|
+
value = wizard.removeValidation(dynamicSteps.general, 'name', value)
|
218
|
+
onRemoveValidationErrors()
|
219
|
+
}
|
220
|
+
|
221
|
+
return {
|
222
|
+
stepHasError,
|
223
|
+
newValue: value,
|
224
|
+
}
|
225
|
+
}
|
226
|
+
|
227
|
+
const checkDisks = (value: UI_I_WizardStep[]): UI_I_ValidationReturn => {
|
228
|
+
let stepHasError = false
|
229
|
+
|
230
|
+
const isValidStores = !!model.value?.disk_devices.length
|
231
|
+
if (!isValidStores) {
|
232
|
+
stepHasError = wizard.setValidation(
|
233
|
+
dynamicSteps.disks,
|
234
|
+
'disk_devices',
|
235
|
+
{
|
236
|
+
fieldMessage: localization.value.common.diskIsRequired,
|
237
|
+
alertMessage: localization.value.common.diskIsRequired,
|
238
|
+
}
|
239
|
+
)
|
240
|
+
showValidationErrors([localization.value.common.diskIsRequired])
|
241
|
+
} else if (wizard.hasMessage(dynamicSteps.disks, 'disk_devices')) {
|
242
|
+
value = wizard.removeValidation(
|
243
|
+
dynamicSteps.disks,
|
244
|
+
'disk_devices',
|
245
|
+
value
|
246
|
+
)
|
247
|
+
onRemoveValidationErrors()
|
248
|
+
}
|
249
|
+
|
250
|
+
return {
|
251
|
+
stepHasError,
|
252
|
+
newValue: value,
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
const checkDatastore = (value: UI_I_WizardStep[]): UI_I_ValidationReturn => {
|
257
|
+
let stepHasError = false
|
258
|
+
|
259
|
+
const isValidStorage = !!model.value?.backup_storage.length
|
260
|
+
if (!isValidStorage) {
|
261
|
+
stepHasError = wizard.setValidation(
|
262
|
+
dynamicSteps.datastores,
|
263
|
+
'backup_storage',
|
264
|
+
{
|
265
|
+
fieldMessage: localization.value.common.datastoreIsRequired,
|
266
|
+
alertMessage: localization.value.common.datastoreIsRequired,
|
267
|
+
}
|
268
|
+
)
|
269
|
+
showValidationErrors([localization.value.common.datastoreIsRequired])
|
270
|
+
} else if (
|
271
|
+
wizard.hasMessage(dynamicSteps.datastores, 'backup_storage')
|
272
|
+
) {
|
273
|
+
value = wizard.removeValidation(
|
274
|
+
dynamicSteps.datastores,
|
275
|
+
'backup_storage',
|
276
|
+
value
|
277
|
+
)
|
278
|
+
onRemoveValidationErrors()
|
279
|
+
}
|
280
|
+
|
281
|
+
return {
|
282
|
+
stepHasError,
|
283
|
+
newValue: value,
|
284
|
+
}
|
285
|
+
}
|
286
|
+
|
287
|
+
const selectedDatastoresNames = ref<string[]>([])
|
288
|
+
const onChangeDatastore = (names: string[]): void => {
|
289
|
+
selectedDatastoresNames.value = names
|
290
|
+
}
|
291
|
+
|
292
|
+
const strategyOptions = ref<UI_I_OptionItem[]>(
|
293
|
+
strategyOptionsFunc(localization.value)
|
294
|
+
)
|
295
|
+
|
296
|
+
const readyToCompleteInfo = computed<UI_I_TableInfoItem[]>(() => {
|
297
|
+
// General
|
298
|
+
const result = [
|
299
|
+
{
|
300
|
+
label: localization.value.common.name,
|
301
|
+
value: model.value.name,
|
302
|
+
},
|
303
|
+
{
|
304
|
+
label: localization.value.common.description,
|
305
|
+
value: model.value.description,
|
306
|
+
},
|
307
|
+
]
|
308
|
+
|
309
|
+
// Disks
|
310
|
+
model.value.disk_devices.forEach((disk_device, i) => {
|
311
|
+
result.push({
|
312
|
+
label: `${localization.value.common.disk} ${i + 1}`,
|
313
|
+
value: disk_device.location,
|
314
|
+
})
|
315
|
+
})
|
316
|
+
|
317
|
+
// Datastores
|
318
|
+
result.push({
|
319
|
+
label: localization.value.common.datastore,
|
320
|
+
value: selectedDatastoresNames.value.join(', '),
|
321
|
+
})
|
322
|
+
|
323
|
+
// Configuration
|
324
|
+
result.push({
|
325
|
+
label: localization.value.common.strategy,
|
326
|
+
value:
|
327
|
+
strategyOptions.value.find(
|
328
|
+
(option) => option.value === model.value.strategy
|
329
|
+
)?.label || '',
|
330
|
+
})
|
331
|
+
// result.push({
|
332
|
+
// label: localization.value.common.backupWindow,
|
333
|
+
// value: model.value.start_window_min + '',
|
334
|
+
// })
|
335
|
+
|
336
|
+
const gbSizeByB = 1_073_741_824
|
337
|
+
const maxBandwidth =
|
338
|
+
model.value.bandwidth_limit >= gbSizeByB
|
339
|
+
? $binary.bToGb(model.value.bandwidth_limit) + ' Gbps'
|
340
|
+
: $binary.bToMb(model.value.bandwidth_limit) + ' Mbps'
|
341
|
+
|
342
|
+
result.push({
|
343
|
+
label: localization.value.common.maxBandwidth,
|
344
|
+
value: maxBandwidth,
|
345
|
+
})
|
346
|
+
|
347
|
+
return result
|
348
|
+
})
|
349
|
+
|
350
|
+
const errors = ref<string[]>([])
|
351
|
+
const showValidationErrors = (data: string[]): void => {
|
352
|
+
errors.value = data
|
353
|
+
}
|
354
|
+
const onRemoveValidationErrors = (): void => {
|
355
|
+
errors.value = []
|
356
|
+
}
|
357
|
+
|
358
|
+
const onFinish = (): void => {
|
359
|
+
emits('finish')
|
360
|
+
}
|
361
|
+
const onHideModal = (): void => {
|
362
|
+
emits('hide')
|
363
|
+
}
|
364
|
+
</script>
|
365
|
+
|
366
|
+
<style scoped lang="scss">
|
367
|
+
:deep(.modal-body) {
|
368
|
+
display: flex;
|
369
|
+
flex-direction: column;
|
370
|
+
}
|
371
|
+
</style>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="configuration">
|
3
|
+
<div class="stack-view">
|
4
|
+
<common-pages-backups-modals-create-backup-configuration-strategy
|
5
|
+
v-model="model"
|
6
|
+
/>
|
7
|
+
<!-- <common-pages-backups-modals-create-backup-configuration-backup-window-->
|
8
|
+
<!-- v-model="model"-->
|
9
|
+
<!-- />-->
|
10
|
+
<common-pages-backups-modals-create-backup-configuration-max-bandwidth
|
11
|
+
v-model="model"
|
12
|
+
/>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</template>
|
16
|
+
|
17
|
+
<script lang="ts" setup>
|
18
|
+
import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
|
19
|
+
|
20
|
+
const model = defineModel<UI_I_CreateBackupForm>({ required: true })
|
21
|
+
</script>
|
22
|
+
|
23
|
+
<style lang="scss" scoped>
|
24
|
+
.stack-view {
|
25
|
+
:deep(.select-input__inner) {
|
26
|
+
min-width: max-content;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
</style>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<template>
|
2
|
+
<atoms-stack-block :has-children="false">
|
3
|
+
<template #stackBlockKey>
|
4
|
+
<span>{{ localization.common.backupWindow }}</span>
|
5
|
+
</template>
|
6
|
+
<template #stackBlockContent>
|
7
|
+
<input
|
8
|
+
v-model="model.start_window_min"
|
9
|
+
data-id="hours-input"
|
10
|
+
type="number"
|
11
|
+
class="hrs"
|
12
|
+
/>
|
13
|
+
</template>
|
14
|
+
</atoms-stack-block>
|
15
|
+
</template>
|
16
|
+
|
17
|
+
<script lang="ts" setup>
|
18
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
19
|
+
import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
|
20
|
+
|
21
|
+
const model = defineModel<UI_I_CreateBackupForm>({ required: true })
|
22
|
+
|
23
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
24
|
+
</script>
|
25
|
+
|
26
|
+
<style lang="scss" scoped></style>
|
@@ -0,0 +1,65 @@
|
|
1
|
+
<template>
|
2
|
+
<atoms-stack-block :has-children="false">
|
3
|
+
<template #stackBlockKey>
|
4
|
+
<span>{{ localization.common.maxBandwidth }}</span>
|
5
|
+
</template>
|
6
|
+
<template #stackBlockContent>
|
7
|
+
<div class="flex-align-center">
|
8
|
+
<input
|
9
|
+
v-model="maxBindwidthLocal"
|
10
|
+
data-id="mbps-input"
|
11
|
+
type="number"
|
12
|
+
class="mbps"
|
13
|
+
/>
|
14
|
+
|
15
|
+
<common-select-input
|
16
|
+
v-model="selectedType"
|
17
|
+
:data="maxBandwidthOptionsLocal"
|
18
|
+
test-id="backup-max-bandwidth-type"
|
19
|
+
class="ml-1"
|
20
|
+
/>
|
21
|
+
</div>
|
22
|
+
</template>
|
23
|
+
</atoms-stack-block>
|
24
|
+
</template>
|
25
|
+
|
26
|
+
<script lang="ts" setup>
|
27
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
28
|
+
import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
|
29
|
+
import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
|
30
|
+
import type { UI_T_BandwidthOption } from '~/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/models/types'
|
31
|
+
import { maxBandwidthOptions } from '~/components/common/pages/backups/modals/createBackup/configuration/maxBandwidth/lib/config/options'
|
32
|
+
|
33
|
+
const model = defineModel<UI_I_CreateBackupForm>({ required: true })
|
34
|
+
|
35
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
36
|
+
const { $binary }: any = useNuxtApp()
|
37
|
+
|
38
|
+
const maxBandwidthOptionsLocal = ref<UI_I_OptionItem[]>(maxBandwidthOptions)
|
39
|
+
|
40
|
+
const maxBindwidthLocal = computed<number>({
|
41
|
+
get() {
|
42
|
+
return selectedType.value === 1
|
43
|
+
? $binary.bToGb(model.value.bandwidth_limit)
|
44
|
+
: $binary.bToMb(model.value.bandwidth_limit)
|
45
|
+
},
|
46
|
+
set(newValue: number) {
|
47
|
+
model.value.bandwidth_limit =
|
48
|
+
selectedType.value === 1
|
49
|
+
? $binary.gbToB(newValue)
|
50
|
+
: $binary.mbToB(newValue)
|
51
|
+
},
|
52
|
+
})
|
53
|
+
|
54
|
+
const selectedType = ref<UI_T_BandwidthOption>(0)
|
55
|
+
watch(selectedType, (newValue) => {
|
56
|
+
if (newValue === 1) model.value.bandwidth_limit *= 1_024
|
57
|
+
else model.value.bandwidth_limit /= 1_024
|
58
|
+
})
|
59
|
+
</script>
|
60
|
+
|
61
|
+
<style lang="scss" scoped>
|
62
|
+
#backup-transaction-logs {
|
63
|
+
margin: 4px 4px 0 0;
|
64
|
+
}
|
65
|
+
</style>
|
@@ -0,0 +1 @@
|
|
1
|
+
export type UI_T_BandwidthOption = 0 | 1 // 0: mbps, 1: gbps
|
package/components/common/pages/backups/modals/createBackup/configuration/strategy/Strategy.vue
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
<template>
|
2
|
+
<atoms-stack-block :has-children="false">
|
3
|
+
<template #stackBlockKey>
|
4
|
+
<span>{{ localization.common.strategy }}</span>
|
5
|
+
</template>
|
6
|
+
<template #stackBlockContent>
|
7
|
+
<common-select-input
|
8
|
+
v-model="model.strategy"
|
9
|
+
:data="strategyOptions"
|
10
|
+
test-id="backup-strategy"
|
11
|
+
/>
|
12
|
+
</template>
|
13
|
+
</atoms-stack-block>
|
14
|
+
</template>
|
15
|
+
|
16
|
+
<script lang="ts" setup>
|
17
|
+
// TODO merge with common-backups-modals-new-rule-retention-strategy
|
18
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
19
|
+
import type { UI_I_OptionItem } from '~/components/atoms/lib/models/interfaces'
|
20
|
+
import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
|
21
|
+
import { strategyOptionsFunc } from '~/components/common/pages/backups/modals/createBackup/lib/config/strategyOptions'
|
22
|
+
|
23
|
+
const model = defineModel<UI_I_CreateBackupForm>({ required: true })
|
24
|
+
|
25
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
26
|
+
|
27
|
+
const strategyOptions = ref<UI_I_OptionItem[]>(
|
28
|
+
strategyOptionsFunc(localization.value)
|
29
|
+
)
|
30
|
+
</script>
|
31
|
+
|
32
|
+
<style lang="scss" scoped>
|
33
|
+
#backup-transaction-logs {
|
34
|
+
margin: 4px 4px 0 0;
|
35
|
+
}
|
36
|
+
</style>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="datastores h-full">
|
3
|
+
<common-pages-backups-modals-create-backup-datastores-table-view
|
4
|
+
v-model:selected="model.backup_storage"
|
5
|
+
:data-table="props.datastoreTable?.items"
|
6
|
+
:total-items="props.datastoreTable?.total_items || 0"
|
7
|
+
:total-pages="props.datastoreTable?.total_pages || 1"
|
8
|
+
:loading="props.datastoreTableLoading"
|
9
|
+
/>
|
10
|
+
</div>
|
11
|
+
</template>
|
12
|
+
|
13
|
+
<script lang="ts" setup>
|
14
|
+
import type { UI_I_CreateBackupForm } from '~/components/common/pages/backups/modals/lib/models/interfaces'
|
15
|
+
|
16
|
+
const props = defineProps<{
|
17
|
+
datastoreTable: any // ??
|
18
|
+
datastoreTableLoading: boolean
|
19
|
+
}>()
|
20
|
+
const emits = defineEmits<{
|
21
|
+
(event: 'change', value: string[]): void
|
22
|
+
}>()
|
23
|
+
|
24
|
+
const model = defineModel<UI_I_CreateBackupForm>({ required: true })
|
25
|
+
|
26
|
+
const { $store }: any = useNuxtApp()
|
27
|
+
|
28
|
+
const selectedKeys = ref<string[]>([])
|
29
|
+
|
30
|
+
watch(
|
31
|
+
() => props.datastoreTable,
|
32
|
+
() => {
|
33
|
+
selectedKeys.value = []
|
34
|
+
},
|
35
|
+
{ deep: true, immediate: true }
|
36
|
+
)
|
37
|
+
|
38
|
+
watch(
|
39
|
+
() => model.value.backup_storage,
|
40
|
+
(newValue: string) => {
|
41
|
+
const selectedNames: string[] = []
|
42
|
+
|
43
|
+
props.datastoreTable?.items.forEach((item) => {
|
44
|
+
if (newValue === item.id) selectedNames.push(item.name)
|
45
|
+
})
|
46
|
+
|
47
|
+
emits('change', selectedNames)
|
48
|
+
},
|
49
|
+
{ deep: true, immediate: true }
|
50
|
+
)
|
51
|
+
</script>
|
52
|
+
|
53
|
+
<style lang="scss" scoped>
|
54
|
+
.backups-table-content {
|
55
|
+
height: 100%;
|
56
|
+
padding: 0 10px 10px 10px;
|
57
|
+
}
|
58
|
+
</style>
|
package/components/common/pages/backups/modals/createBackup/datastores/tableView/TableView.vue
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="data-table-view overflow-hidden">
|
3
|
+
<div class="data-table-view__inner">
|
4
|
+
<atoms-table-data-grid
|
5
|
+
v-model:selected-row="selectedRows"
|
6
|
+
v-model:column-keys="columnKeys"
|
7
|
+
class="data-table"
|
8
|
+
type="radio"
|
9
|
+
test-id="disks-table"
|
10
|
+
:head-items="headItems"
|
11
|
+
:body-items="bodyItems"
|
12
|
+
:total-items="props.totalItems"
|
13
|
+
:total-pages="props.totalPages"
|
14
|
+
:items-per-page="itemsPerPage"
|
15
|
+
:loading="loading"
|
16
|
+
hide-pagination
|
17
|
+
server-off
|
18
|
+
>
|
19
|
+
<template #icon="{ item }">
|
20
|
+
<span :class="['datagrid-cell-icon', item.data]" />
|
21
|
+
<span class="text-ellipsis">
|
22
|
+
{{ item.text }}
|
23
|
+
</span>
|
24
|
+
</template>
|
25
|
+
</atoms-table-data-grid>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
</template>
|
29
|
+
|
30
|
+
<script lang="ts" setup>
|
31
|
+
import type {
|
32
|
+
UI_I_HeadItem,
|
33
|
+
UI_I_ColumnKey,
|
34
|
+
UI_I_BodyItem,
|
35
|
+
} from '~/components/atoms/table/dataGrid/lib/models/interfaces'
|
36
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
37
|
+
import { itemsPerPage } from '~/components/atoms/table/dataGrid/lib/config/itemsPerPage'
|
38
|
+
import * as table from '~/components/common/pages/backups/modals/createBackup/datastores/tableView/lib/config/table'
|
39
|
+
|
40
|
+
const props = defineProps<{
|
41
|
+
dataTable: any // ??
|
42
|
+
loading: boolean
|
43
|
+
totalItems: number
|
44
|
+
totalPages: number
|
45
|
+
}>()
|
46
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
47
|
+
|
48
|
+
const selectedRows = defineModel<string>('selected')
|
49
|
+
|
50
|
+
const columnKeys = ref<UI_I_ColumnKey[]>(table.columnKeys(localization.value))
|
51
|
+
|
52
|
+
const headItems = computed<UI_I_HeadItem[]>(() =>
|
53
|
+
table.headItems(localization.value)
|
54
|
+
)
|
55
|
+
|
56
|
+
const bodyItems = computed<UI_I_BodyItem[][]>(() => {
|
57
|
+
let result: UI_I_BodyItem[][] = []
|
58
|
+
if (props.dataTable) {
|
59
|
+
result = table.bodyItems(props.dataTable, localization.value)
|
60
|
+
}
|
61
|
+
|
62
|
+
return result
|
63
|
+
})
|
64
|
+
watch(
|
65
|
+
bodyItems,
|
66
|
+
() => {
|
67
|
+
setTimeout(() => {
|
68
|
+
selectedRows.value = ''
|
69
|
+
}, 0)
|
70
|
+
},
|
71
|
+
{ deep: true, immediate: true }
|
72
|
+
)
|
73
|
+
</script>
|
74
|
+
|
75
|
+
<style lang="scss" scoped>
|
76
|
+
.data-table-view {
|
77
|
+
height: inherit;
|
78
|
+
margin-bottom: 10px;
|
79
|
+
margin-right: 10px;
|
80
|
+
|
81
|
+
&__inner {
|
82
|
+
height: inherit;
|
83
|
+
}
|
84
|
+
:deep(.data-table) {
|
85
|
+
height: inherit;
|
86
|
+
.datagrid-outer-wrapper {
|
87
|
+
height: inherit;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
.vm-icon {
|
92
|
+
margin-right: 5px;
|
93
|
+
}
|
94
|
+
</style>
|