Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where filtering of old angular plugins occurred in wrong section #107

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 28 additions & 26 deletions base/src/plugin-manager/plugin-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,33 @@ export class PluginManager {
}
});

/* Remove skipped plugins */
return plugins.filter(x => x) as Plugin[];
/* Remove skipped plugins and apps not valid for this version*/
let filtered = plugins.filter(x => x) as Plugin[];
const searchParams = new URLSearchParams(window.location.search);
const useV2Desktop = searchParams.has("use-v2-desktop") && (searchParams.get("use-v2-desktop") == 'true');
return filtered.filter((plugin) => {
if (plugin.type != 'application') {
return true;
} else {
const webContent = plugin.webContent;
if (!webContent) {
return true;
} else if ((webContent.framework != 'angular') && (webContent.framework != 'angular2')) {
return true;
} else {
//exclude apps incompatible with the given desktop environment, depending upon their entryPoint content.
if (useV2Desktop && (!webContent.entryPoint || webContent.entryPoint['2.0'])) {
return true;
} else if (!useV2Desktop && webContent.entryPoint && webContent.entryPoint['3.0']) {
return true;
} else {
this.pluginsById.delete(plugin.identifier);
return false;
}
}
}
});

} else {
throw new Error("ZWED5037E - Unable to parse plugin definitions: Missing field 'pluginDefinitions'");
}
Expand All @@ -62,30 +87,7 @@ export class PluginManager {
case 304:
try {
var result = JSON.parse(this.responseText);
let allPlugins = PluginManager.parsePluginDefinitions(result);
const searchParams = new URLSearchParams(window.location.search);
const useV2Desktop = searchParams.has("use-v2-desktop") && (searchParams.get("use-v2-desktop") == 'true');
let validPlugins = allPlugins.filter((plugin) => {
if (plugin.type != 'application') {
return true;
} else {
const webContent = plugin.getWebContent();
if (!webContent) {
return true;
} else if ((webContent.framework != 'angular') && (webContent.framework != 'angular2')) {
return true;
} else {
//exclude apps incompatible with the given desktop environment, depending upon their entryPoint content.
if (useV2Desktop && (!webContent.entryPoint || webContent.entryPoint['2.0'])) {
return true;
} else if (!useV2Desktop && webContent.entryPoint && webContent.entryPoint['3.0']) {
return true;
} else {
return false;
}
}
}
});
let validPlugins = PluginManager.parsePluginDefinitions(result);
if (!pluginType) {
resolve(validPlugins);
} else {
Expand Down
Loading