Skip to content

Commit 058ac13

Browse files
author
Flurb
committed
Changed Create action into Replace in Redundancy wizard
1 parent 85e8a06 commit 058ac13

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/editors/protocol104/wizards/connectedap.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
typePattern
2121
} from '../foundation/p-types.js';
2222
import {
23+
cloneElement,
2324
compareNames,
2425
ComplexAction,
2526
createElement,
@@ -179,13 +180,13 @@ export function editConnectedApWizard(parent: Element, redundancy?: boolean): Wi
179180
{
180181
title: get('protocol104.network.connectedAp.wizard.title.edit'),
181182
element: parent,
182-
menuActions: [
183-
{
183+
menuActions: redundancy
184+
? [{
184185
icon: 'playlist_add',
185186
label: get('protocol104.network.connectedAp.wizard.addRedundancyGroup'),
186187
action: openRedundancyGroupWizard(parent, redundancyGroupNumbers),
187-
},
188-
],
188+
}]
189+
: undefined,
189190
primary: {
190191
icon: 'save',
191192
label: get('save'),
@@ -270,14 +271,18 @@ function editConnectedApAction(parent: Element, redundancy?: boolean): WizardAct
270271
// All redundancy group actions are done in those wizards itself.
271272
if (redundancy) {
272273
const stationTypeValue = getValue(inputs.find(i => i.label === 'StationType')!)!;
273-
const stationTypeElement = oldAddress?.querySelector('P[type="StationType"]');
274-
stationTypeElement!.textContent = stationTypeValue;
274+
const originalElement = oldAddress?.querySelector('P[type="StationType"]');
275+
276+
const elementClone = cloneElement(originalElement!, {});
277+
elementClone!.textContent = stationTypeValue;
275278

276279
complexAction.actions.push({
277-
new: {
278-
parent: parent,
279-
element: oldAddress!,
280+
old: {
281+
element: originalElement!
280282
},
283+
new: {
284+
element: elementClone
285+
}
281286
});
282287
} else if (oldAddress !== null && !isEqualAddress(oldAddress, newAddress)) {
283288
//address & child elements P are changed: cannot use replace editor action

0 commit comments

Comments
 (0)