Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a simple loading indicator for titlePane and contentPane widgets. #645

Merged
merged 2 commits into from
Dec 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions viewer/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,16 @@ body, html {
#help_parent_underlay {
display: block;
}
.widgetLoader {
color: #333;
display: block;
font-size: 18px;
left: 0;
margin: 4px;
text-align: center;
top: 0;
width: 100%;
}

/*
media queries bootstrap style
Expand Down
16 changes: 16 additions & 0 deletions viewer/js/viewer/_WidgetsMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ define([
pnl = this._createFloatingWidget(parentId, widgetConfig);
}
widgetConfig.parentWidget = pnl;
this._showWidgetLoader(pnl);
}

// 2 ways to use require to accommodate widgets that may have an optional separate configuration file
Expand Down Expand Up @@ -145,6 +146,7 @@ define([
if (widgets[key] && widgets[key].startup && !widgets[key]._started) {
widgets[key].startup();
}
this._hideWidgetLoader(pnl);
},

_setWidgetOptions: function (widgetConfig, options) {
Expand Down Expand Up @@ -186,6 +188,20 @@ define([
return options;
},

_showWidgetLoader: function (pnl) {
if (pnl && pnl.containerNode) {
pnl.loadingNode = put(pnl.containerNode, 'div.widgetLoader i.fa.fa-spinner.fa-pulse.fa-fw').parentNode;
}
},

_hideWidgetLoader: function (pnl) {
if (pnl && pnl.loadingNode) {
require(['dojo/domReady!'], function () {
put(pnl.loadingNode, '!');
});
}
},

_createTitlePaneWidget: function (parentId, widgetConfig) {
var tp,
options = lang.mixin({
Expand Down