Skip to content

Commit 02b8d97

Browse files
Rob TjalmaDennis Labordus
andauthored
feat(editors/IED): display IED data attributes namespace description (openscd#522)
* Implemented adding document to localStorage * Refactor * Fix unit tests * Adding unit tests * Refactor * Refactor translation * Fixing snapshot test * Review comments * Added version text for NSDocs * Review comments * Merge with stash * feat(wizards/settings): Added Nsdoc plugin + Show LN names (openscd#516) * Added first version nsdoc plugin * Added plugin * Refactoring * Refactoring with Jakob * Added LN name * Removed multiple usages of DOMParser * Added refactored nsdoc foundation * Added tests * Changed name of testfile to lowercase * Fixed double names * review comments * Added DO/DA description show * Fix unit tests * Changed referenceInfoTags variable name * Review comment * Removed the dots between toggle icon and info icon * Refactor * Added unit tests * Added unit tests * Removed not used nsdocs (yet) * Fixing weird console error * Added SDO support * Added BDA support * Extended BDA support * Small refactoring * partial 8-1 support * Refactoring * Small refactoring * Added DA 61850-8-1 support unit tests * Added unit tests * Added unit tests * Added separate SDO getDataDescription * Refactor getDataDescription signature * Review comments * Refactoring * Added comments * Fixing unit tests Co-authored-by: Dennis Labordus <[email protected]>
1 parent 9c0c963 commit 02b8d97

19 files changed

+476
-91
lines changed

src/editors/ied/access-point-container.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export class AccessPointContainer extends LitElement {
1919
@property({ attribute: false })
2020
element!: Element;
2121

22+
@property()
23+
ancestors: Element[] = [];
24+
2225
@property()
2326
nsdoc!: Nsdoc;
2427

@@ -35,6 +38,7 @@ export class AccessPointContainer extends LitElement {
3538
server => html`<server-container
3639
.element=${server}
3740
.nsdoc=${this.nsdoc}
41+
.ancestors=${[this.element, ...this.ancestors]}
3842
></server-container>`)}
3943
</action-pane>`;
4044
}

src/editors/ied/da-container.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { IconButtonToggle } from '@material/mwc-icon-button-toggle';
1515

1616
import '../../action-pane.js';
1717
import { getNameAttribute } from '../../foundation.js';
18+
import { Nsdoc } from '../../foundation/nsdoc.js';
1819

1920
/** [[`IED`]] plugin subeditor for editing `(B)DA` element. */
2021
@customElement('da-container')
@@ -30,6 +31,15 @@ export class DAContainer extends LitElement {
3031
*/
3132
@property({ attribute: false })
3233
instanceElement!: Element;
34+
35+
@property({ attribute: false })
36+
daParent!: Element
37+
38+
@property()
39+
ancestors: Element[] = [];
40+
41+
@property()
42+
nsdoc!: Nsdoc;
3343

3444
@query('#toggleButton') toggleButton: IconButtonToggle | undefined;
3545

@@ -83,6 +93,12 @@ export class DAContainer extends LitElement {
8393
const bType = this.element!.getAttribute('bType');
8494

8595
return html`<action-pane .label="${this.header()}" icon="${this.instanceElement != null ? 'done' : ''}">
96+
<abbr slot="action">
97+
<mwc-icon-button
98+
title=${this.nsdoc.getDataDescription(this.element, this.ancestors).label}
99+
icon="info"
100+
></mwc-icon-button>
101+
</abbr>
86102
${bType == 'Struct' ? html`<abbr slot="action" title="${translate('iededitor.toggleChildElements')}">
87103
<mwc-icon-button-toggle
88104
id="toggleButton"
@@ -94,8 +110,11 @@ export class DAContainer extends LitElement {
94110
<h6>${this.renderValue()}</h6>
95111
${this.toggleButton?.on && bType == 'Struct' ? this.getBDAElements().map(element =>
96112
html`<da-container
97-
.element=${element}>
98-
</da-container>`) : nothing}
113+
.element=${element}
114+
.nsdoc=${this.nsdoc}
115+
.daParent=${this.daParent ?? this.element}
116+
.ancestors=${[this.element, ...this.ancestors]}
117+
></da-container>`) : nothing}
99118
</action-pane>
100119
`;
101120
}

src/editors/ied/do-container.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import '../../action-pane.js';
1515
import './da-container.js';
1616
import { getDescriptionAttribute, getNameAttribute } from '../../foundation.js';
1717
import { translate } from 'lit-translate';
18+
import { Nsdoc } from '../../foundation/nsdoc.js';
1819

1920
/** [[`IED`]] plugin subeditor for editing `DO` element. */
2021
@customElement('do-container')
@@ -30,6 +31,12 @@ export class DOContainer extends LitElement {
3031
*/
3132
@property({ attribute: false })
3233
instanceElement!: Element;
34+
35+
@property()
36+
ancestors: Element[] = [];
37+
38+
@property()
39+
nsdoc!: Nsdoc;
3340

3441
@query('#toggleButton') toggleButton: IconButtonToggle | undefined;
3542

@@ -101,6 +108,12 @@ export class DOContainer extends LitElement {
101108
const doElements = this.getDOElements();
102109

103110
return html`<action-pane .label="${this.header()}" icon="${this.instanceElement != null ? 'done' : ''}">
111+
<abbr slot="action">
112+
<mwc-icon-button
113+
title=${this.nsdoc.getDataDescription(this.element).label}
114+
icon="info"
115+
></mwc-icon-button>
116+
</abbr>
104117
${daElements.length > 0 || doElements.length > 0 ?
105118
html`<abbr slot="action" title="${translate('iededitor.toggleChildElements')}">
106119
<mwc-icon-button-toggle
@@ -113,13 +126,17 @@ export class DOContainer extends LitElement {
113126
${this.toggleButton?.on ? daElements.map(da =>
114127
html`<da-container
115128
.element=${da}
116-
.instanceElement=${this.getInstanceDAElement(da)}>
117-
</da-container>`) : nothing}
129+
.instanceElement=${this.getInstanceDAElement(da)}
130+
.nsdoc=${this.nsdoc}
131+
.ancestors=${[this.element, ...this.ancestors]}
132+
></da-container>`) : nothing}
118133
${this.toggleButton?.on ? doElements.map(dO =>
119134
html`<do-container
120135
.element=${dO}
121-
.instanceElement=${this.getInstanceDOElement(dO)}>
122-
</do-container>`) : nothing}
136+
.instanceElement=${this.getInstanceDOElement(dO)}
137+
.nsdoc=${this.nsdoc}
138+
.ancestors=${[this.element, ...this.ancestors]}
139+
></do-container>`) : nothing}
123140
</action-pane>
124141
`;
125142
}

