Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 115 additions & 98 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"date-fns-tz": "3.1.3",
"express": "4.19.2",
"js-cookie": "^3.0.5",
"lodash": "^4.17.21",
"json-bigint": "1.0.0",
"lodash": "4.17.21",
"pinia": "2.1.7",
"tiny-emitter": "2.1.0",
"vue": "^3.3.9",
Expand Down
4 changes: 4 additions & 0 deletions src/assets/styles/bmc/custom/_tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@
background-color: theme-color-dark($light);
}
}

caption {
color: $gray-600;
}
}

.b-table-sticky-header td {
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppHeader/AppHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ getEvents();

const assetTag = computed(() => globalStore.assetTag);
const isNavTagPresent = computed(
() => assetTag.value || globalStore.modelType || globalStore.serialNumber,
() => assetTag.value || globalStore.modelType || globalStore.serialNumber
);
const modelType = computed(() => globalStore.modelType);
const serialNumber = computed(() => globalStore.serialNumber);
Expand Down
5 changes: 4 additions & 1 deletion src/layouts/AppLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import AppHeader from '@/components/AppHeader/AppHeader.vue';
import { ref, watch, onMounted } from 'vue';
import { useRoute } from 'vue-router';
import eventBus from '@/eventBus';
import { GlobalStore } from '@/store';

const globalStore = GlobalStore();
// const { setFocus } = useJumpLinkComposable();
const routerKey = ref(0);
const route = useRoute();
Expand All @@ -33,14 +35,15 @@ onMounted(() => {
});

watch(
() => route,
() => route
// () => {
// nextTick(() => {
// setFocus(focusTarget.value);
// });
// },
);
const refreshPage = async () => {
globalStore.getSystemInfo();
console.log('Refresh called');
routerKey.value += 1;
};
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,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 secret is specified",
"chapSecretRequired": "CHAP secret is required when CHAP name is specified",
"invalidFieldLength": "%{field} should not exceed %{max} characters",
"invalidChapSecretLength": "CHAP secret length must be between %{min} and %{max} characters"
}
Expand Down
10 changes: 9 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ import { createPinia } from 'pinia';
import App from './App.vue';
import router from './router';
import { createBootstrap } from 'bootstrap-vue-next';
import { GlobalStore } from './store';
import { GlobalStore, AuthenticationStore } from './store';
import { format } from 'date-fns-tz';
// Add the necessary CSSs
// import 'bootstrap/dist/css/bootstrap.css';
import 'bootstrap-vue-next/dist/bootstrap-vue-next.css';

import i18n from './i18n';
import ArrowRight16 from '@carbon/icons-vue/es/arrow--right/16';
import WebSocketPlugin, {
initWebSocket,
} from '@/store/plugins/WebSocketPlugin.js';

const pinia = createPinia();
const app = createApp(App);
Expand All @@ -20,7 +23,12 @@ app.component('IconArrowRight', ArrowRight16);
app.use(createBootstrap({ components: true, directives: true })); // Change this line
app.use(i18n);

pinia.use(WebSocketPlugin);

const globalStore = GlobalStore();
const authenticationStore = AuthenticationStore();

if (authenticationStore.isLoggedIn) initWebSocket();

