Skip to content

Commit

Permalink
Remove passing originatingApp as trigger options at all to replace "S…
Browse files Browse the repository at this point in the history
…ave and return" with "Save" for the field visualized from Discover
  • Loading branch information
DianaDerevyankina committed Apr 6, 2022
1 parent e2dafec commit 23b27ab
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/plugins/discover/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

export const APP_ID = 'discover';
export const DEFAULT_COLUMNS_SETTING = 'defaultColumns';
export const SAMPLE_SIZE_SETTING = 'discover:sampleSize';
export const SORT_DEFAULT_ORDER_SETTING = 'discover:sort:defaultOrder';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function DiscoverChart({
if (!timeField) {
return;
}
triggerVisualizeActions(timeField, indexPattern.id, savedSearch.columns || [], false);
triggerVisualizeActions(timeField, indexPattern.id, savedSearch.columns || []);
}, [indexPattern.id, savedSearch, timeField]);

const onShowChartOptions = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
import { getUiActions } from '../../../../../kibana_services';
import type { DataViewField } from '../../../../../../../data_views/public';
import { KBN_FIELD_TYPES } from '../../../../../../../data/public';
import { APP_ID } from '../../../../../../common';

function getTriggerConstant(type: string) {
return type === KBN_FIELD_TYPES.GEO_POINT || type === KBN_FIELD_TYPES.GEO_SHAPE
Expand Down Expand Up @@ -46,20 +45,14 @@ async function getCompatibleActions(
export function triggerVisualizeActions(
field: DataViewField,
indexPatternId: string | undefined,
contextualFields: string[],
shouldPassOriginatingApp: boolean = true
contextualFields: string[]
) {
if (!indexPatternId) return;
const trigger = getTriggerConstant(field.type);
const triggerOptions = {
indexPatternId,
fieldName: field.name,
contextualFields,
...(shouldPassOriginatingApp
? {
originatingApp: APP_ID,
}
: {}),
};
getUiActions().getTrigger(trigger).exec(triggerOptions);
}
Expand Down

0 comments on commit 23b27ab

Please sign in to comment.