Skip to content

Commit 09c1502

Browse files
committed
use constant for geo_point and geo_shape, more TS noise
1 parent 6ee0c26 commit 09c1502

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context_state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ interface AppState {
4747
* Number of records to be fetched after the anchor records (older records)
4848
*/
4949
successorCount: number;
50-
query: Query;
50+
query?: Query;
5151
}
5252

5353
interface GlobalState {

src/legacy/core_plugins/kibana/public/discover/np_ready/components/field_chooser/field_chooser.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ import './discover_field';
2424
import './discover_field_search_directive';
2525
import './discover_index_pattern_directive';
2626
import fieldChooserTemplate from './field_chooser.html';
27-
import { IndexPatternFieldList } from '../../../../../../../../plugins/data/public';
27+
import {
28+
IndexPatternFieldList,
29+
KBN_FIELD_TYPES,
30+
} from '../../../../../../../../plugins/data/public';
2831
import { getMapsAppUrl, isFieldVisualizable, isMapsAppRegistered } from './lib/visualize_url_utils';
2932

3033
export function createFieldChooserDirective($location, config, $route) {
@@ -187,12 +190,15 @@ export function createFieldChooserDirective($location, config, $route) {
187190
return '';
188191
}
189192

190-
if ((field.type === 'geo_point' || field.type === 'geo_shape') && isMapsAppRegistered()) {
193+
if (
194+
(field.type === KBN_FIELD_TYPES.GEO_POINT || field.type === KBN_FIELD_TYPES.GEO_SHAPE) &&
195+
isMapsAppRegistered()
196+
) {
191197
return getMapsAppUrl(field, $scope.indexPattern, $scope.state, $scope.columns);
192198
}
193199

194200
let agg = {};
195-
const isGeoPoint = field.type === 'geo_point';
201+
const isGeoPoint = field.type === KBN_FIELD_TYPES.GEO_POINT;
196202
const type = isGeoPoint ? 'tile_map' : 'histogram';
197203
// If we're visualizing a date field, and our index is time based (and thus has a time filter),
198204
// then run a date histogram

src/legacy/core_plugins/kibana/public/discover/np_ready/components/field_chooser/lib/visualize_url_utils.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818
*/
1919
import uuid from 'uuid/v4';
2020
import rison from 'rison-node';
21-
import { IFieldType, IIndexPattern } from 'src/plugins/data/public';
21+
import {
22+
IFieldType,
23+
IIndexPattern,
24+
KBN_FIELD_TYPES,
25+
} from '../../../../../../../../../plugins/data/public';
2226
import { AppState } from '../../../angular/context_state';
2327
import { getServices } from '../../../../kibana_services';
2428

@@ -40,7 +44,10 @@ export function isMapsAppRegistered() {
4044
}
4145

4246
export function isFieldVisualizable(field: IFieldType) {
43-
if ((field.type === 'geo_point' || field.type === 'geo_shape') && isMapsAppRegistered()) {
47+
if (
48+
(field.type === KBN_FIELD_TYPES.GEO_POINT || field.type === KBN_FIELD_TYPES.GEO_SHAPE) &&
49+
isMapsAppRegistered()
50+
) {
4451
return true;
4552
}
4653
return field.visualizable;
@@ -65,7 +72,7 @@ export function getMapsAppUrl(
6572
}
6673

6774
// Copy filters and query in app state
68-
const mapsAppState = {
75+
const mapsAppState: object = {
6976
filters: appState.filters || [],
7077
};
7178
if (appState.query) {

0 commit comments

Comments
 (0)