-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[UI] remove ember route action helper #23004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rishabh-gupta-hashicorp
merged 6 commits into
main
from
rishabh-gupta/ui/remove-ember-route-action-helper
Oct 31, 2025
+307
−99
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0539a6c
removes dependency on route-action-helper
rishabh-gupta-hashicorp 952d4e7
removes the library ember-route-action-helper
rishabh-gupta-hashicorp 508d70d
fixes linting
rishabh-gupta-hashicorp 26fad14
Merge branch 'main' into rishabh-gupta/ui/remove-ember-route-action-h…
rishabh-gupta-hashicorp d287c09
adds changelog
rishabh-gupta-hashicorp ba5aa29
code refactors and some formatting
rishabh-gupta-hashicorp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| ```release-note:improvement | ||
| ui: Removed ember-route-action-helper and migrated all {{route-action}} usages to explicit route/controller logic. | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
ui/packages/consul-ui/app/controllers/dc/acls/policies/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
| import Controller from '@ember/controller'; | ||
| import { action } from '@ember/object'; | ||
|
|
||
| export default class DcAclsPoliciesIndexController extends Controller { | ||
| @action | ||
| delete(item) { | ||
| // delegate to the route (WithBlockingActions mixin) which has the delete action | ||
| this.target.send('delete', item); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
ui/packages/consul-ui/app/controllers/dc/acls/roles/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
| import Controller from '@ember/controller'; | ||
| import { action } from '@ember/object'; | ||
|
|
||
| export default class DcAclsRolesIndexController extends Controller { | ||
| @action | ||
| delete(item) { | ||
| this.target.send('delete', item); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
ui/packages/consul-ui/app/controllers/dc/acls/tokens/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
| import Controller from '@ember/controller'; | ||
| import { action } from '@ember/object'; | ||
|
|
||
| export default class DcAclsTokensIndexController extends Controller { | ||
| @action | ||
| onUse(item) { | ||
| this.target.send('use', item); | ||
| } | ||
| @action | ||
| onDelete(item) { | ||
| this.target.send('delete', item); | ||
| } | ||
| @action | ||
| onLogout(item) { | ||
| this.target.send('logout', item); | ||
| } | ||
| @action | ||
| onClone(item) { | ||
| this.target.send('clone', item); | ||
| } | ||
| } |
16 changes: 16 additions & 0 deletions
16
ui/packages/consul-ui/app/controllers/dc/intentions/create.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
| import Controller from '@ember/controller'; | ||
| import { inject as service } from '@ember/service'; | ||
| import { action } from '@ember/object'; | ||
|
|
||
| export default class DcIntentionsCreateController extends Controller { | ||
| @service router; | ||
|
|
||
| @action | ||
| goToIndex(dc) { | ||
| this.router.transitionTo('dc.intentions.index', dc); | ||
| } | ||
| } |
16 changes: 16 additions & 0 deletions
16
ui/packages/consul-ui/app/controllers/dc/intentions/edit.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
| import Controller from '@ember/controller'; | ||
| import { inject as service } from '@ember/service'; | ||
| import { action } from '@ember/object'; | ||
|
|
||
| export default class DcIntentionsEditController extends Controller { | ||
| @service router; | ||
|
|
||
| @action | ||
| goToIndex(dc) { | ||
| this.router.transitionTo('dc.intentions.index', dc); | ||
| } | ||
| } |
21 changes: 21 additions & 0 deletions
21
ui/packages/consul-ui/app/controllers/dc/nodes/show/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
| import Controller from '@ember/controller'; | ||
| import { inject as service } from '@ember/service'; | ||
| import { action } from '@ember/object'; | ||
|
|
||
| export default class DcNodesShowIndexController extends Controller { | ||
| @service router; | ||
|
|
||
| @action | ||
| goServices() { | ||
| this.router.replaceWith('dc.nodes.show.services'); | ||
| } | ||
|
|
||
| @action | ||
| goHealthChecks() { | ||
| this.router.replaceWith('dc.nodes.show.healthchecks'); | ||
| } | ||
| } |
19 changes: 19 additions & 0 deletions
19
ui/packages/consul-ui/app/controllers/dc/services/show/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
| import Controller from '@ember/controller'; | ||
| import { inject as service } from '@ember/service'; | ||
| import { action } from '@ember/object'; | ||
|
|
||
| export default class DcServicesShowIndexController extends Controller { | ||
| @service router; | ||
|
|
||
| @action | ||
| forward(tabs = {}) { | ||
| if (tabs.topology) return this.router.replaceWith('dc.services.show.topology'); | ||
| if (tabs.upstreams) return this.router.replaceWith('dc.services.show.upstreams'); | ||
| if (tabs.services) return this.router.replaceWith('dc.services.show.services'); | ||
| return this.router.replaceWith('dc.services.show.instances'); | ||
| } | ||
| } |
15 changes: 15 additions & 0 deletions
15
ui/packages/consul-ui/app/controllers/dc/services/show/topology.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
| import Controller from '@ember/controller'; | ||
| import { action } from '@ember/object'; | ||
| import { getOwner } from '@ember/application'; | ||
|
|
||
| export default class TopologyController extends Controller { | ||
| @action | ||
| createIntention(source, destination) { | ||
| const route = getOwner(this).lookup('route:dc.services.show.topology'); | ||
| return route.createIntention(source, destination); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
| import Route from 'consul-ui/routing/route'; | ||
| import { inject as service } from '@ember/service'; | ||
|
|
||
| export default class DcAclsIndexRoute extends Route { | ||
| @service router; | ||
|
|
||
| beforeModel() { | ||
| this.router.replaceWith('dc.acls.tokens'); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
| import Route from 'consul-ui/routing/route'; | ||
|
|
||
| export default class DcNodesShowRttRoute extends Route { | ||
| redirect(model) { | ||
| const distances = model?.tomography?.distances; | ||
| if (Array.isArray(distances) && distances.length == 0) { | ||
| this.replaceWith('dc.nodes.show'); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| /** | ||
| * Copyright (c) HashiCorp, Inc. | ||
| * SPDX-License-Identifier: BUSL-1.1 | ||
| */ | ||
| import Route from 'consul-ui/routing/route'; | ||
| import { inject as service } from '@ember/service'; | ||
|
|
||
| export default class DcShowIndexRoute extends Route { | ||
| // Use the abilities service (ember-can) backing the {{can}} helper | ||
| @service abilities; | ||
|
|
||
| afterModel() { | ||
| const canAccess = this.abilities.can('access overview'); | ||
| this.replaceWith(canAccess ? 'dc.show.serverstatus' : 'dc.services.index'); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,5 +6,4 @@ | |
| <Route | ||
| @name={{this.routeName}} | ||
| as |route|> | ||
| {{did-insert (route-action 'replaceWith' 'dc.acls.tokens')}} | ||
| </Route> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't we need to keep did-insert modifer? or are you handling it somewhere else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, It is now handled directly in the route file here