Skip to content

Commit

Permalink
catching possible error when getting index pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic committed Jul 5, 2021
1 parent 04879a8 commit e8b8d1e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,17 @@ export const FileDataVisualizerPage: FC = () => {
});
},
canDisplay: async ({ indexPatternId }) => {
const { timeFieldName } = await getIndexPattern(indexPatternId);

return (
isFullLicense() &&
timeFieldName !== undefined &&
checkPermission('canCreateJob') &&
mlNodesAvailable()
);
try {
const { timeFieldName } = await getIndexPattern(indexPatternId);
return (
isFullLicense() &&
timeFieldName !== undefined &&
checkPermission('canCreateJob') &&
mlNodesAvailable()
);
} catch (error) {
return false;
}
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,17 @@ export const IndexDataVisualizerPage: FC = () => {
});
},
canDisplay: async ({ indexPatternId }) => {
const { timeFieldName } = await getIndexPattern(indexPatternId);
return (
isFullLicense() &&
timeFieldName !== undefined &&
checkPermission('canCreateJob') &&
mlNodesAvailable()
);
try {
const { timeFieldName } = await getIndexPattern(indexPatternId);
return (
isFullLicense() &&
timeFieldName !== undefined &&
checkPermission('canCreateJob') &&
mlNodesAvailable()
);
} catch (error) {
return false;
}
},
dataTestSubj: 'dataVisualizerCreateAdvancedJobCard',
},
Expand Down

0 comments on commit e8b8d1e

Please sign in to comment.