Skip to content

Commit 0c98e08

Browse files
author
Dennis Labordus
committed
Small changes, labels to bundle, placeholders and constants.
Signed-off-by: Dennis Labordus <[email protected]>
1 parent f684a81 commit 0c98e08

File tree

10 files changed

+168
-29
lines changed

10 files changed

+168
-29
lines changed

src/locamation/LocamationIEDList.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {newSubWizardEvent, newWizardEvent, Wizard, WizardInput} from '../foundat
88
import {isSCLNamespace} from "../schemas.js";
99
import {Nsdoc} from "../foundation/nsdoc.js";
1010

11-
import {iedHeader, lDeviceHeader} from "./foundation.js";
11+
import {iedHeader, lDeviceHeader, LOCAMATION_MANUFACTURER, LOCAMATION_PRIVATE} from "./foundation.js";
1212
import {locamationLNListWizard} from "./LocamationLNList.js";
1313

1414
@customElement('locamation-ied-list')
@@ -19,9 +19,9 @@ export class LocamationIEDListElement extends LitElement {
1919
nsdoc!: Nsdoc;
2020

2121
private get logicaDevices(): Element[] {
22-
return Array.from(this.doc!.querySelectorAll('IED[manufacturer="Locamation B.V."] LDevice'))
22+
return Array.from(this.doc!.querySelectorAll(`IED[manufacturer="${LOCAMATION_MANUFACTURER}"] LDevice`))
2323
.filter(isSCLNamespace)
24-
.filter(element => element.querySelector('LN > Private[type="LCMTN_VMU_SENSOR"]') !== null);
24+
.filter(element => element.querySelector(`LN > Private[type="${LOCAMATION_PRIVATE}"]`) !== null);
2525
}
2626

2727
close(): void {

src/locamation/LocamationLNEdit.ts

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ export class LocamationVMUEditElement extends LitElement {
3939
title: get('locamation.vmu.updateAction', {lnName: lnHeader(this.logicalNode, this.nsdoc)}),
4040
};
4141

42-
complexAction.actions.push(...createEditorAction(locamationPrivate, 'IDENTIFIER', getInputFieldValue(inputs, 'Identifier')));
42+
complexAction.actions.push(...createEditorAction(locamationPrivate, 'IDENTIFIER', getInputFieldValue(inputs, 'identifier')));
4343
if (hasPrivateElement(this.logicalNode, 'SUM')) {
44-
complexAction.actions.push(...createEditorAction(locamationPrivate, 'SUM', getInputFieldValue(inputs, 'Sum')));
44+
complexAction.actions.push(...createEditorAction(locamationPrivate, 'SUM', getInputFieldValue(inputs, 'sum')));
4545
} else {
46-
complexAction.actions.push(...createEditorAction(locamationPrivate, 'CHANNEL', getInputFieldValue(inputs, 'Channel')));
46+
complexAction.actions.push(...createEditorAction(locamationPrivate, 'CHANNEL', getInputFieldValue(inputs, 'channel')));
4747
}
48-
complexAction.actions.push(...createEditorAction(locamationPrivate, 'TRANSFORM-PRIMARY', getInputFieldValue(inputs, 'TransformPrimary')));
49-
complexAction.actions.push(...createEditorAction(locamationPrivate, 'TRANSFORM-SECONDARY', getInputFieldValue(inputs, 'TransformSecondary')));
48+
complexAction.actions.push(...createEditorAction(locamationPrivate, 'TRANSFORM-PRIMARY', getInputFieldValue(inputs, 'transformPrimary')));
49+
complexAction.actions.push(...createEditorAction(locamationPrivate, 'TRANSFORM-SECONDARY', getInputFieldValue(inputs, 'transformSecondary')));
5050

5151
return complexAction.actions.length ? [complexAction] : [];
5252
}
@@ -58,11 +58,11 @@ export class LocamationVMUEditElement extends LitElement {
5858
const oldTransformPrimary = getPrivateTextValue(locamationPrivate, 'TRANSFORM-PRIMARY');
5959
const oldTransformSecondary = getPrivateTextValue(locamationPrivate, 'TRANSFORM-SECONDARY');
6060

61-
return inputFieldChanged(inputs, 'Identifier', oldIdentifier)
62-
|| (hasPrivateElement(locamationPrivate, 'SUM') ? inputFieldChanged(inputs, 'Sum', oldSum) : false)
63-
|| (hasPrivateElement(locamationPrivate, 'CHANNEL') ? inputFieldChanged(inputs, 'Channel', oldChannel) : false)
64-
|| inputFieldChanged(inputs, 'TransformPrimary', oldTransformPrimary)
65-
|| inputFieldChanged(inputs, 'TransformSecondary', oldTransformSecondary);
61+
return inputFieldChanged(inputs, 'identifier', oldIdentifier)
62+
|| (hasPrivateElement(locamationPrivate, 'SUM') ? inputFieldChanged(inputs, 'sum', oldSum) : false)
63+
|| (hasPrivateElement(locamationPrivate, 'CHANNEL') ? inputFieldChanged(inputs, 'channel', oldChannel) : false)
64+
|| inputFieldChanged(inputs, 'transformPrimary', oldTransformPrimary)
65+
|| inputFieldChanged(inputs, 'transformSecondary', oldTransformSecondary);
6666
}
6767

6868
private checkValidityInputs(inputs: WizardInput[]): boolean {
@@ -101,45 +101,47 @@ export class LocamationVMUEditElement extends LitElement {
101101
disabled>
102102
</wizard-textfield>
103103
104-
<wizard-textfield id="Identifier"
105-
label="Identifier"
104+
<wizard-textfield id="identifier"
105+
label="${translate('locamation.vmu.identifier')}"
106106
.maybeValue=${getPrivateTextValue(locamationPrivate, 'IDENTIFIER')}
107107
helper="${translate('locamation.vmu.identifierHelper')}"
108+
placeholder="134.12.213"
108109
pattern="^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\\.(?!$)|$)){3}$"
109110
required
110111
dialogInitialFocus>
111112
</wizard-textfield>
112113
113114
${hasPrivateElement(locamationPrivate, 'SUM') ?
114-
html `<wizard-textfield id="Sum"
115-
label="Sum"
115+
html `<wizard-textfield id="sum"
116+
label="${translate('locamation.vmu.sum')}"
116117
.maybeValue=${getPrivateTextValue(locamationPrivate, 'SUM')}
117-
helper="The collection of three channel numbers for which the sum of currents or voltages will be calculated. The numbers are separated by commas. Values for the current sensor range from 0 - 5, for the voltage sensor 0-2."
118+
helper="${translate('locamation.vmu.sumHelper')}"
119+
placeholder="0,1,2"
118120
pattern="${sumPattern}"
119121
required>
120122
</wizard-textfield>` : html ``
121123
}
122124
${hasPrivateElement(locamationPrivate, 'CHANNEL') ?
123-
html `<wizard-textfield id="Channel"
124-
label="Channel"
125+
html `<wizard-textfield id="channel"
126+
label="${translate('locamation.vmu.channel')}"
125127
.maybeValue=${getPrivateTextValue(locamationPrivate, 'CHANNEL')}
126-
helper="The channel number on the sensor. Values for the current sensor range from 0 - 5, for the voltage sensor 0-2."
128+
helper="${translate('locamation.vmu.channelHelper')}"
127129
pattern="${channelPattern}"
128130
required>
129131
</wizard-textfield>` : html ``
130132
}
131133
132-
<wizard-textfield id="TransformPrimary"
133-
label="Transform Primary"
134+
<wizard-textfield id="transformPrimary"
135+
label="${translate('locamation.vmu.transformPrimary')}"
134136
.maybeValue=${getPrivateTextValue(locamationPrivate, 'TRANSFORM-PRIMARY')}
135-
helper="The nominator of the ratio of the measement transformer."
137+
helper="${translate('locamation.vmu.transformPrimaryHelper')}"
136138
pattern="${patterns.unsigned}"
137139
required>
138140
</wizard-textfield>
139-
<wizard-textfield id="TransformSecondary"
140-
label="Transform Secondary"
141+
<wizard-textfield id="transformSecondary"
142+
label="${translate('locamation.vmu.transformSecondary')}"
141143
.maybeValue=${getPrivateTextValue(locamationPrivate, 'TRANSFORM-SECONDARY')}
142-
helper="The denominator of the ratio of the measement transformer."
144+
helper="${translate('locamation.vmu.transformSecondaryHelper')}"
143145
pattern="${patterns.unsigned}"
144146
required>
145147
</wizard-textfield>

src/locamation/LocamationLNList.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {Nsdoc} from "../foundation/nsdoc.js";
1111
import '../wizard-textfield.js';
1212

1313
import {locamationLNEditWizard} from "./LocamationLNEdit.js";
14-
import {iedHeader, lDeviceHeader, lnHeader} from "./foundation.js";
14+
import {iedHeader, lDeviceHeader, lnHeader, LOCAMATION_PRIVATE} from "./foundation.js";
1515

1616
@customElement('locamation-ln-list')
1717
export class LocamationLNodeListElement extends LitElement {
@@ -23,7 +23,7 @@ export class LocamationLNodeListElement extends LitElement {
2323
private get logicaNodes(): Element[] {
2424
return Array.from(this.lDevice!.querySelectorAll('LN'))
2525
.filter(isSCLNamespace)
26-
.filter(element => element.querySelector('Private[type="LCMTN_VMU_SENSOR"]') !== null);
26+
.filter(element => element.querySelector(`Private[type="${LOCAMATION_PRIVATE}"]`) !== null);
2727
}
2828

2929
close(): void {

src/locamation/foundation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
WizardInput
1111
} from "../foundation.js";
1212

13+
export const LOCAMATION_MANUFACTURER = "Locamation B.V.";
1314
export const LOCAMATION_PRIVATE = "LCMTN_VMU_SENSOR";
1415
export const LOCAMATION_NS = "https://www.locamation.com/61850/VMU/SCL";
1516
export const LOCAMATION_PREFIX = "lcmtn_ext";

src/translations/de.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,16 @@ export const de: Translations = {
577577
name: '???',
578578
},
579579
version: '???',
580+
identifier: '???',
580581
identifierHelper: '???',
582+
sum: '???',
583+
sumHelper: '???',
584+
channel: '???',
585+
channelHelper: '???',
586+
transformPrimary: '???',
587+
transformPrimaryHelper: '???',
588+
transformSecondary: '???',
589+
transformSecondaryHelper: '???',
581590
updateAction: '???',
582591
},
583592
},

src/translations/en.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,16 @@ export const en = {
579579
name: 'Logical Node',
580580
},
581581
version: 'Locamation VMU Version',
582+
identifier: 'Identifier',
582583
identifierHelper: 'The address of the sensor. The address is constructed of 3 numbers, separated by dots. The range of each number is 0-255.',
584+
sum: 'Sum',
585+
sumHelper: 'The collection of three channel numbers for which the sum of currents or voltages will be calculated. The numbers are separated by commas. Values for the current sensor range from 0 - 5, for the voltage sensor 0-2.',
586+
channel: 'Channel',
587+
channelHelper: 'The channel number on the sensor. Values for the current sensor range from 0 - 5, for the voltage sensor 0-2.',
588+
transformPrimary: 'Transform Primary',
589+
transformPrimaryHelper: 'The nominator of the ratio of the measement transformer.',
590+
transformSecondary: 'Transform Secondary',
591+
transformSecondaryHelper: 'The denominator of the ratio of the measement transformer.',
583592
updateAction: 'Locamation private fields updated for Logica Node {{lnName}}',
584593
},
585594
},

test/integration/compas-editors/__snapshots__/CompasVersions.test.snap.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,28 @@ snapshots["compas-versions-plugin items-in-list looks like the latest snapshot"]
107107
`;
108108
/* end snapshot compas-versions-plugin items-in-list looks like the latest snapshot */
109109

110+
snapshots["compas-versions-plugin no-items-in-list looks like the latest snapshot"] =
111+
`<mwc-list>
112+
<mwc-list-item
113+
aria-disabled="false"
114+
mwc-list-item=""
115+
tabindex="0"
116+
>
117+
<span style="color: var(--base1)">
118+
[compas.noSclVersions]
119+
</span>
120+
</mwc-list-item>
121+
</mwc-list>
122+
<wizard-dialog>
123+
</wizard-dialog>
124+
`;
125+
/* end snapshot compas-versions-plugin no-items-in-list looks like the latest snapshot */
126+
127+
snapshots["compas-versions-plugin show-loading looks like the latest snapshot"] =
128+
`<compas-loading>
129+
</compas-loading>
130+
<wizard-dialog>
131+
</wizard-dialog>
132+
`;
133+
/* end snapshot compas-versions-plugin show-loading looks like the latest snapshot */
134+

test/unit/compas/__snapshots__/CompasOpen.test.snap.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,35 @@ snapshots["compas-open when-project-needs-to-be-selected looks like the latest s
3939
`;
4040
/* end snapshot compas-open when-project-needs-to-be-selected looks like the latest snapshot */
4141

42+
snapshots["compas-open when-type-needs-to-be-selected looks like the latest snapshot"] =
43+
`<compas-divider>
44+
</compas-divider>
45+
<section>
46+
<h3>
47+
[compas.open.localTitle]
48+
</h3>
49+
<input
50+
accept=".sed,.scd,.ssd,.isd,.iid,.cid,.icd"
51+
hidden=""
52+
id="scl-file"
53+
required=""
54+
type="file"
55+
>
56+
<mwc-button label="[compas.open.selectFileButton]">
57+
</mwc-button>
58+
</section>
59+
<compas-divider>
60+
</compas-divider>
61+
<section>
62+
<h3>
63+
[compas.open.compasTitle]
64+
</h3>
65+
<p>
66+
[compas.open.listSclTypes]
67+
</p>
68+
<compas-scltype-list>
69+
</compas-scltype-list>
70+
</section>
71+
`;
72+
/* end snapshot compas-open when-type-needs-to-be-selected looks like the latest snapshot */
73+

test/unit/compas/__snapshots__/CompasSave.test.snap.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,27 @@ snapshots["compas-save new document in compas looks like the latest snapshot"] =
5555
`;
5656
/* end snapshot compas-save new document in compas looks like the latest snapshot */
5757

58+
snapshots["compas-save existing document in compas looks like the latest snapshot"] =
59+
`<compas-divider>
60+
</compas-divider>
61+
<section>
62+
<h3>
63+
[compas.save.localTitle]
64+
</h3>
65+
<mwc-button label="[compas.save.saveFileButton]">
66+
</mwc-button>
67+
</section>
68+
<compas-divider>
69+
</compas-divider>
70+
<section>
71+
<h3>
72+
[compas.save.compasTitle]
73+
</h3>
74+
<compas-changeset-radiogroup>
75+
</compas-changeset-radiogroup>
76+
<compas-comment>
77+
</compas-comment>
78+
</section>
79+
`;
80+
/* end snapshot compas-save existing document in compas looks like the latest snapshot */
81+

test/unit/compas/__snapshots__/CompasUploadVersion.test.snap.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,40 @@ snapshots["compas-upload-version existing document in compas through wizard look
3535
`;
3636
/* end snapshot compas-upload-version existing document in compas through wizard looks like the latest snapshot */
3737

38+
snapshots["compas-upload-version existing document in compas looks like the latest snapshot"] =
39+
`<input
40+
accept=".scd"
41+
hidden=""
42+
id="scl-file"
43+
required=""
44+
type="file"
45+
>
46+
<wizard-textfield
47+
id="filename"
48+
label="[compas.uploadVersion.filename]"
49+
readonly=""
50+
required=""
51+
>
52+
</wizard-textfield>
53+
<mwc-button label="[compas.uploadVersion.selectButton]">
54+
</mwc-button>
55+
<compas-changeset-radiogroup>
56+
</compas-changeset-radiogroup>
57+
<compas-comment>
58+
</compas-comment>
59+
`;
60+
/* end snapshot compas-upload-version existing document in compas looks like the latest snapshot */
61+
62+
snapshots["compas-upload-version no document in compas (anymore) looks like the latest snapshot"] =
63+
`<mwc-list>
64+
<mwc-list-item
65+
aria-disabled="false"
66+
mwc-list-item=""
67+
tabindex="0"
68+
>
69+
[compas.notExists]
70+
</mwc-list-item>
71+
</mwc-list>
72+
`;
73+
/* end snapshot compas-upload-version no document in compas (anymore) looks like the latest snapshot */
74+

0 commit comments

Comments
 (0)