Skip to content

Commit

Permalink
change order of validation and all trycatch in semver check
Browse files Browse the repository at this point in the history
Signed-off-by: Joanne Wang <[email protected]>
  • Loading branch information
jowg-amazon committed Oct 30, 2024
1 parent d2b3495 commit 4e4d324
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions public/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,18 @@ export function getManageChannelsUrl() {
}

export function dataSourceFilterFn(dataSource) {
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) {
// Filter out invalid data source
return false;
}
}

export function getSeverityText(severity) {
Expand Down

0 comments on commit 4e4d324

Please sign in to comment.