summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
authorVitalii Lysak <v.lysak@dunice.net>2022-09-21 18:32:09 +0300
committerVitalii Lysak <v.lysak@dunice.net>2022-09-21 18:32:09 +0300
commit3731ececbd603859fe83b49a2b19f33c2c3e43ec (patch)
tree52c8ed4876bdeef5aefc547a77a84bffd702748c /src/views
parent5ad081015c923158c67108af6f3b58ce8ff764c9 (diff)
downloadwebui-vue-3731ececbd603859fe83b49a2b19f33c2c3e43ec.tar.xz
SILABMC-316: add time zone
Diffstat (limited to 'src/views')
-rw-r--r--src/views/_sila/Overview/DateTime/DateTime.vue45
-rw-r--r--src/views/_sila/Overview/OverviewQuickLinks.vue33
-rw-r--r--src/views/_sila/ProfileSettings/ProfileSettings.vue10
3 files changed, 58 insertions, 30 deletions
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();
},
},
};