diff --git a/ui/src/components/Sessions/SessionClose.vue b/ui/src/components/Sessions/SessionClose.vue index 75f373ac4af..a2ae55fda7c 100644 --- a/ui/src/components/Sessions/SessionClose.vue +++ b/ui/src/components/Sessions/SessionClose.vue @@ -47,8 +47,8 @@ - diff --git a/ui/src/components/Sessions/SessionDelete.vue b/ui/src/components/Sessions/SessionDelete.vue index 865dc8e09ed..6476866c3fb 100644 --- a/ui/src/components/Sessions/SessionDelete.vue +++ b/ui/src/components/Sessions/SessionDelete.vue @@ -2,7 +2,7 @@
@@ -46,8 +46,8 @@
- diff --git a/ui/src/components/Sessions/SessionList.vue b/ui/src/components/Sessions/SessionList.vue index f8b64e6ff67..950b23d2bf5 100644 --- a/ui/src/components/Sessions/SessionList.vue +++ b/ui/src/components/Sessions/SessionList.vue @@ -105,6 +105,7 @@
@@ -145,181 +146,155 @@
- diff --git a/ui/src/store/modules/sessions.ts b/ui/src/store/modules/sessions.ts index fa58fa21308..2e131564171 100755 --- a/ui/src/store/modules/sessions.ts +++ b/ui/src/store/modules/sessions.ts @@ -2,10 +2,11 @@ import { Module } from "vuex"; import * as apiSession from "../api/sessions"; import { ISessions } from "@/interfaces/ISessions"; import { State } from ".."; +import { ITerminalLog } from "@/interfaces/ITerminal"; export interface SessionsState { sessions: Array; - session: ISessions; + session: Array; numberSessions: number; page: number; perPage: number; @@ -15,7 +16,7 @@ export const sessions: Module = { namespaced: true, state: { sessions: [], - session: {} as ISessions, + session: {} as ITerminalLog[], numberSessions: 0, page: 1, perPage: 10, @@ -39,6 +40,18 @@ export const sessions: Module = { state.session = res.data; }, + updateSession: (state, res) => { + const newSession = res.data; + + Object.keys(newSession).forEach((key) => { + if (Object.prototype.hasOwnProperty.call(state.session, key)) { + state.session[key] = newSession[key]; + } else { + state.session = { ...state.session, [key]: newSession[key] }; + } + }); + }, + setPagePerpage: (state, data) => { state.page = data.page; state.perPage = data.perPage; @@ -55,13 +68,12 @@ export const sessions: Module = { }, clearObjectSession: (state) => { - state.session = {} as ISessions; + state.session = []; }, removeRecordedSession: (state) => { state.session = { ...state.session, - recorded: false, }; }, }, @@ -115,6 +127,21 @@ export const sessions: Module = { } }, + updateLogSession: async (context, uid) => { + try { + const res = await apiSession.getLog(uid); + + if (context.state.session.length === res.data.length) { + throw new Error(); + } + + context.commit("setSession", res); + } catch (error) { + context.commit("clearObjectSession"); + throw error; + } + }, + resetPagePerpage: async (context) => { context.commit("resetPagePerpage"); }, diff --git a/ui/src/views/DetailsSessions.vue b/ui/src/views/DetailsSessions.vue index 884a6d1e489..e8defcab139 100644 --- a/ui/src/views/DetailsSessions.vue +++ b/ui/src/views/DetailsSessions.vue @@ -39,6 +39,7 @@ :device="session.device" :notHasAuthorization="!hasAuthorizationPlay()" :recorded="session.authenticated && session.recorded" + :is-active="session.active" @update="refreshSessions" data-test="sessionPlay-component" />