Skip to content

Commit

Permalink
fix up loading spinner and show/hide label picker if no selections pr…
Browse files Browse the repository at this point in the history
…ovided
  • Loading branch information
green3g committed Jun 21, 2017
1 parent d03b9bb commit 28047e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions widgets/LabelLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ define([
this.labelInfos[layerId][sublayer].selections;
this.tabContainer.selectChild(this.tabBasic);
if (hasSelections) {
this.set('hasLabels', true);
this.emptyStore(this.labelSelectionStore);
this.labelInfos[layerId][sublayer].selections.forEach(lang.hitch(this, function (labelObj) {
labelObj.id = '_' + count++;
Expand All @@ -272,12 +273,15 @@ define([
this.labelSelect.set('value', '_' + 1);
this.labelTextbox.set('value', this.labelSelectionStore.get('_' + 1).value);
this.addSelectedLabels();
domClass.remove(this.defaultLabelWrapper, 'dijitHidden');
} else {
domClass.add(this.defaultLabelWrapper, 'dijitHidden');
this.set('hasLabels', false);
}
},
_setFields: function (fields) {
if (!fields.length) {
return;
}
this.set('hasLabels', true);

fields.forEach(lang.hitch(this, function (f) {
this.labelSelectionStore.put({
Expand All @@ -287,6 +291,10 @@ define([
});
}));
},
hasLabels: false,
_setHasLabelsAttr: function (labels) {
domClass[labels ? 'remove' : 'add'](this.fieldSpinner, 'dijitHidden');
},
/**
* Display a field loading spinner
* set using `this.set('fieldsLoading', true)`
Expand Down
2 changes: 1 addition & 1 deletion widgets/LabelLayer/templates/LabelLayer.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<div data-dojo-type="dijit/layout/TabContainer" data-dojo-attach-point="tabContainer" style="height:82%;">
<div data-dojo-type="dijit/layout/ContentPane" title="Labels" data-dojo-attach-point="tabBasic">

<span data-dojo-attach-point="fieldSpinner" class="dijitHidden"><i class="fa fa-spinner fa-spin"></i> Loading fields...</span>
<div data-dojo-attach-point="defaultLabelWrapper">
<label for="fieldSelect">${i18n.labelSelect.label}:
<span data-dojo-attach-point="fieldSpinner" class="dijitHidden"><i class="fa fa-spinner fa-spin"></i></span>
</label>
<br />
<input data-dojo-type="dijit/form/FilteringSelect" data-dojo-props="
Expand Down

0 comments on commit 28047e4

Please sign in to comment.