-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9886 from hashicorp/b-ui/topo-viz-accounting
UI: Topology info panel incorrect accounting bugs
- Loading branch information
Showing
6 changed files
with
267 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,15 +47,17 @@ export default class TopologyControllers extends Controller { | |
return reduceToLargestUnit(this.totalMemory)[1]; | ||
} | ||
|
||
@computed('model.allocations[email protected]') | ||
@computed('scheduledAllocations[email protected]') | ||
get totalReservedMemory() { | ||
const mibs = this.model.allocations.mapBy('allocatedResources.memory').reduce(sumAggregator, 0); | ||
const mibs = this.scheduledAllocations | ||
.mapBy('allocatedResources.memory') | ||
.reduce(sumAggregator, 0); | ||
return mibs * 1024 * 1024; | ||
} | ||
|
||
@computed('model.allocations[email protected]') | ||
@computed('scheduledAllocations[email protected]') | ||
get totalReservedCPU() { | ||
return this.model.allocations.mapBy('allocatedResources.cpu').reduce(sumAggregator, 0); | ||
return this.scheduledAllocations.mapBy('allocatedResources.cpu').reduce(sumAggregator, 0); | ||
} | ||
|
||
@computed('totalMemory', 'totalReservedMemory') | ||
|
@@ -70,13 +72,13 @@ export default class TopologyControllers extends Controller { | |
return this.totalReservedCPU / this.totalCPU; | ||
} | ||
|
||
@computed('activeAllocation', 'model.allocations.@each.{taskGroupName,job}') | ||
@computed('activeAllocation', 'scheduledAllocations.@each.{taskGroupName,job}') | ||
get siblingAllocations() { | ||
if (!this.activeAllocation) return []; | ||
const taskGroup = this.activeAllocation.taskGroupName; | ||
const jobId = this.activeAllocation.belongsTo('job').id(); | ||
|
||
return this.model.allocations.filter(allocation => { | ||
return this.scheduledAllocations.filter(allocation => { | ||
return allocation.taskGroupName === taskGroup && allocation.belongsTo('job').id() === jobId; | ||
}); | ||
} | ||
|
@@ -104,7 +106,7 @@ export default class TopologyControllers extends Controller { | |
|
||
@computed('[email protected]') | ||
get uniqueActiveAllocationNodes() { | ||
return this.siblingAllocations.mapBy('node').uniq(); | ||
return this.siblingAllocations.mapBy('node.id').uniq(); | ||
} | ||
|
||
@action | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.