Skip to content

Commit 38df074

Browse files
committed
Merge pull request #60 from maeisabelle/Quick-Start-InstallUninstall
Quick-Start Install and Uninstall
2 parents af32312 + 7f14670 commit 38df074

File tree

16 files changed

+11437
-31
lines changed

16 files changed

+11437
-31
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
<img id="img_logo" src="images/logo.png">
55
</div>
66
<div id="sitemenu" class="col-xs-6 col-sm-6 col-md-6 dropdown" ng-if="status != null">
7-
<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>
9-
<button type="submit" name="uninstall" class="btn btn-primary" ng-if="status.installed" ng-click="uninstall()">Uninstall</button>
7+
<button type="submit" name="installUserModules" class="btn btn-primary" ng-if="status.installed" ng-click="installUserModules()" ng-disabled="action.type != null">Deploy to server</button>
8+
<button type="submit" name="uninstall" class="btn btn-primary" ng-if="status.installed" ng-click="uninstall()" ng-disabled="action.type != null">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>
1211
</button>
@@ -15,8 +14,8 @@
1514
</ul>
1615
</div>
1716
</div>
18-
<div id="message" class="alert alert-info" ng-if="status != null">
19-
<a href="dismiss" class="close" data-dismiss="alert" aria-label="close">&times;</a>
17+
<div id="message" class="alert alert-info" ng-if="status != null && action.type === 'Install'">
18+
<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>
2221
<li ng-if="!status.serverVersionAccepted">ML version is unacceptable.</li>

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

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ var module = angular.module('dhib.quickstart.directives.header', dependencies);
44
module.directive('header', [
55
'$http'
66
,'$location'
7+
,'$mdDialog'
78
,'DataHub'
89
,function(
910
$http
1011
,$location
12+
,$mdDialog
1113
,DataHub
1214
) {
1315
return {
@@ -17,28 +19,36 @@ module.directive('header', [
1719
}
1820
,link : function(scope, element, attrs) {
1921
scope.logout = function () {
20-
DataHub.logout();
21-
$location.path('/login');
22-
},
23-
scope.install = function () {
22+
if(scope.action.type != null) {
23+
return;
24+
}
2425
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;
26+
DataHub.logout()
27+
.finally(function () {
28+
scope.loading = false;
29+
$location.path('/login');
3530
});
31+
},
32+
scope.uninstall = function (ev) {
33+
var confirm = $mdDialog.confirm().title('Confirm Uninstall')
34+
.textContent('Do you really want to continue uninstalling data hub?')
35+
.ariaLabel('Uninstall')
36+
.targetEvent(ev)
37+
.ok('Yes')
38+
.cancel('No');
39+
$mdDialog.show(confirm).then(function() {
40+
DataHub.preUninstall();
41+
}, function() {
42+
//do nothing
43+
});
3644
},
3745
scope.installUserModules = function () {
38-
scope.loading = true;
46+
scope.action.type = 'Deploy to Server';
47+
scope.action.progressType = 'success';
48+
scope.action.message = 'Deploy to Server is in progress';
3949
DataHub.installUserModules()
4050
.finally(function () {
41-
scope.loading = false;
51+
scope.action.type = null;
4252
});
4353
}
4454
}

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

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

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 is 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: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,47 @@ 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+
width: 0px;
221+
margin: 0px;
222+
}
223+
224+
.nav, .pagination, .carousel, .panel-title a {
225+
cursor: pointer;
226+
}
227+
228+
#progressBar {
229+
background-color: #444547;
230+
display: table;
231+
height: 450px;
232+
width: 100%;
233+
}
234+
235+
#progressBar > div {
236+
display: table-cell;
237+
vertical-align: middle;
238+
}
239+
240+
#progressBar > div {
241+
margin-left: auto;
242+
margin-right: auto;
243+
width: 200px;
244+
}
245+
246+
.progress {
247+
height: 30px;
248+
}
249+
250+
.progress span {
251+
font-size: 25px;
252+
line-height: 20px;
253+
}
254+
255+
.progress-bar {
256+
padding: 3px;
214257
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
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>
17+
<script src="lib/angular.js/js/angular-aria.min.js"></script>
18+
<script src="lib/angular.js/js/angular-material.min.js"></script>
1519

1620
<!-- Angular Dependencies -->
1721
<script src="lib/jquery/js/jquery.min.js"></script>
@@ -35,6 +39,7 @@
3539
<link href="lib/bootstrap-3.3.6-dist/css/bootstrap.min.css" rel="stylesheet"></link>
3640
<link href="lib/font-awesome/css/font-awesome.min.css" rel="stylesheet"></link>
3741
<link href="lib/abn_tree/css/abn_tree.css" rel="stylesheet"></link>
42+
<link href="lib/angular.js/css/angular-material.min.css" rel="stylesheet"></link>
3843

3944

4045
<!-- App-Specific CSS -->

quick-start/src/main/webapp/WEB-INF/static/lib/angular.js/css/angular-material.min.css

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)