Skip to content

Commit 582a2fa

Browse files
refactor(wizards/templates/lnodetype): remove mwc-buttons from wizard content (openscd#626)
1 parent b0db54f commit 582a2fa

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

src/editors/templates/lnodetype-wizard.ts

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
getValue,
2323
identity,
2424
isPublic,
25-
newActionEvent,
2625
newSubWizardEvent,
2726
newWizardEvent,
2827
patterns,
@@ -139,7 +138,7 @@ function dOWizard(options: WizardOptions): Wizard | undefined {
139138
title,
140139
action,
141140
type,
142-
deleteButton,
141+
menuActions,
143142
name,
144143
desc,
145144
accessControl,
@@ -149,24 +148,13 @@ function dOWizard(options: WizardOptions): Wizard | undefined {
149148
get('do.wizard.title.edit'),
150149
updateDoAction(DO),
151150
DO.getAttribute('type'),
152-
html`<mwc-button
153-
icon="delete"
154-
trailingIcon
155-
label="${translate('remove')}"
156-
@click=${(e: MouseEvent) => {
157-
e.target!.dispatchEvent(newWizardEvent());
158-
e.target!.dispatchEvent(
159-
newActionEvent({
160-
old: {
161-
parent: DO.parentElement!,
162-
element: DO,
163-
reference: DO.nextSibling,
164-
},
165-
})
166-
);
167-
}}
168-
fullwidth
169-
></mwc-button> `,
151+
[
152+
{
153+
icon: 'delete',
154+
label: get('remove'),
155+
action: remove(DO),
156+
},
157+
],
170158
DO.getAttribute('name'),
171159
DO.getAttribute('desc'),
172160
DO.getAttribute('accessControl'),
@@ -176,7 +164,7 @@ function dOWizard(options: WizardOptions): Wizard | undefined {
176164
get('do.wizard.title.add'),
177165
createDoAction((<CreateOptions>options).parent),
178166
null,
179-
html``,
167+
undefined,
180168
'',
181169
null,
182170
null,
@@ -192,8 +180,8 @@ function dOWizard(options: WizardOptions): Wizard | undefined {
192180
title,
193181
element: DO ?? undefined,
194182
primary: { icon: '', label: get('save'), action },
183+
menuActions,
195184
content: [
196-
deleteButton,
197185
html`<wizard-textfield
198186
label="name"
199187
.maybeValue=${name}

test/integration/editors/templates/lnodetype-wizard.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ describe('LNodeType wizards', () => {
414414
)
415415
);
416416
deleteButton = <HTMLElement>(
417-
parent.wizardUI.dialog?.querySelector('mwc-button[icon="delete"]')
417+
parent.wizardUI.dialog?.querySelector('mwc-menu > mwc-list-item')
418418
);
419419
});
420420

0 commit comments

Comments
 (0)