bfg-common 1.4.271 → 1.4.273

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.
@@ -124,6 +124,29 @@ const userNameErrorText = computed<string>(() => {
124
124
  const frequencyMethodOptions = computed<UI_I_SelectInputItem[]>(() =>
125
125
  frequencyMethodFunc(localization.value)
126
126
  )
127
+
128
+ watch(
129
+ model,
130
+ (newValue: UI_I_ScheduleNewTasksForm) => {
131
+ console.log(newValue, '444444')
132
+ const date = newValue.frg_on_time && new Date(newValue.frg_on_time)
133
+ newValue.cron = generateOnceCronExpression(date)
134
+ },
135
+ { deep: true }
136
+ )
137
+
138
+ const generateOnceCronExpression = (date: Date | null): any => {
139
+ if(!date) return
140
+ const minutes = date.getMinutes()
141
+ const hours = date.getHours()
142
+ const day = date.getDate()
143
+ const month = date.getMonth() + 1 // В cron месяцы начинаются с 1 (январь = 1)
144
+ const dayOfWeek = '*' // Для одноразовой задачи день недели неважен
145
+
146
+ // Генерируем cron-выражение
147
+ const cronExpression = `${minutes} ${hours} ${day} ${month} ${dayOfWeek} once`
148
+ return cronExpression
149
+ }
127
150
  </script>
128
151
 
129
152
  <style lang="scss" scoped>
@@ -16,4 +16,5 @@ export interface UI_I_ScheduleNewTasksForm {
16
16
  frq_week_day: UI_T_FrequencyWeeksDays
17
17
  frg_on_time: number | null
18
18
  frg_on_week_days: number[]
19
+ cron: string
19
20
  }
@@ -15,7 +15,7 @@
15
15
  <template #modalBody="{ selectedStep }">
16
16
  <common-pages-scheduled-tasks-modals-common-new-task-form
17
17
  v-if="selectedStep.id === 0"
18
- v-model="newScheduledTaskForm"
18
+ v-model="modelSchedulerTask"
19
19
  :target="selectedVirtualMachine"
20
20
  />
21
21
 
@@ -95,12 +95,9 @@ import type { UI_I_VmSettings } from '~/lib/models/store/vm/interfaces'
95
95
  import type { UI_I_TreeNode } from '~/components/common/recursionTree/lib/models/interfaces'
96
96
  import type { UI_I_StorageConfigurePerDiskItem } from '~/components/common/wizards/vm/migrate/select/storage/configure/disk/table/lib/models/interfaces'
97
97
  import type { UI_I_TableInfoItem } from '~/components/atoms/table/info/lib/models/interfaces'
98
- import type {UI_I_ScheduleNewTasksForm} from "~/components/common/pages/scheduledTasks/modals/lib/models/interfaces";
98
+ import type { UI_I_ScheduleNewTasksForm } from '~/components/common/pages/scheduledTasks/modals/lib/models/interfaces'
99
99
  import { constructDataReadyViewFunc } from '~/components/common/wizards/vm/migrate/lib/config/constructDataReady'
100
100
  import * as validation from '~/components/common/wizards/vm/migrate/lib/validations'
101
- import {
102
- scheduledTaskDefaultFormFunc
103
- } from "~/components/common/pages/scheduledTasks/modals/lib/config/createScheduledTask";
104
101
 
105
102
  const props = defineProps<{
106
103
  project: UI_T_Project
@@ -119,6 +116,10 @@ const emits = defineEmits<{
119
116
  (event: 'hide'): void
120
117
  (event: 'finish', value: UI_I_MigrateFormLocal): void
121
118
  }>()
119
+ const modelSchedulerTask = defineModel<UI_I_ScheduleNewTasksForm>(
120
+ 'schedulerForm',
121
+ { required: true }
122
+ )
122
123
 
123
124
  const localization = computed<UI_I_Localization>(() => useLocal())
124
125
 
@@ -166,9 +167,6 @@ const form = ref<UI_I_MigrateFormLocal>({
166
167
  },
167
168
  vMotion_priority: 'high',
168
169
  })
169
- const newScheduledTaskForm = ref<UI_I_ScheduleNewTasksForm>(
170
- useDeepCopy(scheduledTaskDefaultFormFunc())
171
- )
172
170
 
173
171
  const validationFunc = async (
174
172
  value: UI_I_WizardStep[],
@@ -236,6 +234,14 @@ watch(
236
234
  { deep: true, immediate: true }
237
235
  )
238
236
 
237
+ watch(
238
+ modelSchedulerTask,
239
+ (newValue: UI_I_ScheduleNewTasksForm) => {
240
+ if (props.isScheduledTasks) wizard.setDisabledNextButton(newValue.isValid)
241
+ },
242
+ { immediate: true, deep: true }
243
+ )
244
+
239
245
  const loading = ref<boolean>(false)
240
246
 
241
247
  const connectedStorageIdOnVm = computed<string>(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.271",
4
+ "version": "1.4.273",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",