diff options
author | Vitalii Lysak <v.lysak@dunice.net> | 2022-09-21 18:32:09 +0300 |
---|---|---|
committer | Vitalii Lysak <v.lysak@dunice.net> | 2022-09-21 18:32:09 +0300 |
commit | 3731ececbd603859fe83b49a2b19f33c2c3e43ec (patch) | |
tree | 52c8ed4876bdeef5aefc547a77a84bffd702748c | |
parent | 5ad081015c923158c67108af6f3b58ce8ff764c9 (diff) | |
download | webui-vue-3731ececbd603859fe83b49a2b19f33c2c3e43ec.tar.xz |
SILABMC-316: add time zone
-rw-r--r-- | src/locales/en-US.json | 4 | ||||
-rw-r--r-- | src/locales/ru-RU.json | 4 | ||||
-rw-r--r-- | src/store/modules/GlobalStore.js | 14 | ||||
-rw-r--r-- | src/views/_sila/Overview/DateTime/DateTime.vue | 45 | ||||
-rw-r--r-- | src/views/_sila/Overview/OverviewQuickLinks.vue | 33 | ||||
-rw-r--r-- | src/views/_sila/ProfileSettings/ProfileSettings.vue | 10 |
6 files changed, 72 insertions, 38 deletions
diff --git a/src/locales/en-US.json b/src/locales/en-US.json index 4f95af69..a83eb992 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -1153,7 +1153,7 @@ }, "pageTransfer": { "title": "Setting up information transfer", - "description": "Set up SNMP, SMTP and SYSLOG", + "description": "Set up SNMP V2, SMTP and SYSLOG", "saveSmtpSuсcess": "Save SMTP successfully.", "saveSmtpError": "Save SMTP error.", "smtp": { @@ -1167,7 +1167,7 @@ "testMessage": "Test message" }, "snmp": { - "snmpTitle": "SNMP settings", + "snmpTitle": "SNMP V2 settings", "host": "SNMP server", "port": "SNMP port", "saveSubscriberSuсcess": "Subscriber added successfully", diff --git a/src/locales/ru-RU.json b/src/locales/ru-RU.json index 5188a898..017531a5 100644 --- a/src/locales/ru-RU.json +++ b/src/locales/ru-RU.json @@ -1154,7 +1154,7 @@ }, "pageTransfer": { "title": "Настройка передачи информации", - "description": "Настройте SNMP, SMTP и SYSLOG", + "description": "Настройте SNMP V2, SMTP и SYSLOG", "saveSmtpSuсcess": "Настройки SMTP успешно сохранены.", "saveSmtpError": "Ошибка сохранения настроек SMTP.", "smtp": { @@ -1174,7 +1174,7 @@ "delSubscriber": "Удалить подписчика" }, "snmp": { - "snmpTitle": "Настройки SNMP", + "snmpTitle": "Настройки SNMP V2", "host": "SNMP сервер", "port": "SNMP порт", "saveSubscriberSuсcess": "Подписчик успешно добавлен", diff --git a/src/store/modules/GlobalStore.js b/src/store/modules/GlobalStore.js index 3f512087..14c10b7c 100644 --- a/src/store/modules/GlobalStore.js +++ b/src/store/modules/GlobalStore.js @@ -39,8 +39,8 @@ const GlobalStore = { state: { assetTag: null, bmcTime: null, - liveBmcTime: null, liveClock: null, + liveDate: null, clockInterval: null, modelType: null, serialNumber: null, @@ -59,8 +59,8 @@ const GlobalStore = { serialNumber: (state) => state.serialNumber, serverStatus: (state) => state.serverStatus, bmcTime: (state) => state.bmcTime, - liveBmcTime: (state) => state.liveBmcTime, liveClock: (state) => state.liveClock, + liveDate: (state) => state.liveDate, timeZone: (state) => state.timeZone, languagePreference: (state) => state.languagePreference, isUtcDisplay: (state) => state.isUtcDisplay, @@ -73,7 +73,7 @@ const GlobalStore = { setSerialNumber: (state, serialNumber) => (state.serialNumber = serialNumber), setBmcTime: (state, bmcTime) => (state.bmcTime = bmcTime), - setLiveBmcTime: (state, liveBmcTime) => (state.liveBmcTime = liveBmcTime), + setLiveDate: (state, liveDate) => (state.liveDate = liveDate), setLiveClock: (state, liveClock) => (state.liveClock = liveClock), setTimeZone: (state, timeZone) => { state.timeZone = timeZone; @@ -114,17 +114,23 @@ const GlobalStore = { let clockData = state.bmcTime; let clockInterval = setInterval(() => { clockData.setSeconds(clockData.getSeconds() + 1); - commit('setLiveBmcTime', clockData.toString()); + let year = clockData.getFullYear(); + let month = clockData.getMonth() + 1; + let day = clockData.getDate(); let hours = clockData.getHours(); let minutes = clockData.getMinutes(); let sec = clockData.getSeconds(); + if (month < 10) { + month = '0' + month; + } if (minutes < 10) { minutes = '0' + minutes; } if (sec < 10) { sec = '0' + sec; } + commit('setLiveDate', year + '-' + month + '-' + day); commit('setLiveClock', hours + ':' + minutes + ':' + sec); }, 1000); commit('setClockInterval', clockInterval); diff --git a/src/views/_sila/Overview/DateTime/DateTime.vue b/src/views/_sila/Overview/DateTime/DateTime.vue index 55193d64..5d985ebe 100644 --- a/src/views/_sila/Overview/DateTime/DateTime.vue +++ b/src/views/_sila/Overview/DateTime/DateTime.vue @@ -18,14 +18,14 @@ <b-col lg="3"> <dl> <dt>{{ $t('pageDateTime.form.date') }}</dt> - <dd v-if="liveBmcTime">{{ liveBmcTime | formatDate }}</dd> + <dd v-if="liveDate">{{ liveDate }}</dd> <dd v-else>--</dd> </dl> </b-col> <b-col lg="3"> <dl> <dt>{{ $t('pageDateTime.form.time.label') }}</dt> - <dd v-if="liveBmcTime">{{ liveBmcTime | formatTime }}</dd> + <dd v-if="liveTime">{{ liveTime }}</dd> <dd v-else>--</dd> </dl> </b-col> @@ -53,7 +53,7 @@ </b-form-group> </b-col> </b-row> - <b-form-radio + <!--<b-form-radio v-model="form.configurationSelected" value="manual" data-test-id="dateTime-radio-configureManual" @@ -216,7 +216,7 @@ </b-input-group> </b-form-group> </b-col> - </b-row> + </b-row>--> <b-button variant="primary" type="submit" @@ -233,7 +233,6 @@ <script> import Alert from '@/components/_sila/Global/Alert'; -import IconCalendar from '@carbon/icons-vue/es/calendar/20'; import PageTitle from '@/components/_sila/Global/PageTitle'; import PageSection from '@/components/_sila/Global/PageSection'; @@ -254,7 +253,7 @@ import { requiredIf, helpers } from 'vuelidate/lib/validators'; export default { name: 'DateTime', - components: { Alert, IconCalendar, PageTitle, PageSection }, + components: { Alert, PageTitle, PageSection }, mixins: [ BVToastMixin, LoadingBarMixin, @@ -320,15 +319,26 @@ export default { isNotAdmin() { return this.$store.getters['authentication/role'] === 'ReadOnly'; }, - liveBmcTime() { - if (!this.$store.getters['global/liveBmcTime']) { - return; - } - return new Date(this.$store.getters['global/liveBmcTime']); - }, bmcTime() { return this.$store.getters['global/bmcTime']; }, + liveDate() { + return this.$store.getters['global/liveDate']; + }, + liveClock() { + return this.$store.getters['global/liveClock']; + }, + liveTime() { + if (!this.liveClock || !this.storeTimeZone) { + return; + } + + return ( + this.$store.getters['global/liveClock'] + + ' ' + + this.storeTimeZone.split(' ')[0] + ); + }, storeTimeZone() { return this.$store.getters['global/timeZone']; }, @@ -399,7 +409,14 @@ export default { ?.slice(0, 5); }, submitForm() { - this.$v.$touch(); + this.startLoader(); + this.$store.dispatch('global/changeTimeZone', this.timeZone); + this.$store.dispatch('global/getBmcTime').finally(() => { + this.endLoader(); + this.successToast(); + }); + + /*this.$v.$touch(); if (this.$v.$invalid) return; this.startLoader(); @@ -458,7 +475,7 @@ export default { .catch(({ message }) => this.errorToast(message)) .finally(() => { this.$v.form.$reset(); - }); + });*/ }, getUtcDate(date, time) { // Split user input string values to create diff --git a/src/views/_sila/Overview/OverviewQuickLinks.vue b/src/views/_sila/Overview/OverviewQuickLinks.vue index ca069fe0..e7b6b03e 100644 --- a/src/views/_sila/Overview/OverviewQuickLinks.vue +++ b/src/views/_sila/Overview/OverviewQuickLinks.vue @@ -4,12 +4,12 @@ <b-col sm="6" lg="9" class="mb-2 mt-2"> <dl> <dt>{{ $t('pageOverview.bmcTime') }}</dt> - <dd v-if="liveBmcTime" data-test-id="overviewQuickLinks-text-bmcTime"> - {{ liveBmcTime | formatDate }} - <span style="display: inline-block; width: 68px">{{ - liveClock - }}</span> - {{ isUtcDisplay ? $t('pageProfileSettings.UTC') : timezone }} + <dd + v-if="liveDate && liveTime" + data-test-id="overviewQuickLinks-text-bmcTime" + > + {{ liveDate }} {{ liveTime }} + <!--{{ isUtcDisplay ? $t('pageProfileSettings.UTC') : timezone }}--> </dd> <dd v-else>--</dd> </dl> @@ -41,15 +41,26 @@ export default { }, mixins: [BVToastMixin, LocalTimezoneLabelMixin], computed: { - liveBmcTime() { - if (!this.$store.getters['global/liveBmcTime']) { - return; - } - return new Date(this.$store.getters['global/liveBmcTime']); + timeZone() { + return this.$store.getters['global/timeZone']; + }, + liveDate() { + return this.$store.getters['global/liveDate']; }, liveClock() { return this.$store.getters['global/liveClock']; }, + liveTime() { + if (!this.liveClock || !this.timeZone) { + return; + } + + return ( + this.$store.getters['global/liveClock'] + + ' ' + + this.timeZone.split(' ')[0] + ); + }, timezone() { return this.localOffset(); }, diff --git a/src/views/_sila/ProfileSettings/ProfileSettings.vue b/src/views/_sila/ProfileSettings/ProfileSettings.vue index f7ed6cd6..95636299 100644 --- a/src/views/_sila/ProfileSettings/ProfileSettings.vue +++ b/src/views/_sila/ProfileSettings/ProfileSettings.vue @@ -89,7 +89,7 @@ </page-section> </b-col> </b-row> - <page-section :section-title="$t('pageProfileSettings.timezoneDisplay')"> + <!--<page-section :section-title="$t('pageProfileSettings.timezoneDisplay')"> <p>{{ $t('pageProfileSettings.timezoneDisplayDesc') }}</p> <b-row> <b-col md="9" lg="8" xl="9"> @@ -115,7 +115,7 @@ </b-form-group> </b-col> </b-row> - </page-section> + </page-section>--> <b-button variant="primary" type="submit" @@ -204,18 +204,18 @@ export default { }) .catch(({ message }) => this.errorToast(message)); }, - saveTimeZonePrefrenceData() { + /*saveTimeZonePrefrenceData() { localStorage.setItem('storedUtcDisplay', this.form.isUtcDisplay); this.$store.commit('global/setUtcTime', this.form.isUtcDisplay); this.successToast( this.$t('pageProfileSettings.toast.successUpdatingTimeZone') ); - }, + },*/ submitForm() { if (this.form.confirmPassword || this.form.newPassword) { this.saveNewPasswordInputData(); } - this.saveTimeZonePrefrenceData(); + // this.saveTimeZonePrefrenceData(); }, }, }; |