Skip to content

Commit 49e9007

Browse files
authored
fix(editors/subscriber-later-binding): Add GOOSE icon to later binding editor, closes openscd#1017 (openscd#1022)
1 parent 216226c commit 49e9007

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/editors/subscription/later-binding/fcda-later-binding-list.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
state,
99
TemplateResult,
1010
} from 'lit-element';
11-
import { nothing } from 'lit-html';
11+
import { nothing, SVGTemplateResult } from 'lit-html';
1212
import { translate } from 'lit-translate';
1313

1414
import '@material/mwc-icon';
@@ -22,13 +22,17 @@ import {
2222
identity,
2323
newWizardEvent,
2424
} from '../../../foundation.js';
25-
import { smvIcon } from '../../../icons/icons.js';
25+
import { gooseIcon, smvIcon } from '../../../icons/icons.js';
2626
import { wizards } from '../../../wizards/wizard-library.js';
2727

2828
import { styles } from '../foundation.js';
2929

3030
import { getFcdaTitleValue, newFcdaSelectEvent } from './foundation.js';
3131

32+
type controlTag = 'SampledValueControl' | 'GSEControl';
33+
34+
type iconLookup = Record<controlTag, SVGTemplateResult>;
35+
3236
/**
3337
* A sub element for showing all Goose/Sampled Value Controls.
3438
* A control can be edited using the standard wizard.
@@ -39,17 +43,24 @@ export class FCDALaterBindingList extends LitElement {
3943
@property({ attribute: false })
4044
doc!: XMLDocument;
4145
@property()
42-
controlTag!: 'SampledValueControl' | 'GSEControl';
46+
controlTag!: controlTag;
4347

4448
// The selected Elements when a FCDA Line is clicked.
4549
@state()
4650
selectedControlElement: Element | undefined;
4751
@state()
4852
selectedFcdaElement: Element | undefined;
4953

54+
@property({ attribute: false })
55+
iconControlLookup: iconLookup;
56+
5057
constructor() {
5158
super();
5259

60+
this.iconControlLookup = {
61+
SampledValueControl: smvIcon,
62+
GSEControl: gooseIcon,
63+
};
5364
this.resetSelection = this.resetSelection.bind(this);
5465
parent.addEventListener('open-doc', this.resetSelection);
5566
}
@@ -169,7 +180,9 @@ export class FCDALaterBindingList extends LitElement {
169180
: nothing}</span
170181
>
171182
<span slot="secondary">${identity(controlElement)}</span>
172-
<mwc-icon slot="graphic">${smvIcon}</mwc-icon>
183+
<mwc-icon slot="graphic"
184+
>${this.iconControlLookup[this.controlTag]}</mwc-icon
185+
>
173186
</mwc-list-item>
174187
<li divider role="separator"></li>
175188
${fcdaElements.map(fcdaElement =>

0 commit comments

Comments
 (0)