Skip to content

Commit 48a7776

Browse files
committed
Disable some buttons if something is loading. Show progress bar for install, uninstall and deploy to server as we don't want any actions from the user if those actions are being done.
1 parent 0db84e2 commit 48a7776

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +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="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>
99
<button class="btn btn-default dropdown-toggle" type="button" id="headerDropdownMenu" data-toggle="dropdown" aria-expanded="true">
1010
Welcome {{status.mlUsername}}! <span class="caret"></span>
1111
</button>
@@ -14,8 +14,8 @@
1414
</ul>
1515
</div>
1616
</div>
17-
<div id="message" class="alert alert-info" ng-if="status != null && action.type !== 'Uninstall'">
18-
<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>
1919
<ul>
2020
<li ng-if="status.serverVersionAccepted">ML version is acceptable.</li>
2121
<li ng-if="!status.serverVersionAccepted">ML version is unacceptable.</li>

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ module.directive('header', [
1717
}
1818
,link : function(scope, element, attrs) {
1919
scope.logout = function () {
20+
if(scope.action.type != null) {
21+
return;
22+
}
2023
scope.loading = true;
2124
DataHub.logout()
2225
.finally(function () {
@@ -28,10 +31,12 @@ module.directive('header', [
2831
DataHub.preUninstall();
2932
},
3033
scope.installUserModules = function () {
31-
scope.loading = true;
34+
scope.action.type = 'Deploy to Server';
35+
scope.action.progressType = 'success';
36+
scope.action.message = 'Deploy to Server is in progress';
3237
DataHub.installUserModules()
3338
.finally(function () {
34-
scope.loading = false;
39+
scope.action.type = null;
3540
});
3641
}
3742
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.factory('DataHub', [
2222
service.status = data;
2323
if(!service.status.installed) {
2424
service.action.type = "Install";
25-
service.action.message = "Install in progress...";
25+
service.action.message = "Install is in progress...";
2626
service.action.progressType = "success";
2727
}
2828
})

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ <h4 class="no_margin_top"><strong>Login</strong></h4>
4545

4646
<div class="row center-block text-center">
4747
<div class="col-md-12">
48-
<button class="btn btn-primary width_100" ng-click="login">Login</button>
48+
<button class="btn btn-primary width_100" ng-click="login" ng-disabled="loading">Login</button>
4949
</div>
5050
</div>
5151
</div>

0 commit comments

Comments
 (0)