From 3874a0730a390ee86d591044b70012e0dd9bfeaa Mon Sep 17 00:00:00 2001 From: Tom Searle Date: Mon, 17 Aug 2026 14:08:12 +0100 Subject: [PATCH 1/2] fix(medcat-trainer): sync frontend status for server side features - for ee syncable features --- medcat-trainer/webapp/frontend/src/App.vue | 41 +++++++++++++++---- .../src/components/common/DocumentSummary.vue | 2 +- .../webapp/frontend/src/plugins/registry.ts | 11 +++-- 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/medcat-trainer/webapp/frontend/src/App.vue b/medcat-trainer/webapp/frontend/src/App.vue index 8e7b92898..4f2241d74 100644 --- a/medcat-trainer/webapp/frontend/src/App.vue +++ b/medcat-trainer/webapp/frontend/src/App.vue @@ -65,7 +65,8 @@ import Login from '@/components/common/Login.vue' import EventBus from '@/event-bus' import { isOidcEnabled, getRuntimeConfig } from './runtimeConfig'; -import { getMenuItems } from './plugins/registry' +import { getMenuItems, clearBootstrap } from './plugins/registry' +import { initPluginBootstrap } from './plugins/bootstrap' import { UNAUTHORIZED_EVENT, resetUnauthorizedGuard, clearClientAuth } from './httpAuth' export default { @@ -79,6 +80,7 @@ export default { version: '', useOidc: isOidcEnabled(), sessionExpired: false, + pluginBootstrapTick: 0, } }, computed: { @@ -88,6 +90,7 @@ export default { return `${v.slice(0, 7)}…${v.slice(-6)}` }, pluginMenuItems () { + void this.pluginBootstrapTick return getMenuItems() } }, @@ -99,14 +102,32 @@ export default { openLogin () { if (!this.useOidc) { this.loginModal = true - } else { - // Kick off OIDC login if needed - if (this.$keycloak && !this.$keycloak.authenticated) { - this.$keycloak.login() - } + } else if (this.$keycloak && !this.$keycloak.authenticated) { + this.$keycloak.login() } }, - loginSuccessful () { + applyTraditionalSession (payload) { + const session = readTraditionalSession(name => this.$cookies.get(name)) + this.uname = payload?.username ?? session?.username ?? null + this.isAdmin = payload?.isAdmin ?? session?.isAdmin ?? false + }, + discardIncompleteTraditionalSession () { + const names = authCookieNames() + const token = this.$cookies.get(names.token) + const username = this.$cookies.get(names.username) + if ((token && !username) || (!token && username)) { + clearClientAuth(this.$http) + } + }, + async refreshPluginBootstrap () { + await initPluginBootstrap(this.$http) + this.pluginBootstrapTick++ + }, + dropPluginBootstrap () { + clearBootstrap() + this.pluginBootstrapTick++ + }, + async loginSuccessful (payload) { this.sessionExpired = false resetUnauthorizedGuard() if (!this.useOidc) { @@ -116,6 +137,7 @@ export default { } else { this.updateOidcUser() } + await this.refreshPluginBootstrap() if (this.$route.name !== 'home') { this.$router.push({ name: 'home' }) } @@ -126,6 +148,7 @@ export default { this.uname = null this.isAdmin = false this.sessionExpired = true + this.dropPluginBootstrap() this.openLogin() }, updateOidcUser () { @@ -138,7 +161,9 @@ export default { logout () { this.uname = null this.isAdmin = false - // Clear header + cookies together so a refresh cannot resurrect a half-logged-in state. + this.dropPluginBootstrap() + // Clear header + namespaced cookies together. Do not touch bare + // `api-token` / `admin` names — those belong to other MCT versions. clearClientAuth(this.$http) this.$cookies.remove('username') this.$cookies.remove('api-token') diff --git a/medcat-trainer/webapp/frontend/src/components/common/DocumentSummary.vue b/medcat-trainer/webapp/frontend/src/components/common/DocumentSummary.vue index 3f1e97a2b..55917a7e0 100644 --- a/medcat-trainer/webapp/frontend/src/components/common/DocumentSummary.vue +++ b/medcat-trainer/webapp/frontend/src/components/common/DocumentSummary.vue @@ -25,7 +25,7 @@ {{doc.text === 'nan' ? '' : (limitText(doc.text) || '')}} + v-if="preparedDocIds.includes(doc.id) || completeBgTasks.includes(doc.id)"> Predictions ready for Doc: {{doc.id}} { try { @@ -115,7 +122,5 @@ export function clearPluginRegistry(): void { } buildTimeMenuItems.length = 0 buildTimeVueRoutes.length = 0 - serverMenuExtensions = [] - serverRoutes = [] - serverFeatures = [] + clearBootstrap() } From 8e059d983cfe2d7d208ca7a932a91eee184bbad9 Mon Sep 17 00:00:00 2001 From: Tom Searle Date: Tue, 18 Aug 2026 17:19:25 +0100 Subject: [PATCH 2/2] fix(medcat-trainer): fix bad merge --- medcat-trainer/webapp/frontend/src/App.vue | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/medcat-trainer/webapp/frontend/src/App.vue b/medcat-trainer/webapp/frontend/src/App.vue index 2c84ee70e..998508d4c 100644 --- a/medcat-trainer/webapp/frontend/src/App.vue +++ b/medcat-trainer/webapp/frontend/src/App.vue @@ -127,22 +127,6 @@ export default { this.pluginBootstrapTick++ }, async loginSuccessful (payload) { - } - }, - applyTraditionalSession (payload) { - const session = readTraditionalSession(name => this.$cookies.get(name)) - this.uname = payload?.username ?? session?.username ?? null - this.isAdmin = payload?.isAdmin ?? session?.isAdmin ?? false - }, - discardIncompleteTraditionalSession () { - const names = authCookieNames() - const token = this.$cookies.get(names.token) - const username = this.$cookies.get(names.username) - if ((token && !username) || (!token && username)) { - clearClientAuth(this.$http) - } - }, - loginSuccessful (payload) { this.sessionExpired = false resetUnauthorizedGuard() if (!this.useOidc) {