Merge ~ya-bo-ng/maas:one-pod-view-improvements into maas:master

Proposed by Anthony Dillon
Status: Merged
Approved by: Anthony Dillon
Approved revision: 0079a31c366cb529d28f7bbc9d2d4d31af29f623
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~ya-bo-ng/maas:one-pod-view-improvements
Merge into: maas:master
Diff against target: 62 lines (+17/-5)
2 files modified
src/maasserver/static/js/angular/controllers/pod_details.js (+6/-0)
src/maasserver/static/partials/pod-details.html (+11/-5)
Reviewer Review Type Date Requested Status
Caleb Ellis (community) Approve
Andres Rodriguez (community) Approve
Review via email: mp+355932@code.launchpad.net

Commit message

LP: #1793655 - Add over commit styling to the single pod view panel

Description of the change

Added UI that represents to CPU and RAM with overcommit applied.

Screenshots

Normal: https://screenshots.firefox.com/M8gmUWaIxNG10YqO/10.54.72.65
Over commited: https://screenshots.firefox.com/5OYE6IX8sCfMDjl2/10.54.72.65

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

Hi Ant,

I think this would fix https://bugs.launchpad.net/maas/+bug/1793655 ?

Also, another question, I thought we were gonna use a different color to highlight the overcommit section?

review: Needs Information
Revision history for this message
Anthony Dillon (ya-bo-ng) wrote :

Good point, I have amended the commit message. After a discussion we have gone from the medium term fix as of this branch instead of the short term fix of the colour change.

Revision history for this message
Andres Rodriguez (andreserl) wrote :

sounds good, although i would have just preferred to update the color.

review: Approve
Revision history for this message
Anthony Dillon (ya-bo-ng) wrote :

Sorry, I know. It has sparked a debate about the use of colours across all applications in the design/UX teams. So, to get this out the door, this is a good first step.

Revision history for this message
Caleb Ellis (caleb-ellis) wrote :

Code lgtm +1

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :
0079a31... by Anthony Dillon

Fix lint

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/static/js/angular/controllers/pod_details.js b/src/maasserver/static/js/angular/controllers/pod_details.js
2index b347b5a..7d17492 100644
3--- a/src/maasserver/static/js/angular/controllers/pod_details.js
4+++ b/src/maasserver/static/js/angular/controllers/pod_details.js
5@@ -275,6 +275,12 @@ angular.module('MAAS').controller('PodDetailsController', [
6 $scope.action.option = $scope.compose.action;
7 };
8
9+ // Calculate the available cores with overcommit applied
10+ $scope.availableWithOvercommit = function(
11+ total, used, overcommitRatio) {
12+ return (total * overcommitRatio) - used;
13+ };
14+
15 // Called before the compose params is sent over the websocket.
16 $scope.composePreProcess = function(params) {
17 params = angular.copy(params);
18diff --git a/src/maasserver/static/partials/pod-details.html b/src/maasserver/static/partials/pod-details.html
19index b3a2d51..11e73f4 100644
20--- a/src/maasserver/static/partials/pod-details.html
21+++ b/src/maasserver/static/partials/pod-details.html
22@@ -386,29 +386,35 @@
23 <div class="p-pod-summary__aside">
24 <div class="p-pod-summary__cpu">
25 <div class="row">
26- <h4>CPU cores: {$ pod.total.cores $}</h4>
27+ <h4>
28+ CPU cores: {$ pod.total.cores $}
29+ <span data-ng-if="pod.cpu_over_commit_ratio > 1">x {$ pod.cpu_over_commit_ratio $}</span>
30+ </h4>
31 </div>
32 <div class="p-meter--cpu-cores">
33 <div class="p-meter--cpu-cores__container">
34 <span class="p-meter--cpu-cores__core--used" ng-repeat="i in pod.used.cores | range"></span>
35- <span class="p-meter--cpu-cores__core--available" ng-repeat="i in pod.available.cores | range"></span>
36+ <span class="p-meter--cpu-cores__core--available" ng-repeat="i in availableWithOvercommit(pod.total.cores, pod.used.cores, pod.cpu_over_commit_ratio) | range"></span>
37 </div>
38 </div>
39 <p class="u-no-max-width">
40 <span>{$ pod.used.cores $} used</span>
41- <span class="u-float--right">{$ pod.available.cores $} available</span>
42+ <span class="u-float--right">{$ availableWithOvercommit(pod.total.cores, pod.used.cores, pod.cpu_over_commit_ratio) $} available</span>
43 </p>
44 </div>
45 <div class="p-pod-summary__ram">
46 <div class="row">
47- <h4>RAM: {$ pod.total.memory_gb $} (GiB)</h4>
48+ <h4>
49+ RAM: {$ pod.total.memory_gb $} (GiB)
50+ <span data-ng-if="pod.memory_over_commit_ratio > 1">x {$ pod.memory_over_commit_ratio $}</span>
51+ </h4>
52 </div>
53 <div class="p-meter__container">
54 <meter class="p-meter" max="{$ pod.total.memory $}" value="{$ pod.used.memory $}"></meter>
55 </div>
56 <p class="u-no-max-width">
57 <span>{$ pod.used.memory_gb $} GiB used</span>
58- <span class="u-float--right">{$ pod.available.memory_gb $} GiB available</span>
59+ <span class="u-float--right">{$ availableWithOvercommit(pod.total.memory_gb, pod.used.memory_gb, pod.memory_over_commit_ratio) $} GiB available</span>
60 </p>
61 </div>
62 </div>

Subscribers

People subscribed via source and target branches