github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/router.js (about)

     1  import EmberRouter from '@ember/routing/router';
     2  import config from 'nomad-ui/config/environment';
     3  
     4  export default class Router extends EmberRouter {
     5    location = config.locationType;
     6    rootURL = config.rootURL;
     7  }
     8  
     9  Router.map(function () {
    10    this.route('exec', { path: '/exec/:job_name' }, function () {
    11      this.route('task-group', { path: '/:task_group_name' }, function () {
    12        this.route('task', { path: '/:task_name' });
    13      });
    14    });
    15  
    16    this.route('jobs', function () {
    17      this.route('run');
    18      this.route('job', { path: '/:job_name' }, function () {
    19        this.route('task-group', { path: '/:name' });
    20        this.route('definition');
    21        this.route('versions');
    22        this.route('deployments');
    23        this.route('dispatch');
    24        this.route('evaluations');
    25        this.route('allocations');
    26        this.route('clients');
    27        this.route('services', function () {
    28          this.route('service', { path: '/:name' });
    29        });
    30      });
    31    });
    32  
    33    this.route('optimize', function () {
    34      this.route('summary', { path: '*slug' });
    35    });
    36  
    37    this.route('clients', function () {
    38      this.route('client', { path: '/:node_id' }, function () {
    39        this.route('monitor');
    40      });
    41    });
    42  
    43    this.route('servers', function () {
    44      this.route('server', { path: '/:agent_id' }, function () {
    45        this.route('monitor');
    46      });
    47    });
    48  
    49    this.route('topology');
    50  
    51    this.route('csi', function () {
    52      this.route('volumes', function () {
    53        this.route('volume', { path: '/:volume_name' });
    54      });
    55  
    56      this.route('plugins', function () {
    57        this.route('plugin', { path: '/:plugin_name' }, function () {
    58          this.route('allocations');
    59        });
    60      });
    61    });
    62  
    63    this.route('allocations', function () {
    64      this.route('allocation', { path: '/:allocation_id' }, function () {
    65        this.route('fs-root', { path: '/fs' });
    66        this.route('fs', { path: '/fs/*path' });
    67  
    68        this.route('task', { path: '/:name' }, function () {
    69          this.route('logs');
    70          this.route('fs-root', { path: '/fs' });
    71          this.route('fs', { path: '/fs/*path' });
    72        });
    73      });
    74    });
    75  
    76    this.route('settings', function () {
    77      this.route('tokens');
    78    });
    79  
    80    // if we don't include function() the outlet won't render
    81    this.route('evaluations', function () {});
    82  
    83    this.route('not-found', { path: '/*' });
    84    this.route('variables', function () {
    85      this.route('new');
    86  
    87      this.route(
    88        'variable',
    89        {
    90          path: '/var/*id',
    91        },
    92        function () {
    93          this.route('edit');
    94        }
    95      );
    96  
    97      this.route('path', {
    98        path: '/path/*absolutePath',
    99      });
   100    });
   101  
   102    this.route('policies', function () {
   103      this.route('new');
   104  
   105      this.route('policy', {
   106        path: '/:name',
   107      });
   108    });
   109    // Mirage-only route for testing OIDC flow
   110    if (config['ember-cli-mirage']) {
   111      this.route('oidc-mock');
   112    }
   113  });