Skip to content

Commit e5a5ba8

Browse files
author
Qian Xu
committed
1 parent 2c16b79 commit e5a5ba8

File tree

8 files changed

+131
-96
lines changed

8 files changed

+131
-96
lines changed

services/dashboard/index.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@
6767
<span class="icon-bar"></span>
6868
<span class="icon-bar"></span>
6969
</button>
70-
<a class="navbar-brand" href="#">GearPump</a>
70+
<a class="navbar-brand" href="#" style="color:#fff">GearPump</a>
71+
<span class="label label-default"
72+
style="float:left;vertical-align:middle;margin:17px 30px 0 0;clear:none">0.3.0</span>
7173
</div>
7274
<div collapse="navCollapsed" class="collapse navbar-collapse">
7375
<ul class="nav navbar-nav">
@@ -86,6 +88,13 @@
8688
<div ng-view></div>
8789
</div>
8890

91+
<nav class="navbar navbar-default navbar-fixed-bottom" style="min-height:0">
92+
<div class="container">
93+
<p style="display:table-cell;padding:8px 0 8px 0">Project site
94+
<a href="//gearpump.io" target="_blank">gearpump.io</a></p>
95+
</div>
96+
</nav>
97+
8998
<!-- build:js js/jquery.min.js -->
9099
<script src="webjars/jquery/2.0.3/jquery.min.js"></script>
91100
<!-- endbuild -->
@@ -138,6 +147,7 @@
138147
<script src="scripts/app.js"></script>
139148
<script src="scripts/app-01.js"></script>
140149
<script src="scripts/app-02.js"></script>
150+
<script src="scripts/app-03.js"></script>
141151
<script src="scripts/structures.js"></script>
142152

143153
<!-- applist widget -->

services/dashboard/partials/app.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
<ol class="breadcrumb">
2+
<li><a href="#/apps">Applications</a></li>
3+
<li class="active">app{{$routeParams.appId}}</li>
4+
</ol>
15
<adf-dashboard name="{{name}}" collapsible="{{collapsible}}" structure="4-8" adf-model="model" />

services/dashboard/partials/apps.html

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
<div class="row">
2-
<div class="col-md-6">
3-
<table class="table table-striped">
4-
<caption><h4>Applications</h4></caption>
5-
<thead>
6-
<tr>
7-
<td>ID</td>
8-
<td>Name</td>
9-
<td>Status</td>
10-
<td>AppMaster Path</td>
11-
</tr>
12-
</thead>
13-
<tbody>
14-
<tr ng-repeat="app in apps track by $index">
15-
<td ng-click="loadDag(app.id)">{{app.id}}</td>
16-
<td ng-click="loadDag(app.id)">{{app.name}}</td>
17-
<td ng-click="loadDag(app.id)">{{app.status}}</td>
18-
<td ng-click="loadDag(app.id)">{{app.appMasterPath}}</td>
19-
</tr>
20-
</tbody>
21-
</table>
22-
</div>
23-
<div class="col-md-6">
24-
<adf-dashboard name="{{name}}" collapsible="{{collapsible}}" structure="4-8" adf-model="model"/>
25-
</div>
2+
<table class="table table-striped table-hover">
3+
<caption><h4>Applications History</h4></caption>
4+
<thead>
5+
<tr>
6+
<th>ID</th>
7+
<th>Name</th>
8+
<th>Status</th>
9+
<th>AppMaster Path</th>
10+
<th>Worker Path</th>
11+
<th>Action</th>
12+
</tr>
13+
</thead>
14+
<tbody>
15+
<tr ng-repeat="app in apps track by $index">
16+
<th scope="row" ng-click="loadDag(app.id)">{{app.id}}</th>
17+
<td>{{app.name}}</td>
18+
<td><span ng-class="app.status=='active'?'label-success':'label-default'" class="label">
19+
{{app.status}}</span>
20+
</td>
21+
<td>{{app.appMasterPath}}</td>
22+
<td>{{app.workerPath}}</td>
23+
<td><a href="#/app/{{app.id}}">View Charts</a></td>
24+
</tr>
25+
</tbody>
26+
</table>
2627
</div>

services/dashboard/scripts/app-02.js

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,47 +23,18 @@
2323
*/
2424
'use strict';
2525

26-
angular.module('app-02', ['adf', 'app.widgets.visdag'])
27-
.controller('app02Ctrl', function($scope, $rootScope, $http){
28-
29-
var name = 'app-02';
30-
var model = null;//localStorageService.get(name);
31-
if (!model) {
32-
model = {
33-
title: " ",
34-
structure: "4-8",
35-
rows: [{
36-
columns: [{
37-
widgets: [
38-
{
39-
type: "visdag",
40-
config: {
41-
},
42-
title: "DAG(Click AppId on the left to show the DAG)"
43-
}
44-
]
45-
}]
46-
}]
47-
};
48-
}
49-
$scope.name = name;
50-
$scope.model = model;
51-
$scope.collapsible = false;
52-
53-
$scope.loadDag = function(appId) {
54-
$scope.$broadcast('appmaster-selected', {appId: appId});
55-
}
56-
26+
angular.module('app-02', [])
27+
.controller('app02Ctrl', function($scope, $http){
5728
var url = location.origin + '/appmasters';
5829
$http.get(url).then(function (response) {
5930
var masters = response.data.appMasters;
6031
$scope.apps = masters.map(function(app) {
6132
return {
6233
id: app.appId,
6334
name: app.appName,
64-
workerPath: app.workerPath,
6535
status: app.status,
66-
appMasterPath: app.appMasterPath
36+
appMasterPath: app.appMasterPath,
37+
workerPath: app.workerPath
6738
};
6839
});
6940
}, function (err) {

services/dashboard/scripts/app-03.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* *
2+
* The MIT License
3+
*
4+
* Copyright (c) 2014, Sebastian Sdorra
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*/
24+
'use strict';
25+
26+
angular.module('app-03', ['adf', 'app.widgets.visdag'])
27+
.controller('app03Ctrl', function($scope) {
28+
$scope.name = 'app-03';
29+
$scope.model = {
30+
title: " ",
31+
structure: "4-8",
32+
rows: [{
33+
columns: [{
34+
widgets: [
35+
{
36+
type: "visdag",
37+
config: {
38+
},
39+
title: "DAG"
40+
}
41+
]
42+
}]
43+
}]
44+
};
45+
$scope.collapsible = false;
46+
});

services/dashboard/scripts/app.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,27 @@
2525

2626
angular.module('app', [
2727
// Angular modules
28-
'LocalStorageModule',
2928
'ngRoute',
3029
// Angular-dashboard-framework (including extensions)
3130
'adf',
3231
'structures',
3332
// Application extensions
3433
'app.tabset',
3534
// Application controllers
36-
'app-01',
37-
'app-02'
35+
'app-01',
36+
'app-02',
37+
'app-03'
3838
])
39-
.config(function($routeProvider, localStorageServiceProvider){
40-
localStorageServiceProvider.setPrefix('adf');
41-
39+
.config(function($routeProvider){
4240
$routeProvider.when('/cluster', {
4341
templateUrl: 'partials/cluster.html',
4442
controller: 'app01Ctrl'
4543
}).when('/apps', {
4644
templateUrl: 'partials/apps.html',
4745
controller: 'app02Ctrl'
46+
}).when('/app/:appId', {
47+
templateUrl: 'partials/app.html',
48+
controller: 'app03Ctrl'
4849
}).otherwise({redirectTo: '/cluster'});
4950

5051
})

services/dashboard/scripts/widgets/visdag/visdag.js

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -37,41 +37,39 @@ angular.module('app.widgets.visdag', ['adf.provider'])
3737
}
3838
});
3939
})
40-
.controller('visDagCtrl', function ($scope, $http) {
41-
$scope.$on('appmaster-selected', function(event, appMasterSelected) {
42-
var url = location.origin + '/appmaster/' + appMasterSelected.appId + '?detail=true';
43-
$http.get(url).then(function (response) {
44-
var json = response.data;
45-
$scope.data = {
46-
nodes: [],
47-
edges: []
48-
};
40+
.controller('visDagCtrl', function ($scope, $http, $routeParams) {
41+
var url = location.origin + '/appmaster/' + $routeParams.appId + '?detail=true';
42+
$http.get(url).then(function (response) {
43+
var json = response.data;
44+
$scope.data = {
45+
nodes: [],
46+
edges: []
47+
};
4948

50-
function lastPart(name) {
51-
var parts = name.split(/\./);
52-
return parts[parts.length - 1];
53-
}
49+
function lastPart(name) {
50+
var parts = name.split(/\./);
51+
return parts[parts.length - 1];
52+
}
5453

55-
json.dag.vertices.forEach(function (vertex, i) {
56-
var name = lastPart(vertex);
57-
$scope.data.nodes.push({id: name, label: name});
58-
});
54+
json.dag.vertices.forEach(function (vertex, i) {
55+
var name = lastPart(vertex);
56+
$scope.data.nodes.push({id: name, label: name});
57+
});
5958

60-
json.dag.edges.forEach(function (edge, i) {
61-
var source = lastPart(edge[0]);
62-
var target = lastPart(edge[2]);
63-
var value = lastPart(edge[1]);
64-
$scope.data.edges.push({from: source, to: target, label: value});
65-
});
59+
json.dag.edges.forEach(function (edge, i) {
60+
var source = lastPart(edge[0]);
61+
var target = lastPart(edge[2]);
62+
var value = lastPart(edge[1]);
63+
$scope.data.edges.push({from: source, to: target, label: value});
64+
});
6665

67-
$scope.$broadcast('appmaster-data', {
68-
data: $scope.data,
69-
reset: false
70-
});
71-
}, function (err) {
72-
$scope.$broadcast('appmaster-data', {
73-
reset: true
74-
});
66+
$scope.$broadcast('appmaster-data', {
67+
data: $scope.data,
68+
reset: false
69+
});
70+
}, function (err) {
71+
$scope.$broadcast('appmaster-data', {
72+
reset: true
7573
});
7674
});
7775
})
@@ -86,7 +84,7 @@ angular.module('app.widgets.visdag', ['adf.provider'])
8684
height: '600px',
8785
hierarchicalLayout: {
8886
layout: 'direction',
89-
direction: "UD",
87+
direction: "UD"
9088
},
9189
stabilize: true /* stabilize positions before displaying */,
9290
nodes: {

services/dashboard/styles/main.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,8 @@ pre.edit {
137137
border: 3px solid transparent;
138138
border-width: 3px 0;
139139
border-bottom-color: #dd4b39;
140+
}
141+
142+
.breadcrumb {
143+
background-color: transparent;
140144
}

0 commit comments

Comments
 (0)