summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Zakharov <m.zakharov@IBS.RU>2022-10-05 09:27:17 +0300
committerMaksim Zakharov <m.zakharov@IBS.RU>2022-10-05 09:27:17 +0300
commit65f1b84d6a5031093a0d35c9a727184155e87c7e (patch)
tree02b50f562daafb43d3fb31d0a37dddc3aa4a0c69
parent1ecf9b7baa785f57fcdf97b4ccee39473b2fac84 (diff)
downloadwebui-vue-65f1b84d6a5031093a0d35c9a727184155e87c7e.tar.xz
add ntp to date-time
-rw-r--r--src/store/modules/Settings/DateTimeStore.js4
-rw-r--r--src/views/_sila/Overview/DateTime/DateTime.vue71
-rw-r--r--src/views/_sila/Settings/TransferInfo/Smtp.vue2
3 files changed, 47 insertions, 30 deletions
diff --git a/src/store/modules/Settings/DateTimeStore.js b/src/store/modules/Settings/DateTimeStore.js
index 02854918..d6dcc414 100644
--- a/src/store/modules/Settings/DateTimeStore.js
+++ b/src/store/modules/Settings/DateTimeStore.js
@@ -56,11 +56,11 @@ const DateTimeStore = {
* TODO: remove timeout if backend solves
* https://github.com/openbmc/openbmc/issues/3459
*/
- const timeoutVal = state.isNtpProtocolEnabled ? 40000 : 0;
+ const timeoutVal = state.isNtpProtocolEnabled ? 40000 : 100;
return await new Promise((resolve, reject) => {
setTimeout(() => {
return api
- .patch(`/redfish/v1/Managers/bmc`, dateTimeData)
+ .get(`/redfish/v1/Managers/bmc`, dateTimeData)
.then(() => resolve())
.catch(() => reject());
}, timeoutVal);
diff --git a/src/views/_sila/Overview/DateTime/DateTime.vue b/src/views/_sila/Overview/DateTime/DateTime.vue
index 8cb27fc8..1a9cbab4 100644
--- a/src/views/_sila/Overview/DateTime/DateTime.vue
+++ b/src/views/_sila/Overview/DateTime/DateTime.vue
@@ -145,7 +145,16 @@
:disabled="isNotAdmin"
>
NTP
- </b-form-radio>
+ </b-form-radio>-->
+ <b-form-checkbox
+ v-model="form.isNtpSelected"
+ data-test-id="checkbox-authorization"
+ switch
+ :disabled="isNotAdmin"
+ @change="changeConfigure()"
+ >
+ <span> NTP </span>
+ </b-form-checkbox>
<b-row class="mt-3 ml-3">
<b-col sm="6" lg="4" xl="3">
<b-form-group
@@ -216,12 +225,13 @@
</b-input-group>
</b-form-group>
</b-col>
- </b-row>-->
+ </b-row>
<b-button
variant="primary"
type="submit"
data-test-id="dateTime-button-saveSettings"
:disabled="isNotAdmin"
+ @click="submitForm"
>
{{ $t('global.action.saveSettings') }}
</b-button>
@@ -233,6 +243,7 @@
<script>
import Alert from '@/components/_sila/Global/Alert';
+// import IconCalendar from '@/components/_sila/Global/Alert';
import PageTitle from '@/components/_sila/Global/PageTitle';
import PageSection from '@/components/_sila/Global/PageSection';
@@ -253,7 +264,7 @@ import { requiredIf, helpers } from 'vuelidate/lib/validators';
export default {
name: 'DateTime',
- components: { Alert, PageTitle, PageSection },
+ components: { /*IconCalendar,*/ Alert, PageTitle, PageSection },
mixins: [
BVToastMixin,
LoadingBarMixin,
@@ -270,6 +281,7 @@ export default {
timeZoneOptions: null,
locale: this.$store.getters['global/languagePreference'],
form: {
+ isNtpSelected: false,
configurationSelected: '',
manual: {
date: '',
@@ -342,21 +354,21 @@ export default {
storeTimeZone() {
return this.$store.getters['global/timeZone'];
},
- ntpOptionSelected() {
- return this.form.configurationSelected === 'ntp';
- },
+ // ntpOptionSelected() {
+ // return this.form.configurationSelected === 'ntp';
+ // },
manualOptionSelected() {
return this.form.configurationSelected === 'manual';
},
- /*isUtcDisplay() {
+ isUtcDisplay() {
return this.$store.getters['global/isUtcDisplay'];
- },*/
- /*timezone() {
+ },
+ timezone() {
if (this.isUtcDisplay) {
return 'UTC';
}
return this.localOffset();
- },*/
+ },
},
watch: {
ntpServers() {
@@ -380,6 +392,13 @@ export default {
});
},
methods: {
+ changeConfigure() {
+ if (this.form.configurationSelected === 'ntp') {
+ this.form.configurationSelected = 'manual';
+ } else {
+ this.form.configurationSelected = 'ntp';
+ }
+ },
emitChange() {
if (this.$v.$invalid) return;
this.$v.$reset(); //reset to re-validate on blur
@@ -394,6 +413,7 @@ export default {
this.form.configurationSelected = this.isNtpProtocolEnabled
? 'ntp'
: 'manual';
+ this.form.isNtpSelected = this.isNtpProtocolEnabled ? true : false;
[
this.form.ntp.firstAddress = '',
this.form.ntp.secondAddress = '',
@@ -413,32 +433,29 @@ export default {
this.$store.dispatch('global/changeTimeZone', this.timeZone);
this.$store.dispatch('global/getBmcTime').finally(() => {
this.endLoader();
- this.successToast();
+ // this.successToast();
});
-
- /*this.$v.$touch();
- if (this.$v.$invalid) return;
-
+ /* this.$v.$touch();
+ if (this.$v.$invalid) return;*/
this.startLoader();
let dateTimeForm = {};
let isNTPEnabled = this.form.configurationSelected === 'ntp';
if (!isNTPEnabled) {
- const isUtcDisplay = this.$store.getters['global/isUtcDisplay'];
- let date;
-
+ /* const isUtcDisplay = this.$store.getters['global/isUtcDisplay'];
+ let date;*/
dateTimeForm.ntpProtocolEnabled = false;
- if (isUtcDisplay) {
- // Create UTC Date
- date = this.getUtcDate(this.form.manual.date, this.form.manual.time);
- } else {
- // Create local Date
- date = new Date(`${this.form.manual.date} ${this.form.manual.time}`);
+ /* if (isUtcDisplay) {
+ Create UTC Date
+ date = this.getUtcDate(this.form.manual.date, this.form.manual.time);
+ } else {
+ // Create local Date
+ date = new Date(`${this.form.manual.date} ${this.form.manual.time}`);
}
- dateTimeForm.updatedDateTime = date.toISOString();
+ dateTimeForm.updatedDateTime = date.toISOString();*/
} else {
dateTimeForm.ntpProtocolEnabled = true;
@@ -454,7 +471,6 @@ export default {
dateTimeForm.ntpServersArray = [...ntpArrayFiltered];
}
-
this.$store
.dispatch('dateTime/updateDateTime', dateTimeForm)
.then((success) => {
@@ -475,7 +491,8 @@ export default {
.catch(({ message }) => this.errorToast(message))
.finally(() => {
this.$v.form.$reset();
- });*/
+ this.endLoader();
+ });
},
getUtcDate(date, time) {
// Split user input string values to create
diff --git a/src/views/_sila/Settings/TransferInfo/Smtp.vue b/src/views/_sila/Settings/TransferInfo/Smtp.vue
index e5036927..0a12a8f7 100644
--- a/src/views/_sila/Settings/TransferInfo/Smtp.vue
+++ b/src/views/_sila/Settings/TransferInfo/Smtp.vue
@@ -371,7 +371,7 @@ export default {
.dispatch('smtpStore/sendTestMessage', {
from: this.settings.username,
subject: 'TestMessage',
- text: 'Test Message Text',
+ text: 'Test_Message_Text',
})
.then((message) => this.successToast(message))
.catch(({ message }) => this.errorToast(message));