mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-08 16:03:27 +00:00
* fix: gate the chat's open_page on the operating workspace's role Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: don't describe an unresolved open_page role as a denial Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import { resourceTypesStore } from './components/resourceTypesStore'
|
|
import { refreshSuperadmin } from './refreshUser'
|
|
import { clearWorkspaceRoleCache } from './user'
|
|
import {
|
|
workspaceStore,
|
|
userStore,
|
|
usersWorkspaceStore,
|
|
nonMemberWorkspaces,
|
|
superadmin,
|
|
devopsRole,
|
|
clearWorkspaceFromStorage
|
|
} from './stores'
|
|
import { resetProtectionRules, loadProtectionRules } from './workspaceProtectionRules.svelte'
|
|
|
|
export function switchWorkspace(workspace: string | undefined) {
|
|
resourceTypesStore.set(undefined)
|
|
|
|
// Clear protection rules state
|
|
resetProtectionRules()
|
|
|
|
workspaceStore.set(workspace)
|
|
|
|
// Eagerly load protection rules for new workspace
|
|
if (workspace) {
|
|
loadProtectionRules(workspace)
|
|
}
|
|
}
|
|
|
|
export function clearStores(): void {
|
|
try {
|
|
clearWorkspaceFromStorage()
|
|
} catch (e) {
|
|
console.error('error interacting with local storage', e)
|
|
}
|
|
|
|
resourceTypesStore.set(undefined)
|
|
resetProtectionRules()
|
|
clearWorkspaceRoleCache()
|
|
userStore.set(undefined)
|
|
workspaceStore.set(undefined)
|
|
usersWorkspaceStore.set(undefined)
|
|
nonMemberWorkspaces.set(undefined)
|
|
refreshSuperadmin.cancel()
|
|
superadmin.set(undefined)
|
|
devopsRole.set(undefined)
|
|
}
|