Repository: mesos
Updated Branches:
  refs/heads/master 9350af4ac -> c05eab4f4


Introduced a Roles tab in the webui.

Initially, this includes the weight, number of frameworks involved
with the role, and the resource allocation. Longer term this should
include the quota information and the revocable resources.

Review: https://reviews.apache.org/r/57622/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c05eab4f
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c05eab4f
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c05eab4f

Branch: refs/heads/master
Commit: c05eab4f4dfc87555cd131c82d9792cb71a796f4
Parents: 9350af4
Author: Benjamin Mahler <[email protected]>
Authored: Sat Mar 18 14:02:23 2017 +0800
Committer: Haosdent Huang <[email protected]>
Committed: Sat Mar 18 14:14:26 2017 +0800

----------------------------------------------------------------------
 src/Makefile.am                           |  1 +
 src/webui/master/static/index.html        |  3 +++
 src/webui/master/static/js/app.js         |  2 ++
 src/webui/master/static/js/controllers.js | 27 ++++++++++++++++++++
 src/webui/master/static/roles.html        | 34 ++++++++++++++++++++++++++
 5 files changed, 67 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c05eab4f/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index 8c67e47..071656a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1583,6 +1583,7 @@ nobase_dist_pkgdata_DATA +=                               
                \
   webui/master/static/maintenance.html                                 \
   webui/master/static/offers.html                                      \
   webui/master/static/pailer.html                                      \
+  webui/master/static/roles.html                                       \
   webui/master/static/directives/pagination.html                       \
   webui/master/static/directives/tableHeader.html                      \
   webui/master/static/directives/timestamp.html

http://git-wip-us.apache.org/repos/asf/mesos/blob/c05eab4f/src/webui/master/static/index.html
----------------------------------------------------------------------
diff --git a/src/webui/master/static/index.html 
b/src/webui/master/static/index.html
index 7811ecb..d657eb3 100644
--- a/src/webui/master/static/index.html
+++ b/src/webui/master/static/index.html
@@ -42,6 +42,9 @@
               <li data-ng-class="{active: (navbarActiveTab === 'agents')}">
                 <a href="#/agents">Agents</a>
               </li>
+              <li data-ng-class="{active: (navbarActiveTab === 'roles')}">
+                <a href="#/roles">Roles</a>
+              </li>
               <li data-ng-class="{active: (navbarActiveTab === 'offers')}">
                 <a href="#/offers">Offers</a>
               </li>

http://git-wip-us.apache.org/repos/asf/mesos/blob/c05eab4f/src/webui/master/static/js/app.js
----------------------------------------------------------------------
diff --git a/src/webui/master/static/js/app.js 
b/src/webui/master/static/js/app.js
index 73043a8..e11f881 100644
--- a/src/webui/master/static/js/app.js
+++ b/src/webui/master/static/js/app.js
@@ -22,6 +22,8 @@
           {templateUrl: 'static/maintenance.html', controller: 
'MaintenanceCtrl'})
         .when('/offers',
           {templateUrl: 'static/offers.html', controller: 'OffersCtrl'})
+        .when('/roles',
+          {templateUrl: 'static/roles.html', controller: 'RolesCtrl'})
 
         // TODO(tomxing): Remove the following '/slaves/*' paths once the
         // slave->agent rename is complete(MESOS-3779).

http://git-wip-us.apache.org/repos/asf/mesos/blob/c05eab4f/src/webui/master/static/js/controllers.js
----------------------------------------------------------------------
diff --git a/src/webui/master/static/js/controllers.js 
b/src/webui/master/static/js/controllers.js
index ae3e787..fa4742a 100644
--- a/src/webui/master/static/js/controllers.js
+++ b/src/webui/master/static/js/controllers.js
@@ -331,6 +331,10 @@
         tab: 'frameworks'
       },
       {
+        pathRegexp: /^\/roles/,
+        tab: 'roles'
+      },
+      {
         pathRegexp: /^\/offers/,
         tab: 'offers'
       },
@@ -483,6 +487,29 @@
 
   mesosApp.controller('FrameworksCtrl', function() {});
 
+  mesosApp.controller('RolesCtrl', function($scope, $http) {
+    var update = function() {
+      // TODO(haosdent): Send requests to the leading master directly
+      // once `leadingMasterURL` is public.
+      $http.jsonp('/master/roles?jsonp=JSON_CALLBACK')
+      .success(function(response) {
+        $scope.roles = response;
+      })
+      .error(function() {
+        if ($scope.isErrorModalOpen === false) {
+          popupErrorModal();
+        }
+      });
+    };
+
+    if ($scope.state) {
+      update();
+    }
+
+    var removeListener = $scope.$on('state_updated', update);
+    $scope.$on('$routeChangeStart', removeListener);
+  });
+
   mesosApp.controller('OffersCtrl', function() {});
 
   mesosApp.controller('MaintenanceCtrl', function($scope, $http) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/c05eab4f/src/webui/master/static/roles.html
----------------------------------------------------------------------
diff --git a/src/webui/master/static/roles.html 
b/src/webui/master/static/roles.html
new file mode 100644
index 0000000..a8ca03e
--- /dev/null
+++ b/src/webui/master/static/roles.html
@@ -0,0 +1,34 @@
+<ol class="breadcrumb">
+  <li>
+    <a class="badge badge-type" href="#/">Master</a>
+  </li>
+  <li class="active">
+    <span class="badge badge-type">Roles</span>
+  </li>
+</ol>
+
+<table m-table table-content="roles.roles" title="Roles"
+  class="table table-striped table-bordered table-condensed">
+  <thead>
+    <tr>
+      <th data-key="name" data-sort>Role</th>
+      <th data-key="weight">Weight</th>
+      <th data-key="frameworks.length">Frameworks</th>
+      <th data-key="resources.cpus">CPUs</th>
+      <th data-key="resources.gpus">GPUs</th>
+      <th data-key="resources.mem">Mem</th>
+      <th data-key="resources.disk">Disk</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr ng-repeat="role in $data">
+      <td>{{role.name}}</td>
+      <td>{{role.weight | number}}</td>
+      <td>{{role.frameworks.length | number}}</td>
+      <td>{{role.resources.cpus | decimalFloat}}</td>
+      <td>{{role.resources.gpus | decimalFloat}}</td>
+      <td>{{role.resources.mem * (1024 * 1024) | dataSize}}</td>
+      <td>{{role.resources.disk * (1024 * 1024) | dataSize}}</td>
+    </tr>
+  </tbody>
+</table>

Reply via email to