Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed Mar 24, 2021
1 parent f937922 commit e6afc6f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,17 @@ export const getIndexPatternLoadMeta = (): Omit<
id: state.id[0] as string,
},
];
state.id[0] = refName;
return { state, references };
return {
state: {
...state,
id: [refName],
},
references,
};
},

inject(state, references) {
const reference = references.find(({ name }) => name === 'indexPatternLoad.id');
const reference = references.find((ref) => ref.name === 'indexPatternLoad.id');
if (reference) {
state.id[0] = reference.id;
}
Expand Down
8 changes: 7 additions & 1 deletion src/plugins/data/common/search/expressions/kibana_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ export const getKibanaContextFn = (
type: 'search',
id: state.savedSearchId[0] as string,
});
state.savedSearchId[0] = refName;
return {
state: {
...state,
savedSearchId: [refName],
},
references,
};
}
return { state, references };
},
Expand Down
9 changes: 1 addition & 8 deletions src/plugins/data/server/search/expressions/kibana_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

import { i18n } from '@kbn/i18n';
import { StartServicesAccessor } from 'src/core/server';
import { getKibanaContextFn } from '../../../common/search/expressions';
import { DataPluginStart, DataPluginStartDependencies } from '../../plugin';
Expand Down Expand Up @@ -34,13 +33,7 @@ export function getKibanaContext({
return getKibanaContextFn(async (getKibanaRequest) => {
const request = getKibanaRequest && getKibanaRequest();
if (!request) {
throw new Error(
i18n.translate('data.search.kibana_context.error.kibanaRequest', {
defaultMessage:
'A KibanaRequest is required to execute this search on the server. ' +
'Please provide a request object to the expression execution params.',
})
);
throw new Error('KIBANA_CONTEXT_KIBANA_REQUEST_MISSING');
}

const [{ savedObjects }] = await getStartServices();
Expand Down

0 comments on commit e6afc6f

Please sign in to comment.