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 ef5d1ea commit dee5328
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 @@ -650,12 +650,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 dee5328

Please sign in to comment.