Skip to content

Commit 13bd962

Browse files
author
Dennis Labordus
authored
Merge pull request #196 from com-pas/compas-mixin
Create CoMPAS Mixin with Session Expire Dialogs and other loading logic
2 parents f52cac6 + 6f4bc30 commit 13bd962

18 files changed

+548
-473
lines changed

src/compas-services/foundation.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,18 @@ export function createLogEvent(element: Element, reason: any): void {
8585
message += ' (' + reason.status + ')';
8686
}
8787

88-
element.dispatchEvent(
89-
newLogEvent({
90-
kind: 'error',
91-
title: get('compas.error.server'),
92-
message: get('compas.error.serverDetails', {
93-
type: reason.type,
94-
message: message,
95-
}),
96-
})
97-
);
88+
if (element) {
89+
element.dispatchEvent(
90+
newLogEvent({
91+
kind: 'error',
92+
title: get('compas.error.server'),
93+
message: get('compas.error.serverDetails', {
94+
type: reason.type,
95+
message: message,
96+
}),
97+
})
98+
);
99+
}
98100
}
99101

100102
export function getWebsocketUri(settingsUrl: string): string {

src/compas/CompasNsdoc.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ async function processNsdocFile(
5050
* Call backend to get the list of available NSDoc Files on the SCL Validator Service.
5151
* Load each item found using the function #processNsdocFile.
5252
*/
53-
export async function loadNsdocFiles(): Promise<void> {
54-
const openScd = document.querySelector('open-scd');
53+
export async function loadNsdocFiles(element: Element): Promise<void> {
5554
await CompasSclValidatorService()
5655
.listNsdocFiles()
5756
.then(response => {
@@ -61,11 +60,11 @@ export async function loadNsdocFiles(): Promise<void> {
6160
const nsdocId = element.querySelector('NsdocId')!.textContent ?? '';
6261
const filename = element.querySelector('Filename')!.textContent ?? '';
6362
const checksum = element.querySelector('Checksum')!.textContent ?? '';
64-
processNsdocFile(openScd!, id, nsdocId, filename, checksum);
63+
processNsdocFile(element, id, nsdocId, filename, checksum);
6564
}
6665
);
6766
})
6867
.catch(reason => {
69-
createLogEvent(openScd!, reason);
68+
createLogEvent(element, reason);
7069
});
7170
}

src/compas/CompasSession.ts

Lines changed: 0 additions & 299 deletions
This file was deleted.

0 commit comments

Comments
 (0)