Files
threshold-ui/ui/desktop/app/routes/index.js
T

28 lines
616 B
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
2020-11-09 17:42:27 -05:00
import Route from '@ember/routing/route';
2020-11-13 15:20:26 -05:00
import { inject as service } from '@ember/service';
2020-11-09 17:42:27 -05:00
export default class IndexRoute extends Route {
2020-11-13 15:20:26 -05:00
// =services
2022-07-27 10:25:01 -07:00
@service clusterUrl;
@service router;
2020-11-13 15:20:26 -05:00
2020-11-09 17:42:27 -05:00
// =methods
/**
2022-07-27 10:25:01 -07:00
* If no clusterUrl is specified yet, redirects to cluster-url, otherwise scopes.
2020-11-09 17:42:27 -05:00
*/
redirect() {
2022-07-27 10:25:01 -07:00
const rendererClusterUrl = this.clusterUrl.rendererClusterUrl;
if (!rendererClusterUrl) {
this.router.replaceWith('cluster-url');
2020-11-13 15:20:26 -05:00
} else {
this.router.replaceWith('scopes');
2020-11-13 15:20:26 -05:00
}
2020-11-09 17:42:27 -05:00
}
}