Skip to content

Commit 488a4e4

Browse files
authored
Merge pull request #314 from com-pas/275-warning-instead-of-error-in-case-of-no-nsdoc-files-are-found-more-descriptive-warning-message
fix: altered no nsdoc file warning message
2 parents f38bf48 + bfaf3e4 commit 488a4e4

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

packages/compas-open-scd/src/compas-services/foundation.ts

+14
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,20 @@ export function createLogEvent(element: Element, reason: any): void {
103103
}
104104
}
105105

106+
export function createNSDocLogEvent(element: Element, fileName: string): void {
107+
if (element) {
108+
element.dispatchEvent(
109+
newLogEvent({
110+
kind: 'warning',
111+
title: get('compas.warning.nsdoc'),
112+
message: get('compas.warning.nsdocDetails', {
113+
url: `/public/nsdoc/${fileName}`,
114+
}),
115+
})
116+
);
117+
}
118+
}
119+
106120
export function getWebsocketUri(settingsUrl: string): string {
107121
if (settingsUrl.startsWith('http://') || settingsUrl.startsWith('https://')) {
108122
return settingsUrl

packages/compas-open-scd/src/compas/CompasNsdoc.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { newLoadNsdocEvent } from '../Setting.js';
22

3-
import { createLogEvent } from '../compas-services/foundation.js';
3+
import {
4+
createLogEvent,
5+
createNSDocLogEvent,
6+
} from '../compas-services/foundation.js';
47
import { CompasSclValidatorService } from '../compas-services/CompasValidatorService.js';
58
import { CompasNSDocFileService } from '../compas-services/CompasNSDocFileService.js';
69

@@ -39,8 +42,8 @@ async function processNsdocFile(
3942
component.dispatchEvent(newLoadNsdocEvent(nsdocContent, filename));
4043
localStorage.setItem(checksumKey, checksum);
4144
})
42-
.catch(reason => {
43-
createLogEvent(component, reason);
45+
.catch(() => {
46+
createNSDocLogEvent(component, filename);
4447
});
4548
} else {
4649
console.debug(`Loading NSDoc File '${nsdocId}' skipped, already loaded.`);

packages/compas-open-scd/src/translations/de.ts

+4
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,10 @@ export const de: Translations = {
878878
server: '???',
879879
serverDetails: '{{type}}: {{message}}',
880880
},
881+
warning: {
882+
nsdoc: 'NSDoc-Datei konnte nicht geladen werden',
883+
nsdocDetails: 'Die {{url}} kann nicht geladen werden',
884+
},
881885
changeset: {
882886
major: '???',
883887
minor: '???',

packages/compas-open-scd/src/translations/en.ts

+4
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,10 @@ export const en = {
871871
server: 'Error communicating with CoMPAS Ecosystem',
872872
serverDetails: '{{type}}: {{message}}',
873873
},
874+
warning: {
875+
nsdoc: 'Could not load NSDoc file',
876+
nsdocDetails: 'Cannot load {{url}}',
877+
},
874878
changeset: {
875879
major: 'Major change',
876880
minor: 'Minor change',

0 commit comments

Comments
 (0)