Skip to content

Commit

Permalink
Hide pinned filter state in embed mode (#10816)
Browse files Browse the repository at this point in the history
* Hide pinned filter state in embed mode

It doesn’t make sense there, since there won’t be any cross app
navigation, so don’t expose it.

fixes #5056

* Also conditionally hide "all filter" pin state actions
  • Loading branch information
stacey-gammon authored Mar 29, 2017
1 parent b11bbc4 commit d41042a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ui/public/filter_bar/filter_bar.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="filter-bar" ng-show="filters.length">
<div class="filter" ng-class="{ negate: filter.meta.negate, disabled: filter.meta.disabled }" ng-repeat="filter in filters">
<div class="filter-description">
<span ng-if="filter.$state.store == 'globalState'"><i class="fa fa-fw fa-thumb-tack pinned"></i></span>
<span ng-if="filter.$state.store === 'globalState' && showFilterPin()"><i class="fa fa-fw fa-thumb-tack pinned"></i></span>
<span ng-if="filter.meta.alias">{{ filter.meta.alias }}</span>
<span ng-if="!filter.meta.alias">{{ filter.meta.key }}:</span>
<span ng-if="!filter.meta.alias">"{{ filter.meta.value }}"</span>
Expand All @@ -22,7 +22,7 @@
<i ng-show="filter.meta.disabled" class="fa fa-fw fa-square-o disabled"></i>
<i ng-hide="filter.meta.disabled" class="fa fa-fw fa-check-square-o enabled"></i>
</a>
<a class="action filter-pin" ng-click="pinFilter(filter)" data-test-subj="pinFilter-{{ filter.meta.key }}">
<a class="action filter-pin" ng-if="showFilterPin()" ng-click="pinFilter(filter)" data-test-subj="pinFilter-{{ filter.meta.key }}">
<i ng-show="filter.$state.store == 'globalState'" class="fa fa-fw fa-thumb-tack pinned"></i>
<i ng-hide="filter.$state.store == 'globalState'" class="fa fa-fw fa-thumb-tack fa-rotate-270 unpinned"></i>
</a>
Expand Down Expand Up @@ -90,10 +90,10 @@
<div class="filter-link">
<div class="filter-description"><a ng-click="toggleAll(true)">Disable</a></div>
</div>
<div class="filter-link">
<div class="filter-link" ng-if="showFilterPin()">
<div class="filter-description"><a ng-click="pinAll(true)">Pin</a></div>
</div>
<div class="filter-link">
<div class="filter-link" ng-if="showFilterPin()">
<div class="filter-description"><a ng-click="pinAll(false)">Unpin</a></div>
</div>
<div class="filter-link">
Expand Down
5 changes: 5 additions & 0 deletions src/ui/public/filter_bar/filter_bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import FilterBarLibChangeTimeFilterProvider from 'ui/filter_bar/lib/change_time_
import FilterBarQueryFilterProvider from 'ui/filter_bar/query_filter';
import compareFilters from './lib/compare_filters';
import uiModules from 'ui/modules';
import chrome from 'ui/chrome';
const module = uiModules.get('kibana');


Expand Down Expand Up @@ -45,6 +46,10 @@ module.directive('filterBar', function (Private, Promise, getAppState) {

$scope.state = getAppState();

// Don't show filter "pinnability" when in embedded mode, as it doesn't make sense in that context
// as there will be no cross app navigation for which the filter should persist.
$scope.showFilterPin = () => chrome.getVisible();

$scope.aceLoaded = function (editor) {
editor.$blockScrolling = Infinity;
const session = editor.getSession();
Expand Down

0 comments on commit d41042a

Please sign in to comment.