This repository has been archived by the owner on Jan 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the loading indicators on initial console load (#1286)
* Improve the loading indicators on initial console load * A better way of having a global busy state and indicator * Fix unit tests * Fix lint issue
- Loading branch information
1 parent
d61d957
commit b7e658e
Showing
13 changed files
with
174 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
(function () { | ||
'use strict'; | ||
angular | ||
.module('app.utils') | ||
.factory('appBusyService', appBusyServiceFactory); | ||
|
||
/** | ||
* @namespace appBusyService | ||
* @memberof app.utils | ||
* @name appBusyService | ||
* @description The application busy service | ||
* @param {object} appEventService - the event service | ||
* @returns {object} the busy service | ||
*/ | ||
function appBusyServiceFactory() { | ||
|
||
var nextBusyId = 0; | ||
|
||
// Maintain a list of outstanding busy messages - only show the most recent | ||
var busyStack = []; | ||
|
||
var busyStates = {}; | ||
|
||
return { | ||
|
||
busyState: {}, | ||
|
||
_update: function () { | ||
if (busyStack.length === 0) { | ||
this.busyState.active = false; | ||
} else { | ||
// Get the last item - that is the most recent | ||
var newestId = busyStack[busyStack.length - 1]; | ||
var busyInfo = busyStates[newestId]; | ||
this.busyState.label = busyInfo.label; | ||
this.busyState.local = busyInfo.local || false; | ||
this.busyState.active = true; | ||
} | ||
}, | ||
|
||
set: function (label, nonModal) { | ||
var id = nextBusyId; | ||
nextBusyId++; | ||
busyStates[id] = { | ||
id: id, | ||
label: label, | ||
local: nonModal || false | ||
}; | ||
busyStack.push(id); | ||
this._update(); | ||
return id; | ||
}, | ||
|
||
clear: function (id) { | ||
if (busyStack.length === 0) { | ||
return; | ||
} | ||
var newestId = busyStack[busyStack.length - 1]; | ||
delete busyStates[id]; | ||
_.remove(busyStack, function (v) { | ||
return v === id; | ||
}); | ||
|
||
// If we removed what was the newest, then we need to show the next newest, or hide the busy message if none left | ||
if (id === newestId) { | ||
this. _update(); | ||
} | ||
} | ||
}; | ||
} | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 9 additions & 6 deletions
15
components/app-framework/src/widgets/global-spinner/global-spinner.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
<div class="global-spinner" ng-if="globalSpinnerCtrl.spinnerActive"> | ||
<ng-transclude></ng-transclude> | ||
<spinner ng-if="globalSpinnerCtrl.spinnerType === 'spinner'"></spinner> | ||
<bounce-spinner ng-if="globalSpinnerCtrl.spinnerType === 'bounce-spinner'" | ||
ng-class="'{{ globalSpinnerCtrl.classes }}'"> | ||
</bounce-spinner> | ||
<div ng-class="{'global-spinner': !globalSpinnerCtrl.spinnerLocal, 'global-spinner-local': globalSpinnerCtrl.spinnerLocal}" ng-if="globalSpinnerCtrl.spinnerActive"> | ||
<div class="global-spinner-content" ng-class="{'global-spinnter-with-label': globalSpinnerCtrl.spinnerLabel}"> | ||
<ng-transclude></ng-transclude> | ||
<div ng-if="globalSpinnerCtrl.spinnerLabel" translate>{{ globalSpinnerCtrl.spinnerLabel}}</div> | ||
<spinner ng-if="globalSpinnerCtrl.spinnerType === 'spinner'"></spinner> | ||
<bounce-spinner ng-if="globalSpinnerCtrl.spinnerType === 'bounce-spinner'" | ||
ng-class="'{{ globalSpinnerCtrl.classes }}'"> | ||
</bounce-spinner> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
components/cloud-foundry/frontend/i18n/en_US/cloud-foundry.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters