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
18 changes: 16 additions & 2 deletions medcat-trainer/webapp/frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ import Login from '@/components/common/Login.vue'
import EventBus from '@/event-bus'
import { readTraditionalSession, authCookieNames } from './authCookies'
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 {
Expand All @@ -78,6 +79,7 @@ export default {
version: '',
useOidc: isOidcEnabled(),
sessionExpired: false,
pluginBootstrapTick: 0,
}
},
computed: {
Expand All @@ -87,6 +89,7 @@ export default {
return `${v.slice(0, 7)}…${v.slice(-6)}`
},
pluginMenuItems () {
void this.pluginBootstrapTick
return getMenuItems()
}
},
Expand Down Expand Up @@ -115,7 +118,15 @@ export default {
clearClientAuth(this.$http)
}
},
loginSuccessful (payload) {
async refreshPluginBootstrap () {
await initPluginBootstrap(this.$http)
this.pluginBootstrapTick++
},
dropPluginBootstrap () {
clearBootstrap()
this.pluginBootstrapTick++
},
async loginSuccessful (payload) {
this.sessionExpired = false
resetUnauthorizedGuard()
if (!this.useOidc) {
Expand All @@ -124,6 +135,7 @@ export default {
} else {
this.updateOidcUser()
}
await this.refreshPluginBootstrap()
if (this.$route.name !== 'home') {
this.$router.push({ name: 'home' })
}
Expand All @@ -134,6 +146,7 @@ export default {
this.uname = null
this.isAdmin = false
this.sessionExpired = true
this.dropPluginBootstrap()
this.openLogin()
},
updateOidcUser () {
Expand All @@ -146,6 +159,7 @@ export default {
logout () {
this.uname = null
this.isAdmin = false
this.dropPluginBootstrap()
// Clear header + namespaced cookies together. Do not touch bare
// `api-token` / `admin` names — those belong to other MCT versions.
clearClientAuth(this.$http)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{{doc.text === 'nan' ? '' : (limitText(doc.text) || '')}}
</div>
<v-tooltip activator="parent"
v-if="preparedDocIds.includes(doc.id) || completeBgTasks .includes(doc.id)">
v-if="preparedDocIds.includes(doc.id) || completeBgTasks.includes(doc.id)">
Predictions ready for Doc: {{doc.id}}
</v-tooltip>
<v-tooltip activator="parent"
Expand Down
11 changes: 8 additions & 3 deletions medcat-trainer/webapp/frontend/src/plugins/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ export function hasFeature(feature: string): boolean {
return serverFeatures.includes(feature)
}

/** Drop server bootstrap state; keep build-time plugin registrations. */
export function clearBootstrap(): void {
serverMenuExtensions = []
serverRoutes = []
serverFeatures = []
}

/** Load server bootstrap payload (requires authentication). */
export async function loadBootstrap(http: AxiosInstance): Promise<BootstrapPayload | null> {
try {
Expand All @@ -115,7 +122,5 @@ export function clearPluginRegistry(): void {
}
buildTimeMenuItems.length = 0
buildTimeVueRoutes.length = 0
serverMenuExtensions = []
serverRoutes = []
serverFeatures = []
clearBootstrap()
}
Loading