Skip to content

Commit

Permalink
update order of validation; catch exceptions in semver check (#1212)
Browse files Browse the repository at this point in the history
Signed-off-by: Amardeepsingh Siglani <[email protected]>
(cherry picked from commit b350af5)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Oct 30, 2024
1 parent 270a849 commit c8f0aed
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions public/utils/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -654,12 +654,18 @@ export function setBreadcrumbs(crumbs: ChromeBreadcrumb[]) {
}

export function dataSourceFilterFn(dataSource: SavedObject<DataSourceAttributes>) {
const dataSourceVersion = dataSource?.attributes?.dataSourceVersion || '';
const installedPlugins = dataSource?.attributes?.installedPlugins || [];
return (
semver.satisfies(dataSourceVersion, pluginManifest.supportedOSDataSourceVersions) &&
pluginManifest.requiredOSDataSourcePlugins.every((plugin) => installedPlugins.includes(plugin))
);
try {
const dataSourceVersion = dataSource?.attributes?.dataSourceVersion || '';
const installedPlugins = dataSource?.attributes?.installedPlugins || [];
return (
pluginManifest.requiredOSDataSourcePlugins.every((plugin) =>
installedPlugins.includes(plugin)
) && semver.satisfies(dataSourceVersion, pluginManifest.supportedOSDataSourceVersions)
);
} catch (error: any) {
// Filter out invalid data source
return false;
}
}

export function getSeverityText(severity: string) {
Expand Down

0 comments on commit c8f0aed

Please sign in to comment.