Skip to content

Commit

Permalink
Backport PR #8694
Browse files Browse the repository at this point in the history
---------

**Commit 1:**
Conditionally show Visualize button based on aggregatable status

* Original sha: 76c2687
* Authored by Matthew Bargar <[email protected]> on 2016-10-14T22:23:37Z

**Commit 2:**
Switch to ng-show so controller can maintain reference to Visualize button and remove it upon toggle

* Original sha: 9da6ddf
* Authored by Matthew Bargar <[email protected]> on 2016-10-17T17:21:11Z

**Commit 3:**
Add visualizable flag to field object

* Original sha: 75a2f23
* Authored by Matthew Bargar <[email protected]> on 2016-10-17T17:39:13Z
  • Loading branch information
elastic-jasper committed Oct 17, 2016
1 parent 602f897 commit 6874f1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ <h5 ng-show="!field.details.error">Quick Count <kbn-info info="Top 5 values base

<a
ng-href="{{vizLocation(field)}}"
ng-show="field.visualizable"
class="sidebar-item-button primary">
Visualize
<span class="discover-field-vis-warning" ng-show="warnings.length" tooltip="{{warnings.join(' ')}}">
Expand Down
8 changes: 6 additions & 2 deletions src/ui/public/index_patterns/_field.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export default function FieldObjectProvider(Private, shortDotsFilter, $rootScope
let scripted = !!spec.scripted;
let sortable = spec.name === '_score' || ((indexed || scripted) && type.sortable);
let filterable = spec.name === '_id' || scripted || (indexed && type.filterable);
let searchable = !!spec.searchable || scripted;
let aggregatable = !!spec.aggregatable || scripted;
let visualizable = aggregatable;

obj.fact('name');
obj.fact('type');
Expand All @@ -58,13 +61,14 @@ export default function FieldObjectProvider(Private, shortDotsFilter, $rootScope
obj.fact('doc_values', !!spec.doc_values);

// stats
obj.fact('searchable', !!spec.searchable || scripted);
obj.fact('aggregatable', !!spec.aggregatable || scripted);
obj.fact('searchable', searchable);
obj.fact('aggregatable', aggregatable);

// usage flags, read-only and won't be saved
obj.comp('format', format);
obj.comp('sortable', sortable);
obj.comp('filterable', filterable);
obj.comp('visualizable', visualizable);

// computed values
obj.comp('indexPattern', indexPattern);
Expand Down

0 comments on commit 6874f1b

Please sign in to comment.