vault/ui/lib/sync/addon/routes/secrets.ts
claire bontempo 7774261c15
UI: Ember upgrade: Handle deprecation router service from host (#28603)
* use alias for router injection

* update @router declarations in engine files

* fix remaining pki router imports

* dynamically set router based on owner

* address replication routers

* update markdown docs

* use non-deprecated import for getOwner

* revert out of scope changes

* add transition-to test
2024-10-08 09:01:46 -07:00

28 lines
718 B
TypeScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Route from '@ember/routing/route';
import { service } from '@ember/service';
import type RouterService from '@ember/routing/router-service';
import type FlagService from 'vault/services/flags';
export default class SyncSecretsRoute extends Route {
@service('app-router') declare readonly router: RouterService;
@service declare readonly flags: FlagService;
model() {
return {
activatedFeatures: this.flags.activatedFlags,
};
}
afterModel(model: { activatedFeatures: Array<string> }) {
if (!model.activatedFeatures) {
this.router.transitionTo('vault.cluster.sync.secrets.overview');
}
}
}