From 848d59e42d54500c4d1d5d1a5d6f6469c6548024 Mon Sep 17 00:00:00 2001 From: Nikhil Ashoka Date: Mon, 5 May 2025 08:58:23 +0530 Subject: [PATCH 1/8] Implemented Date and Time in Vue3 - Implemented Date and time page in Vue3. - JIRA: https://jsw.ibm.com/browse/PFEBMC-2400 Signed-off-by: Nikhil Ashoka --- src/store/modules/Settings/DateTimeStore.js | 40 +- src/views/Settings/DateTime/DateTime.vue | 508 ++++++++++++-------- 2 files changed, 325 insertions(+), 223 deletions(-) diff --git a/src/store/modules/Settings/DateTimeStore.js b/src/store/modules/Settings/DateTimeStore.js index 3033f2d7ba..932f652a69 100644 --- a/src/store/modules/Settings/DateTimeStore.js +++ b/src/store/modules/Settings/DateTimeStore.js @@ -1,36 +1,36 @@ import api from '@/store/api'; import i18n from '@/i18n'; +import { defineStore } from 'pinia'; -const DateTimeStore = { - namespaced: true, - state: { +export const DateTimeStore = defineStore('dateTime', { + state: () => ({ ntpServers: [], isNtpProtocolEnabled: null, - }, + networkSuppliedServers: [], + }), getters: { - ntpServers: (state) => state.ntpServers, - isNtpProtocolEnabled: (state) => state.isNtpProtocolEnabled, - }, - mutations: { - setNtpServers: (state, ntpServers) => (state.ntpServers = ntpServers), - setIsNtpProtocolEnabled: (state, isNtpProtocolEnabled) => - (state.isNtpProtocolEnabled = isNtpProtocolEnabled), + ntpServersGetter: (state) => state.ntpServers, + isNtpProtocolEnabledGetter: (state) => state.isNtpProtocolEnabled, + networkSuppliedServersGetter: (state) => state.networkSuppliedServers, }, actions: { - async getNtpData({ commit }) { + async getNtpData() { return await api .get('/redfish/v1/Managers/bmc/NetworkProtocol') .then((response) => { const ntpServers = response.data.NTP.NTPServers; const isNtpProtocolEnabled = response.data.NTP.ProtocolEnabled; - commit('setNtpServers', ntpServers); - commit('setIsNtpProtocolEnabled', isNtpProtocolEnabled); + const networkSuppliedServers = + response?.data?.NTP?.NetworkSuppliedServers; + this.ntpServers = ntpServers; + this.isNtpProtocolEnabled = isNtpProtocolEnabled; + this.networkSuppliedServers = networkSuppliedServers; }) .catch((error) => { console.log(error); }); }, - async updateDateTime({ state }, dateTimeForm) { + async updateDateTime(dateTimeForm) { const ntpData = { NTP: { ProtocolEnabled: dateTimeForm.ntpProtocolEnabled, @@ -56,7 +56,7 @@ const DateTimeStore = { * TODO: remove timeout if backend solves * https://github.com/openbmc/openbmc/issues/3459 */ - const timeoutVal = state.isNtpProtocolEnabled ? 20000 : 0; + const timeoutVal = this.isNtpProtocolEnabled ? 20000 : 0; return await new Promise((resolve, reject) => { setTimeout(() => { return api @@ -69,17 +69,17 @@ const DateTimeStore = { }) .then(() => { if (dateTimeForm.ntpProtocolEnabled) { - return i18n.t('pageDateTime.toast.successSaveDateTimeForNtpServer'); + return i18n.global.t('pageDateTime.toast.successSaveDateTimeForNtpServer'); } else { - return i18n.t('pageDateTime.toast.successSaveDateTime'); + return i18n.global.t('pageDateTime.toast.successSaveDateTime'); } }) .catch((error) => { console.log(error); - throw new Error(i18n.t('pageDateTime.toast.errorSaveDateTime')); + throw new Error(i18n.global.t('pageDateTime.toast.errorSaveDateTime')); }); }, }, -}; +}); export default DateTimeStore; diff --git a/src/views/Settings/DateTime/DateTime.vue b/src/views/Settings/DateTime/DateTime.vue index 3d83cbaca2..4e6dad50ff 100644 --- a/src/views/Settings/DateTime/DateTime.vue +++ b/src/views/Settings/DateTime/DateTime.vue @@ -1,8 +1,8 @@ - + From f8d7ed5ea19fd7f244c81d9469316f1c7041d92f Mon Sep 17 00:00:00 2001 From: Nikhil Ashoka Date: Mon, 5 May 2025 15:53:58 +0530 Subject: [PATCH 2/8] Implemented Date and Time in Vue3 - Implemented Date and time page in Vue3. - JIRA: https://jsw.ibm.com/browse/PFEBMC-2400 --- src/locales/en-US.json | 28 ++- src/router/routes.js | 9 + src/store/index.js | 2 + src/views/Settings/DateTime/DateTime.vue | 285 +++++++++++------------ 4 files changed, 166 insertions(+), 158 deletions(-) diff --git a/src/locales/en-US.json b/src/locales/en-US.json index c80473fb1e..6cdb967bbb 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -408,6 +408,9 @@ "messagePowerOff": "The server must be powered off to change date and time to manual or NTP." }, "configureSettings": "Configure settings", + "viewDynamicNtp": "View Dynamic NTP servers", + "dhcpNtpInfoTooltip": "This section captures the DHCP supplied NTP server details", + "staticNtp":"Static NTP servers", "form": { "date": "Date", "manual": "Manual", @@ -465,12 +468,18 @@ "processorCores": "Processor cores", "totalCores": "Total cores", "alert": { - "message": "Memory dimms and processor cores can be configured or deconfigured only when the server is powered off." + "message": "Memory dimms and processor cores can be configured or deconfigured only when the server is powered off.", + "warning": "If memory event occurred at runtime and server has not yet been rebooted then the memory resource is still in use. Once server is rebooted, the memory resource will become deconfigured and not in use." }, "toast": { "deleteReqFailed": "The delete request failed because the resource requested cannot be deleted.", "errorDisablingSetting": "Error disabling setting", - "errorEnablingSetting": "Error enabling setting" + "errorEnablingSetting": "Error enabling setting", + "errorConfiguringProcessorCore": "Error Configuring Processor Core", + "errorConfiguringDIMM": "Error Configuring Memory DIMM", + "errorDeconfiguringProcessorCore": "Error Deconfiguring Processor Core", + "errorDeconfiguringDIMM" : "Error Deconfiguring Memory DIMM" + }, "table": { "deconfigurationType": "Deconfiguration Type", @@ -625,6 +634,8 @@ "errorStartResourceDumpInvalidSelector": "Error initiating dump. Invalid resource selector.", "errorStartResourceDumpInvalidPassword": "Error initiating dump. Invalid password.", "errorStartSystemDump": "Error starting new System dump.", + "resourceDumpSuccess": "Resource Dump created successfully.", + "resourceDumpFailed": "Resource Dump creation failed.", "successDeleteDump": "Successfully deleted %{count} dump. | Successfully deleted %{count} dumps.", "successStartBmcDumpTitle": "BMC dump started", "successStartDump": "The dump will take some time to complete.", @@ -823,12 +834,10 @@ "concurrentMaintenancePowerOffDesc": "Use this function to power off the power domain that includes resources that are currently in a disk unit attention state.", "concurrentMaintenancePowerOn": "Concurrent Maintenance Power On Domain (Function 69)", "concurrentMaintenancePowerOnDesc": "Use this function to power on the power domain that was powered off by using function 68.", - "disableRemoteService": "Disable Remote Service (Function 65)", - "disableRemoteServiceDesc": "Use this function to deactivate a remote service session.", + "consoleServiceFunction": "Console Service Function (Function 65)", + "consoleServiceFunctionDesc": "Use this function to initiate console recovery (IBM i 7.5, or later).", "diskUnitIOP": "Disk Unit IOP Reset/Reload (Function 67)", "diskUnitIOPDesc": "Use this function to initiate an I/O processor dump and reset/reload of an IOP that controls resources that are currently in a disk unit attention state.", - "enableRemoteService": "Enable Remote Service (Function 66)", - "enableRemoteServiceDesc": "Use this function to activate a remote service session.", "execute": "Execute", "iopControlStorageDump": "IOP Control Storage Dump (Function 70)", "iopControlStorageDumpDesc": "Use this function to initiate an I/O processor dump and reset/reload of the IOP that was designated to control the load source device when the logical partition was activated.", @@ -1153,7 +1162,8 @@ "updateDynamicIoDrawerAttachment": "Update dynamic I/O drawer attachment", "alert": { "heading": "Applying changes", - "message": "System has to be powered off. Changes made will take effect on next reboot.", + "message1": "System has to be powered off.", + "message2": "Changes made will take effect on next reboot.", "serverMustBePoweredOffTo": "Server must be powered off to:", "updateActiveMemoryMirroring": "Update active memory mirror mode", "updateIoAdapterEnlargedCapacity": "@:pageMemory.updateIoAdapterEnlargedCapacity", @@ -1379,7 +1389,7 @@ "successIpmiNetworkPolicyUpdate": "Successfully updated %{policy}. The BMC normally takes about 30 seconds to change the state.", "successNextBootToast": "Applying changes to %{policy}. Changes made to %{policy} will take effect on next reboot." }, - "acfUploadEnablementConfirmText": "Caution: Enabling this setting allows unauthenticated users to upload Access Control Files (ACFs) without logging in and without pressing Function 74 on the Operator Panel. Do you want to proceed?", + "acfUploadEnablementConfirmText": "Caution: Enabling this setting removes the physical system access requirement from the process to upload an Access Control File (ACF). This would allow anyone who is authorized to request an ACF and has network access to ASMI to gain access to the admin account. Do you want to proceed?", "vtpm": "VirtualTPM", "vtpmDescription": "Enabling vTPM makes a TPM available to the guest operating system." }, @@ -1780,7 +1790,7 @@ "invalidVlanTagId": "VLAN ID must be in range %{min} to %{max}", "invalidIsciTargetPort": "The port value should be a positive integer between %{min} and %{max}", "chapNameRequired": "CHAP name is required when CHAP secret is specified", - "chapSecretRequired": "CHAP secret is required when CHAP name is specified", + "chapSecretRequired": "CHAP secret is required when CHAP secret is specified", "invalidFieldLength": "%{field} should not exceed %{max} characters", "invalidChapSecretLength": "CHAP secret length must be between %{min} and %{max} characters" } diff --git a/src/router/routes.js b/src/router/routes.js index 05e2dbb510..ca6d1ac6db 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -18,6 +18,7 @@ import Memory from '@/views/ResourceManagement/Memory'; import PostCodes from '@/views/Logs/PostCodeLogs/PostCodes.vue'; import PostCodeLogs from '@/views/Logs/PostCodeLogs/PostCodeLogs.vue'; import Power from '@/views/ResourceManagement/Power'; +import DateTime from '@/views/Settings/DateTime/DateTime.vue' import PowerRestorePolicy from '@/views/Settings/PowerRestorePolicy'; import ConcurrentMaintenance from '../views/HardwareStatus/ConcurrentMaintenance/ConcurrentMaintenance.vue'; import PcieTopology from '../views/HardwareStatus/PcieTopology/PcieTopology.vue'; @@ -266,6 +267,14 @@ export const routes = [ title: i18n.global.t('appPageTitle.deconfigurationRecords'), }, }, + { + path: '/settings/date-time', + name: 'date-time', + component: DateTime, + meta: { + title: i18n.global.t('appPageTitle.dateTime'), + }, + }, { path: '/settings/power-restore-policy', name: 'power-restore-policy', diff --git a/src/store/index.js b/src/store/index.js index dcc869d378..47a5488f14 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -2,6 +2,7 @@ import EventLogStore from './modules/Logs/EventLogStore'; import GlobalStore from './modules/GlobalStore'; import AuthenticationStore from './modules/Authentication/AuthenticationStore'; +import DateTimeStore from './modules/Settings/DateTimeStore' import FirmwareStore from './modules/Operations/FirmwareStore'; import SystemStore from './modules/HardwareStatus/SystemStore'; import NetworkStore from './modules/Settings/NetworkStore'; @@ -41,6 +42,7 @@ export { EventLogStore, GlobalStore, AuthenticationStore, + DateTimeStore, FirmwareStore, SystemStore, NetworkStore, diff --git a/src/views/Settings/DateTime/DateTime.vue b/src/views/Settings/DateTime/DateTime.vue index 4e6dad50ff..9b2993ff01 100644 --- a/src/views/Settings/DateTime/DateTime.vue +++ b/src/views/Settings/DateTime/DateTime.vue @@ -6,8 +6,8 @@ {{ $t('pageDateTime.alert.message') }} - - {{ $t('pageDateTime.alert.link') }} + {{ $t('pageDateTime.alert.link') }} @@ -61,7 +61,7 @@ @@ -110,35 +110,27 @@ -
+
{{ $t('global.form.invalidFormat') }}
-
+
{{ $t('global.form.fieldRequired') }}
- - - - - + --> - + @@ -172,12 +144,12 @@ @blur="v$.form.manual.time.$touch()" /> -
+ + @@ -206,9 +178,9 @@ @blur="v$.form.ntp.firstAddress.$touch()" /> -
+ @@ -227,9 +199,9 @@ data-test-id="dateTime-input-ntpServer2" /> -
+ @@ -248,14 +220,9 @@ data-test-id="dateTime-input-ntpServer3" /> -
+ @@ -332,13 +299,13 @@ const rules = computed(() => ({ required: requiredIf(function () { return form.value.configurationSelected === 'manual'; }), - pattern: helpers.regex('pattern', isoDateRegex), + pattern: helpers.regex(isoDateRegex), }, time: { required: requiredIf(function () { return form.value.configurationSelected === 'manual'; }), - pattern: helpers.regex('pattern', isoTimeRegex), + pattern: helpers.regex(isoTimeRegex), }, }, ntp: { From 0f0147f2558b850b66d6db5a84d24842a60e9b3c Mon Sep 17 00:00:00 2001 From: Nikhil Ashoka Date: Thu, 8 May 2025 14:39:58 +0530 Subject: [PATCH 5/8] Fixed validation issues for NTP - Fixed issue that were occurring when we select NTP servers. --- src/views/Settings/DateTime/DateTime.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/views/Settings/DateTime/DateTime.vue b/src/views/Settings/DateTime/DateTime.vue index 149432e273..72ed271a3a 100644 --- a/src/views/Settings/DateTime/DateTime.vue +++ b/src/views/Settings/DateTime/DateTime.vue @@ -266,6 +266,9 @@ onBeforeRouteLeave(() => { hideLoader(); }); +const notSameAs = (value1, value2) => { + return value2 ? value1 !== value2 : true; +} const isoDateRegex = /([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))/; const isoTimeRegex = /^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/; const manualDate = ref(''); @@ -315,11 +318,11 @@ const rules = computed(() => ({ }), }, secondAddress: { - isSameAsFirstAddress: not(sameAs('firstAddress')), + isSameAsFirstAddress: () => notSameAs(form.value.ntp.firstAddress, form.value.ntp.secondAddress), }, thirdAddress: { - isSameAsFirstAddress: not(sameAs('firstAddress')), - isSameAsSecondAddress: not(sameAs('secondAddress')), + isSameAsFirstAddress: () => notSameAs(form.value.ntp.firstAddress, form.value.ntp.thirdAddress), + isSameAsSecondAddress: () => notSameAs(form.value.ntp.secondAddress, form.value.ntp.thirdAddress), }, } } From 180ead958906c86b42bc299735966904c1c74bd1 Mon Sep 17 00:00:00 2001 From: Nikhil Ashoka Date: Thu, 8 May 2025 14:50:32 +0530 Subject: [PATCH 6/8] Code re-arranged - Code rearranged and updated in Date and time page. --- src/views/Settings/DateTime/DateTime.vue | 114 +++++++++++------------ 1 file changed, 54 insertions(+), 60 deletions(-) diff --git a/src/views/Settings/DateTime/DateTime.vue b/src/views/Settings/DateTime/DateTime.vue index 72ed271a3a..a72cc80395 100644 --- a/src/views/Settings/DateTime/DateTime.vue +++ b/src/views/Settings/DateTime/DateTime.vue @@ -244,12 +244,10 @@