diff --git a/src/translations/de.ts b/src/translations/de.ts index 3d4a5c596b..6de352ea8e 100644 --- a/src/translations/de.ts +++ b/src/translations/de.ts @@ -34,6 +34,8 @@ export const de: Translations = { securityEnabled: 'Aktive Sicherungsmaßnahmen', DataSet: 'Datensetz', Communication: 'Kommunikation', + TrgOps: 'Triggerbedingungen', + OptFields: 'Optionale felder', }, settings: { title: 'Einstellungen', diff --git a/src/translations/en.ts b/src/translations/en.ts index 0f2698340d..03b21e020f 100644 --- a/src/translations/en.ts +++ b/src/translations/en.ts @@ -32,6 +32,8 @@ export const en = { securityEnabled: 'Security enabled', DataSet: 'Dataset', Communication: 'Communication', + TrgOps: 'Trigger options', + OptFields: 'Optional fields', }, settings: { title: 'Settings', diff --git a/src/wizards/dataset.ts b/src/wizards/dataset.ts index 7bf27bc6b1..ecb24430a6 100644 --- a/src/wizards/dataset.ts +++ b/src/wizards/dataset.ts @@ -11,7 +11,7 @@ import { cloneElement, getValue, identity, - newWizardEvent, + newSubWizardEvent, selector, Update, Wizard, @@ -19,7 +19,7 @@ import { WizardActor, WizardInput, } from '../foundation.js'; -import { wizards } from './wizard-library.js'; +import { createFCDAsWizard } from './fcda.js'; function updateDataSetAction(element: Element): WizardActor { return (inputs: WizardInput[], wizard: Element): WizardAction[] => { @@ -95,6 +95,7 @@ export function editDataSetWizard(element: Element): Wizard { .maybeValue=${name} helper="${translate('scl.name')}" required + disabled="true" > `, html` `, - html` { - const wizard = wizards['FCDA'].create(element); - if (wizard) { - e.target?.dispatchEvent(newWizardEvent(wizard)); - e.target?.dispatchEvent(newWizardEvent()); - } - }} - >`, html`${Array.from(element.querySelectorAll('FCDA')).map( fcda => @@ -124,6 +114,15 @@ export function editDataSetWizard(element: Element): Wizard { >` )}`, + html``, ], }, ]; diff --git a/src/wizards/fcda.ts b/src/wizards/fcda.ts index c9aace2906..c71ed473f1 100644 --- a/src/wizards/fcda.ts +++ b/src/wizards/fcda.ts @@ -114,9 +114,8 @@ function getReader(server: Element): (path: string[]) => Promise { }; } -export function createFCDAsWizard(parent: Element): Wizard | undefined { +export function createFCDAsWizard(parent: Element): Wizard { const server = parent.closest('Server'); - if (!server) return; return [ { @@ -127,13 +126,15 @@ export function createFCDAsWizard(parent: Element): Wizard | undefined { action: createFCDAsAction(parent), }, content: [ - html` path[path.length - 1]} - >`, + server + ? html` path[path.length - 1]} + >` + : html``, ], }, ]; diff --git a/src/wizards/reportcontrol.ts b/src/wizards/reportcontrol.ts index 289c1880b7..4a2c85f7db 100644 --- a/src/wizards/reportcontrol.ts +++ b/src/wizards/reportcontrol.ts @@ -29,6 +29,9 @@ import { Delete, } from '../foundation.js'; import { maxLength, patterns } from './foundation/limits.js'; +import { editTrgOpsWizard } from './trgops.js'; +import { editOptFieldsWizard } from './optfields.js'; +import { editDataSetWizard } from './dataset.js'; export function removeReportControlAction(element: Element): Delete[] { if (!element.parentElement) return []; @@ -241,6 +244,12 @@ export function editReportControlWizard(element: Element): Wizard { const bufTime = element.getAttribute('bufTime'); const intgPd = element.getAttribute('intgPd'); + const trgOps = element.querySelector('TrgOps'); + const optFields = element.querySelector('OptFields'); + const dataSet = element.parentElement?.querySelector( + `DataSet[name="${element.getAttribute('datSet')}"]` + ); + return [ { title: get('wizard.title.edit', { tagName: element.tagName }), @@ -261,6 +270,42 @@ export function editReportControlWizard(element: Element): Wizard { bufTime, intgPd, }), + dataSet + ? html` { + e.target?.dispatchEvent( + newSubWizardEvent(() => editDataSetWizard(dataSet)) + ); + }} + >` + : html``, + trgOps + ? html` { + e.target?.dispatchEvent( + newSubWizardEvent(() => editTrgOpsWizard(trgOps)) + ); + }} + >` + : html``, + optFields + ? html` { + e.target?.dispatchEvent( + newSubWizardEvent(() => editOptFieldsWizard(optFields)) + ); + }} + >` + : html``, html` { const dchg = getValue(inputs.find(i => i.label === 'dchg')!); @@ -56,12 +39,7 @@ function updateTrgOpsAction(element: Element): WizardActor { }); const trgOptAction = { old: { element }, new: { element: newElement } }; - const intPdAction = updateIntPdInParentReportAction( - element.parentElement, - period === 'true' ? true : false - ); - - return intPdAction ? [trgOptAction, intPdAction] : [trgOptAction]; + return [trgOptAction]; }; } diff --git a/test/integration/wizards/reportcontrol-wizarding-editing.test.ts b/test/integration/wizards/reportcontrol-wizarding-editing.test.ts index 915adca60f..f14f713169 100644 --- a/test/integration/wizards/reportcontrol-wizarding-editing.test.ts +++ b/test/integration/wizards/reportcontrol-wizarding-editing.test.ts @@ -79,6 +79,7 @@ describe('Wizards for SCL element ReportControl', () => { let parentIED: Element; beforeEach(async () => { + element.workflow.length = 0; // remove all wizard from FIFO queue parentIED = doc.querySelector('IED')!; element.workflow.push(() => selectReportControlWizard(parentIED)); await element.requestUpdate(); @@ -162,6 +163,61 @@ describe('Wizards for SCL element ReportControl', () => { expect(report.innerHTML).to.contain('ReportCb'); }); + it('opens edit wizard for DataSet element on edit dataset button click', async () => { + const editDataSetButton =