src/editors/ied/ied-container.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export class IedContainer extends LitElement {
5050
ap => html`<access-point-container
5151
.element=${ap}
5252
.nsdoc=${this.nsdoc}
53+
.ancestors=${[this.element]}
5354
></access-point-container>`)}
5455
</action-pane>`;
5556
}

src/editors/ied/ldevice-container.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ export class LDeviceContainer extends LitElement {
2222
@property({ attribute: false })
2323
element!: Element;
2424

25+
@property()
26+
ancestors: Element[] = [];
27+
2528
@property()
2629
nsdoc!: Nsdoc;
2730

@@ -55,6 +58,7 @@ export class LDeviceContainer extends LitElement {
5558
${this.toggleButton?.on ? lnElements.map(ln => html`<ln-container
5659
.element=${ln}
5760
.nsdoc=${this.nsdoc}
61+
.ancestors=${[this.element, ...this.ancestors]}
5862
></ln-container>
5963
`) : nothing}
6064
</div>

src/editors/ied/ln-container.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export class LNContainer extends LitElement {
2323
@property({ attribute: false })
2424
element!: Element;
2525

26+
@property()
27+
ancestors: Element[] = [];
28+
2629
@property()
2730
nsdoc!: Nsdoc;
2831

@@ -76,8 +79,10 @@ export class LNContainer extends LitElement {
7679
</abbr>` : nothing}
7780
${this.toggleButton?.on ? this.getDOElements().map(dO => html`<do-container
7881
.element=${dO}
79-
.instanceElement=${this.getInstanceElement(dO)}>
80-
</do-container>
82+
.instanceElement=${this.getInstanceElement(dO)}
83+
.nsdoc=${this.nsdoc}
84+
.ancestors=${[this.element, ...this.ancestors]}
85+
></do-container>
8186
`) : nothing}
8287
</action-pane>`;
8388
}

src/editors/ied/server-container.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ export class ServerContainer extends LitElement {
1717
@property({ attribute: false })
1818
element!: Element;
1919

20+
@property()
21+
ancestors: Element[] = [];
22+
2023
@property()
2124
nsdoc!: Nsdoc;
2225

@@ -30,6 +33,7 @@ export class ServerContainer extends LitElement {
3033
server => html`<ldevice-container
3134
.element=${server}
3235
.nsdoc=${this.nsdoc}
36+
.ancestors=${[this.element, ...this.ancestors]}
3337
></ldevice-container>`)}
3438
</action-pane>`;
3539
}

0 commit comments

Comments
 (0)