Skip to content

Commit 9562c06

Browse files
Backport of [UI] Remove send Action deprecation into release/1.22.x (#22957)
backport of commit d03f619 Co-authored-by: suresh-hashicorp <[email protected]>
1 parent 70583a7 commit 9562c06

File tree

22 files changed

+120
-94
lines changed

22 files changed

+120
-94
lines changed

.changelog/22938.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:improvement
2+
ui: removes send action instances as part of https://deprecations.emberjs.com/id/ember-component-send-action/
3+
```

ui/packages/consul-lock-sessions/app/components/consul/lock-session/form/index.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
@text='Invalidate Session'
8787
@color='critical'
8888
data-test-delete
89-
{{on 'click' (fn confirm (fn writer.delete @item))}}
89+
{{on 'click' (fn confirm )}}
9090
/>
9191
</BlockSlot>
9292
<BlockSlot @name="dialog" as |execute cancel message|>
@@ -98,7 +98,7 @@
9898
@text='Confirm Invalidation'
9999
@color='critical'
100100
data-test-delete
101-
{{on 'click' (fn execute)}}
101+
{{on 'click' (queue execute (fn writer.delete @item))}}
102102
/>
103103
<Hds::Button
104104
@text='Cancel'

ui/packages/consul-lock-sessions/app/components/consul/lock-session/list/index.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ as |item index|>
9090
@text='Invalidate'
9191
@color='critical'
9292
data-test-delete
93-
{{on 'click' (fn confirm (fn @ondelete item))}}
93+
{{on 'click' confirm}}
9494
/>
9595
</BlockSlot>
9696
<BlockSlot @name="dialog" as |execute cancel message|>
@@ -102,7 +102,7 @@ as |item index|>
102102
@text='Confirm Invalidate'
103103
@color='critical'
104104
data-test-delete
105-
{{on 'click' (fn execute)}}
105+
{{on 'click' (queue execute (fn @ondelete item))}}
106106
/>
107107
<Hds::Button
108108
@text='Cancel'

ui/packages/consul-nspaces/app/components/consul/nspace/form/index.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,13 @@
145145
data-test-delete
146146
@color='critical'
147147
@text='Delete'
148-
{{on "click" (fn confirm (fn writer.delete item))}}
148+
{{on "click" (fn confirm )}}
149149
/>
150150
</BlockSlot>
151151
<BlockSlot @name="dialog" as |execute cancel message|>
152152
<DeleteConfirmation
153153
@message={{message}}
154-
@execute={{execute}}
154+
@execute={{queue execute (fn writer.delete item)}}
155155
@cancel={{cancel}}
156156
/>
157157
</BlockSlot>

ui/packages/consul-partitions/app/components/consul/partition/form/index.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ as |State Guard ChartAction dispatch state|>
118118
@text='Delete'
119119
data-test-delete
120120
@color='critical'
121-
{{on 'click' (fn confirm (fn writer.delete item))}}
121+
{{on 'click' confirm}}
122122
/>
123123
</BlockSlot>
124124
<BlockSlot @name="dialog" as |execute cancel message|>
125125
<DeleteConfirmation
126126
@message={{message}}
127-
@execute={{execute}}
127+
@execute={{queue execute (fn writer.delete item)}}
128128
@cancel={{cancel}}
129129
/>
130130
</BlockSlot>

ui/packages/consul-ui/app/components/child-selector/index.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
</label>
5151
{{/if}}
5252
{{#if (gt items.length 0)}}
53-
<YieldSlot @name="set">{{yield}}</YieldSlot>
53+
<YieldSlot @name="set" @params={{block-params (action "remove")}}>{{yield}}</YieldSlot>
5454
{{else}}
5555

5656
{{/if}}

ui/packages/consul-ui/app/components/confirmation-dialog/index.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@
33
* SPDX-License-Identifier: BUSL-1.1
44
*/
55

6-
/*eslint ember/closure-actions: "warn"*/
76
import Component from '@ember/component';
7+
import { action } from '@ember/object';
8+
import { tracked } from '@glimmer/tracking';
89

910
import Slotted from 'block-slots';
10-
import { set } from '@ember/object';
1111

12-
export default Component.extend(Slotted, {
13-
tagName: '',
14-
message: 'Are you sure?',
15-
confirming: false,
16-
permanent: false,
17-
actions: {
18-
cancel: function () {
19-
set(this, 'confirming', false);
20-
},
21-
execute: function () {
22-
set(this, 'confirming', false);
23-
this.sendAction(...['actionName', ...this['arguments']]);
24-
},
25-
confirm: function () {
26-
const [action, ...args] = arguments;
27-
set(this, 'actionName', action);
28-
set(this, 'arguments', args);
29-
set(this, 'confirming', true);
30-
},
31-
},
32-
});
12+
export default class ConfirmationDialogComponent extends Component.extend(Slotted) {
13+
tagName = '';
14+
message = 'Are you sure?';
15+
@tracked confirming = false;
16+
permanent = false;
17+
18+
@action
19+
cancel() {
20+
this.confirming = false;
21+
}
22+
23+
@action
24+
execute() {
25+
this.confirming = false;
26+
}
27+
28+
@action
29+
confirm() {
30+
this.confirming = true;
31+
}
32+
}

ui/packages/consul-ui/app/components/consul/intention/form/index.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,14 @@ as |item readonly|}}
178178
@text='Delete'
179179
@color='critical'
180180
disabled={{api.disabled}}
181-
{{on 'click' (fn confirm api.delete)}}
181+
{{on 'click' (fn confirm)}}
182182
data-test-delete
183183
/>
184184
</BlockSlot>
185185
<BlockSlot @name="dialog" as |execute cancel message|>
186186
<DeleteConfirmation
187187
@message={{message}}
188-
@execute={{execute}}
188+
@execute={{queue execute api.delete}}
189189
@cancel={{cancel}}
190190
/>
191191
</BlockSlot>

ui/packages/consul-ui/app/components/consul/intention/list/table/index.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
<BlockSlot @name='trigger'>
9696
More
9797
</BlockSlot>
98-
<BlockSlot @name='menu' as |confirm send keypressClick change|>
98+
<BlockSlot @name='menu' as |confirm keypressClick change|>
9999
{{#if (can 'write intention' item=item)}}
100100
<components.MenuItem href={{href-to (or routeName 'dc.intentions.edit') item.ID}}>
101101
<BlockSlot @name="label">

ui/packages/consul-ui/app/components/consul/kv/form/index.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@
127127
@color='critical'
128128
data-test-delete
129129
disabled={{api.disabled}}
130-
{{on 'click' (action confirm api.delete)}}
130+
{{on 'click' (action confirm)}}
131131
/>
132132
</BlockSlot>
133133
<BlockSlot @name='dialog' as |execute cancel message|>
134134
<DeleteConfirmation
135135
@message={{message}}
136-
@execute={{execute}}
136+
@execute={{queue execute api.delete}}
137137
@cancel={{cancel}}
138138
/>
139139
</BlockSlot>

0 commit comments

Comments
 (0)