diff --git a/ui/app/routes/topology.js b/ui/app/routes/topology.js new file mode 100644 index 000000000..97b4f0217 --- /dev/null +++ b/ui/app/routes/topology.js @@ -0,0 +1,27 @@ +import { inject as service } from '@ember/service'; +import Route from '@ember/routing/route'; +import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state'; +import notifyForbidden from 'nomad-ui/utils/notify-forbidden'; +import classic from 'ember-classic-decorator'; +import RSVP from 'rsvp'; + +@classic +export default class TopologyRoute extends Route.extend(WithForbiddenState) { + @service store; + @service system; + + breadcrumbs = [ + { + label: 'Topology', + args: ['topology'], + }, + ]; + + model() { + return RSVP.hash({ + allocations: this.store.findAll('allocation'), + jobs: this.store.findAll('job'), + nodes: this.store.findAll('node'), + }).catch(notifyForbidden(this)); + } +} diff --git a/ui/app/templates/topology.hbs b/ui/app/templates/topology.hbs index 19f060db0..585089b36 100644 --- a/ui/app/templates/topology.hbs +++ b/ui/app/templates/topology.hbs @@ -5,5 +5,19 @@

Cluster topology visualization goes here

:D

+ +

Clients

+
    + {{#each model.nodes as |node|}} +
  1. {{node.name}} {{!node.allocations.length}} {{node.resources.cpu}} MHz {{node.resources.memory}} MiB
  2. + {{/each}} +
+ +

Allocations

+
    + {{#each model.allocations as |allocation|}} +
  1. {{allocation.shortId}} {{allocation.node.name}} {{allocation.job.name}}/{{allocation.taskGroup.name}} {{allocation.resources.cpu}} MHz {{allocation.resources.memory}} MiB
  2. + {{/each}} +
diff --git a/ui/config/environment.js b/ui/config/environment.js index 9d758e0a6..65af8d9a6 100644 --- a/ui/config/environment.js +++ b/ui/config/environment.js @@ -24,11 +24,11 @@ module.exports = function(environment) { }, APP: { - blockingQueries: true, - mirageScenario: 'smallCluster', - mirageWithNamespaces: true, + blockingQueries: false, + mirageScenario: 'topoSmall', + mirageWithNamespaces: false, mirageWithTokens: true, - mirageWithRegions: true, + mirageWithRegions: false, }, }; diff --git a/ui/mirage/scenarios/default.js b/ui/mirage/scenarios/default.js index fadd4f734..c30dc446a 100644 --- a/ui/mirage/scenarios/default.js +++ b/ui/mirage/scenarios/default.js @@ -1,4 +1,5 @@ import config from 'nomad-ui/config/environment'; +import * as topoScenarios from './topo'; import { pickOne } from '../utils'; const withNamespaces = getConfigValue('mirageWithNamespaces', false); @@ -14,6 +15,7 @@ const allScenarios = { allNodeTypes, everyFeature, emptyCluster, + ...topoScenarios, }; const scenario = getConfigValue('mirageScenario', 'emptyCluster'); diff --git a/ui/mirage/scenarios/topo.js b/ui/mirage/scenarios/topo.js new file mode 100644 index 000000000..d22763ff8 --- /dev/null +++ b/ui/mirage/scenarios/topo.js @@ -0,0 +1,53 @@ +import faker from 'nomad-ui/mirage/faker'; +import { generateNetworks, generatePorts } from '../common'; + +export function topoSmall(server) { + server.createList('agent', 3); + server.createList('node', 12, { + datacenter: 'dc1', + status: 'ready', + resources: { + CPU: 4000, + MemoryMB: 8192, + DiskMB: 10000, + IOPS: 100000, + Networks: generateNetworks(), + Ports: generatePorts(), + }, + }); + + const jobResources = [ + ['M: 256, C: 150'], + ['M: 128, C: 400'], + ['M: 512, C: 100'], + ['M: 256, C: 150'], + ['M: 200, C: 50'], + ['M: 64, C: 100'], + ['M: 128, C: 150'], + ['M: 1024, C: 500'], + ['M: 100, C: 300', 'M: 200, C: 150'], + ['M: 512, C: 250', 'M: 600, C: 200'], + ]; + + jobResources.forEach(spec => { + server.create('job', { + status: 'running', + datacenters: ['dc1'], + type: 'service', + createAllocations: false, + resourceSpec: spec, + }); + }); + + server.createList('allocation', 35, { + forceRunningClientStatus: true, + }); +} + +export function topoSmallProblems(server) {} + +export function topoMedium(server) {} + +export function topoMediumBatch(server) {} + +export function topoMediumVariadic(server) {}