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,388 +1,388 @@
1
- <template>
2
- <div class="chart-option-timespan-split">
3
- <div class="vertical-flex-container">
4
- <div class="timespan-objects-section-direction">
5
- <label for="chart-timespan-type-select"
6
- >{{ localization.timespan }}:</label
7
- >
8
- <div class="vertical-flex-container chart-option-timespan-settings">
9
- <div class="timespan-select chart-option-setting-row">
10
- <div class="view-select-label horizontal-flex-container">
11
- <div class="select">
12
- <select
13
- id="chart-timespan-type-select"
14
- v-model="selectedTimespan"
15
- >
16
- <option
17
- v-for="(item, index) in timespanOptions"
18
- :key="index"
19
- :value="item.value"
20
- >
21
- {{ item.text }}
22
- </option>
23
- </select>
24
- </div>
25
- </div>
26
- </div>
27
- <div
28
- :class="[
29
- 'custom-timespan-settings-container',
30
- { active: selectedTimespan === 'custom_interval' },
31
- ]"
32
- >
33
- <table>
34
- <tbody>
35
- <tr>
36
- <td class="relative">
37
- <input
38
- id="custom-time-lastInput"
39
- v-model="timespanRadioSelect"
40
- type="radio"
41
- value="last"
42
- class="custom-radio-button"
43
- name="lastFrom"
44
- />
45
- <label
46
- for="custom-time-lastInput"
47
- class="custom-radio-label"
48
- >{{ localization.last }}:
49
- </label>
50
- </td>
51
- <td>
52
- <div
53
- :class="[
54
- 'custom-timespan-type-last-container',
55
- { active: timespanRadioSelect === 'last' },
56
- ]"
57
- >
58
- <input
59
- id="chart-option-setting-row"
60
- v-model="last"
61
- type="number"
62
- class="chart-option-setting-row custom-time-input"
63
- />
64
- <div
65
- class="chart-option-setting-row custom-time-input inline-block"
66
- >
67
- <div
68
- class="view-select-label horizontal-flex-container"
69
- >
70
- <div class="select">
71
- <select
72
- id="chart-timespan-type-select"
73
- v-model="selectedCustomTime"
74
- >
75
- <option
76
- v-for="(item, index) in customTimeOptions"
77
- :key="index"
78
- :value="item.value"
79
- >
80
- {{ item.text }}
81
- </option>
82
- </select>
83
- </div>
84
- </div>
85
- </div>
86
- </div>
87
- </td>
88
- </tr>
89
- <tr>
90
- <td class="relative">
91
- <input
92
- id="custom-time-fromInput"
93
- v-model="timespanRadioSelect"
94
- type="radio"
95
- value="from"
96
- class="custom-radio-button"
97
- name="lastFrom"
98
- />
99
- <label
100
- for="custom-time-fromInput"
101
- class="custom-radio-label text-capitalize text-right"
102
- >{{ localization.from }}:
103
- </label>
104
- </td>
105
- <td>
106
- <div
107
- :class="[
108
- 'date-container-row disabled-container calendar-date-row',
109
- { active: timespanRadioSelect === 'from' },
110
- ]"
111
- >
112
- <input
113
- id="current-date-from"
114
- v-model.lazy="currentDateFrom"
115
- type="text"
116
- class="chart-option-setting-row custom-time-input first-from"
117
- />
118
- <div class="section-datepicker">
119
- <atoms-datepicker
120
- v-model="dateFrom"
121
- :lang="currentLang"
122
- class="calendar-from calendar-popup btn-show-hide-calendar"
123
- @update="onUpdateDateFrom"
124
- />
125
- </div>
126
- <input
127
- id="current-time-from"
128
- v-model="currentTimeFrom"
129
- type="text"
130
- class="chart-option-setting-row custom-time-input"
131
- />
132
- </div>
133
- </td>
134
- </tr>
135
- <tr>
136
- <td class="custom-time-label-text text-right">
137
- {{ localization.to }}:
138
- </td>
139
- <td>
140
- <div
141
- :class="[
142
- 'date-container-row disabled-container calendar-date-row',
143
- { active: timespanRadioSelect === 'from' },
144
- ]"
145
- >
146
- <input
147
- id="current-date-to"
148
- v-model.lazy="currentDateTo"
149
- type="text"
150
- class="chart-option-setting-row custom-time-input first-to"
151
- />
152
- <div class="section-datepicker">
153
- <atoms-datepicker
154
- v-model="dateTo"
155
- :lang="currentLang"
156
- class="calendar-from calendar-popup btn-show-hide-calendar"
157
- @update="onUpdateDateTo"
158
- />
159
- </div>
160
- <input
161
- id="current-time-to"
162
- v-model="currentTimeTo"
163
- type="text"
164
- class="chart-option-setting-row custom-time-input"
165
- />
166
- </div>
167
- </td>
168
- </tr>
169
- <tr>
170
- <td></td>
171
- <td
172
- :class="[
173
- 'disabled-container',
174
- { active: timespanRadioSelect === 'from' },
175
- ]"
176
- >
177
- <span> (time is in ISO 8601 format) </span>
178
- </td>
179
- </tr>
180
- </tbody>
181
- </table>
182
- </div>
183
- </div>
184
- </div>
185
- <div class="horizontal-flex-container chart-type-container">
186
- <div class="view-select-label horizontal-flex-container">
187
- <label for="chart-type-select" class="label-select"
188
- >{{ localization.chartType }}:</label
189
- >
190
- <div class="select">
191
- <select id="chart-type-select" v-model="selectedChartType">
192
- <option
193
- v-for="(item, index) in chartTypeOptions"
194
- :key="index"
195
- :value="item.value"
196
- >
197
- {{ item.text }}
198
- </option>
199
- </select>
200
- </div>
201
- </div>
202
- </div>
203
- </div>
204
- </div>
205
- </template>
206
-
207
- <script setup lang="ts">
208
- import { format } from 'date-fns'
209
- import { UI_I_Localization } from '~/models/interfaces'
210
- import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
211
- import {
212
- timespanFunc,
213
- customTimeFunc,
214
- chartTypeFunc,
215
- } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/config/dateForm'
216
-
217
- const { $store, $formattedDate, $isDate, $getTimeFormat, $getUnixByDate } =
218
- useNuxtApp()
219
-
220
- const localization = computed<UI_I_Localization>(() => useLocal())
221
-
222
- const timespanOptions = computed<UI_I_OptionItem[]>(() =>
223
- timespanFunc(localization.value)
224
- )
225
- const selectedTimespan = ref<string>(timespanOptions.value[0].value)
226
-
227
- const timespanRadioSelect = ref<string>('last')
228
-
229
- const last = ref<number>(1)
230
-
231
- const selectedCustomTime = ref<string>('hours')
232
- const customTimeOptions = computed<UI_I_OptionItem[]>(() =>
233
- customTimeFunc(localization.value)
234
- )
235
-
236
- const selectedChartType = ref<string>('line_graph')
237
- const chartTypeOptions = computed<UI_I_OptionItem[]>(() =>
238
- chartTypeFunc(localization.value)
239
- )
240
-
241
- const yesterday = new Date().setDate(new Date().getDate() - 1)
242
- const dateFrom = ref<number>(yesterday)
243
- const dateTo = ref<number>(new Date().getTime())
244
-
245
- const currentLang = ref<string>(useLocalStorage('lang') ?? 'ru_RU')
246
-
247
- const timeFormatUpdater = computed<number>(
248
- () => $store.getters['main/getTimeFormatUpdater']
249
- )
250
- watch(timeFormatUpdater, () => {
251
- currentLang.value = useLocalStorage('lang') ?? 'ru_RU'
252
- getCurrentTime()
253
- })
254
-
255
- const currentDateFrom = ref<string>('')
256
- const currentDateTo = ref<string>('')
257
- const currentTimeFrom = ref<string>('')
258
- const currentTimeTo = ref<string>('')
259
-
260
- const getCurrentTime = (): void => {
261
- currentDateFrom.value = $formattedDate(yesterday, '')
262
- currentDateTo.value = $formattedDate(new Date(), '')
263
-
264
- const currentTime = format(new Date(), $getTimeFormat(true))
265
- currentTimeFrom.value = currentTime
266
- currentTimeTo.value = currentTime
267
- }
268
-
269
- const onUpdateDateFrom = (val: number) => {
270
- if (!val) return
271
-
272
- currentDateFrom.value = $formattedDate(new Date(val), '')
273
- }
274
- watch(currentDateFrom, (val) => {
275
- if (!val) return
276
-
277
- if ($isDate(val)) dateFrom.value = $getUnixByDate(val)
278
- })
279
-
280
- const onUpdateDateTo = (val: number) => {
281
- if (!val) return
282
-
283
- currentDateTo.value = $formattedDate(new Date(val), '')
284
- }
285
- watch(currentDateTo, (val) => {
286
- if (!val) return
287
-
288
- if ($isDate(val)) dateTo.value = $getUnixByDate(val)
289
- })
290
-
291
- onMounted(() => {
292
- getCurrentTime()
293
- })
294
- </script>
295
-
296
- <style scoped lang="scss">
297
- .chart-option-timespan-split {
298
- overflow-x: auto;
299
- flex-basis: 56%;
300
- padding: 5px;
301
-
302
- .timespan-objects-section-direction {
303
- display: flex;
304
- flex-direction: row;
305
- align-items: flex-start;
306
-
307
- .chart-option-timespan-settings {
308
- margin-left: 15px;
309
-
310
- .chart-option-setting-row {
311
- width: 150px;
312
- margin-bottom: 5px;
313
- }
314
-
315
- .custom-radio-button {
316
- position: absolute;
317
- opacity: 0;
318
-
319
- &:checked + .custom-radio-label:before {
320
- box-shadow: inset 0 0 0 6px #0079b8;
321
- border: none;
322
- }
323
- }
324
- .custom-radio-label {
325
- display: block;
326
- position: relative;
327
- min-height: 19.2px;
328
- padding-left: 23px;
329
- cursor: pointer;
330
- line-height: 19.2px;
331
- color: #454545;
332
-
333
- &:before {
334
- position: absolute;
335
- top: 3px;
336
- left: 0;
337
- content: '';
338
- display: inline-block;
339
- height: 16px;
340
- width: 16px;
341
- border: 0.8px solid #565656;
342
- border-radius: 50%;
343
- }
344
- }
345
-
346
- .calendar-date-row {
347
- display: flex;
348
- align-items: center;
349
-
350
- .custom-time-input.first-from,
351
- .custom-time-input.first-to {
352
- max-width: 114px;
353
- }
354
- .btn-show-hide-calendar {
355
- margin: 0 9px;
356
- cursor: pointer;
357
- }
358
- }
359
-
360
- .custom-time-input {
361
- margin-left: 8px;
362
- margin-right: 8px;
363
- max-width: 140px;
364
- }
365
- }
366
-
367
- .custom-timespan-settings-container:not(.active),
368
- .custom-timespan-type-last-container:not(.active),
369
- .disabled-container:not(.active) {
370
- opacity: 0.6;
371
- pointer-events: none;
372
- }
373
- }
374
-
375
- .chart-type-container {
376
- margin-top: 15px;
377
-
378
- .horizontal-flex-container {
379
- display: flex;
380
- flex-direction: row;
381
-
382
- .select {
383
- margin-left: 15px;
384
- }
385
- }
386
- }
387
- }
388
- </style>
1
+ <template>
2
+ <div class="chart-option-timespan-split">
3
+ <div class="vertical-flex-container">
4
+ <div class="timespan-objects-section-direction">
5
+ <label for="chart-timespan-type-select"
6
+ >{{ localization.timespan }}:</label
7
+ >
8
+ <div class="vertical-flex-container chart-option-timespan-settings">
9
+ <div class="timespan-select chart-option-setting-row">
10
+ <div class="view-select-label horizontal-flex-container">
11
+ <div class="select">
12
+ <select
13
+ id="chart-timespan-type-select"
14
+ v-model="selectedTimespan"
15
+ >
16
+ <option
17
+ v-for="(item, index) in timespanOptions"
18
+ :key="index"
19
+ :value="item.value"
20
+ >
21
+ {{ item.text }}
22
+ </option>
23
+ </select>
24
+ </div>
25
+ </div>
26
+ </div>
27
+ <div
28
+ :class="[
29
+ 'custom-timespan-settings-container',
30
+ { active: selectedTimespan === 'custom_interval' },
31
+ ]"
32
+ >
33
+ <table>
34
+ <tbody>
35
+ <tr>
36
+ <td class="relative">
37
+ <input
38
+ id="custom-time-lastInput"
39
+ v-model="timespanRadioSelect"
40
+ type="radio"
41
+ value="last"
42
+ class="custom-radio-button"
43
+ name="lastFrom"
44
+ />
45
+ <label
46
+ for="custom-time-lastInput"
47
+ class="custom-radio-label"
48
+ >{{ localization.last }}:
49
+ </label>
50
+ </td>
51
+ <td>
52
+ <div
53
+ :class="[
54
+ 'custom-timespan-type-last-container',
55
+ { active: timespanRadioSelect === 'last' },
56
+ ]"
57
+ >
58
+ <input
59
+ id="chart-option-setting-row"
60
+ v-model="last"
61
+ type="number"
62
+ class="chart-option-setting-row custom-time-input"
63
+ />
64
+ <div
65
+ class="chart-option-setting-row custom-time-input inline-block"
66
+ >
67
+ <div
68
+ class="view-select-label horizontal-flex-container"
69
+ >
70
+ <div class="select">
71
+ <select
72
+ id="chart-timespan-type-select"
73
+ v-model="selectedCustomTime"
74
+ >
75
+ <option
76
+ v-for="(item, index) in customTimeOptions"
77
+ :key="index"
78
+ :value="item.value"
79
+ >
80
+ {{ item.text }}
81
+ </option>
82
+ </select>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ </td>
88
+ </tr>
89
+ <tr>
90
+ <td class="relative">
91
+ <input
92
+ id="custom-time-fromInput"
93
+ v-model="timespanRadioSelect"
94
+ type="radio"
95
+ value="from"
96
+ class="custom-radio-button"
97
+ name="lastFrom"
98
+ />
99
+ <label
100
+ for="custom-time-fromInput"
101
+ class="custom-radio-label text-capitalize text-right"
102
+ >{{ localization.from }}:
103
+ </label>
104
+ </td>
105
+ <td>
106
+ <div
107
+ :class="[
108
+ 'date-container-row disabled-container calendar-date-row',
109
+ { active: timespanRadioSelect === 'from' },
110
+ ]"
111
+ >
112
+ <input
113
+ id="current-date-from"
114
+ v-model.lazy="currentDateFrom"
115
+ type="text"
116
+ class="chart-option-setting-row custom-time-input first-from"
117
+ />
118
+ <div class="section-datepicker">
119
+ <atoms-datepicker
120
+ v-model="dateFrom"
121
+ :lang="currentLang"
122
+ class="calendar-from calendar-popup btn-show-hide-calendar"
123
+ @update="onUpdateDateFrom"
124
+ />
125
+ </div>
126
+ <input
127
+ id="current-time-from"
128
+ v-model="currentTimeFrom"
129
+ type="text"
130
+ class="chart-option-setting-row custom-time-input"
131
+ />
132
+ </div>
133
+ </td>
134
+ </tr>
135
+ <tr>
136
+ <td class="custom-time-label-text text-right">
137
+ {{ localization.to }}:
138
+ </td>
139
+ <td>
140
+ <div
141
+ :class="[
142
+ 'date-container-row disabled-container calendar-date-row',
143
+ { active: timespanRadioSelect === 'from' },
144
+ ]"
145
+ >
146
+ <input
147
+ id="current-date-to"
148
+ v-model.lazy="currentDateTo"
149
+ type="text"
150
+ class="chart-option-setting-row custom-time-input first-to"
151
+ />
152
+ <div class="section-datepicker">
153
+ <atoms-datepicker
154
+ v-model="dateTo"
155
+ :lang="currentLang"
156
+ class="calendar-from calendar-popup btn-show-hide-calendar"
157
+ @update="onUpdateDateTo"
158
+ />
159
+ </div>
160
+ <input
161
+ id="current-time-to"
162
+ v-model="currentTimeTo"
163
+ type="text"
164
+ class="chart-option-setting-row custom-time-input"
165
+ />
166
+ </div>
167
+ </td>
168
+ </tr>
169
+ <tr>
170
+ <td></td>
171
+ <td
172
+ :class="[
173
+ 'disabled-container',
174
+ { active: timespanRadioSelect === 'from' },
175
+ ]"
176
+ >
177
+ <span> (time is in ISO 8601 format) </span>
178
+ </td>
179
+ </tr>
180
+ </tbody>
181
+ </table>
182
+ </div>
183
+ </div>
184
+ </div>
185
+ <div class="horizontal-flex-container chart-type-container">
186
+ <div class="view-select-label horizontal-flex-container">
187
+ <label for="chart-type-select" class="label-select"
188
+ >{{ localization.chartType }}:</label
189
+ >
190
+ <div class="select">
191
+ <select id="chart-type-select" v-model="selectedChartType">
192
+ <option
193
+ v-for="(item, index) in chartTypeOptions"
194
+ :key="index"
195
+ :value="item.value"
196
+ >
197
+ {{ item.text }}
198
+ </option>
199
+ </select>
200
+ </div>
201
+ </div>
202
+ </div>
203
+ </div>
204
+ </div>
205
+ </template>
206
+
207
+ <script setup lang="ts">
208
+ import { format } from 'date-fns'
209
+ import { UI_I_Localization } from '~/models/interfaces'
210
+ import { UI_I_OptionItem } from '~/components/atoms/models/interfaces'
211
+ import {
212
+ timespanFunc,
213
+ customTimeFunc,
214
+ chartTypeFunc,
215
+ } from '~/components/common/monitor/advanced/tools/chartOptionsModal/counters/timespan/form/config/dateForm'
216
+
217
+ const { $store, $formattedDate, $isDate, $getTimeFormat, $getUnixByDate } =
218
+ useNuxtApp()
219
+
220
+ const localization = computed<UI_I_Localization>(() => useLocal())
221
+
222
+ const timespanOptions = computed<UI_I_OptionItem[]>(() =>
223
+ timespanFunc(localization.value)
224
+ )
225
+ const selectedTimespan = ref<string>(timespanOptions.value[0].value)
226
+
227
+ const timespanRadioSelect = ref<string>('last')
228
+
229
+ const last = ref<number>(1)
230
+
231
+ const selectedCustomTime = ref<string>('hours')
232
+ const customTimeOptions = computed<UI_I_OptionItem[]>(() =>
233
+ customTimeFunc(localization.value)
234
+ )
235
+
236
+ const selectedChartType = ref<string>('line_graph')
237
+ const chartTypeOptions = computed<UI_I_OptionItem[]>(() =>
238
+ chartTypeFunc(localization.value)
239
+ )
240
+
241
+ const yesterday = new Date().setDate(new Date().getDate() - 1)
242
+ const dateFrom = ref<number>(yesterday)
243
+ const dateTo = ref<number>(new Date().getTime())
244
+
245
+ const currentLang = ref<string>(useLocalStorage('lang') ?? 'ru_RU')
246
+
247
+ const timeFormatUpdater = computed<number>(
248
+ () => $store.getters['main/getTimeFormatUpdater']
249
+ )
250
+ watch(timeFormatUpdater, () => {
251
+ currentLang.value = useLocalStorage('lang') ?? 'ru_RU'
252
+ getCurrentTime()
253
+ })
254
+
255
+ const currentDateFrom = ref<string>('')
256
+ const currentDateTo = ref<string>('')
257
+ const currentTimeFrom = ref<string>('')
258
+ const currentTimeTo = ref<string>('')
259
+
260
+ const getCurrentTime = (): void => {
261
+ currentDateFrom.value = $formattedDate(yesterday, '')
262
+ currentDateTo.value = $formattedDate(new Date(), '')
263
+
264
+ const currentTime = format(new Date(), $getTimeFormat(true))
265
+ currentTimeFrom.value = currentTime
266
+ currentTimeTo.value = currentTime
267
+ }
268
+
269
+ const onUpdateDateFrom = (val: number) => {
270
+ if (!val) return
271
+
272
+ currentDateFrom.value = $formattedDate(new Date(val), '')
273
+ }
274
+ watch(currentDateFrom, (val) => {
275
+ if (!val) return
276
+
277
+ if ($isDate(val)) dateFrom.value = $getUnixByDate(val)
278
+ })
279
+
280
+ const onUpdateDateTo = (val: number) => {
281
+ if (!val) return
282
+
283
+ currentDateTo.value = $formattedDate(new Date(val), '')
284
+ }
285
+ watch(currentDateTo, (val) => {
286
+ if (!val) return
287
+
288
+ if ($isDate(val)) dateTo.value = $getUnixByDate(val)
289
+ })
290
+
291
+ onMounted(() => {
292
+ getCurrentTime()
293
+ })
294
+ </script>
295
+
296
+ <style scoped lang="scss">
297
+ .chart-option-timespan-split {
298
+ overflow-x: auto;
299
+ flex-basis: 56%;
300
+ padding: 5px;
301
+
302
+ .timespan-objects-section-direction {
303
+ display: flex;
304
+ flex-direction: row;
305
+ align-items: flex-start;
306
+
307
+ .chart-option-timespan-settings {
308
+ margin-left: 15px;
309
+
310
+ .chart-option-setting-row {
311
+ width: 150px;
312
+ margin-bottom: 5px;
313
+ }
314
+
315
+ .custom-radio-button {
316
+ position: absolute;
317
+ opacity: 0;
318
+
319
+ &:checked + .custom-radio-label:before {
320
+ box-shadow: inset 0 0 0 6px #0079b8;
321
+ border: none;
322
+ }
323
+ }
324
+ .custom-radio-label {
325
+ display: block;
326
+ position: relative;
327
+ min-height: 19.2px;
328
+ padding-left: 23px;
329
+ cursor: pointer;
330
+ line-height: 19.2px;
331
+ color: #454545;
332
+
333
+ &:before {
334
+ position: absolute;
335
+ top: 3px;
336
+ left: 0;
337
+ content: '';
338
+ display: inline-block;
339
+ height: 16px;
340
+ width: 16px;
341
+ border: 0.8px solid #565656;
342
+ border-radius: 50%;
343
+ }
344
+ }
345
+
346
+ .calendar-date-row {
347
+ display: flex;
348
+ align-items: center;
349
+
350
+ .custom-time-input.first-from,
351
+ .custom-time-input.first-to {
352
+ max-width: 114px;
353
+ }
354
+ .btn-show-hide-calendar {
355
+ margin: 0 9px;
356
+ cursor: pointer;
357
+ }
358
+ }
359
+
360
+ .custom-time-input {
361
+ margin-left: 8px;
362
+ margin-right: 8px;
363
+ max-width: 140px;
364
+ }
365
+ }
366
+
367
+ .custom-timespan-settings-container:not(.active),
368
+ .custom-timespan-type-last-container:not(.active),
369
+ .disabled-container:not(.active) {
370
+ opacity: 0.6;
371
+ pointer-events: none;
372
+ }
373
+ }
374
+
375
+ .chart-type-container {
376
+ margin-top: 15px;
377
+
378
+ .horizontal-flex-container {
379
+ display: flex;
380
+ flex-direction: row;
381
+
382
+ .select {
383
+ margin-left: 15px;
384
+ }
385
+ }
386
+ }
387
+ }
388
+ </style>