-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(line-editor.ts):unit_test_added * feat(line-editor):add_edit_wizard * feat(line-editor-wizard-editing.test):part-of-test * feat(line-editor_wizard_editing)_continue * feat(line.test,etc):editing_and_testing * feat(line.ts):createLineWizard_added * feat(zeroline-pane):create_Line_added * feat(line.test.ts):create_tests_added * feat(line-editor.ts):remove_line_and_test * feat(line-editor):add_add_button_and_test * feat(process-editor.ts):editor_added * fix(Process.scd):GeneralEquipment_added * fix(Process.scd):GeneralEquipment_added --------- Co-authored-by: Steffen van den Driest <35229971+Stef3st@users.noreply.github.com>
- Loading branch information
1 parent
fc6af77
commit 1ec77e1
Showing
8 changed files
with
409 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
import { | ||
css, | ||
customElement, | ||
html, | ||
LitElement, | ||
TemplateResult, | ||
property, | ||
state, | ||
} from 'lit-element'; | ||
|
||
import '@material/mwc-icon'; | ||
import '@material/mwc-icon-button'; | ||
import '@material/mwc-menu'; | ||
|
||
import './conducting-equipment-editor.js'; | ||
import './function-editor.js'; | ||
import './general-equipment-editor.js'; | ||
import './l-node-editor.js'; | ||
import './line-editor.js'; | ||
import './process-editor.js'; | ||
import './substation-editor.js'; | ||
import './process-editor.js'; | ||
|
||
import { styles } from './foundation.js'; | ||
import { getChildElementsByTagName } from '../../foundation.js'; | ||
|
||
@customElement('process-editor') | ||
export class ProcessEditor extends LitElement { | ||
/** The document being edited as provided to editor by [[`Zeroline`]]. */ | ||
@property({ attribute: false }) | ||
doc!: XMLDocument; | ||
/** SCL element Process */ | ||
@property({ attribute: false }) | ||
element!: Element; | ||
/** Whether `Function` and `LNode` are rendered */ | ||
@property({ type: Boolean }) | ||
showfunctions = false; | ||
|
||
@state() | ||
get header(): string { | ||
const name = this.element.getAttribute('name') ?? ''; | ||
const desc = this.element.getAttribute('desc'); | ||
|
||
return `${name} ${desc ? `—${desc}` : ''}`; | ||
} | ||
|
||
private renderConductingEquipments(): TemplateResult { | ||
const ConductingEquipments = getChildElementsByTagName( | ||
this.element, | ||
'ConductingEquipment' | ||
); | ||
return html` ${ConductingEquipments.map( | ||
ConductingEquipment => | ||
html`<conducting-equipment-editor | ||
.doc=${this.doc} | ||
.element=${ConductingEquipment} | ||
?showfunctions=${this.showfunctions} | ||
></conducting-equipment-editor>` | ||
)}`; | ||
} | ||
|
||
private renderGeneralEquipments(): TemplateResult { | ||
const GeneralEquipments = getChildElementsByTagName( | ||
this.element, | ||
'GeneralEquipment' | ||
); | ||
return html` ${GeneralEquipments.map( | ||
GeneralEquipment => | ||
html`<general-equipment-editor | ||
.doc=${this.doc} | ||
.element=${GeneralEquipment} | ||
?showfunctions=${this.showfunctions} | ||
></general-equipment-editor>` | ||
)}`; | ||
} | ||
|
||
private renderLines(): TemplateResult { | ||
const Lines = getChildElementsByTagName(this.element, 'Line'); | ||
return html` ${Lines.map( | ||
Line => | ||
html`<line-editor | ||
.doc=${this.doc} | ||
.element=${Line} | ||
?showfunctions=${this.showfunctions} | ||
></line-editor>` | ||
)}`; | ||
} | ||
|
||
private renderSubstations(): TemplateResult { | ||
const Substations = getChildElementsByTagName(this.element, 'Substation'); | ||
return html` ${Substations.map( | ||
Substation => | ||
html`<substation-editor | ||
.doc=${this.doc} | ||
.element=${Substation} | ||
?showfunctions=${this.showfunctions} | ||
></substation-editor>` | ||
)}`; | ||
} | ||
|
||
private renderProcesses(): TemplateResult { | ||
const Processes = getChildElementsByTagName(this.element, 'Process'); | ||
return html` ${Processes.map( | ||
Process => | ||
html`<process-editor | ||
.doc=${this.doc} | ||
.element=${Process} | ||
?showfunctions=${this.showfunctions} | ||
></process-editor>` | ||
)}`; | ||
} | ||
|
||
private renderFunctions(): TemplateResult { | ||
if (!this.showfunctions) return html``; | ||
|
||
const Functions = getChildElementsByTagName(this.element, 'Function'); | ||
return html` ${Functions.map( | ||
Function => | ||
html`<function-editor | ||
.doc=${this.doc} | ||
.element=${Function} | ||
?showfunctions=${this.showfunctions} | ||
></function-editor>` | ||
)}`; | ||
} | ||
|
||
private renderLNodes(): TemplateResult { | ||
if (!this.showfunctions) return html``; | ||
|
||
const lNodes = getChildElementsByTagName(this.element, 'LNode'); | ||
return lNodes.length | ||
? html`<div class="container lnode"> | ||
${lNodes.map( | ||
lNode => | ||
html`<l-node-editor | ||
.doc=${this.doc} | ||
.element=${lNode} | ||
></l-node-editor>` | ||
)} | ||
</div>` | ||
: html``; | ||
} | ||
|
||
render(): TemplateResult { | ||
return html`<action-pane label=${this.header}> | ||
${this.renderConductingEquipments()}${this.renderGeneralEquipments()}${this.renderFunctions()}${this.renderLNodes()} | ||
${this.renderLines()} ${this.renderSubstations()}${this.renderProcesses()} | ||
</action-pane>`; | ||
} | ||
static styles = css` | ||
${styles} | ||
:host(.moving) { | ||
opacity: 0.3; | ||
} | ||
abbr { | ||
text-decoration: none; | ||
border-bottom: none; | ||
} | ||
`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<SCL xmlns="http://www.iec.ch/61850/2003/SCL" version="2007" revision="B" release="4"> | ||
<Header id="general_equipment"/> | ||
<Process name="ProcessGenConduct"> | ||
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI" /> | ||
<GeneralEquipment name="genSub" desc="someDesc" type="AXN"/> | ||
<Function name="someFunction"> | ||
<SubFunction name="someSubFunc"/> | ||
</Function> | ||
<ConductingEquipment name="someCondEq" type="CBR"> | ||
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI" /> | ||
</ConductingEquipment> | ||
</Process> | ||
<Process name="ProcProcSubAA1"> | ||
<Substation name="AA1" desc=""> | ||
<GeneralEquipment name="genSub" desc="someDesc" type="AXN"/> | ||
<GeneralEquipment name="genSub2" desc="someDesc" type="AXN"/> | ||
<VoltageLevel name="E1" desc="" nomFreq="50" numPhases="3"> | ||
<GeneralEquipment name="genVolt1" type="BAT"> | ||
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI"/> | ||
<EqFunction name="Eq1"/> | ||
</GeneralEquipment> | ||
<Bay name="Q01" desc=""> | ||
<Function name="F1"> | ||
<SubFunction name="Sub1"> | ||
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI"/> | ||
<GeneralEquipment name="someGenCon1" desc="someDesc" type="MOT"/> | ||
</SubFunction> | ||
</Function> | ||
</Bay> | ||
</VoltageLevel> | ||
</Substation> | ||
<Process name="ProcessSubAA2"> | ||
<Substation name="AA2" desc=""> | ||
<GeneralEquipment name="genSub" desc="someDesc" type="AXN"/> | ||
<GeneralEquipment name="genSub2" desc="someDesc" type="AXN"/> | ||
<VoltageLevel name="E1" desc="" nomFreq="50" numPhases="3"> | ||
<GeneralEquipment name="genVolt1" type="BAT"> | ||
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI"/> | ||
<EqFunction name="Eq1"/> | ||
</GeneralEquipment> | ||
<Bay name="Q01" desc=""> | ||
<Function name="F1"> | ||
<SubFunction name="Sub1"> | ||
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI"/> | ||
<GeneralEquipment name="someGenCon1" desc="someDesc" type="MOT"/> | ||
</SubFunction> | ||
</Function> | ||
</Bay> | ||
</VoltageLevel> | ||
</Substation> | ||
</Process> | ||
</Process> | ||
<Process name="ProcessLine"> | ||
<Line name="Berlin" desc="" type="test" nomFreq="50" numPhases="3"> | ||
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI" /> | ||
<GeneralEquipment name="someGenEq" type="BAT"> | ||
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI" /> | ||
</GeneralEquipment> | ||
<Function name="someFunctionToMunich"> | ||
<SubFunction name="someSubFunc"> | ||
</SubFunction> | ||
</Function> | ||
<Voltage multiplier="k" unit="V">380.0</Voltage> | ||
<ConductingEquipment name="someCondEq" type="DIS"> | ||
<LNode iedName="None" lnClass="CSWI" lnInst="1" lnType="OpenSCD_CSWI" /> | ||
</ConductingEquipment> | ||
</Line> | ||
</Process> | ||
</SCL> |
59 changes: 59 additions & 0 deletions
59
test/unit/editors/substation/__snapshots__/process-editor.test.snap.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* @web/test-runner snapshot v1 */ | ||
export const snapshots = {}; | ||
|
||
snapshots["web component rendering Process element rendering LNode, GeneralEquipment,Function and ConductingEquipment children looks like the latest snapshot"] = | ||
`<action-pane | ||
label="ProcessGenConduct " | ||
tabindex="0" | ||
> | ||
<conducting-equipment-editor showfunctions=""> | ||
</conducting-equipment-editor> | ||
<general-equipment-editor showfunctions=""> | ||
</general-equipment-editor> | ||
<function-editor showfunctions=""> | ||
</function-editor> | ||
<div class="container lnode"> | ||
<l-node-editor> | ||
</l-node-editor> | ||
</div> | ||
</action-pane> | ||
`; | ||
/* end snapshot web component rendering Process element rendering LNode, GeneralEquipment,Function and ConductingEquipment children looks like the latest snapshot */ | ||
|
||
snapshots["web component rendering Process element hides LNode and Function children looks like the latest snapshot"] = | ||
`<action-pane | ||
label="ProcessGenConduct " | ||
tabindex="0" | ||
> | ||
<conducting-equipment-editor> | ||
</conducting-equipment-editor> | ||
<general-equipment-editor> | ||
</general-equipment-editor> | ||
</action-pane> | ||
`; | ||
/* end snapshot web component rendering Process element hides LNode and Function children looks like the latest snapshot */ | ||
|
||
snapshots["web component rendering Process element rendering Substation and Process children looks like the latest snapshot"] = | ||
`<action-pane | ||
label="ProcProcSubAA1 " | ||
tabindex="0" | ||
> | ||
<substation-editor showfunctions=""> | ||
</substation-editor> | ||
<process-editor showfunctions=""> | ||
</process-editor> | ||
</action-pane> | ||
`; | ||
/* end snapshot web component rendering Process element rendering Substation and Process children looks like the latest snapshot */ | ||
|
||
snapshots["web component rendering Process element rendering a Line child looks like the latest snapshot"] = | ||
`<action-pane | ||
label="ProcessLine " | ||
tabindex="0" | ||
> | ||
<line-editor showfunctions=""> | ||
</line-editor> | ||
</action-pane> | ||
`; | ||
/* end snapshot web component rendering Process element rendering a Line child looks like the latest snapshot */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.