Files
threshold-ui/ui/admin/app/routes/onboarding/quick-setup/create-resources/success.js
T
Cameron Perera f143ba3d58 refactor: 💡 Update Quick Setup Success screen button route (#1330)
Route to Target details screen now

✅ Closes: ICU-6096
2022-09-16 14:25:45 -05:00

39 lines
1.0 KiB
JavaScript

import Route from '@ember/routing/route';
import { getOwner } from '@ember/application';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
export default class OnboardingQuickSetupCreateResourcesSuccessRoute extends Route {
// =services
@service router;
// =attributes
/**
* Looks up the window object indirectly.
* @type {Window}
*/
get window() {
// The Ember way of accessing globals...
const document = getOwner(this).lookup('service:-document').documentElement;
// defaultView === window, but without using globals directly
return document.parentNode.defaultView;
}
// =methods
model() {
const model = this.modelFor('onboarding.quick-setup.create-resources');
return {
...model,
clusterUrl: this.window.location.origin,
};
}
@action
showTargetList(scope) {
const {
project: { id: scopeID },
target: { id: targetID },
} = scope;
this.router.transitionTo('scopes.scope.targets.target', scopeID, targetID);
}
}