Skip to content

Commit

Permalink
refactor: on review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobVogelsang committed May 30, 2022
1 parent 463a871 commit 008955d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/editors/substation/l-node-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class LNodeEditor extends LitElement {
return this.element.getAttribute('iedName') === 'None' ?? false;
}
@state()
private get isIedRef(): boolean {
private get isIEDReference(): boolean {
return this.element.getAttribute('iedName') !== 'None';
}

Expand Down Expand Up @@ -138,7 +138,7 @@ export class LNodeEditor extends LitElement {
icon="delete"
@click="${() => this.remove()}}"
></mwc-fab
>${this.isIedRef
>${this.isIEDReference
? html``
: html`<mwc-fab
slot="action"
Expand Down
10 changes: 8 additions & 2 deletions src/foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2758,13 +2758,19 @@ export function getChildElementsByTagName(
);
}

/** maxumum allow number for `lnInst` attribute */
/** maximum value for `lnInst` attribute */
const maxLnInst = 99;
const lnInstRange = Array(maxLnInst)
.fill(1)
.map((_, i) => `${i + 1}`);

/** generator function returning unique `lnInst` for a `lnClass` `LNode` element */
/**
* @param parent - The LNodes' parent element to be scanned once for `lnInst`
* values already in use. Be sure to create a new generator every time the
* children of this element change.
* @returns a function generating increasing unused `lnInst` values for
* `lnClass` LNodes within `parent` on subsequent invocations
*/
export function newLnInstGenerator(
parent: Element
): (lnClass: string) => string | undefined {
Expand Down

0 comments on commit 008955d

Please sign in to comment.