Skip to content

Commit 2cef3d7

Browse files
ca-dJakob Vogelsang
andauthored
fix(validatetemplates): don't require "Oper" if ctlModel=status-only (#269)
* refactor(validatetemplates, validateschema): unify translations * fix(validator/velidatetemplate): add warning for missing ctlModel definition Co-authored-by: Jakob Vogelsang <[email protected]>
1 parent 21ab8ce commit 2cef3d7

File tree

8 files changed

+165
-97
lines changed

8 files changed

+165
-97
lines changed

src/translations/de.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,22 @@ export const de: Translations = {
6464
'{{ parent }} enthält bereits ein {{ child }} Kind namens "{{ name }}"',
6565
},
6666
},
67-
validate: {
68-
title: 'Projekt validieren',
69-
valid: '{{ name }} erfolgreich validiert',
70-
invalid: '{{ name }} Validierung fehlgeschlagen',
71-
fatal: 'Fataler Validierungsfehler',
72-
loadError: 'Konnte Schema {{ name }} nicht laden',
67+
validator: {
68+
schema: {
69+
title: 'Projekt validieren',
70+
valid: '{{ name }} erfolgreich validiert',
71+
invalid: '{{ name }} Validierung fehlgeschlagen',
72+
fatal: 'Fataler Validierungsfehler',
73+
loadError: 'Konnte Schema {{ name }} nicht laden',
74+
},
75+
templates: {
76+
title: 'Templates validieren',
77+
mandatoryChild:
78+
'{{ tag }} {{ id }} fehlt ein obligatorisches {{ childTag }}-Kind {{ childId }}',
79+
missingCoDO: 'Control-Dienst Datenattribut vom Typ {{ type }} fehlt',
80+
missingCtlModelDef:
81+
'CtlModel Definition fehlt. Kann {{ childTag }} {{ childId }} in {{ tag }} {{ id }} nicht validieren.',
82+
},
7383
},
7484
textfield: {
7585
required: 'Pflichtfeld',

src/translations/en.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,22 @@ export const en = {
9595
srcHelper: 'The vendor supplied extension URL',
9696
},
9797
},
98-
validate: {
99-
title: 'Validate project',
100-
valid: '{{ name }} validation successful',
101-
invalid: '{{ name }} validation failed',
102-
fatal: 'Fatal validation error',
103-
loadError: 'Could not load schema {{ name }}',
98+
validator: {
99+
schema: {
100+
title: 'Validate project',
101+
valid: '{{ name }} validation successful',
102+
invalid: '{{ name }} validation failed',
103+
fatal: 'Fatal validation error',
104+
loadError: 'Could not load schema {{ name }}',
105+
},
106+
templates: {
107+
title: 'Validate templates',
108+
mandatoryChild:
109+
'{{ tag }} {{ id }} is missing mandatory child {{ childTag }} {{ childId }}',
110+
missingCoDO: 'Control service related DA of type {{ type }} is missing',
111+
missingCtlModelDef:
112+
'Missing ctlModel definition. Cannot validate {{ childTag }} {{ childId }} within {{ tag }} {{ id }}',
113+
},
104114
},
105115
substation: {
106116
name: 'Substation',

src/validators/ValidateSchema.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default class ValidateSchema extends LitElement {
2323
docName!: string;
2424

2525
private async getValidator(xsd: string, xsdName: string): Promise<Validator> {
26-
if (!window.Worker) throw new Error(get('validate.fatal'));
26+
if (!window.Worker) throw new Error(get('validator.schema.fatal'));
2727
if (validators[xsdName]) return validators[xsdName]!;
2828

2929
const worker: Worker = new Worker('public/js/worker.js');
@@ -45,7 +45,7 @@ export default class ValidateSchema extends LitElement {
4545
worker.addEventListener('message', (e: MessageEvent<WorkerMessage>) => {
4646
if (isLoadSchemaResult(e.data)) {
4747
if (e.data.loaded) resolve(validate);
48-
else reject(get('validate.loadEror', { name: e.data.file }));
48+
else reject(get('validator.schema.loadEror', { name: e.data.file }));
4949
} else if (isValidationError(e.data)) {
5050
const parts = e.data.message.split(': ', 2);
5151
const description = parts[1] ? parts[1] : parts[0];
@@ -68,7 +68,7 @@ export default class ValidateSchema extends LitElement {
6868
} else if (!isValidationResult(e.data)) {
6969
document.querySelector('open-scd')!.dispatchEvent(
7070
newLogEvent({
71-
title: get('validate.fatal'),
71+
title: get('validator.schema.fatal'),
7272
kind: 'error',
7373
message: e.data,
7474
})
@@ -102,16 +102,16 @@ export default class ValidateSchema extends LitElement {
102102
document.querySelector('open-scd')!.dispatchEvent(
103103
newLogEvent({
104104
kind: 'warning',
105-
title: get('validate.invalid', { name: result.file }),
105+
title: get('validator.schema.invalid', { name: result.file }),
106106
})
107107
);
108-
throw new Error(get('validate.invalid', { name: result.file }));
108+
throw new Error(get('validator.schema.invalid', { name: result.file }));
109109
}
110110

111111
document.querySelector('open-scd')!.dispatchEvent(
112112
newLogEvent({
113113
kind: 'info',
114-
title: get('validate.valid', { name: result.file }),
114+
title: get('validator.schema.valid', { name: result.file }),
115115
})
116116
);
117117
}

0 commit comments

Comments
 (0)