diff --git a/packages/openscd/src/translations/de.ts b/packages/openscd/src/translations/de.ts index 67e314ede6..701a766945 100644 --- a/packages/openscd/src/translations/de.ts +++ b/packages/openscd/src/translations/de.ts @@ -252,6 +252,7 @@ export const de: Translations = { wizard: { nameHelper: 'Name des IED', descHelper: 'Beschreibung des IED', + noDescWarning: "Warnung! Einige S-IEDs können nicht angezeigt werden, da sie kein „des“-Attribut haben. Klicke hier, um das Attribut manuell hinzuzufügen.", title: { edit: 'IED bearbeiten', delete: 'IED mit Abhängigkeiten entfernen', diff --git a/packages/openscd/src/translations/en.ts b/packages/openscd/src/translations/en.ts index ca983fd40d..2cef227375 100644 --- a/packages/openscd/src/translations/en.ts +++ b/packages/openscd/src/translations/en.ts @@ -249,6 +249,7 @@ export const en = { wizard: { nameHelper: 'IED name', descHelper: 'IED description', + noDescWarning: "Warning! Some S-IEDs cannot be displayed because they do not have a “desc” attribute. Click here to add the attribute manually.", title: { edit: 'Edit IED', delete: 'Remove IED with references', diff --git a/packages/plugins/src/editors/IED.ts b/packages/plugins/src/editors/IED.ts index 052a1309c0..af59c90de6 100644 --- a/packages/plugins/src/editors/IED.ts +++ b/packages/plugins/src/editors/IED.ts @@ -23,9 +23,11 @@ import { compareNames, getDescriptionAttribute, getNameAttribute, + newWizardEvent, } from '@openscd/open-scd/src/foundation.js'; import { Nsdoc } from '@openscd/open-scd/src/foundation/nsdoc.js'; import { getIcon } from '@openscd/open-scd/src/icons/icons.js'; +import { wizards } from '../wizards/wizard-library.js'; /** An editor [[`plugin`]] for editing the `IED` section. */ export default class IedPlugin extends LitElement { @@ -99,6 +101,11 @@ export default class IedPlugin extends LitElement { return undefined; } + @state() + private get iedsWithoutDesc(): Element[] { + return this.iedList.filter(ied => !ied.hasAttribute('desc')); + } + lNClassListOpenedOnce = false; protected updated(_changedProperties: PropertyValues): void { @@ -147,10 +154,31 @@ export default class IedPlugin extends LitElement { return selectedLNClasses; } + private openEditWizard(element: Element): void { + const wizard = wizards['IED'].edit(element); + if (wizard) this.dispatchEvent(newWizardEvent(wizard)); + } + render(): TemplateResult { const iedList = this.iedList; if (iedList.length > 0) { return html`
+ ${ + this.iedsWithoutDesc.length > 0 + ? html` +
+ ${get('ied.wizard.noDescWarning')} + edit +
+ ` + : nothing + }

${get('filters')}:

@@ -175,6 +203,13 @@ export default class IedPlugin extends LitElement { return; } + // const selectedIedNames = e.detail.selectedItems.map(item => { + // const [name] = item.split('__'); + // return name; + // }); + + // console.log("HERE: ", selectedIedNames) + this.lNClassListOpenedOnce = false; this.selectedIEDs = e.detail.selectedItems; this.selectedLNClasses = []; @@ -252,6 +287,18 @@ export default class IedPlugin extends LitElement { display: flex; } + .missing-desc-banner { + margin-bottom: 16px; + background-color: #ffcc00; + padding: 8px 16px; + display: flex; + align-items: center; + justify-content: space-between; + cursor: pointer; + border-radius: 4px; + transition: opacity 0.2s ease-in-out; + } + h1 { color: var(--mdc-theme-on-surface); font-family: 'Roboto', sans-serif; diff --git a/packages/plugins/src/menu/VirtualTemplateIED.ts b/packages/plugins/src/menu/VirtualTemplateIED.ts index 077e567f48..68ce0b7865 100644 --- a/packages/plugins/src/menu/VirtualTemplateIED.ts +++ b/packages/plugins/src/menu/VirtualTemplateIED.ts @@ -271,7 +271,7 @@ export default class VirtualTemplateIED extends LitElement { `,