bfg-common 1.2.44 → 1.2.46

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.
@@ -32,7 +32,6 @@
32
32
  </div>
33
33
  <a
34
34
  id="chart-options-button"
35
- href="#"
36
35
  class="chart-options-button"
37
36
  @click="onShowChartOptions"
38
37
  >{{ localization.chartOptions }}</a
@@ -375,6 +374,7 @@ onMounted(() => {
375
374
  white-space: nowrap;
376
375
  text-transform: capitalize;
377
376
  color: var(--dropdown-item-color);
377
+ cursor: pointer;
378
378
  }
379
379
 
380
380
  .chart-action-bar {
@@ -18,12 +18,9 @@
18
18
  <span v-else class="single-option">{{ periodOptions[0].text }}</span>
19
19
  </div>
20
20
  <div v-show="isShowCustomIntervalButton">
21
- <a
22
- id="show-interval-modal-button"
23
- href="#"
24
- @click="onShowIntervalModal"
25
- >{{ localization.changeCustomInterval }}</a
26
- >
21
+ <a id="show-interval-modal-button" @click="onShowIntervalModal">{{
22
+ localization.changeCustomInterval
23
+ }}</a>
27
24
  </div>
28
25
  <div v-if="!disabledPeriodOptions" class="chart-title">
29
26
  {{ chartTitleDate }}
@@ -47,7 +44,9 @@
47
44
  </div>
48
45
 
49
46
  <common-monitor-overview-filters-custom-interval-modal
50
- v-show="isShowIntervalModal"
47
+ v-if="isShowIntervalModal"
48
+ :selected-periods="props.selectedPeriods"
49
+ :format-date="props.formatDate"
51
50
  @hide="onHideIntervalModal"
52
51
  @submit="onSubmitIntervalModal"
53
52
  />
@@ -72,12 +71,14 @@ const props = defineProps<{
72
71
  endDate: number
73
72
  chartType: 'spline' | 'pie'
74
73
  view: UI_T_OverviewViewType
75
- formatDate?: 'string'
76
- formatTime?: 'string'
74
+ selectedPeriods: number[]
75
+ formatDate: string
76
+ formatTime?: string
77
77
  }>()
78
78
 
79
79
  const emits = defineEmits<{
80
- (event: 'update-filters', filters: UI_I_MonitorGraphPayload): void
80
+ (event: 'update-filters', value: UI_I_MonitorGraphPayload): void
81
+ (event: 'update-custom-date', value: number[]): void
81
82
  }>()
82
83
 
83
84
  const selectedPeriod = ref<string>('')
@@ -107,6 +108,7 @@ const onSubmitIntervalModal = (customDates: number[]): void => {
107
108
  customDatesData.value = customDates
108
109
  sendUpdatedFilters()
109
110
  onHideIntervalModal()
111
+ emits('update-custom-date', customDates)
110
112
  }
111
113
 
112
114
  const chartTitleDate = computed<string>(() => {
@@ -197,6 +199,11 @@ watch(
197
199
  text-transform: uppercase;
198
200
  }
199
201
 
202
+ #show-interval-modal-button {
203
+ cursor: pointer;
204
+ color: var(--dropdown-item-color);
205
+ }
206
+
200
207
  .view-select-label {
201
208
  margin-left: auto;
202
209
  padding-right: 7px;
@@ -105,12 +105,18 @@ import { format } from 'date-fns'
105
105
  import { UI_I_Localization } from '~/models/interfaces'
106
106
  import { checkDateFunc } from '~/components/common/monitor/overview/filters/customIntervalModal/config/dateChecker'
107
107
 
108
+ const props = defineProps<{
109
+ formatDate: string
110
+ selectedPeriods: number[]
111
+ }>()
112
+
108
113
  const emits = defineEmits<{
109
114
  (event: 'hide'): void
110
115
  (event: 'submit', arg1: number[]): void
111
116
  }>()
112
117
 
113
- const { $store, $formattedDate, $isDate, $getUnixByDate } = useNuxtApp()
118
+ const { $store, $formattedDate, $formattedTime, $isDate, $getUnixByDate } =
119
+ useNuxtApp()
114
120
 
115
121
  const localization = computed<UI_I_Localization>(() => useLocal())
116
122
 
@@ -132,12 +138,27 @@ const currentTimeFrom = ref<string>('')
132
138
  const currentTimeTo = ref<string>('')
133
139
 
134
140
  const getCurrentTime = (): void => {
135
- currentDateFrom.value = $formattedDate(yesterday, '')
136
- currentDateTo.value = $formattedDate(new Date(), '')
141
+ if (!props.selectedPeriods.length) {
142
+ currentDateFrom.value = $formattedDate(yesterday, props.formatDate)
143
+ currentDateTo.value = $formattedDate(new Date(), props.formatDate)
144
+
145
+ const currentTime = format(new Date(), 'H:mm:ss')
146
+ currentTimeFrom.value = currentTime
147
+ currentTimeTo.value = currentTime
148
+
149
+ return
150
+ }
137
151
 
138
- const currentTime = format(new Date(), 'H:mm:ss')
139
- currentTimeFrom.value = currentTime
140
- currentTimeTo.value = currentTime
152
+ currentDateFrom.value = $formattedDate(
153
+ props.selectedPeriods[0],
154
+ props.formatDate
155
+ )
156
+ currentDateTo.value = $formattedDate(
157
+ props.selectedPeriods[1],
158
+ props.formatDate
159
+ )
160
+ currentTimeFrom.value = $formattedTime(props.selectedPeriods[0], '', true)
161
+ currentTimeTo.value = $formattedTime(props.selectedPeriods[1], '', true)
141
162
  }
142
163
 
143
164
  const timeFormatUpdater = computed<number>(
@@ -152,7 +173,7 @@ watch(timeFormatUpdater, () => {
152
173
  const onUpdateDateFrom = (val: number): void => {
153
174
  if (!val) return
154
175
 
155
- currentDateFrom.value = $formattedDate(new Date(val), '')
176
+ currentDateFrom.value = $formattedDate(new Date(val), props.formatDate)
156
177
  }
157
178
  watch(currentDateFrom, (newValue) => {
158
179
  if (!newValue) return
@@ -163,7 +184,7 @@ watch(currentDateFrom, (newValue) => {
163
184
  const onUpdateDateTo = (val: number): void => {
164
185
  if (!val) return
165
186
 
166
- currentDateTo.value = $formattedDate(new Date(val), '')
187
+ currentDateTo.value = $formattedDate(new Date(val), props.formatDate)
167
188
  }
168
189
  watch(currentDateTo, (newValue) => {
169
190
  if (!newValue) return
@@ -7,29 +7,31 @@ export const checkDateFunc = (
7
7
  timeFrom: string,
8
8
  timeTo: string
9
9
  ): string | number[] => {
10
- const { $formattedDatetime, $isDate } = useNuxtApp()
10
+ const { $isDate, $getUnixByDate } = useNuxtApp()
11
11
 
12
12
  let result = ''
13
13
  const startDate = dateFrom + ' ' + timeFrom
14
+ const unixStartDate = $getUnixByDate(startDate)
14
15
  const endDate = dateTo + ' ' + timeTo
16
+ const unixEndDate = $getUnixByDate(endDate)
15
17
 
16
- if (!$isDate(startDate) || !$isDate(endDate) || !timeFrom || !timeTo)
18
+ if (
19
+ !$isDate(unixStartDate) ||
20
+ !$isDate(unixEndDate) ||
21
+ !timeFrom ||
22
+ !timeTo
23
+ ) {
17
24
  result = localization.invalidTimeEntry
18
- else {
19
- const endDateFormatted = $formattedDatetime(endDate, '', true)
20
- const endDateTime = new Date(endDateFormatted).getTime()
21
-
22
- const startDateFormatted = $formattedDatetime(startDate, '', true)
23
- const startDateTime = new Date(startDateFormatted).getTime()
24
-
25
- if (endDateTime > new Date().getTime())
26
- result = localization.oneOfSelectedDatesIsInTheFuture
27
- else if (endDateTime === startDateTime)
28
- result = localization.timeToShouldBeLaterTimeFrom
29
- else if (endDateTime - startDateTime <= 3600000)
30
- result = localization.timeRangeShouldNotBeSmallerThanHour
31
- else return [startDateTime, endDateTime]
25
+ return result
32
26
  }
33
27
 
28
+ if (unixEndDate > new Date().getTime())
29
+ result = localization.oneOfSelectedDatesIsInTheFuture
30
+ else if (unixEndDate === unixStartDate)
31
+ result = localization.timeToShouldBeLaterTimeFrom
32
+ else if (unixEndDate - unixStartDate <= 3600000)
33
+ result = localization.timeRangeShouldNotBeSmallerThanHour
34
+ else return [unixStartDate, unixEndDate]
35
+
34
36
  return result
35
37
  }
@@ -16,6 +16,8 @@ export type UI_T_ActionType =
16
16
  | 'takeSnapshot'
17
17
  | 'revertLatestSnapshot'
18
18
  | 'deleteAllSnapshots'
19
+ | 'manageSnapshots'
20
+ | 'addNetworking'
19
21
 
20
22
  export type UI_T_CustomizeHardwareField =
21
23
  | 'cpu.vcpus'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.2.44",
4
+ "version": "1.2.46",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",