Skip to content

Conversation

@rishabh-gupta-hashicorp
Copy link
Contributor

Description

We have been using ember-route-action-helper library for route-actions. This is no longer needed since the features of this addon are now provided directly by Ember.

Also, this library depends on a deprecated feature of Ember - deprecation id: ember-global
With no upgrades to this library in past few years, it can be removed now.

https://www.npmjs.com/package/ember-route-action-helper

Testing & Reproduction steps

Links

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

@github-actions github-actions bot added the theme/ui Anything related to the UI label Oct 29, 2025
@rishabh-gupta-hashicorp rishabh-gupta-hashicorp added the backport/all Apply backports for all active releases per .release/versions.hcl label Oct 29, 2025
@suresh-hashicorp suresh-hashicorp changed the title Rishabh gupta/UI/remove ember route action helper [UI] remove ember route action helper Oct 30, 2025
@suresh-hashicorp
Copy link
Contributor

LGTM

@action
delete(item) {
// Forwarders replacing route-action usage
@action onCreate(item, event) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@action onCreate(item, event) {
@action
onCreate(event, item) {

two nit picks here it's not call to action but more of observation:

  • having decorator on its own line is common format
  • is there a reason you are passing event as a second arg? if there is no particular reason it would be more obvious in the future when we start using function on on modifers where event is always going to be first

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the decorator formatting.

Regarding (item, event) ordering
We are binding the item with onCreate when we are calling using fn in the corresponding template file:
@onCreate={{fn this.onCreate item}}

This will then come up as the first argument.

For consistency with how on modifiers work, I believe we will have to do refactoring at multiple places.

import { getOwner } from '@ember/application';

export default class TopologyController extends Controller {
get routeInstance() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • this shouldn't be a getter if it's not accessing any dynamic class member like tracked properties or other getters or args
  • since we are not using it in many spots it would make sense to co locate with the invoke it like:
@action
createIntention(source, destination) {
const route = getOwner(this).lookup('route:dc.services.show.topology');
    return route.createIntention(source, destination);
  }


export default class DcAclsIndexRoute extends Route {
beforeModel() {
this.replaceWith('dc.acls.tokens');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you are creating a brand new route it would make sense not to introduce new deprecations so we have to inject router service instead of using route methods on the route it self so you would have something like:

@service router;

beforeModel() {
    this.router.replaceWith('dc.acls.tokens');

<Route
@name={{this.routeName}}
as |route|>
{{did-insert (route-action 'replaceWith' 'dc.acls.tokens')}}
Copy link
Collaborator

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

Copy link
Contributor Author

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

route.model.tomography
as |tomography|}}
{{#if (not tomography.distances)}}
{{did-insert (route-action 'replaceWith' 'dc.nodes.show')}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also handled directly in the route like above.

@isRemoteDC={{not dc.Local}}
@hasMetricsProvider={{gt config.data.metrics_provider.length 0}}
@oncreate={{route-action 'createIntention'}}
@oncreate={{fn this.createIntention}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you do not any arguments to the funtion you do not need fn you can just say:

Suggested change
@oncreate={{fn this.createIntention}}
@oncreate={{this.createIntention}}

{{! Listen out for blocking query/client setting changes }}
<DataSource
@src={{uri 'settings://consul:client'}}
@onchange={{fn this.onClientChanged}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@rishabh-gupta-hashicorp rishabh-gupta-hashicorp merged commit e5ab065 into main Oct 31, 2025
82 of 86 checks passed
@hc-github-team-consul-core hc-github-team-consul-core added backport/1.22 Changes are backported to 1.22 backport/ent/1.18 Changes are backported to 1.18 ent backport/ent/1.20 backport to ent 1.20 backport/ent/1.21 changes are backported to 1.21 ent labels Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/all Apply backports for all active releases per .release/versions.hcl backport/ent/1.18 Changes are backported to 1.18 ent backport/ent/1.20 backport to ent 1.20 backport/ent/1.21 changes are backported to 1.21 ent backport/1.22 Changes are backported to 1.22 theme/ui Anything related to the UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants