Skip to content

Commit 34365c4

Browse files
committed
Changes to include an install and uninstall page
1 parent af32312 commit 34365c4

File tree

12 files changed

+11376
-25
lines changed

12 files changed

+11376
-25
lines changed

quick-start/src/main/webapp/WEB-INF/static/app/directives/header.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
</div>
66
<div id="sitemenu" class="col-xs-6 col-sm-6 col-md-6 dropdown" ng-if="status != null">
77
<button type="submit" name="installUserModules" class="btn btn-primary" ng-if="status.installed" ng-click="installUserModules()">Deploy to server</button>
8-
<button type="submit" name="install" class="btn btn-default" ng-if="!status.installed" ng-click="install()">Install</button>
98
<button type="submit" name="uninstall" class="btn btn-primary" ng-if="status.installed" ng-click="uninstall()">Uninstall</button>
109
<button class="btn btn-default dropdown-toggle" type="button" id="headerDropdownMenu" data-toggle="dropdown" aria-expanded="true">
1110
Welcome {{status.mlUsername}}! <span class="caret"></span>
@@ -15,7 +14,7 @@
1514
</ul>
1615
</div>
1716
</div>
18-
<div id="message" class="alert alert-info" ng-if="status != null">
17+
<div id="message" class="alert alert-info" ng-if="status != null && action.type !== 'Uninstall'">
1918
<a href="dismiss" class="close" data-dismiss="alert" aria-label="close">&times;</a>
2019
<ul>
2120
<li ng-if="status.serverVersionAccepted">ML version is acceptable.</li>

quick-start/src/main/webapp/WEB-INF/static/app/directives/headerDirective.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,15 @@ module.directive('header', [
1717
}
1818
,link : function(scope, element, attrs) {
1919
scope.logout = function () {
20-
DataHub.logout();
21-
$location.path('/login');
22-
},
23-
scope.install = function () {
2420
scope.loading = true;
25-
DataHub.install()
26-
.finally(function () {
27-
scope.loading = false;
28-
});
29-
},
30-
scope.uninstall = function () {
31-
scope.loading = true;
32-
DataHub.uninstall()
33-
.finally(function () {
34-
scope.loading = false;
21+
DataHub.logout()
22+
.finally(function () {
23+
scope.loading = false;
24+
$location.path('/login');
3525
});
26+
},
27+
scope.uninstall = function () {
28+
DataHub.preUninstall();
3629
},
3730
scope.installUserModules = function () {
3831
scope.loading = true;

quick-start/src/main/webapp/WEB-INF/static/app/quickStartApp.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ var dependencies = [
66
,'dhib.quickstart.directives.footer'
77
,'dhib.quickstart.directives.spinner'
88
,'angularBootstrapNavTree'
9+
,'ngAnimate'
10+
,'ui.bootstrap'
911
];
1012
var module = angular.module('quickStartApp', dependencies);
1113

quick-start/src/main/webapp/WEB-INF/static/app/services/dataHubService.js

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,19 @@ module.factory('DataHub', [
1212
,$route
1313
) {
1414
var service = {
15+
16+
action : {}
1517

16-
login : function (loginForm) {
18+
,login : function (loginForm) {
1719
var promise = $http
1820
.post('api/data-hub/login', loginForm)
1921
.success(function (data) {
2022
service.status = data;
23+
if(!service.status.installed) {
24+
service.action.type = "Install";
25+
service.action.message = "Install in progress...";
26+
service.action.progressType = "success";
27+
}
2128
})
2229
.error(function () {
2330
service.status = null;
@@ -59,25 +66,39 @@ module.factory('DataHub', [
5966
var promise = $http.post('api/data-hub/install')
6067
.success(function (status) {
6168
service.status = status;
69+
service.action.type = null;
6270
service.displayMessage('Install is successful.', 'success', 'notification', false);
6371
service.reloadRoute();
6472
})
6573
.error(function () {
66-
service.displayMessage('Install is unsuccessful.', 'error', 'notification', false);
74+
service.action.message = "Install is unsuccessful.";
75+
service.action.progressType = "danger";
76+
//service.displayMessage('Install is unsuccessful.', 'error', 'notification', false);
6777
});
6878

6979
return promise;
7080
}
7181

82+
,preUninstall : function() {
83+
service.action.type = 'Uninstall';
84+
service.action.progressType = 'success';
85+
service.action.message = 'Uninstall is in progress';
86+
service.reloadRoute();
87+
}
88+
7289
,uninstall : function () {
7390
var promise = $http.post('api/data-hub/uninstall')
7491
.success(function (status) {
7592
service.status = status;
76-
service.displayMessage('Uninstall is successful.', 'success', 'notification', false);
77-
service.reloadRoute();
93+
service.action.type = "Uninstall";
94+
service.action.message = "Uninstall is successful.";
95+
//service.displayMessage('Uninstall is successful.', 'success', 'notification', false);
96+
//service.reloadRoute();
7897
})
7998
.error(function () {
80-
service.displayMessage('Uninstall is unsuccessful.', 'error', 'notification', false);
99+
service.action.message = "Uninstall is unsuccessful.";
100+
service.action.progressType = "danger";
101+
//service.displayMessage('Uninstall is unsuccessful.', 'error', 'notification', false);
81102
});
82103

83104
return promise;

quick-start/src/main/webapp/WEB-INF/static/css/quick-start.css

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,48 @@ ul.nav.abn-tree i {
211211
.spinner > .child {
212212
position: relative;
213213
left: 50%;
214+
float: right;
215+
z-index: 1000;
216+
}
217+
218+
.fa-spin {
219+
font-size: 80px;
220+
margin: 0px;
221+
float: right;
222+
z-index: 1000;
223+
}
224+
225+
.nav, .pagination, .carousel, .panel-title a {
226+
cursor: pointer;
227+
}
228+
229+
#progressBar {
230+
background-color: #444547;
231+
display: table;
232+
height: 450px;
233+
width: 100%;
234+
}
235+
236+
#progressBar > div {
237+
display: table-cell;
238+
vertical-align: middle;
239+
}
240+
241+
#progressBar > div {
242+
margin-left: auto;
243+
margin-right: auto;
244+
width: 200px;
245+
}
246+
247+
.progress {
248+
height: 30px;
249+
}
250+
251+
.progress span {
252+
font-size: 25px;
253+
line-height: 20px;
254+
}
255+
256+
.progress-bar {
257+
padding: 3px;
214258
}

quick-start/src/main/webapp/WEB-INF/static/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
<!-- Angular -->
1313
<script src="lib/angular.js/js/angular.js"></script>
1414
<script src="lib/angular.js/js/angular-route.js"></script>
15+
<script src="lib/angular.js/js/angular-animate.js"></script>
16+
<script src="lib/angular.js/js/ui-bootstrap-tpls-1.1.2.js"></script>
1517

1618
<!-- Angular Dependencies -->
1719
<script src="lib/jquery/js/jquery.min.js"></script>

0 commit comments

Comments
 (0)