Skip to content

Commit

Permalink
addressed review comments
Browse files Browse the repository at this point in the history
Signed-off-by: msivasubramaniaan <[email protected]>
  • Loading branch information
msivasubramaniaan committed Aug 16, 2024
1 parent f57469b commit c82fa22
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/alizer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*-----------------------------------------------------------------------------------------------*/


interface Version {
export interface Version {
SchemaVersion: number;
Default: boolean;
Version: string;
Expand Down
18 changes: 13 additions & 5 deletions src/webview/create-component/createComponentLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
} from '../common-ext/createComponentHelpers';
import { loadWebviewHtml, validateGitURL } from '../common-ext/utils';
import { Devfile, DevfileRegistry, TemplateProjectIdentifier } from '../common/devfile';
import { AlizerAnalyzeResponse } from '../../alizer/types';
import { AlizerAnalyzeResponse, Version } from '../../alizer/types';
import { Alizer } from '../../alizer/alizerWrapper';

interface CloneProcess {
Expand Down Expand Up @@ -594,11 +594,19 @@ async function getCompDescription(devfile: AlizerAnalyzeResponse): Promise<Compo
if (!devfile) {
return Array.from(compDescriptions);
}
return Array.from(compDescriptions).filter(({ name, version }) => {
if (devfile.Name === name && devfile.Versions[0].Version === version) {
return true;
return Array.from(compDescriptions).filter((compDesc) => {
if (devfile.Name === compDesc.name && getVersion(devfile.Versions, compDesc.version)) {
return compDesc;
}
}
);
}

function getVersion(devfileVersions: Version[], matchedVersion: string): Version {
return devfileVersions.find((devfileVersion) => {
if (devfileVersion.Version === matchedVersion) {
return devfileVersion;
}
return false;
}
);
}
Expand Down
1 change: 0 additions & 1 deletion test/integration/alizerWrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,4 @@ suite('./alizer/alizerWrapper.ts', function () {

});

test('deleteComponentConfiguration');
});

0 comments on commit c82fa22

Please sign in to comment.