open-nomad/ui/app/router.js
Phil Renaud da4cb6422e Secure Variables: Build a path tree and traverse it at /variables/*path (#13202)
* Recursive trie-building with variable paths

* tree structure applied to new path routes and a new util class

* Breadcrumbs for SV paths and prompt when nothing exists at a path

* Lint and test cleanup

* Pre-review cleanup

* lintfix

* Abstracted pathtree each-ins into a new component class

* Path tree component styles

* Types added and PR feedback addressed

* Path tree to variable paths

* Slightly simpler path QP mods

* More pr feedback handling

* Trim moved into a function on variable model

* Traversal and compaction tests for PathTree

* Trim Path tests

* Variable-paths component tests

* Lint fixup for tests
2022-07-11 13:34:04 -04:00

99 lines
2.4 KiB
JavaScript

import EmberRouter from '@ember/routing/router';
import config from 'nomad-ui/config/environment';
export default class Router extends EmberRouter {
location = config.locationType;
rootURL = config.rootURL;
}
Router.map(function () {
this.route('exec', { path: '/exec/:job_name' }, function () {
this.route('task-group', { path: '/:task_group_name' }, function () {
this.route('task', { path: '/:task_name' });
});
});
this.route('jobs', function () {
this.route('run');
this.route('job', { path: '/:job_name' }, function () {
this.route('task-group', { path: '/:name' });
this.route('definition');
this.route('versions');
this.route('deployments');
this.route('dispatch');
this.route('evaluations');
this.route('allocations');
this.route('clients');
});
});
this.route('optimize', function () {
this.route('summary', { path: '*slug' });
});
this.route('clients', function () {
this.route('client', { path: '/:node_id' }, function () {
this.route('monitor');
});
});
this.route('servers', function () {
this.route('server', { path: '/:agent_id' }, function () {
this.route('monitor');
});
});
this.route('topology');
this.route('csi', function () {
this.route('volumes', function () {
this.route('volume', { path: '/:volume_name' });
});
this.route('plugins', function () {
this.route('plugin', { path: '/:plugin_name' }, function () {
this.route('allocations');
});
});
});
this.route('allocations', function () {
this.route('allocation', { path: '/:allocation_id' }, function () {
this.route('fs-root', { path: '/fs' });
this.route('fs', { path: '/fs/*path' });
this.route('task', { path: '/:name' }, function () {
this.route('logs');
this.route('fs-root', { path: '/fs' });
this.route('fs', { path: '/fs/*path' });
});
});
});
this.route('settings', function () {
this.route('tokens');
});
// if we don't include function() the outlet won't render
this.route('evaluations', function () {});
this.route('not-found', { path: '/*' });
this.route('variables', function () {
this.route('new');
this.route(
'variable',
{
path: '/*path',
},
function () {
this.route('edit');
}
);
this.route('path', {
path: '/path/*absolutePath',
});
});
});