Skip to content

Commit 845d1a5

Browse files
authored
feat(editors/later-binding): Improve supervision visibility and remove clutter (openscd#1141)
* Improve supervision visibility and later binding information display. * Remove clutter in later binding (closes openscd#1024) * Add subscription information (closes openscd#1037) * Add snapshots
1 parent fc47474 commit 845d1a5

File tree

10 files changed

+2565
-56
lines changed

10 files changed

+2565
-56
lines changed

src/editors/subscription/later-binding/ext-ref-later-binding-list.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,11 @@ export class ExtRefLaterBindingList extends LitElement {
256256
? html` (${getDescriptionAttribute(extRefElement)})`
257257
: nothing}
258258
</span>
259-
<span slot="secondary">${identity(extRefElement)}</span>
259+
<span slot="secondary"
260+
>${identity(extRefElement.parentElement)}${supervisionNode !== null
261+
? ` (${identity(supervisionNode)})`
262+
: ''}</span
263+
>
260264
<mwc-icon slot="graphic">swap_horiz</mwc-icon>
261265
${supervisionNode !== null
262266
? html`<mwc-icon title="${identity(supervisionNode)}" slot="meta"
@@ -329,7 +333,9 @@ export class ExtRefLaterBindingList extends LitElement {
329333
? html` (${getDescriptionAttribute(extRefElement)})`
330334
: nothing}
331335
</span>
332-
<span slot="secondary">${identity(extRefElement)}</span>
336+
<span slot="secondary"
337+
>${identity(extRefElement.parentElement)}</span
338+
>
333339
<mwc-icon slot="graphic">arrow_back</mwc-icon>
334340
</mwc-list-item>`
335341
)}`

test/integration/editors/GooseSubscriberLaterBinding.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
getSelectedSubItemValue,
1010
selectFCDAItem,
1111
} from './test-support.js';
12+
import { ExtRefLaterBindingList } from '../../../src/editors/subscription/later-binding/ext-ref-later-binding-list.js';
1213

1314
describe('GOOSE Subscribe Later Binding Plugin', () => {
1415
customElements.define(
@@ -31,6 +32,33 @@ describe('GOOSE Subscribe Later Binding Plugin', () => {
3132
);
3233
});
3334

35+
it('when selecting an FCDA element with subscriptions it looks like the latest snapshot', async () => {
36+
doc = await fetch('/test/testfiles/editors/LaterBindingGOOSE-LGOS.scd')
37+
.then(response => response.text())
38+
.then(str => new DOMParser().parseFromString(str, 'application/xml'));
39+
40+
element = await fixture(
41+
html`<goose-subscriber-later-binding-plugin
42+
.doc="${doc}"
43+
></goose-subscriber-later-binding-plugin>`
44+
);
45+
46+
const fcdaListElement = getFCDABindingList(element);
47+
selectFCDAItem(
48+
fcdaListElement,
49+
'GOOSE_Publisher>>QB2_Disconnector>GOOSE2',
50+
'GOOSE_Publisher>>QB2_Disconnector>GOOSE2sDataSet>QB2_Disconnector/ CSWI 1.Pos stVal (ST)'
51+
);
52+
await element.requestUpdate();
53+
54+
const extRefListElement = <ExtRefLaterBindingList>(
55+
element.shadowRoot?.querySelector('extref-later-binding-list')
56+
);
57+
await extRefListElement.requestUpdate();
58+
59+
await expect(extRefListElement).shadowDom.to.equalSnapshot();
60+
});
61+
3462
it('when subscribing an available ExtRef then the lists are changed', async () => {
3563
const fcdaListElement = getFCDABindingList(element);
3664
const extRefListElement = getExtrefLaterBindingList(element);

test/integration/editors/SMVSubscriberLaterBinding.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
getSelectedSubItemValue,
1111
selectFCDAItem,
1212
} from './test-support.js';
13+
import { ExtRefLaterBindingList } from '../../../src/editors/subscription/later-binding/ext-ref-later-binding-list.js';
1314

1415
describe('SMV Subscribe Later Binding plugin', () => {
1516
customElements.define(
@@ -32,6 +33,33 @@ describe('SMV Subscribe Later Binding plugin', () => {
3233
await element.requestUpdate();
3334
});
3435

36+
it('when selecting an FCDA element with subscriptions it looks like the latest snapshot', async () => {
37+
doc = await fetch('/test/testfiles/editors/LaterBindingSMV-LSVS.scd')
38+
.then(response => response.text())
39+
.then(str => new DOMParser().parseFromString(str, 'application/xml'));
40+
41+
element = await fixture(
42+
html`<smv-subscribe-later-binding-plugin
43+
.doc="${doc}"
44+
></smv-subscribe-later-binding-plugin>`
45+
);
46+
47+
const fcdaListElement = getFCDABindingList(element);
48+
selectFCDAItem(
49+
fcdaListElement,
50+
'SMV_Publisher>>CurrentTransformer>currrentOnly',
51+
'SMV_Publisher>>CurrentTransformer>currrentOnlysDataSet>CurrentTransformer/L1 TCTR 1.AmpSv instMag.i (MX)'
52+
);
53+
await element.requestUpdate();
54+
55+
const extRefListElement = <ExtRefLaterBindingList>(
56+
element.shadowRoot?.querySelector('extref-later-binding-list')
57+
);
58+
await extRefListElement.requestUpdate();
59+
60+
await expect(extRefListElement).shadowDom.to.equalSnapshot();
61+
});
62+
3563
it('when subscribing an available ExtRef then the lists are changed', async () => {
3664
const fcdaListElement = getFCDABindingList(element);
3765
const extRefListElement = getExtrefLaterBindingList(element);

0 commit comments

Comments
 (0)