Skip to content

Commit 58c814b

Browse files
Merge pull request #276 from com-pas/sync
Sync from OpenSCD
2 parents b713839 + d7fe04c commit 58c814b

Some content is hidden

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

54 files changed

+783
-301
lines changed

.github/workflows/stale-issues.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This workflow labels stale issues.
2+
#
3+
# For more information, see:
4+
# https://github.com/actions/stale
5+
name: Mark stale issues
6+
7+
on:
8+
workflow_dispatch:
9+
schedule:
10+
- cron: '0 19 * * *'
11+
12+
jobs:
13+
stale:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
issues: write
17+
18+
steps:
19+
- uses: actions/stale@v5
20+
with:
21+
repo-token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
days-before-stale: 60
24+
days-before-close: -1
25+
days-before-pr-stale: -1
26+
days-before-pr-close: -1
27+
28+
stale-issue-label: 'stale'
29+
stale-issue-message: |
30+
Hello there,
31+
32+
Thank you for opening this issue! We appreciate your interest in our project.
33+
However, it seems that this issue hasn't had any activity for a while. To ensure that our issue tracker remains organized and efficient, we occasionally review and address stale issues.
34+
35+
If you believe this issue is still relevant and requires attention, please provide any additional context, updates, or details that might help us understand the problem better.
36+
Feel free to continue the conversation here.
37+
38+
If the issue is no longer relevant, you can simply close it. If you're uncertain, you can always reopen it later.
39+
40+
Remember, our project thrives on community contributions, and your input matters. We're here to collaborate and improve.
41+
Thank you for being part of this journey!
42+
43+
44+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# 1. Record architecture decisions
2+
3+
Date: 2023-07
4+
5+
## Status
6+
7+
Accepted
8+
9+
## Context
10+
11+
We need to record the architectural decisions made on this project.
12+
13+
## Decision
14+
15+
We will follow the decisions recorded in the central organizational
16+
repository ([.github](https://github.com/openscd/.github)),
17+
and record new repo-specific decisions in this repository.
18+
19+
20+
We write ADRs in the `docs/decisions` folder instead of a standard `doc/adr`:
21+
- `docs` instead of `doc` because `doc` is used for the generated documentation.
22+
- `decisions` instead of `adrs` because it is more explicit and a followed practice:
23+
[↗ Markdown Any Decision Records - Applying MADR to your project ](https://adr.github.io/madr/#applying-madr-to-your-project)
24+
25+
## Consequences
26+
27+
- It will be harder to track which decisions have to be taken into consideration
28+
- Local decisions will be easier to find

src/Hosting.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import { Drawer } from '@material/mwc-drawer';
1515
import { ActionDetail, List } from '@material/mwc-list';
1616
import { ListItem } from '@material/mwc-list/mwc-list-item';
1717

18-
import { Mixin, newPendingStateEvent, UserInfoEvent } from './foundation.js';
18+
import { Mixin, newPendingStateEvent } from './foundation.js';
19+
import { UserInfoEvent } from './compas/foundation.js';
1920
import { LoggingElement } from './Logging.js';
2021
import { PluggingElement, Plugin, pluginIcons } from './Plugging.js';
2122
import { SettingElement } from './Setting.js';

src/compas/CompasUserInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { newUserInfoEvent } from '../foundation.js';
1+
import { newUserInfoEvent } from './foundation.js';
22

33
import { CompasUserInfoService } from '../compas-services/CompasUserInfoService.js';
44
import { createLogEvent } from '../compas-services/foundation.js';

src/compas/foundation.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,25 @@ export function compareVersions(
106106
}
107107
return result;
108108
}
109+
110+
/** Represents user information from a backend. */
111+
export interface UserInfoDetail {
112+
name: string;
113+
}
114+
export type UserInfoEvent = CustomEvent<UserInfoDetail>;
115+
export function newUserInfoEvent(
116+
name: string,
117+
eventInitDict?: CustomEventInit<Partial<UserInfoDetail>>
118+
): UserInfoEvent {
119+
return new CustomEvent<UserInfoDetail>('userinfo', {
120+
bubbles: true,
121+
composed: true,
122+
...eventInitDict,
123+
detail: { name, ...eventInitDict?.detail },
124+
});
125+
}
126+
declare global {
127+
interface ElementEventMap {
128+
['userinfo']: UserInfoEvent;
129+
}
130+
}

src/editors/IED.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ export default class IedPlugin extends LitElement {
9696
super.updated(_changedProperties);
9797

9898
// When the document is updated, we reset the selected IED.
99-
if (_changedProperties.has('doc') || _changedProperties.has('nsdoc')) {
99+
if (
100+
_changedProperties.has('doc') ||
101+
_changedProperties.has('editCount') ||
102+
_changedProperties.has('nsdoc')
103+
) {
100104
this.selectedIEDs = [];
101105
this.selectedLNClasses = [];
102106

src/editors/communication/subnetwork-editor.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@ export class SubNetworkEditor extends LitElement {
142142
private subNetworkSpecs(): string {
143143
if (!this.type && !this.bitrate) return '';
144144

145-
return `(${this.type}${
146-
this.type && this.bitrate ? ` — ${this.bitrate}` : ``
147-
})`;
145+
return `(${[this.type, this.bitrate].filter(text => !!text).join(' — ')})`;
148146
}
149147

150148
private header(): string {

src/editors/protocol104/wizards/selectDo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
getNameAttribute,
1414
identity,
1515
newSubWizardEvent,
16-
selector,
16+
find,
1717
Wizard,
1818
WizardActor,
1919
WizardInputElement,
@@ -158,7 +158,7 @@ function checkAndGetLastElementFromPath(
158158
const [tagName, id] = path.pop()!.split(': ');
159159
if (!expectedTag.includes(tagName)) return null;
160160

161-
return doc.querySelector(selector(tagName, id));
161+
return find(doc, tagName, id);
162162
}
163163

164164
/**

src/editors/publisher/data-set-editor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import './data-set-element-editor.js';
1919
import '../../filtered-list.js';
2020
import { FilteredList } from '../../filtered-list.js';
2121

22-
import { compareNames, identity, selector } from '../../foundation.js';
22+
import { compareNames, identity, find } from '../../foundation.js';
2323
import { styles, updateElementReference } from './foundation.js';
2424

2525
@customElement('data-set-editor')
@@ -50,7 +50,7 @@ export class DataSetEditor extends LitElement {
5050

5151
private selectDataSet(evt: Event): void {
5252
const id = ((evt.target as FilteredList).selected as ListItem).value;
53-
const dataSet = this.doc.querySelector(selector('DataSet', id));
53+
const dataSet = find(this.doc, 'DataSet', id);
5454

5555
if (dataSet) {
5656
this.selectedDataSet = dataSet;

src/editors/publisher/foundation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { css } from 'lit-element';
22

3-
import { identity, selector } from '../../foundation.js';
3+
import { identity, find } from '../../foundation.js';
44

55
export function updateElementReference(
66
newDoc: XMLDocument,
@@ -9,7 +9,7 @@ export function updateElementReference(
99
if (!oldElement || !oldElement.closest('SCL')) return null;
1010

1111
const id = identity(oldElement);
12-
const newElement = newDoc.querySelector(selector(oldElement.tagName, id));
12+
const newElement = find(newDoc, oldElement.tagName, id);
1313

1414
return newElement;
1515
}

0 commit comments

Comments
 (0)