app.config.globalProperties.$filters = {
shortTimeZone(value) {
Expand Down
15 changes: 12 additions & 3 deletions src/router/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import HostConsole from '@/views/Operations/HostConsole';
import HostConsoleConsole from '@/views/Operations/HostConsole/HostConsoleConsole.vue';
import CapacityOnDemand from '../views/ResourceManagement/CapacityOnDemand/CapacityOnDemand.vue';
import DeconfigurationRecords from '../views/Logs/DeconfigurationRecords/DeconfigurationRecords.vue';
import ServerPowerOperations from '@/views/Operations/ServerPowerOperations';

const roles = {
administrator: 'Administrator',
Expand Down Expand Up @@ -83,6 +84,14 @@ export const routes = [
exclusiveToRoles: [roles.administrator],
},
},
{
path: '/operations/server-power-operations',
name: 'server-power-operations',
component: ServerPowerOperations,
meta: {
title: i18n.global.t('appPageTitle.serverPowerOperations'),
},
},
{
path: '/hardware-status/sensors',
name: 'sensors',
Expand Down Expand Up @@ -189,14 +198,14 @@ export const routes = [
title: i18n.global.t('appPageTitle.hostConsole'),
},
},
{
{
path: '/logs/deconfiguration-records',
name: 'deconfiguration-records',
component: DeconfigurationRecords,
meta: {
title: i18n.global.t('appPageTitle.deconfigurationRecords'),
},
},
},
},
{
path: '/settings/power-restore-policy',
name: 'power-restore-policy',
Expand Down
4 changes: 3 additions & 1 deletion src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import UserManagementStore from './modules/SecurityAndAccess/UserManagementStore
import PcieTopologyStore from './modules/HardwareStatus/PcieTopologyStore.js';
import HardwareDeconfigurationStore from './modules/Settings/HardwareDeconfigurationStore';
import DeconfigurationRecordsStore from './modules/Logs/DeconfigurationRecordsStore.js';
import NetworkSettingsStore from './modules/Operations/NetworkSettingsStore.js';
// ... (export use other stores)
export {
EventLogStore,
Expand Down Expand Up @@ -64,5 +65,6 @@ export {
UserManagementStore,
PcieTopologyStore,
HardwareDeconfigurationStore,
DeconfigurationRecordsStore
DeconfigurationRecordsStore,
NetworkSettingsStore,
};
10 changes: 4 additions & 6 deletions src/store/modules/Authentication/AuthenticationStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useCookies } from 'vue3-cookies';
import Cookies from 'js-cookie';
const { cookies } = useCookies();
// const router = useRouter();

export const AuthenticationStore = defineStore('authentication', {
state: () => ({
consoleWindow: null,
Expand Down Expand Up @@ -51,7 +52,6 @@ export const AuthenticationStore = defineStore('authentication', {
.then((response) => {
this.authSuccess();
this.$state.authError = false;
this.xsrfCookie = response.data.token;
})
.catch((error) => {
this.$state.authError = true;
Expand Down Expand Up @@ -82,7 +82,6 @@ export const AuthenticationStore = defineStore('authentication', {
console.log(error);
this.logoutRemove();
});

},
getUserInfo(username) {
return api
Expand All @@ -96,14 +95,13 @@ export const AuthenticationStore = defineStore('authentication', {
.then((response) => {
this.$state.bmcTime = response.data.DateTime;
const cookie = Cookies.get('XSRF-TOKEN');
console.log('cookie', cookie);
})
.catch((error) => console.log(error));
},
resetStoreState() {
this.$state.authError = false;
this.$state.xsrfCookie = cookies.get('XSRF-TOKEN');
this.$state.isAuthenticatedCookie = cookies.get('IsAuthenticated');
this.authError = false;
this.xsrfCookie = cookies.get('XSRF-TOKEN');
this.isAuthenticatedCookie = cookies.get('IsAuthenticated');
},
},
});
Expand Down
112 changes: 74 additions & 38 deletions src/store/modules/GlobalStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ export const GlobalStore = defineStore('global', {
serialNumber: null,
safeMode: null,
serverStatus: 'unreachable',
postCodeValue: null,
languagePreference: localStorage.getItem('storedLanguage') || 'en-US',
isUtcDisplay: localStorage.getItem('storedUtcDisplay')
? JSON.parse(localStorage.getItem('storedUtcDisplay'))
: true,
username: localStorage.getItem('storedUsername'),
isAuthorized: true,
userPrivilege: null,
currentUser: JSON.parse(localStorage.getItem('storedCurrentUser')),
isAuthorized: true,
hmcManaged: localStorage.getItem('storedHmcManagedValue') || null,
isServiceLoginEnabled: false,
}),
getters: {
bootProgressGetter: (state) => state.bootProgress,
Expand All @@ -57,14 +59,31 @@ export const GlobalStore = defineStore('global', {
state.bootProgress === 'OSBootStarted' ||
state.bootProgress === 'OSRunning',
isOSRunningGetter: (state) => state.bootProgress === 'OSRunning',
assetTagGetter: (state) => state.assetTag,
modelTypeGetter: (state) => state.modelType,
serialNumberGetter: (state) => state.serialNumber,
getIsUtcDisplay: (state) => state.isUtcDisplay,
safeModeGetter: (state) => state.safeMode,
postCodeValueGetter: (state) => state.postCodeValue,
bmcTimeGetter: (state) => state.bmcTime,
acfInstalledGetter: (state) => state.acfInstalled,
expirationDateGetter: (state) => state.expirationDate,
languagePreferenceGetter: (state) => state.languagePreference,
isUtcDisplayGetter: (state) => state.isUtcDisplay,
serverStatusGetter: (state) => state.serverStatus,
usernameGetter: (state) => state.username,
hmcManagedGetter: (state) => state.hmcManaged,
currentUserGetter: (state) => state.currentUser,
isServiceUser: (state) =>
state.currentUser?.RoleId === 'OemIBMServiceAgent' || !state.currentUser,
isReadOnlyUserGetter: (state) =>
state.currentUser?.RoleId === 'ReadOnly' || !state.currentUser,
isAdminUser: (state) =>
state.currentUser?.RoleId === 'Administrator' || !state.currentUser,
isReadOnlyUser: (state) =>
state.currentUser?.RoleId === 'ReadOnly' || !state.currentUser,
isAuthorizedGetter: (state) => state.isAuthorized,
isServiceLoginEnabledGetter: (state) => state.isServiceLoginEnabled,
},
actions: {
async getBmcTime() {
Expand All @@ -77,8 +96,58 @@ export const GlobalStore = defineStore('global', {
})
.catch((error) => console.log(error));
},
setCurrentUser (currentUsr) {
this.currentUser = currentUsr
async getServiceLogin() {
return await api
.get('/redfish/v1/AccountService/Accounts/service')
.then((response) => {
this.acfInstalled = response.data.Oem.IBM.ACF.ACFInstalled;
this.expirationDate = response.data.Oem.IBM.ACF.ExpirationDate;
this.isServiceLoginEnabled = response.data.Enabled;
})
.catch((error) => console.log(error));
},
getCurrentUser(username = localStorage.getItem('storedUsername')) {
if (localStorage.getItem('storedCurrentUser')) return;
return api
.get(`/redfish/v1/AccountService/Accounts/${username}`)
.then(({ data }) => {
this.currentUser = data;
localStorage.setItem(
'storedCurrentUser',
JSON.stringify(this.currentUser)
);
})
.catch((error) => {
console.log(error);
this.getAccountService();
});
},
getAccountService() {
return api
.get('/redfish/v1/AccountService')
.then((response) => {
if (response.data?.LDAP?.RemoteRoleMapping?.length > 0) {
return Promise.resolve();
}
})
.catch(() => {
return Promise.reject();
});
},
async getHmcManaged() {
return await api
.get(
'/redfish/v1/Registries/BiosAttributeRegistry/BiosAttributeRegistry'
)
.then(({ data: { RegistryEntries } }) => {
const hmcMananged = RegistryEntries.Attributes.filter(
(Attribute) => Attribute.AttributeName == 'pvm_hmc_managed'
);
let hmcManangedValue = hmcMananged[0].CurrentValue;
this.hmcManaged = hmcManangedValue;
localStorage.setItem('storedHmcManagedValue', hmcManangedValue);
})
.catch((error) => console.log(error));
},
getSystemInfo() {
api
Expand Down Expand Up @@ -110,43 +179,13 @@ export const GlobalStore = defineStore('global', {
} else {
this.serverStatus = serverStateMapper(PowerState);
}
},
}
)
.catch((error) => {
console.log(error);
return Promise.reject();
});
},
getCurrentUser(
username = localStorage.getItem('storedUsername')
) {
if (localStorage.getItem('storedCurrentUser')) return;
return api
.get(`/redfish/v1/AccountService/Accounts/${username}`)
.then(({ data }) => {
this.setCurrentUser(data)
localStorage.setItem(
'storedCurrentUser',
JSON.stringify(this.currentUser)
);
})
.catch((error) => {
console.log(error);
return this.getAccountService();
});
},
getAccountService() {
return api
.get('/redfish/v1/AccountService')
.then((response) => {
if (response.data?.LDAP?.RemoteRoleMapping?.length > 0) {
return Promise.resolve();
}
})
.catch(() => {
return Promise.reject();
});
},
async getBootProgress() {
api
.get('/redfish/v1/Systems/system')
Expand All @@ -165,9 +204,6 @@ export const GlobalStore = defineStore('global', {
this.isAuthorized = true;
}, 100);
},
setUtcTime(state, isUtcDisplay) {
state.isUtcDisplay = isUtcDisplay;
},
async getCurrentTask(task) {
return await api.get(task).then(({ data }) => {
return data;
Expand Down
Loading