bfg-common 1.4.723 → 1.4.725
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/assets/localization/local_be.json +5 -2
- package/assets/localization/local_en.json +5 -2
- package/assets/localization/local_hy.json +5 -2
- package/assets/localization/local_kk.json +5 -2
- package/assets/localization/local_ru.json +5 -2
- package/assets/localization/local_zh.json +5 -2
- package/assets/scss/clarity/local_ar.json +2916 -0
- package/assets/scss/common/normalize.scss +6 -0
- package/components/common/browse/blocks/contents/Files.vue +1 -1
- package/components/common/layout/theHeader/lib/models/enums.ts +1 -0
- package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/ChangeLanguage.vue +5 -2
- package/components/common/mainNavigationPanel/MainNavigationPanelOld.vue +36 -20
- package/components/common/monitor/advanced/Advanced.vue +244 -244
- package/components/common/monitor/advanced/tools/Tools.vue +447 -447
- package/components/common/monitor/advanced/tools/chartOptionsModal/ChartOptionsModal.vue +511 -511
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/Counters.vue +108 -108
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/Timespan.vue +95 -95
- package/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/Form.vue +544 -544
- package/components/common/monitor/overview/filters/Filters.vue +235 -235
- package/components/common/monitor/overview/filters/customIntervalModal/CustomIntervalModal.vue +250 -250
- package/components/common/monitor/overview/filters/customIntervalModal/lib/config/dateChecker.ts +62 -62
- package/components/common/pages/hardwareHealth/HardwareHealth.vue +213 -213
- package/components/common/pages/hardwareHealth/historyTestimony/Graph.vue +456 -456
- package/components/common/pages/hardwareHealth/historyTestimony/tools/Tools.vue +387 -387
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/ChartOptionsModal.vue +494 -494
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/Counters.vue +96 -96
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/Timespan.vue +68 -68
- package/components/common/pages/hardwareHealth/historyTestimony/tools/chartOptionsModal/counters/timespan/form/Form.vue +544 -544
- package/components/common/recursionTree/RecursionTree.vue +29 -18
- package/components/common/selectLanguage/lib/config/config.ts +5 -0
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/MediaNew.vue +17 -2
- package/components/common/vm/actions/common/customizeHardware/virtualHardware/cdDvdDrive/media/MediaOld.vue +11 -3
- package/composables/useLocal.ts +5 -0
- package/layouts/auth.vue +1 -0
- package/package.json +1 -1
package/components/common/monitor/overview/filters/customIntervalModal/CustomIntervalModal.vue
CHANGED
|
@@ -1,250 +1,250 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<atoms-modal
|
|
3
|
-
width="580px"
|
|
4
|
-
class="add-permission"
|
|
5
|
-
:show="true"
|
|
6
|
-
:title="titleIntervalModal"
|
|
7
|
-
:second-title="selectedItem"
|
|
8
|
-
test-id="overview-custom-interval-modal"
|
|
9
|
-
@hide="onHide"
|
|
10
|
-
@submit="onSubmit"
|
|
11
|
-
>
|
|
12
|
-
<template #modalBody>
|
|
13
|
-
<atoms-alert
|
|
14
|
-
v-show="alertShow"
|
|
15
|
-
status="alert-danger"
|
|
16
|
-
:items="alertItems"
|
|
17
|
-
test-id="overview-alert"
|
|
18
|
-
@remove="alertShow = false"
|
|
19
|
-
/>
|
|
20
|
-
|
|
21
|
-
<table>
|
|
22
|
-
<tbody>
|
|
23
|
-
<tr>
|
|
24
|
-
<td class="text-right">
|
|
25
|
-
<label class="custom-time-label">
|
|
26
|
-
<span class="custom-time-label-text text-capitalize">
|
|
27
|
-
{{ localization.common.from }}:
|
|
28
|
-
</span>
|
|
29
|
-
</label>
|
|
30
|
-
</td>
|
|
31
|
-
<td>
|
|
32
|
-
<div class="flex-align-center input-row-container">
|
|
33
|
-
<input
|
|
34
|
-
id="current-date-from"
|
|
35
|
-
v-model.lazy="currentDateFrom"
|
|
36
|
-
data-id="current-date-from-input"
|
|
37
|
-
type="text"
|
|
38
|
-
class="chart-option-setting-row custom-time-input first-from"
|
|
39
|
-
/>
|
|
40
|
-
<div class="section-datepicker">
|
|
41
|
-
<atoms-datepicker
|
|
42
|
-
v-model="dateFrom"
|
|
43
|
-
:lang="props.currentLang"
|
|
44
|
-
class="chart-option-setting-row custom-time-input"
|
|
45
|
-
test-id="overview-first-date-datepicker"
|
|
46
|
-
@update="onUpdateDateFrom"
|
|
47
|
-
/>
|
|
48
|
-
</div>
|
|
49
|
-
<input
|
|
50
|
-
id="current-time-from"
|
|
51
|
-
v-model="currentTimeFrom"
|
|
52
|
-
data-id="current-time-from-input"
|
|
53
|
-
type="text"
|
|
54
|
-
class="chart-option-setting-row custom-time-input"
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
|
-
</td>
|
|
58
|
-
</tr>
|
|
59
|
-
<tr>
|
|
60
|
-
<td class="text-right">
|
|
61
|
-
<label class="custom-time-label">
|
|
62
|
-
<span class="custom-time-label-text text-capitalize">
|
|
63
|
-
{{ localization.common.to }}:
|
|
64
|
-
</span>
|
|
65
|
-
</label>
|
|
66
|
-
</td>
|
|
67
|
-
<td>
|
|
68
|
-
<div class="flex-align-center input-row-container">
|
|
69
|
-
<input
|
|
70
|
-
id="current-date-to"
|
|
71
|
-
v-model.lazy="currentDateTo"
|
|
72
|
-
data-id="current-date-to-input"
|
|
73
|
-
type="text"
|
|
74
|
-
class="chart-option-setting-row custom-time-input first-from"
|
|
75
|
-
/>
|
|
76
|
-
<div class="section-datepicker">
|
|
77
|
-
<atoms-datepicker
|
|
78
|
-
v-model="dateTo"
|
|
79
|
-
:lang="props.currentLang"
|
|
80
|
-
class="chart-option-setting-row custom-time-input"
|
|
81
|
-
test-id="overview-first-date-to-datepicker"
|
|
82
|
-
@update="onUpdateDateTo"
|
|
83
|
-
/>
|
|
84
|
-
</div>
|
|
85
|
-
<input
|
|
86
|
-
id="current-time-to"
|
|
87
|
-
v-model="currentTimeTo"
|
|
88
|
-
data-id="current-time-to-input"
|
|
89
|
-
type="text"
|
|
90
|
-
class="chart-option-setting-row custom-time-input"
|
|
91
|
-
/>
|
|
92
|
-
</div>
|
|
93
|
-
</td>
|
|
94
|
-
</tr>
|
|
95
|
-
<tr>
|
|
96
|
-
<td></td>
|
|
97
|
-
<td class="text-format-date">
|
|
98
|
-
(date and time are in ISO 8601 format)
|
|
99
|
-
</td>
|
|
100
|
-
</tr>
|
|
101
|
-
</tbody>
|
|
102
|
-
</table>
|
|
103
|
-
</template>
|
|
104
|
-
</atoms-modal>
|
|
105
|
-
</template>
|
|
106
|
-
|
|
107
|
-
<script setup lang="ts">
|
|
108
|
-
import { format } from 'date-fns'
|
|
109
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
110
|
-
import { checkDateFunc } from '~/components/common/monitor/overview/filters/customIntervalModal/lib/config/dateChecker'
|
|
111
|
-
|
|
112
|
-
const props = defineProps<{
|
|
113
|
-
formatDate: string
|
|
114
|
-
selectedPeriods: number[]
|
|
115
|
-
currentLang: string
|
|
116
|
-
validDateEnd: number
|
|
117
|
-
}>()
|
|
118
|
-
|
|
119
|
-
const emits = defineEmits<{
|
|
120
|
-
(event: 'hide'): void
|
|
121
|
-
(event: 'submit', value: number[]): void
|
|
122
|
-
}>()
|
|
123
|
-
|
|
124
|
-
const { $formattedDate, $formattedTime, $isDate, $getUnixByDate } = useNuxtApp()
|
|
125
|
-
|
|
126
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
127
|
-
|
|
128
|
-
const titleIntervalModal = ref<string>(
|
|
129
|
-
`${localization.value.common.timeRange}:`
|
|
130
|
-
)
|
|
131
|
-
|
|
132
|
-
const selectedItem = ref<string>('')
|
|
133
|
-
|
|
134
|
-
const onHide = (): void => {
|
|
135
|
-
getCurrentTime()
|
|
136
|
-
emits('hide')
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const yesterday = new Date().setDate(new Date().getDate() - 1)
|
|
140
|
-
const dateFrom = ref<number>(yesterday)
|
|
141
|
-
const dateTo = ref<number>(new Date().getTime())
|
|
142
|
-
|
|
143
|
-
const currentDateFrom = ref<string>('')
|
|
144
|
-
const currentDateTo = ref<string>('')
|
|
145
|
-
const currentTimeFrom = ref<string>('')
|
|
146
|
-
const currentTimeTo = ref<string>('')
|
|
147
|
-
|
|
148
|
-
const getCurrentTime = (): void => {
|
|
149
|
-
if (!props.selectedPeriods.length) {
|
|
150
|
-
currentDateFrom.value = $formattedDate(yesterday, props.formatDate)
|
|
151
|
-
currentDateTo.value = $formattedDate(props.validDateEnd, props.formatDate)
|
|
152
|
-
|
|
153
|
-
currentTimeFrom.value = format(new Date(), 'H:mm:ss')
|
|
154
|
-
currentTimeTo.value = format(props.validDateEnd, 'H:mm:ss')
|
|
155
|
-
|
|
156
|
-
return
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
currentDateFrom.value = $formattedDate(
|
|
160
|
-
props.selectedPeriods[0],
|
|
161
|
-
props.formatDate
|
|
162
|
-
)
|
|
163
|
-
currentDateTo.value = $formattedDate(
|
|
164
|
-
props.selectedPeriods[1],
|
|
165
|
-
props.formatDate
|
|
166
|
-
)
|
|
167
|
-
currentTimeFrom.value = $formattedTime(props.selectedPeriods[0], '', true)
|
|
168
|
-
currentTimeTo.value = $formattedTime(props.selectedPeriods[1], '', true)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
const onUpdateDateFrom = (val: number): void => {
|
|
172
|
-
if (!val) return
|
|
173
|
-
|
|
174
|
-
currentDateFrom.value = $formattedDate(new Date(val), props.formatDate)
|
|
175
|
-
}
|
|
176
|
-
watch(currentDateFrom, (newValue) => {
|
|
177
|
-
if (!newValue) return
|
|
178
|
-
|
|
179
|
-
if ($isDate(newValue)) dateFrom.value = $getUnixByDate(newValue)
|
|
180
|
-
})
|
|
181
|
-
|
|
182
|
-
const onUpdateDateTo = (val: number): void => {
|
|
183
|
-
if (!val) return
|
|
184
|
-
|
|
185
|
-
currentDateTo.value = $formattedDate(new Date(val), props.formatDate)
|
|
186
|
-
}
|
|
187
|
-
watch(currentDateTo, (newValue) => {
|
|
188
|
-
if (!newValue) return
|
|
189
|
-
|
|
190
|
-
if ($isDate(newValue)) dateTo.value = $getUnixByDate(newValue)
|
|
191
|
-
})
|
|
192
|
-
|
|
193
|
-
const alertShow = ref<boolean>(false)
|
|
194
|
-
const alertItems = ref<string[]>([])
|
|
195
|
-
|
|
196
|
-
const onSubmit = (): void => {
|
|
197
|
-
alertItems.value = []
|
|
198
|
-
alertShow.value = false
|
|
199
|
-
|
|
200
|
-
if (!dateFrom.value || !dateTo.value) return
|
|
201
|
-
|
|
202
|
-
const result = checkDateFunc(
|
|
203
|
-
localization.value,
|
|
204
|
-
currentDateFrom.value,
|
|
205
|
-
currentDateTo.value,
|
|
206
|
-
currentTimeFrom.value,
|
|
207
|
-
currentTimeTo.value,
|
|
208
|
-
props.validDateEnd,
|
|
209
|
-
props.formatDate
|
|
210
|
-
)
|
|
211
|
-
|
|
212
|
-
if (typeof result === 'string') {
|
|
213
|
-
alertShow.value = true
|
|
214
|
-
alertItems.value.push(result)
|
|
215
|
-
return
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
emits('submit', [result[0], result[1]])
|
|
219
|
-
onHide()
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
watch(
|
|
223
|
-
() => [props.selectedPeriods, props.currentLang],
|
|
224
|
-
(): void => {
|
|
225
|
-
getCurrentTime()
|
|
226
|
-
},
|
|
227
|
-
{ deep: true }
|
|
228
|
-
)
|
|
229
|
-
|
|
230
|
-
onMounted(() => {
|
|
231
|
-
selectedItem.value = location.hostname
|
|
232
|
-
getCurrentTime()
|
|
233
|
-
onSubmit()
|
|
234
|
-
})
|
|
235
|
-
</script>
|
|
236
|
-
|
|
237
|
-
<style scoped lang="scss">
|
|
238
|
-
.input-row-container {
|
|
239
|
-
padding-left: 5px;
|
|
240
|
-
|
|
241
|
-
.custom-time-input {
|
|
242
|
-
max-width: 120px;
|
|
243
|
-
margin-right: 15px;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
.text-format-date {
|
|
247
|
-
display: inline-block;
|
|
248
|
-
margin-top: 5px;
|
|
249
|
-
}
|
|
250
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<atoms-modal
|
|
3
|
+
width="580px"
|
|
4
|
+
class="add-permission"
|
|
5
|
+
:show="true"
|
|
6
|
+
:title="titleIntervalModal"
|
|
7
|
+
:second-title="selectedItem"
|
|
8
|
+
test-id="overview-custom-interval-modal"
|
|
9
|
+
@hide="onHide"
|
|
10
|
+
@submit="onSubmit"
|
|
11
|
+
>
|
|
12
|
+
<template #modalBody>
|
|
13
|
+
<atoms-alert
|
|
14
|
+
v-show="alertShow"
|
|
15
|
+
status="alert-danger"
|
|
16
|
+
:items="alertItems"
|
|
17
|
+
test-id="overview-alert"
|
|
18
|
+
@remove="alertShow = false"
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
<table>
|
|
22
|
+
<tbody>
|
|
23
|
+
<tr>
|
|
24
|
+
<td class="text-right">
|
|
25
|
+
<label class="custom-time-label">
|
|
26
|
+
<span class="custom-time-label-text text-capitalize">
|
|
27
|
+
{{ localization.common.from }}:
|
|
28
|
+
</span>
|
|
29
|
+
</label>
|
|
30
|
+
</td>
|
|
31
|
+
<td>
|
|
32
|
+
<div class="flex-align-center input-row-container">
|
|
33
|
+
<input
|
|
34
|
+
id="current-date-from"
|
|
35
|
+
v-model.lazy="currentDateFrom"
|
|
36
|
+
data-id="current-date-from-input"
|
|
37
|
+
type="text"
|
|
38
|
+
class="chart-option-setting-row custom-time-input first-from"
|
|
39
|
+
/>
|
|
40
|
+
<div class="section-datepicker">
|
|
41
|
+
<atoms-datepicker
|
|
42
|
+
v-model="dateFrom"
|
|
43
|
+
:lang="props.currentLang"
|
|
44
|
+
class="chart-option-setting-row custom-time-input"
|
|
45
|
+
test-id="overview-first-date-datepicker"
|
|
46
|
+
@update="onUpdateDateFrom"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
<input
|
|
50
|
+
id="current-time-from"
|
|
51
|
+
v-model="currentTimeFrom"
|
|
52
|
+
data-id="current-time-from-input"
|
|
53
|
+
type="text"
|
|
54
|
+
class="chart-option-setting-row custom-time-input"
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
</td>
|
|
58
|
+
</tr>
|
|
59
|
+
<tr>
|
|
60
|
+
<td class="text-right">
|
|
61
|
+
<label class="custom-time-label">
|
|
62
|
+
<span class="custom-time-label-text text-capitalize">
|
|
63
|
+
{{ localization.common.to }}:
|
|
64
|
+
</span>
|
|
65
|
+
</label>
|
|
66
|
+
</td>
|
|
67
|
+
<td>
|
|
68
|
+
<div class="flex-align-center input-row-container">
|
|
69
|
+
<input
|
|
70
|
+
id="current-date-to"
|
|
71
|
+
v-model.lazy="currentDateTo"
|
|
72
|
+
data-id="current-date-to-input"
|
|
73
|
+
type="text"
|
|
74
|
+
class="chart-option-setting-row custom-time-input first-from"
|
|
75
|
+
/>
|
|
76
|
+
<div class="section-datepicker">
|
|
77
|
+
<atoms-datepicker
|
|
78
|
+
v-model="dateTo"
|
|
79
|
+
:lang="props.currentLang"
|
|
80
|
+
class="chart-option-setting-row custom-time-input"
|
|
81
|
+
test-id="overview-first-date-to-datepicker"
|
|
82
|
+
@update="onUpdateDateTo"
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
<input
|
|
86
|
+
id="current-time-to"
|
|
87
|
+
v-model="currentTimeTo"
|
|
88
|
+
data-id="current-time-to-input"
|
|
89
|
+
type="text"
|
|
90
|
+
class="chart-option-setting-row custom-time-input"
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
</td>
|
|
94
|
+
</tr>
|
|
95
|
+
<tr>
|
|
96
|
+
<td></td>
|
|
97
|
+
<td class="text-format-date">
|
|
98
|
+
(date and time are in ISO 8601 format)
|
|
99
|
+
</td>
|
|
100
|
+
</tr>
|
|
101
|
+
</tbody>
|
|
102
|
+
</table>
|
|
103
|
+
</template>
|
|
104
|
+
</atoms-modal>
|
|
105
|
+
</template>
|
|
106
|
+
|
|
107
|
+
<script setup lang="ts">
|
|
108
|
+
import { format } from 'date-fns'
|
|
109
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
110
|
+
import { checkDateFunc } from '~/components/common/monitor/overview/filters/customIntervalModal/lib/config/dateChecker'
|
|
111
|
+
|
|
112
|
+
const props = defineProps<{
|
|
113
|
+
formatDate: string
|
|
114
|
+
selectedPeriods: number[]
|
|
115
|
+
currentLang: string
|
|
116
|
+
validDateEnd: number
|
|
117
|
+
}>()
|
|
118
|
+
|
|
119
|
+
const emits = defineEmits<{
|
|
120
|
+
(event: 'hide'): void
|
|
121
|
+
(event: 'submit', value: number[]): void
|
|
122
|
+
}>()
|
|
123
|
+
|
|
124
|
+
const { $formattedDate, $formattedTime, $isDate, $getUnixByDate } = useNuxtApp()
|
|
125
|
+
|
|
126
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
127
|
+
|
|
128
|
+
const titleIntervalModal = ref<string>(
|
|
129
|
+
`${localization.value.common.timeRange}:`
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
const selectedItem = ref<string>('')
|
|
133
|
+
|
|
134
|
+
const onHide = (): void => {
|
|
135
|
+
getCurrentTime()
|
|
136
|
+
emits('hide')
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const yesterday = new Date().setDate(new Date().getDate() - 1)
|
|
140
|
+
const dateFrom = ref<number>(yesterday)
|
|
141
|
+
const dateTo = ref<number>(new Date().getTime())
|
|
142
|
+
|
|
143
|
+
const currentDateFrom = ref<string>('')
|
|
144
|
+
const currentDateTo = ref<string>('')
|
|
145
|
+
const currentTimeFrom = ref<string>('')
|
|
146
|
+
const currentTimeTo = ref<string>('')
|
|
147
|
+
|
|
148
|
+
const getCurrentTime = (): void => {
|
|
149
|
+
if (!props.selectedPeriods.length) {
|
|
150
|
+
currentDateFrom.value = $formattedDate(yesterday, props.formatDate)
|
|
151
|
+
currentDateTo.value = $formattedDate(props.validDateEnd, props.formatDate)
|
|
152
|
+
|
|
153
|
+
currentTimeFrom.value = format(new Date(), 'H:mm:ss')
|
|
154
|
+
currentTimeTo.value = format(props.validDateEnd, 'H:mm:ss')
|
|
155
|
+
|
|
156
|
+
return
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
currentDateFrom.value = $formattedDate(
|
|
160
|
+
props.selectedPeriods[0],
|
|
161
|
+
props.formatDate
|
|
162
|
+
)
|
|
163
|
+
currentDateTo.value = $formattedDate(
|
|
164
|
+
props.selectedPeriods[1],
|
|
165
|
+
props.formatDate
|
|
166
|
+
)
|
|
167
|
+
currentTimeFrom.value = $formattedTime(props.selectedPeriods[0], '', true)
|
|
168
|
+
currentTimeTo.value = $formattedTime(props.selectedPeriods[1], '', true)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const onUpdateDateFrom = (val: number): void => {
|
|
172
|
+
if (!val) return
|
|
173
|
+
|
|
174
|
+
currentDateFrom.value = $formattedDate(new Date(val), props.formatDate)
|
|
175
|
+
}
|
|
176
|
+
watch(currentDateFrom, (newValue) => {
|
|
177
|
+
if (!newValue) return
|
|
178
|
+
|
|
179
|
+
if ($isDate(newValue)) dateFrom.value = $getUnixByDate(newValue)
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
const onUpdateDateTo = (val: number): void => {
|
|
183
|
+
if (!val) return
|
|
184
|
+
|
|
185
|
+
currentDateTo.value = $formattedDate(new Date(val), props.formatDate)
|
|
186
|
+
}
|
|
187
|
+
watch(currentDateTo, (newValue) => {
|
|
188
|
+
if (!newValue) return
|
|
189
|
+
|
|
190
|
+
if ($isDate(newValue)) dateTo.value = $getUnixByDate(newValue)
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
const alertShow = ref<boolean>(false)
|
|
194
|
+
const alertItems = ref<string[]>([])
|
|
195
|
+
|
|
196
|
+
const onSubmit = (): void => {
|
|
197
|
+
alertItems.value = []
|
|
198
|
+
alertShow.value = false
|
|
199
|
+
|
|
200
|
+
if (!dateFrom.value || !dateTo.value) return
|
|
201
|
+
|
|
202
|
+
const result = checkDateFunc(
|
|
203
|
+
localization.value,
|
|
204
|
+
currentDateFrom.value,
|
|
205
|
+
currentDateTo.value,
|
|
206
|
+
currentTimeFrom.value,
|
|
207
|
+
currentTimeTo.value,
|
|
208
|
+
props.validDateEnd,
|
|
209
|
+
props.formatDate
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
if (typeof result === 'string') {
|
|
213
|
+
alertShow.value = true
|
|
214
|
+
alertItems.value.push(result)
|
|
215
|
+
return
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
emits('submit', [result[0], result[1]])
|
|
219
|
+
onHide()
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
watch(
|
|
223
|
+
() => [props.selectedPeriods, props.currentLang],
|
|
224
|
+
(): void => {
|
|
225
|
+
getCurrentTime()
|
|
226
|
+
},
|
|
227
|
+
{ deep: true }
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
onMounted(() => {
|
|
231
|
+
selectedItem.value = location.hostname
|
|
232
|
+
getCurrentTime()
|
|
233
|
+
onSubmit()
|
|
234
|
+
})
|
|
235
|
+
</script>
|
|
236
|
+
|
|
237
|
+
<style scoped lang="scss">
|
|
238
|
+
.input-row-container {
|
|
239
|
+
padding-left: 5px;
|
|
240
|
+
|
|
241
|
+
.custom-time-input {
|
|
242
|
+
max-width: 120px;
|
|
243
|
+
margin-right: 15px;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
.text-format-date {
|
|
247
|
+
display: inline-block;
|
|
248
|
+
margin-top: 5px;
|
|
249
|
+
}
|
|
250
|
+
</style>
|
package/components/common/monitor/overview/filters/customIntervalModal/lib/config/dateChecker.ts
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
-
|
|
3
|
-
const isMoreThanOneMonth = (startDate: number, endDate: number): boolean => {
|
|
4
|
-
const date1 = new Date(startDate)
|
|
5
|
-
const date2 = new Date(endDate)
|
|
6
|
-
|
|
7
|
-
const nextMonth = new Date(date1)
|
|
8
|
-
nextMonth.setMonth(date1.getMonth() + 1)
|
|
9
|
-
|
|
10
|
-
return nextMonth < date2
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const checkDateFunc = (
|
|
14
|
-
localization: UI_I_Localization,
|
|
15
|
-
dateFrom: string,
|
|
16
|
-
dateTo: string,
|
|
17
|
-
timeFrom: string,
|
|
18
|
-
timeTo: string,
|
|
19
|
-
unixValidEnd: number,
|
|
20
|
-
formatDate: string
|
|
21
|
-
): string | number[] => {
|
|
22
|
-
const { $isDate, $getUnixByDate } = useNuxtApp()
|
|
23
|
-
|
|
24
|
-
let result = ''
|
|
25
|
-
const startDate = dateFrom + ' ' + timeFrom
|
|
26
|
-
const unixStartDate = $getUnixByDate(startDate)
|
|
27
|
-
const endDate = dateTo + ' ' + timeTo
|
|
28
|
-
const unixEndDate = $getUnixByDate(endDate)
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
!$isDate(unixStartDate) ||
|
|
32
|
-
!$isDate(unixEndDate) ||
|
|
33
|
-
!timeFrom ||
|
|
34
|
-
!timeTo
|
|
35
|
-
) {
|
|
36
|
-
result = localization.inventoryMonitor.invalidTimeEntry
|
|
37
|
-
return result
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (unixEndDate > unixValidEnd) {
|
|
41
|
-
const { $formattedDatetime } = useNuxtApp()
|
|
42
|
-
|
|
43
|
-
const currentShowValidEnd = $formattedDatetime(
|
|
44
|
-
new Date(unixValidEnd),
|
|
45
|
-
formatDate,
|
|
46
|
-
true
|
|
47
|
-
)
|
|
48
|
-
result =
|
|
49
|
-
localization.inventoryMonitor.timeRangeShouldNotBeMoreThanValidTo.replace(
|
|
50
|
-
'{0}',
|
|
51
|
-
currentShowValidEnd
|
|
52
|
-
)
|
|
53
|
-
} else if (unixEndDate === unixStartDate)
|
|
54
|
-
result = localization.inventoryMonitor.timeToShouldBeLaterTimeFrom
|
|
55
|
-
else if (unixEndDate - unixStartDate <= 3600000)
|
|
56
|
-
result = localization.inventoryMonitor.timeRangeShouldNotBeSmallerThanHour
|
|
57
|
-
else if (isMoreThanOneMonth(unixStartDate, unixEndDate))
|
|
58
|
-
result = localization.inventoryMonitor.timeRangeShouldNotBeMoreThanMonth
|
|
59
|
-
else return [unixStartDate, unixEndDate]
|
|
60
|
-
|
|
61
|
-
return result
|
|
62
|
-
}
|
|
1
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
2
|
+
|
|
3
|
+
const isMoreThanOneMonth = (startDate: number, endDate: number): boolean => {
|
|
4
|
+
const date1 = new Date(startDate)
|
|
5
|
+
const date2 = new Date(endDate)
|
|
6
|
+
|
|
7
|
+
const nextMonth = new Date(date1)
|
|
8
|
+
nextMonth.setMonth(date1.getMonth() + 1)
|
|
9
|
+
|
|
10
|
+
return nextMonth < date2
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const checkDateFunc = (
|
|
14
|
+
localization: UI_I_Localization,
|
|
15
|
+
dateFrom: string,
|
|
16
|
+
dateTo: string,
|
|
17
|
+
timeFrom: string,
|
|
18
|
+
timeTo: string,
|
|
19
|
+
unixValidEnd: number,
|
|
20
|
+
formatDate: string
|
|
21
|
+
): string | number[] => {
|
|
22
|
+
const { $isDate, $getUnixByDate } = useNuxtApp()
|
|
23
|
+
|
|
24
|
+
let result = ''
|
|
25
|
+
const startDate = dateFrom + ' ' + timeFrom
|
|
26
|
+
const unixStartDate = $getUnixByDate(startDate)
|
|
27
|
+
const endDate = dateTo + ' ' + timeTo
|
|
28
|
+
const unixEndDate = $getUnixByDate(endDate)
|
|
29
|
+
|
|
30
|
+
if (
|
|
31
|
+
!$isDate(unixStartDate) ||
|
|
32
|
+
!$isDate(unixEndDate) ||
|
|
33
|
+
!timeFrom ||
|
|
34
|
+
!timeTo
|
|
35
|
+
) {
|
|
36
|
+
result = localization.inventoryMonitor.invalidTimeEntry
|
|
37
|
+
return result
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (unixEndDate > unixValidEnd) {
|
|
41
|
+
const { $formattedDatetime } = useNuxtApp()
|
|
42
|
+
|
|
43
|
+
const currentShowValidEnd = $formattedDatetime(
|
|
44
|
+
new Date(unixValidEnd),
|
|
45
|
+
formatDate,
|
|
46
|
+
true
|
|
47
|
+
)
|
|
48
|
+
result =
|
|
49
|
+
localization.inventoryMonitor.timeRangeShouldNotBeMoreThanValidTo.replace(
|
|
50
|
+
'{0}',
|
|
51
|
+
currentShowValidEnd
|
|
52
|
+
)
|
|
53
|
+
} else if (unixEndDate === unixStartDate)
|
|
54
|
+
result = localization.inventoryMonitor.timeToShouldBeLaterTimeFrom
|
|
55
|
+
else if (unixEndDate - unixStartDate <= 3600000)
|
|
56
|
+
result = localization.inventoryMonitor.timeRangeShouldNotBeSmallerThanHour
|
|
57
|
+
else if (isMoreThanOneMonth(unixStartDate, unixEndDate))
|
|
58
|
+
result = localization.inventoryMonitor.timeRangeShouldNotBeMoreThanMonth
|
|
59
|
+
else return [unixStartDate, unixEndDate]
|
|
60
|
+
|
|
61
|
+
return result
|
|
62
|
+
}
|