Workplace Widget

This commit is contained in:
chris
2026-10-26 19:10:24 +00:00
parent 1f7c8d93cc
commit 90af5db9ad
33 changed files with 767 additions and 575 deletions

View File

@@ -181,6 +181,7 @@ async function setup(){
identity.value=await signInContext();
if(identity.value.station){station.value=identity.value.station;localStorage.setItem('hmi.stationNumber',station.value);}
authIssue.value=null;
if(identity.value.schemaReady === false){authIssue.value='database';warning.value='Die HMI-Tabellen sind noch nicht initialisiert. Bitte Systemdiagnose öffnen.';return;}
if(!identity.value.bootstrapRequired)await reloadPages();
} catch(e){
const status=e instanceof HmiHttpError?e.status:0;
@@ -196,6 +197,7 @@ async function startLogin(){
identity.value=await imsapiLogin(loginUser.value,loginPassword.value,station.value);
loginPassword.value='';authIssue.value=null;warning.value='';
localStorage.setItem('hmi.stationNumber',station.value);
if(identity.value.schemaReady === false){authIssue.value='database';warning.value='HMI-Datenbank ist nicht bereit. Die Systemdiagnose ist jetzt ohne Administratorrolle verfügbar.';return;}
if(!identity.value.bootstrapRequired)await reloadPages();
}catch(e){warning.value=e instanceof Error?e.message:String(e);authIssue.value='login';}
finally{loginBusy.value=false;}

View File

@@ -1,6 +1,6 @@
const root = '/backend/api/hmi/v1';
export class HmiHttpError extends Error { constructor(public readonly status: number, message: string) { super(message); this.name = 'HmiHttpError'; } }
export interface Identity { csrf: string; user: string; station: string; designer: boolean; publisher: boolean; admin: boolean; scriptEditor: boolean; bootstrapRequired?: boolean; }
export interface Identity { csrf: string; user: string; station: string; designer: boolean; publisher: boolean; admin: boolean; scriptEditor: boolean; bootstrapRequired?: boolean; schemaReady?: boolean; schemaFailureCode?: string; }
let identity: Identity | null = null;
export function currentIdentity(): Identity | null { return identity; }
export async function imsapiLogin(username: string, password: string, station: string): Promise<Identity> {