Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
Added the ability to duplicate operation calls so multiple payloads s…
Browse files Browse the repository at this point in the history
…upported.
  • Loading branch information
John Heath (JHEA) authored and John Heath (JHEA) committed Nov 22, 2021
1 parent 3adb02f commit f2b5fe1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,35 @@ <h4>Toggle</h4>

<ng-template #normalOp>
<h4>Operation</h4>

<label class="label-with-help">
Duplicate operation
<span class="help-icon">
<img src="{{CONST_HELP_IMAGE_FILE}}" alt="help tooltip"
title="Add an extra version of this command.">
</span>
</label>
<button
style="color:#1776BF;"
type="button" class="button"
(click)="addCommand(op)">
<span class="fa fa-plus"></span>
</button>

<label class="label-with-help">
Delete operation
<span class="help-icon">
<img src="{{CONST_HELP_IMAGE_FILE}}" alt="help tooltip"
title="Add an extra version of this command.">
</span>
</label>
<button
style="color:#1776BF;"
type="button" class="button"
(click)="deleteCommand(i)">
<span class="fa fa-minus"></span>
</button>

<label>
Tooltip text
</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,17 @@ export class DeviceControlWidgetConfig implements OnInit, OnDestroy {
);
}

addCommand(op: DeviceOperation) {
let copy = _.cloneDeep(op);
this.widgetHelper.getWidgetConfig().selectedOperations.push(
copy
);
}

deleteCommand(index: number) {
this.widgetHelper.getWidgetConfig().selectedOperations.splice(index, 1);
}

removeToggle(index: number) {
this.widgetHelper.getWidgetConfig().selectedToggles.splice(index, 1);
}
Expand Down

0 comments on commit f2b5fe1

Please sign in to comment.