Skip to content

Commit 72fdfdd

Browse files
author
Dennis Labordus
committed
Review comments processed.
Signed-off-by: Dennis Labordus <[email protected]>
1 parent bdc5610 commit 72fdfdd

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

src/editors/protocol104/wizards/connectedap.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
import { html, TemplateResult } from 'lit-element';
22
import { get, translate } from 'lit-translate';
3+
import { ifDefined } from 'lit-html/directives/if-defined';
34

45
import '@material/mwc-checkbox';
56
import '@material/mwc-switch';
67
import '@material/mwc-formfield';
78
import '@material/mwc-list/mwc-list-item';
89
import '@material/mwc-list/mwc-check-list-item';
910
import '@material/mwc-icon';
11+
1012
import { Checkbox } from '@material/mwc-checkbox';
1113
import { List } from '@material/mwc-list';
1214
import { ListItemBase } from '@material/mwc-list/mwc-list-item-base';
15+
import { SingleSelectedEvent } from '@material/mwc-list/mwc-list-foundation';
1316

1417
import '../../../wizard-textfield.js';
1518
import '../../../filtered-list.js';
19+
1620
import {
1721
pTypes104,
1822
stationTypeOptions,
@@ -35,15 +39,11 @@ import {
3539
WizardInputElement,
3640
WizardMenuActor,
3741
} from '../../../foundation.js';
38-
import { createTypeRestrictionCheckbox } from '../../../wizards/connectedap.js';
39-
import { SingleSelectedEvent } from '@material/mwc-list/mwc-list-foundation';
40-
import { ifDefined } from 'lit-html/directives/if-defined';
41-
import { typeMaxLength } from '../../../wizards/foundation/p-types.js';
42+
import { getTypeAttribute } from '../foundation/foundation.js';
4243
import {
4344
createRedundancyGroupWizard,
4445
editRedundancyGroupWizard,
4546
} from './redundancygroup.js';
46-
import { getTypeAttribute } from '../foundation/foundation';
4747

4848
interface AccessPointDescription {
4949
element: Element;
@@ -383,6 +383,21 @@ function createEditTextField(parent: Element, pType: string): TemplateResult {
383383
pattern="${ifDefined(typePattern[pType])}"
384384
.maybeValue=${parent.querySelector(`Address > P[type="${pType}"]`)
385385
?.innerHTML ?? null}
386-
maxLength="${ifDefined(typeMaxLength[pType])}"
387386
></wizard-textfield>`;
388387
}
388+
389+
function createTypeRestrictionCheckbox(element: Element): TemplateResult {
390+
return html`<mwc-formfield
391+
label="${translate('connectedap.wizard.addschemainsttype')}"
392+
><mwc-checkbox
393+
id="typeRestriction"
394+
?checked=${hasTypeRestriction(element)}
395+
></mwc-checkbox>
396+
</mwc-formfield>`;
397+
}
398+
399+
function hasTypeRestriction(element: Element): boolean {
400+
return Array.from(element.querySelectorAll('Address > P'))
401+
.filter(p => isPublic(p))
402+
.some(pType => pType.getAttribute('xsi:type'));
403+
}

src/translations/en.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,11 @@ export const en = {
403403
},
404404
redundancyGroupNumberLabel: 'Redundancy Group number',
405405
addedLRedundancyGroup:
406-
'Added Redundancy Group {{ rGNumber }} from SubNetwork[name="{{ subNetworkName }}"] > ConnectedAP[apName="{{ apName }}"][iedName="{{ iedName }}"]',
406+
'Added Redundancy Group {{ rGNumber }} from SubNetwork (name="{{ subNetworkName }}") and ConnectedAP (AccessPoint Name="{{ apName }}", IED Name="{{ iedName }}")',
407407
editedRedundancyGroup:
408-
'Edited Redundancy Group {{ rGNumber }} from SubNetwork[name="{{ subNetworkName }}"] > ConnectedAP[apName="{{ apName }}"][iedName="{{ iedName }}"]',
408+
'Edited Redundancy Group {{ rGNumber }} from SubNetwork (name="{{ subNetworkName }}") and ConnectedAP (AccessPoint Name="{{ apName }}", IED Name="{{ iedName }}")',
409409
removedRedundancyGroup:
410-
'Removed Redundancy Group {{ rGNumber }} from SubNetwork[name="{{ subNetworkName }}"] > ConnectedAP[apName="{{ apName }}"][iedName="{{ iedName }}"]',
410+
'Removed Redundancy Group {{ rGNumber }} from SubNetwork (name="{{ subNetworkName }}") and ConnectedAP (AccessPoint Name="{{ apName }}", IED Name="{{ iedName }}")',
411411
logicLinkGroupTitle: 'Logic Links',
412412
noLogicLinksAvailable: 'No Logic Links available',
413413
addLogicLink: 'Logic Link',
@@ -421,11 +421,11 @@ export const en = {
421421
},
422422
logicLinkNumberLabel: 'Logic Link number',
423423
addedLogicLink:
424-
'Added Logic Link group from SubNetwork[name="{{ subNetworkName }}"] > ConnectedAP[apName="{{ apName }}"][iedName="{{ iedName }}"]',
424+
'Added Logic Link group to SubNetwork (name="{{ subNetworkName }}") and ConnectedAP (AccessPoint Name="{{ apName }}", IED Name="{{ iedName }}")',
425425
editedLogicLink:
426-
'Edited Logic Link group from SubNetwork[name="{{ subNetworkName }}"] > ConnectedAP[apName="{{ apName }}"][iedName="{{ iedName }}"]',
426+
'Edited Logic Link group from SubNetwork (name="{{ subNetworkName }}") and ConnectedAP (AccessPoint Name="{{ apName }}", IED Name="{{ iedName }}")',
427427
removedLogicLink:
428-
'Removed Logic Link group from SubNetwork[name="{{ subNetworkName }}"] > ConnectedAP[apName="{{ apName }}"][iedName="{{ iedName }}"]',
428+
'Removed Logic Link group from SubNetwork (name="{{ subNetworkName }}") and ConnectedAP (AccessPoint Name="{{ apName }}", IED Name="{{ iedName }}")',
429429
},
430430
},
431431
},

0 commit comments

Comments
 (0)