Skip to content

Commit f905221

Browse files
author
Rob Tjalma
authored
Merge pull request #112 from com-pas/merge_upstream_v090
Merge Upstream Version v0.9.0
2 parents 5d219e0 + ffaf62d commit f905221

File tree

91 files changed

+7539
-627
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+7539
-627
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [0.9.0](https://github.com/openscd/open-scd/compare/v0.8.2...v0.9.0) (2022-02-04)
6+
7+
8+
### Features
9+
10+
* **settings:** load nsdoc to local storage ([#502](https://github.com/openscd/open-scd/issues/502)) ([659aa8e](https://github.com/openscd/open-scd/commits/659aa8ef3459ab8f513df2cf7971a02753a3a21b)), closes [#516](https://github.com/openscd/open-scd/issues/516)
11+
* **wizards/reportcontrol:** added new IED wizard to update name/description ([#494](https://github.com/openscd/open-scd/issues/494)) ([110c83d](https://github.com/openscd/open-scd/commits/110c83d658f9c2a0f0c273249aefbee0f50fcfc1))
12+
* **wizards/reportcontrol:** allow basic ReportControl manipulation capability ([#505](https://github.com/openscd/open-scd/issues/505)) ([943b8dc](https://github.com/openscd/open-scd/commits/943b8dc2b82e6039bd6de99aabbfd10e31527256)), closes [#438](https://github.com/openscd/open-scd/issues/438) [#492](https://github.com/openscd/open-scd/issues/492) [#493](https://github.com/openscd/open-scd/issues/493) [#499](https://github.com/openscd/open-scd/issues/499)
13+
* **wizards/sampledvaluecontrol:** add edit wizards accessable from selection ([#510](https://github.com/openscd/open-scd/issues/510)) ([fa468b7](https://github.com/openscd/open-scd/commits/fa468b714b714623031fdd754a0056a9cd793214))
14+
* **wizards/smv:** add edit wizard and allow access from sampledvaluecontrol wizard ([#519](https://github.com/openscd/open-scd/issues/519)) ([aff0367](https://github.com/openscd/open-scd/commits/aff036776eba7434d619de20a67f8f07b3b3c5c7))
15+
16+
17+
### Bug Fixes
18+
19+
* **editors/SingleLineDiagram:** added check if a substation is available/selected before drawing ([4eabdb3](https://github.com/openscd/open-scd/commits/4eabdb3ac9fdc2f2db2ebb2058bd8675592e12d6))
20+
* **editors:** In IED and SLD Editors fixed preserving the selection (IED or Substation) ([#501](https://github.com/openscd/open-scd/issues/501)) ([b10df43](https://github.com/openscd/open-scd/commits/b10df4364e4c5b8c1f4cb14766f1e50c1d6af567))
21+
* **menu/Help:** incorrect import of markup parser ([#531](https://github.com/openscd/open-scd/issues/531)) ([b6f7ea1](https://github.com/openscd/open-scd/commits/b6f7ea1024a30d7ed0f1f3af5bf42536f0f82fb5))
22+
* **wizards/fcda:** make sure lnInst is non empty string ([#512](https://github.com/openscd/open-scd/issues/512)) ([f8d2dc7](https://github.com/openscd/open-scd/commits/f8d2dc75a804b06c2e4f1178d0f9768b967ea806))
23+
524
### [0.8.2](https://github.com/openscd/open-scd/compare/v0.8.1...v0.8.2) (2022-01-15)
625

726

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@
4040
"purpose": "maskable"
4141
}
4242
],
43-
"version": "0.8.2"
43+
"version": "0.9.0"
4444
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "open-scd",
3-
"version": "0.8.2",
3+
"version": "0.9.0",
44
"repository": "https://github.com/openscd/open-scd.git",
55
"description": "A bottom-up substation configuration designer for projects described using SCL `IEC 61850-6` Edition 2 or greater.",
66
"keywords": [

src/Plugging.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { TextField } from '@material/mwc-textfield';
2626
import { ifImplemented, LitElementConstructor, Mixin } from './foundation.js';
2727
import { EditingElement } from './Editing.js';
2828
import { officialPlugins } from '../public/js/plugins.js';
29+
import { initializeNsdoc } from './foundation/nsdoc.js';
2930

3031
type PluginKind = 'editor' | 'menu' | 'validator';
3132
const menuPosition = ['top', 'middle', 'bottom'] as const;
@@ -208,6 +209,7 @@ export function Plugging<TBase extends new (...args: any[]) => EditingElement>(
208209
.docName=${this.docName}
209210
.docId=${this.docId}
210211
.pluginId=${plugin.src}
212+
.nsdoc=${await initializeNsdoc()}
211213
></${loadedPlugins.get(plugin.src)}>`;
212214
},
213215
};

src/Setting.ts

Lines changed: 113 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,42 @@
11
import { html, property, query, TemplateResult } from 'lit-element';
2-
import { registerTranslateConfig, translate, use } from 'lit-translate';
2+
import { get, registerTranslateConfig, translate, use } from 'lit-translate';
33

44
import '@material/mwc-button';
55
import '@material/mwc-dialog';
66
import '@material/mwc-formfield';
77
import '@material/mwc-list/mwc-list-item';
88
import '@material/mwc-select';
99
import '@material/mwc-switch';
10+
1011
import { Dialog } from '@material/mwc-dialog';
1112
import { Select } from '@material/mwc-select';
1213
import { Switch } from '@material/mwc-switch';
1314

14-
import { ifImplemented, LitElementConstructor, Mixin } from './foundation.js';
15+
import { ifImplemented, LitElementConstructor, Mixin, newLogEvent } from './foundation.js';
1516
import { Language, languages, loader } from './translations/loader.js';
17+
18+
import './WizardDivider.js';
1619
import { WizardDialog } from './wizard-dialog.js';
1720

1821
export type Settings = {
1922
language: Language;
2023
theme: 'light' | 'dark';
2124
mode: 'safe' | 'pro';
2225
showieds: 'on' | 'off';
26+
'IEC 61850-7-2': string | undefined;
27+
'IEC 61850-7-3': string | undefined;
28+
'IEC 61850-7-4': string | undefined;
29+
'IEC 61850-8-1': string | undefined;
2330
};
2431
export const defaults: Settings = {
2532
language: 'en',
2633
theme: 'light',
2734
mode: 'safe',
2835
showieds: 'off',
36+
'IEC 61850-7-2': undefined,
37+
'IEC 61850-7-3': undefined,
38+
'IEC 61850-7-4': undefined,
39+
'IEC 61850-8-1': undefined
2940
};
3041

3142
/** Mixin that saves [[`Settings`]] to `localStorage`, reflecting them in the
@@ -42,6 +53,10 @@ export function Setting<TBase extends LitElementConstructor>(Base: TBase) {
4253
theme: this.getSetting('theme'),
4354
mode: this.getSetting('mode'),
4455
showieds: this.getSetting('showieds'),
56+
'IEC 61850-7-2': this.getSetting('IEC 61850-7-2'),
57+
'IEC 61850-7-3': this.getSetting('IEC 61850-7-3'),
58+
'IEC 61850-7-4': this.getSetting('IEC 61850-7-4'),
59+
'IEC 61850-8-1': this.getSetting('IEC 61850-8-1')
4560
};
4661
}
4762

@@ -56,11 +71,15 @@ export function Setting<TBase extends LitElementConstructor>(Base: TBase) {
5671
@query('#showieds')
5772
showiedsUI!: Switch;
5873

74+
@query('#nsdoc-file')
75+
private nsdocFileUI!: HTMLInputElement;
76+
5977
private getSetting<T extends keyof Settings>(setting: T): Settings[T] {
6078
return (
6179
<Settings[T] | null>localStorage.getItem(setting) ?? defaults[setting]
6280
);
6381
}
82+
6483
/** Update the `value` of `setting`, storing to `localStorage`. */
6584
setSetting<T extends keyof Settings>(setting: T, value: Settings[T]): void {
6685
localStorage.setItem(setting, <string>(<unknown>value));
@@ -70,6 +89,15 @@ export function Setting<TBase extends LitElementConstructor>(Base: TBase) {
7089
this.requestUpdate();
7190
}
7291

92+
/** Remove the `setting` in `localStorage`. */
93+
removeSetting<T extends keyof Settings>(setting: T): void {
94+
localStorage.removeItem(setting);
95+
this.shadowRoot
96+
?.querySelector<WizardDialog>('wizard-dialog')
97+
?.requestUpdate();
98+
this.requestUpdate();
99+
}
100+
73101
private onClosing(ae: CustomEvent<{ action: string } | null>): void {
74102
if (ae.detail?.action === 'reset') {
75103
Object.keys(this.settings).forEach(item =>
@@ -90,6 +118,78 @@ export function Setting<TBase extends LitElementConstructor>(Base: TBase) {
90118
if (changedProperties.has('settings')) use(this.settings.language);
91119
}
92120

121+
private renderFileSelect(): TemplateResult {
122+
return html `
123+
<input id="nsdoc-file" accept=".nsdoc" type="file" hidden required multiple
124+
@change=${(evt: Event) => this.loadNsdocFile(evt)}}>
125+
<mwc-button label="${translate('settings.selectFileButton')}"
126+
id="selectFileButton"
127+
@click=${() => {
128+
const input = <HTMLInputElement | null>this.shadowRoot!.querySelector("#nsdoc-file");
129+
input?.click();
130+
}}>
131+
</mwc-button>
132+
`;
133+
}
134+
135+
private async loadNsdocFile(evt: Event): Promise<void> {
136+
const files = Array.from(
137+
(<HTMLInputElement | null>evt.target)?.files ?? []
138+
);
139+
140+
if (files.length == 0) return;
141+
files.forEach(async file => {
142+
const text = await file.text();
143+
const id = this.parseToXmlObject(text).querySelector('NSDoc')?.getAttribute('id');
144+
if (!id) {
145+
document
146+
.querySelector('open-scd')!
147+
.dispatchEvent(
148+
newLogEvent({ kind: 'error', title: get('settings.invalidFileNoIdFound') })
149+
);
150+
return;
151+
}
152+
153+
this.setSetting(id as keyof Settings, text);
154+
})
155+
156+
this.nsdocFileUI.value = '';
157+
this.requestUpdate();
158+
}
159+
160+
/**
161+
* Render one .nsdoc item in the Settings wizard
162+
* @param key - The key of the nsdoc file in the settings.
163+
* @returns a .nsdoc item for the Settings wizard
164+
*/
165+
private renderNsdocItem<T extends keyof Settings>(key: T): TemplateResult {
166+
const nsdSetting = this.settings[key];
167+
let nsdVersion: string | undefined | null;
168+
let nsdRevision: string | undefined | null;
169+
let nsdRelease: string | undefined | null;
170+
171+
if (nsdSetting) {
172+
const nsdoc = this.parseToXmlObject(nsdSetting)!.querySelector('NSDoc');
173+
nsdVersion = nsdoc?.getAttribute('version');
174+
nsdRevision = nsdoc?.getAttribute('revision');
175+
nsdRelease = nsdoc?.getAttribute('release');
176+
}
177+
178+
return html`<mwc-list-item id=${key} graphic="avatar" hasMeta twoline .disabled=${!nsdSetting}>
179+
<span>${key}</span>
180+
${nsdSetting ? html`<span slot="secondary">${nsdVersion}${nsdRevision}${nsdRelease}</span>` :
181+
html``}
182+
${nsdSetting ? html`<mwc-icon slot="graphic" style="color:green;">done</mwc-icon>` :
183+
html`<mwc-icon slot="graphic" style="color:red;">close</mwc-icon>`}
184+
${nsdSetting ? html`<mwc-icon id="deleteNsdocItem" slot="meta" @click=${() => {this.removeSetting(key)}}>delete</mwc-icon>` :
185+
html``}
186+
</mwc-list-item>`;
187+
}
188+
189+
private parseToXmlObject(text: string): XMLDocument {
190+
return new DOMParser().parseFromString(text, 'application/xml');
191+
}
192+
93193
constructor(...params: any[]) {
94194
super(...params);
95195

@@ -140,6 +240,17 @@ export function Setting<TBase extends LitElementConstructor>(Base: TBase) {
140240
></mwc-switch>
141241
</mwc-formfield>
142242
</form>
243+
<wizard-divider></wizard-divider>
244+
<section>
245+
<h3>${translate('settings.loadNsdTranslations')}</h3>
246+
${this.renderFileSelect()}
247+
</section>
248+
<mwc-list id="nsdocList">
249+
${this.renderNsdocItem('IEC 61850-7-2')}
250+
${this.renderNsdocItem('IEC 61850-7-3')}
251+
${this.renderNsdocItem('IEC 61850-7-4')}
252+
${this.renderNsdocItem('IEC 61850-8-1')}
253+
</mwc-list>
143254
<mwc-button slot="secondaryAction" dialogAction="close">
144255
${translate('cancel')}
145256
</mwc-button>

src/WizardDivider.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import {css, customElement, html, LitElement, TemplateResult} from "lit-element";
2+
3+
@customElement('wizard-divider')
4+
export class WizardDividerElement extends LitElement {
5+
render(): TemplateResult {
6+
return html `
7+
<div role="separator"></div>
8+
`
9+
}
10+
11+
static styles = css`
12+
div {
13+
height: 0px;
14+
margin: 10px 0px 10px 0px;
15+
border-top: none;
16+
border-right: none;
17+
border-left: none;
18+
border-image: initial;
19+
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
20+
}
21+
`
22+
}

src/action-pane.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export class ActionPane extends LitElement {
152152
color: var(--mdc-theme-on-surface);
153153
font-family: 'Roboto', sans-serif;
154154
font-weight: 300;
155-
overflow: visible;
155+
overflow: clip visible;
156156
white-space: nowrap;
157157
text-overflow: ellipsis;
158158
margin: 0px;

0 commit comments

Comments
 (0)