Skip to content

Commit 387ce50

Browse files
author
Rob Tjalma
authored
Merge pull request #30 from com-pas/compas-settings-plugin
Refactored Compas Settings to plugin.
2 parents cd0dff3 + 5b3a43f commit 387ce50

20 files changed

+458
-271
lines changed

__snapshots__/compas-scltype-list.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# `compas-scltype-list`
22

3-
#### `looks like the latest snapshot`
3+
## `show-loading`
4+
5+
#### `looks like the latest snapshot`
46

57
```html
68
<mwc-list>
@@ -15,3 +17,62 @@
1517

1618
```
1719

20+
## `no-items-in-list`
21+
22+
#### `looks like the latest snapshot`
23+
24+
```html
25+
<mwc-list>
26+
<mwc-list-item
27+
aria-disabled="false"
28+
mwc-list-item=""
29+
tabindex="0"
30+
>
31+
[compas.open.noSclTypes]
32+
</mwc-list-item>
33+
</mwc-list>
34+
35+
```
36+
37+
## `after-list-loaded`
38+
39+
#### `looks like the latest snapshot`
40+
41+
```html
42+
<mwc-list>
43+
<mwc-list-item
44+
aria-disabled="false"
45+
mwc-list-item=""
46+
tabindex="0"
47+
>
48+
<span>
49+
<description>
50+
System Exchange Description
51+
</description>
52+
(
53+
<code>
54+
SED
55+
</code>
56+
)
57+
</span>
58+
</mwc-list-item>
59+
<mwc-list-item
60+
aria-disabled="false"
61+
mwc-list-item=""
62+
tabindex="-1"
63+
>
64+
<span>
65+
<description>
66+
Substation Specification Description
67+
</description>
68+
(
69+
<code>
70+
SSD
71+
</code>
72+
)
73+
</span>
74+
</mwc-list-item>
75+
</mwc-list>
76+
77+
```
78+

__snapshots__/compas-settings.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# `compas-settings`
2+
3+
#### `looks like the latest snapshot`
4+
5+
```html
6+
<mwc-textfield
7+
dialoginitialfocus=""
8+
id="sclDataServiceUrl"
9+
label="[compas.settings.sclDataServiceUrl]"
10+
required=""
11+
value="http://localhost:9090/compas-scl-data-service"
12+
>
13+
</mwc-textfield>
14+
<mwc-button style="--mdc-theme-primary: var(--mdc-theme-error)">
15+
[reset]
16+
</mwc-button>
17+
18+
```
19+

__snapshots__/open-scd.md

Lines changed: 19 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@
314314
</mwc-list-item>
315315
<mwc-list-item
316316
aria-disabled="false"
317-
class="static"
317+
class="middle"
318318
graphic="icon"
319319
iconid="settings"
320320
mwc-list-item=""
@@ -326,6 +326,8 @@
326326
<span>
327327
CoMPAS Settings
328328
</span>
329+
<mwc-linear-progress indeterminate="">
330+
</mwc-linear-progress>
329331
</mwc-list-item>
330332
<mwc-list-item
331333
aria-disabled="false"
@@ -862,6 +864,22 @@
862864
role="separator"
863865
>
864866
</li>
867+
<mwc-check-list-item
868+
aria-disabled="false"
869+
class="official"
870+
graphic="control"
871+
hasmeta=""
872+
left=""
873+
mwc-list-item=""
874+
selected=""
875+
tabindex="-1"
876+
value="/src/menu/CompasSettings.js"
877+
>
878+
<mwc-icon slot="meta">
879+
settings
880+
</mwc-icon>
881+
CoMPAS Settings
882+
</mwc-check-list-item>
865883
<mwc-check-list-item
866884
aria-disabled="false"
867885
class="official"
@@ -1041,43 +1059,6 @@
10411059
</mwc-circular-progress-four-color>
10421060
<wizard-dialog>
10431061
</wizard-dialog>
1044-
<mwc-dialog
1045-
class="styled"
1046-
heading="CoMPAS Settings"
1047-
id="compasSettings"
1048-
>
1049-
<form>
1050-
<mwc-textfield
1051-
dialoginitialfocus=""
1052-
id="sclDataServiceUrl"
1053-
label="CoMPAS SCL Data Service"
1054-
required=""
1055-
value="http://localhost:9090/compas-scl-data-service"
1056-
>
1057-
</mwc-textfield>
1058-
</form>
1059-
<mwc-button
1060-
dialogaction="close"
1061-
slot="secondaryAction"
1062-
>
1063-
Cancel
1064-
</mwc-button>
1065-
<mwc-button
1066-
dialogaction="reset"
1067-
slot="secondaryAction"
1068-
style="--mdc-theme-primary: var(--mdc-theme-error)"
1069-
>
1070-
Reset
1071-
</mwc-button>
1072-
<mwc-button
1073-
dialogaction="save"
1074-
icon="save"
1075-
slot="primaryAction"
1076-
trailingicon=""
1077-
>
1078-
Save
1079-
</mwc-button>
1080-
</mwc-dialog>
10811062
<mwc-dialog
10821063
heading="Settings"
10831064
id="settings"

public/js/plugins.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,15 @@ export const officialPlugins = [
131131
requireDoc: true,
132132
position: 'middle'
133133
},
134+
{
135+
name: 'CoMPAS Settings',
136+
src: '/src/menu/CompasSettings.js',
137+
icon: 'settings',
138+
default: true,
139+
kind: 'menu',
140+
requireDoc: false,
141+
position: 'bottom'
142+
},
134143
{
135144
name: 'Help',
136145
src: '/src/menu/Help.js',

src/Hosting.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { Mixin, newPendingStateEvent, ValidateEvent } from './foundation.js';
88
import { LoggingElement } from './Logging.js';
99
import { Plugin, PluggingElement, pluginIcons } from './Plugging.js';
1010
import { SettingElement } from './Setting.js';
11-
import {CompasSettingElement} from "./compas/CompasSetting.js";
1211

1312
interface MenuItem {
1413
icon: string;
@@ -35,8 +34,7 @@ export type HostingElement = Mixin<typeof Hosting>;
3534
export function Hosting<
3635
TBase extends new (...args: any[]) => PluggingElement &
3736
LoggingElement &
38-
SettingElement &
39-
CompasSettingElement
37+
SettingElement
4038
>(Base: TBase) {
4139
class HostingElement extends Base {
4240
/** The currently active editor tab. */
@@ -177,12 +175,6 @@ export function Hosting<
177175
action: (): void => this.settingsUI.show(),
178176
kind: 'static',
179177
},
180-
{
181-
icon: 'settings',
182-
name: 'compas.settings.name',
183-
action: (): void => this.compasSettingsUI.show(),
184-
kind: 'static',
185-
},
186178
...bottomMenu,
187179
{
188180
icon: 'extension',

src/compas/CompasSclDataService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {ChangeSet} from "./CompasChangeSet.js";
2-
import {CompasSetting} from "./CompasSetting.js";
2+
import {CompasSettings} from "./CompasSettingsElement.js";
33

44
export const SDS_NAMESPACE = 'https://www.lfenergy.org/compas/SclDataService';
55

@@ -16,7 +16,7 @@ export interface UpdateRequestBody {
1616
export function CompasSclDataService() {
1717

1818
function getCompasSettings() {
19-
return CompasSetting().compasSettings;
19+
return CompasSettings().compasSettings;
2020
}
2121

2222
return {

src/compas/CompasScltypeList.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ export class CompasScltypeList extends LitElement {
1111
sclTypes!: Element[];
1212

1313
firstUpdated() {
14+
this.fetchData();
15+
}
16+
17+
fetchData() {
1418
CompasSclDataService().listSclTypesAndOrder()
1519
.then(types => this.sclTypes = types)
1620
}

src/compas/CompasSetting.ts

Lines changed: 0 additions & 109 deletions
This file was deleted.

0 commit comments

Comments
 (0)