2019-08-31 20:51:14 -07:00
|
|
|
import EmberRouter from '@ember/routing/router';
|
2020-08-26 15:44:50 -07:00
|
|
|
import config from 'datahub-web/config/environment';
|
2019-08-31 20:51:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Extends the EmberRouter object to define application routes and track events cross application
|
|
|
|
* @class ApplicationRouter
|
|
|
|
* @extends {EmberRouter}
|
|
|
|
*/
|
2020-08-26 15:44:50 -07:00
|
|
|
export default class ApplicationRouter extends EmberRouter {
|
2019-08-31 20:51:14 -07:00
|
|
|
/**
|
|
|
|
* Sets application root prefix for all routes
|
|
|
|
* @type {string}
|
|
|
|
* @memberof ApplicationRouter
|
|
|
|
*/
|
|
|
|
rootURL = config.rootURL;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the type of URL that the application will use e.g. HashLocation
|
|
|
|
* On instantiation this property is a string but post-instantiation is mutated to a IEmberLocation instance
|
|
|
|
* @type {string}
|
|
|
|
* @memberof ApplicationRouter
|
|
|
|
*/
|
|
|
|
location = config.locationType;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApplicationRouter.map(function(): void {
|
2020-08-26 15:44:50 -07:00
|
|
|
this.route('entity-type', { path: '/:entity_type' }, function(): void {
|
|
|
|
this.route('urn', { path: '/:urn' }, function(): void {
|
|
|
|
this.route('tab', { path: '/:tab_selected' });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2019-08-31 20:51:14 -07:00
|
|
|
this.route('page-not-found', {
|
|
|
|
path: '/*wildcard'
|
|
|
|
});
|
|
|
|
|
|
|
|
this.route('datasets', function(): void {
|
|
|
|
this.route(
|
|
|
|
'dataset',
|
|
|
|
{
|
|
|
|
path: '/:dataset_urn'
|
|
|
|
},
|
|
|
|
function(): void {
|
|
|
|
this.route('tab', {
|
|
|
|
path: '/:tab_selected'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2020-08-26 15:44:50 -07:00
|
|
|
this.route('features', function(): void {
|
|
|
|
this.route(
|
|
|
|
'feature',
|
|
|
|
{
|
|
|
|
path: '/:feature_urn'
|
|
|
|
},
|
|
|
|
function(): void {
|
|
|
|
this.route('tab', {
|
|
|
|
path: '/:tab_selected'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Adds the top level route for data jobs, navigated by the specific urn
|
|
|
|
// Also adds the instance sub route for a specific job and the anchor route for a job tab
|
|
|
|
this.route('jobs', function(): void {
|
|
|
|
this.route(
|
|
|
|
'job',
|
|
|
|
{
|
|
|
|
path: '/:job_urn'
|
|
|
|
},
|
|
|
|
function(): void {
|
|
|
|
this.route('tab', {
|
|
|
|
path: '/:tab_selected'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2019-08-31 20:51:14 -07:00
|
|
|
this.route('lists', function(): void {
|
|
|
|
this.route('entity', {
|
|
|
|
path: '/:entity_name'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
this.route('search');
|
|
|
|
|
|
|
|
this.route('logout');
|
|
|
|
|
|
|
|
this.route('login');
|
|
|
|
|
2020-08-26 15:44:50 -07:00
|
|
|
this.route('retina-authoring');
|
|
|
|
|
2019-08-31 20:51:14 -07:00
|
|
|
this.route('browse', function(): void {
|
|
|
|
this.route('entity', {
|
|
|
|
path: '/:entity'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
this.route('browsesearch', function(): void {
|
|
|
|
this.route('entity', {
|
|
|
|
path: '/:entity'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
this.route('user', function(): void {
|
2020-01-29 16:48:24 -08:00
|
|
|
this.route('profile', { path: '/:user_id' }, function(): void {
|
|
|
|
this.route('tab', { path: '/:tab_selected' });
|
|
|
|
});
|
2019-08-31 20:51:14 -07:00
|
|
|
});
|
|
|
|
|
2020-08-26 15:44:50 -07:00
|
|
|
this.route('app-catalogue', { path: '/apps' });
|
|
|
|
|
|
|
|
this.route('dataconcepts', function(): void {
|
|
|
|
this.route('dataconcept', { path: '/:concept_urn' }, function(): void {
|
|
|
|
this.route('tab', { path: '/:tab_selected' });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
this.route('lineage', function() {
|
|
|
|
this.route('urn', { path: '/:urn' });
|
|
|
|
});
|
|
|
|
|
|
|
|
// TODO: META-10716 Investigate and implement approach to agnostically include routes from monorepo addon packages
|
|
|
|
// Index and top-level route are not required for any current use cases, therefore not implemented
|
|
|
|
this.route('pending-proposals', { path: 'pending-proposals/:urn' });
|
|
|
|
this.route('schema-graph', function() {
|
|
|
|
this.route('urn', { path: '/:urn' });
|
|
|
|
});
|
|
|
|
});
|