diff --git a/src/components/Global/TableToolbar.vue b/src/components/Global/TableToolbar.vue index 76a610cb60..e0ee1bad47 100644 --- a/src/components/Global/TableToolbar.vue +++ b/src/components/Global/TableToolbar.vue @@ -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 }} diff --git a/src/router/routes.js b/src/router/routes.js index 79466005ce..be6c0d1857 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -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', @@ -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', diff --git a/src/store/index.js b/src/store/index.js index fd8e8dead4..8d296f97f2 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -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 { @@ -34,4 +35,5 @@ export { ConcurrentMaintenanceStore, IBMiServiceFunctionsStore, AuditLogsStore, + SessionsStore, }; diff --git a/src/store/modules/SecurityAndAccess/SessionsStore.js b/src/store/modules/SecurityAndAccess/SessionsStore.js index 794c75a7f4..b9848be307 100644 --- a/src/store/modules/SecurityAndAccess/SessionsStore.js +++ b/src/store/modules/SecurityAndAccess/SessionsStore.js @@ -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) => @@ -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); @@ -51,7 +48,7 @@ const SessionsStore = { return await api .all(promises) .then((response) => { - dispatch('getSessionsData'); + this.getSessionsData(); return response; }) .then( @@ -60,7 +57,7 @@ const SessionsStore = { const toastMessages = []; if (successCount) { - const message = i18n.tc( + const message = i18n.global.t( 'pageSessions.toast.successDelete', successCount, ); @@ -68,7 +65,7 @@ const SessionsStore = { } if (errorCount) { - const message = i18n.tc( + const message = i18n.global.t( 'pageSessions.toast.errorDelete', errorCount, ); @@ -79,5 +76,5 @@ const SessionsStore = { ); }, }, -}; +}); export default SessionsStore; diff --git a/src/views/SecurityAndAccess/Sessions/Sessions.vue b/src/views/SecurityAndAccess/Sessions/Sessions.vue index 4ca2ff9123..7f482c8e7f 100644 --- a/src/views/SecurityAndAccess/Sessions/Sessions.vue +++ b/src/views/SecurityAndAccess/Sessions/Sessions.vue @@ -1,8 +1,8 @@ - + - - + + {{ $t('pageSessions.alert.heading') }} @@ -11,72 +11,80 @@ {{ $t('pageSessions.alert.message') }} - - - - + + + + - - + + - - - - + + + + - - - {{ $t('global.table.selectAll') }} - + - - {{ $t('global.table.selectItem') }} - + @change=" + toggleSelectRow( + tableSessionsRef, + row.index, + sessionsStore.allConnections[row.index].isSelected, + row.item, + ) + " + > @@ -92,217 +100,222 @@ @click-table-action="onTableRowAction($event, row.item)" > - - - + + + - - - + + - - - - + + + - - - + + + + + {{ + $t('pageSessions.modal.disconnectMessage', { count: count }, count) + }} + + + - -
+ {{ + $t('pageSessions.modal.disconnectMessage', { count: count }, count) + }} +