Full TopoViz story

This commit is contained in:
Michael Lange 2023-06-22 16:17:17 -07:00
parent cb30ef1a0f
commit 85371941c4
1 changed files with 64 additions and 1 deletions

View File

@ -32,6 +32,43 @@ const nodeGen = (name, datacenter, memory, cpu, allocations = []) => ({
})),
});
const nodeModelGen = (datacenter, id, name, resources = '2000/1000') => {
const [cpu, memory] = resources.split('/');
return {
datacenter,
id,
name,
isEligible: true,
isDraining: false,
resources: { cpu, memory },
};
};
const allocModelGen = (
id,
taskGroupName,
clientStatus,
nodeId,
jobId,
resources = '100/100'
) => {
const [cpu, memory] = resources.split('/');
return {
id,
taskGroupName,
clientStatus,
isScheduled: true,
allocatedResources: { cpu, memory },
belongsTo(t) {
return {
id() {
return t === 'node' ? nodeId : jobId;
},
};
},
};
};
export let Node = () => ({
template: hbs`
<SvgPatterns />
@ -96,4 +133,30 @@ export let Datacenter = () => ({
},
});
export let FullViz = () => {};
export let FullViz = () => ({
template: hbs`
{{#if delayedTruth.complete}}
<TopoViz
@nodes={{nodes}}
@allocations={{allocations}}
/>
{{/if}}
`,
context: {
delayedTruth: DelayedTruth.create(),
nodes: [
nodeModelGen('dc1', '1', 'pdx-1', '2000/1000'),
nodeModelGen('dc1', '2', 'pdx-2', '2000/1000'),
nodeModelGen('dc1', '3', 'pdx-3', '2000/3000'),
nodeModelGen('dc2', '4', 'yyz-1', '2000/1000'),
nodeModelGen('dc2', '5', 'yyz-2', '2000/2000'),
],
allocations: [
allocModelGen('1', 'name', 'running', '1', 'job-1', '200/500'),
allocModelGen('1', 'name', 'running', '5', 'job-1', '200/500'),
],
setAllocation() {
console.log('hmm');
},
},
});