Skip to content

Commit deb67eb

Browse files
author
Dennis Labordus
committed
Refactor CoMPAS Versions Tab, added help content.
Signed-off-by: Dennis Labordus <[email protected]>
1 parent 9230396 commit deb67eb

File tree

6 files changed

+49
-3
lines changed

6 files changed

+49
-3
lines changed

__snapshots__/compas-versions-plugin.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@
121121
slot="graphic"
122122
style="width: 90px"
123123
>
124+
<mwc-icon>
125+
restore
126+
</mwc-icon>
124127
</span>
125128
</mwc-list-item>
126129
</mwc-list>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
In the CoMPAS Editor the different versions of an SCL XML File are shown that are stored in CoMPAS.
2+
3+
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M13 3c-4.97 0-9 4.03-9 9H1l4 3.99L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.25 2.52.77-1.28-3.52-2.09V8z"/></svg>:
4+
Restore a specific version from CoMPAS. <br/>
5+
By pressing the icon and confirming the action that specific version will be loaded in OpenSCD.
6+
That version isn't saved yet in CoMPAS as the latest version. By saving it using the menu 'Save CoMPAS'
7+
the loaded version can be saved as the latest version.
8+
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"/></svg>:
9+
Remove a specific version from CoMPAS.<br/>
10+
By pressing the icon and confirming the action that specific version will be removed from CoMPAS.
11+
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M14.12 10.47L12 12.59l-2.13-2.12-1.41 1.41L10.59 14l-2.12 2.12 1.41 1.41L12 15.41l2.12 2.12 1.41-1.41L13.41 14l2.12-2.12zM15.5 4l-1-1h-5l-1 1H5v2h14V4zM6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM8 9h8v10H8V9z"/></svg>:
12+
Remove the SCL XML File completely from CoMPAS, all versions.<br/>
13+
By pressing the icon and confirming the action all versions will be removed from CoMPAS.

public/md/Home.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
This is an open repository of information on OpenSCD and IEC 61850-6. You are welcome to share your knowledge with the rest of the world at https://github.com/openscd/open-scd/wiki/Home/_edit 😄 . Welcome aboard!
22

3-
So far we have documented some essential [general OpenSCD editor features](https://github.com/openscd/open-scd/wiki/OpenSCD-Editor-Features) and features regarding the individual [sections of an SCL file](https://github.com/openscd/open-scd/wiki/SCL-Sections) .
3+
So far we have documented some essential [general OpenSCD editor features](https://github.com/openscd/open-scd/wiki/OpenSCD-Editor-Features) and features regarding the individual [sections of an SCL file](https://github.com/openscd/open-scd/wiki/SCL-Sections).
4+
And for CoMPAS there is also some documentation about the [CoMPAS Version Editor](https://github.com/openscd/open-scd/wiki/CoMPAS-Versions-Editor).

public/md/_Sidebar.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@
2121
### DataTypeTemplates
2222

2323
- [DataTypeTemplate editor](https://github.com/openscd/open-scd/wiki/DataTypeTemplate-editor)
24+
25+
## CoMPASS
26+
27+
- [CoMPAS Versions Editor](https://github.com/openscd/open-scd/wiki/CoMPAS-Versions-Editor)

src/compas-editors/CompasVersions.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ export default class CompasVersionsPlugin extends LitElement {
8989
if (items.length - 1 === index) {
9090
return html`<mwc-list-item tabindex="0" graphic="control">
9191
${name} (${version})
92-
<span slot="graphic" style="width: 90px"></span>
92+
<span slot="graphic" style="width: 90px">
93+
<mwc-icon @click=${() => {
94+
this.confirmRestoreCompas(version);
95+
}}>restore</mwc-icon>
96+
</span>
9397
</mwc-list-item>`
9498
}
9599
return html`<mwc-list-item tabindex="0"

test/integration/compas-editors/CompasVersions.test.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,28 @@ describe('compas-versions-plugin', () => {
118118

119119
it('has 3 item entries', () => {
120120
expect(element.shadowRoot!.querySelectorAll('mwc-list > mwc-list-item'))
121-
.to.have.length(3)
121+
.to.have.length(3);
122+
});
123+
124+
it('first entry has correct buttons', () => {
125+
expect(element.shadowRoot!.querySelectorAll('mwc-list > mwc-list-item').length)
126+
.to.be.greaterThan(1);
127+
// Retrieve the first item after checking that there are items.
128+
const item = element.shadowRoot!.querySelectorAll('mwc-list > mwc-list-item')[0];
129+
// There should be 2 buttons, first the restore, second the delete.
130+
expect(item.querySelectorAll('span > mwc-icon')).to.have.length(2);
131+
expect(item.querySelectorAll('span > mwc-icon')[0].textContent).to.be.equal('restore');
132+
expect(item.querySelectorAll('span > mwc-icon')[1].textContent).to.be.equal('delete');
133+
});
134+
135+
it('last entry has one buttons', () => {
136+
expect(element.shadowRoot!.querySelectorAll('mwc-list > mwc-list-item'))
137+
.to.have.length(3);
138+
// Retrieve the last item after checking that there are 3 items.
139+
const item = element.shadowRoot!.querySelectorAll('mwc-list > mwc-list-item')[2];
140+
// There should be 1 buttons, the restore button.
141+
expect(item.querySelectorAll('span > mwc-icon')).to.have.length(1);
142+
expect(item.querySelectorAll('span > mwc-icon')[0].textContent).to.be.equal('restore');
122143
});
123144

124145
it('looks like the latest snapshot', async () => {

0 commit comments

Comments
 (0)