Skip to content

Commit

Permalink
No legend warning
Browse files Browse the repository at this point in the history
refs #254
  • Loading branch information
DailisLangovskis authored and raitisbe committed Sep 5, 2019
1 parent 0100185 commit d216056
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
12 changes: 12 additions & 0 deletions components/legend/legend.component.js
Expand Up @@ -20,6 +20,18 @@ export default {
layer.on('change:visible', layerVisibilityChanged);
}
},
/**
* Check if there is any visible layer
* @memberof hs.legend.controller
* @function noLayerExists
*/
noLayerExists: function () {
var visibleLayers = $scope.layerDescriptors.filter(function(check){
return check.visible == true;
});
console.log(visibleLayers);
return (visibleLayers.length == 0)
},

/**
* Remove selected layer from legend items
Expand Down
3 changes: 3 additions & 0 deletions components/legend/partials/legend.html
Expand Up @@ -2,6 +2,9 @@
<hs.layout.panel-header panel-name="legend" panel-title="'Legend'||translate"></hs.layout.panel-header>
<div class="card-body">
<p><input type="text" class="form-control" placeholder="Filter:" ng-model="query.title"></p>
<span ng-if="noLayerExists()">
<p style="text-align: center">No layer with legend exists!</p>
</span>
<ul class="list-group">
<li ng-repeat="layer in layerDescriptors | filter:query" class="list-group-item" ng-show="isLegendable(layer)">
{{layer.title}}
Expand Down
2 changes: 1 addition & 1 deletion components/legend/partials/legendmd.html
Expand Up @@ -10,7 +10,7 @@ <h3>{{layer.title}}</h3>
<md-list-item ng-repeat="layer in layers | filter:query" class="list-group-item" ng-show="hasLegend(layer, 'vector')">
<div class="md-list-item-text" layout="column">
{{layer.title}}
<p ng-repeat="category in layer.lyr.getSource().legend_categories | orderBy:'name'"><span style="background-color: {{category.color}};">&nbsp;&nbsp;&nbsp;</span>&nbsp;{{category.name}}</p>
<p ng-repeat="category in layer.lyr.getSource().legend_categories | orderBy:'name'"><span style="background-color: '{{category.color}}';">&nbsp;&nbsp;&nbsp;</span>&nbsp;{{category.name}}</p>
</div>
</md-list-item>
</md-list>
Expand Down

0 comments on commit d216056

Please sign in to comment.