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
2 changes: 1 addition & 1 deletion src/components/Global/TableToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
:data-test-id="`table-button-${action.value}Selected`"
variant="primary"
class="d-block"
@click="emit('batch-action', action.value)"
@click="$emit('batch-action', action.value)"
>
{{ action.label }}
</BButton>
Expand Down
9 changes: 9 additions & 0 deletions src/router/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import PowerRestorePolicy from '@/views/Settings/PowerRestorePolicy';
import ConcurrentMaintenance from '../views/HardwareStatus/ConcurrentMaintenance/ConcurrentMaintenance.vue';
import IBMiServiceFunctions from '@/views/Logs/IBMiServiceFunctions';
import Notices from '@/views/Notices/Notices.vue';
import Sessions from '@/views/SecurityAndAccess/Sessions';

const roles = {
administrator: 'Administrator',
Expand Down Expand Up @@ -152,6 +153,14 @@ export const routes = [
title: i18n.global.t('appPageTitle.memory'),
},
},
{
path: '/security-and-access/sessions',
name: 'sessions',
component: Sessions,
meta: {
title: i18n.global.t('appPageTitle.sessions'),
},
},
{
path: '/:pathMatch(.*)*',
name: 'page-not-found',
Expand Down
2 changes: 2 additions & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import PowerPolicyStore from './modules/Settings/PowerPolicyStore';
import ConcurrentMaintenanceStore from './modules/HardwareStatus/ConcurrentMaintenanceStore';
import IBMiServiceFunctionsStore from './modules/Logs/IBMiServiceFunctionsStore';
import AuditLogsStore from './modules/Logs/AuditLogsStore';
import SessionsStore from './modules/SecurityAndAccess/SessionsStore.js';

// ... (export use other stores)
export {
Expand All @@ -34,4 +35,5 @@ export {
ConcurrentMaintenanceStore,
IBMiServiceFunctionsStore,
AuditLogsStore,
SessionsStore,
};
29 changes: 13 additions & 16 deletions src/store/modules/SecurityAndAccess/SessionsStore.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import api, { getResponseCount } from '@/store/api';
import i18n from '@/i18n';
import { defineStore } from 'pinia';

const SessionsStore = {
namespaced: true,
state: {
export const SessionsStore = defineStore('sessions', {
state: () => ({
allConnections: [],
},
}),
getters: {
allConnections: (state) => state.allConnections,
},
mutations: {
setAllConnections: (state, allConnections) =>
(state.allConnections = allConnections),
allConnectionsGetter: (state) => state.allConnections,
},
actions: {
async getSessionsData({ commit }) {
async getSessionsData() {
return await api
.get('/redfish/v1/SessionService/Sessions')
.then((response) =>
Expand All @@ -29,19 +25,20 @@ const SessionsStore = {
let filteredIPAddress =
sessionUri.data?.ClientOriginIPAddress.split('::ffff:').pop();
return {
isSelected: false,
clientID: sessionUri.data?.Context,
username: sessionUri.data?.UserName,
ipAddress: filteredIPAddress,
uri: sessionUri.data['@odata.id'],
};
});
commit('setAllConnections', allConnectionsData);
this.allConnections = allConnectionsData;
})
.catch((error) => {
console.log('Client Session Data:', error);
});
},
async disconnectSessions({ dispatch }, uris = []) {
async disconnectSessions(uris) {
const promises = uris.map((uri) =>
api.delete(uri).catch((error) => {
console.log(error);
Expand All @@ -51,7 +48,7 @@ const SessionsStore = {
return await api
.all(promises)
.then((response) => {
dispatch('getSessionsData');
this.getSessionsData();
return response;
})
.then(
Expand All @@ -60,15 +57,15 @@ const SessionsStore = {
const toastMessages = [];

if (successCount) {
const message = i18n.tc(
const message = i18n.global.t(
'pageSessions.toast.successDelete',
successCount,
);
toastMessages.push({ type: 'success', message });
}

if (errorCount) {
const message = i18n.tc(
const message = i18n.global.t(
'pageSessions.toast.errorDelete',
errorCount,
);
Expand All @@ -79,5 +76,5 @@ const SessionsStore = {
);
},
},
};
});
export default SessionsStore;
Loading