Skip to content

Commit c82fa22

Browse files
addressed review comments
Signed-off-by: msivasubramaniaan <msivasub@redhat.com>
1 parent f57469b commit c82fa22

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

src/alizer/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
* Licensed under the MIT License. See LICENSE file in the project root for license information.
44
*-----------------------------------------------------------------------------------------------*/
55

6-
7-
interface Version {
6+
export interface Version {
87
SchemaVersion: number;
98
Default: boolean;
109
Version: string;

src/webview/create-component/createComponentLoader.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
} from '../common-ext/createComponentHelpers';
3131
import { loadWebviewHtml, validateGitURL } from '../common-ext/utils';
3232
import { Devfile, DevfileRegistry, TemplateProjectIdentifier } from '../common/devfile';
33-
import { AlizerAnalyzeResponse } from '../../alizer/types';
33+
import { AlizerAnalyzeResponse, Version } from '../../alizer/types';
3434
import { Alizer } from '../../alizer/alizerWrapper';
3535

3636
interface CloneProcess {
@@ -594,11 +594,19 @@ async function getCompDescription(devfile: AlizerAnalyzeResponse): Promise<Compo
594594
if (!devfile) {
595595
return Array.from(compDescriptions);
596596
}
597-
return Array.from(compDescriptions).filter(({ name, version }) => {
598-
if (devfile.Name === name && devfile.Versions[0].Version === version) {
599-
return true;
597+
return Array.from(compDescriptions).filter((compDesc) => {
598+
if (devfile.Name === compDesc.name && getVersion(devfile.Versions, compDesc.version)) {
599+
return compDesc;
600+
}
601+
}
602+
);
603+
}
604+
605+
function getVersion(devfileVersions: Version[], matchedVersion: string): Version {
606+
return devfileVersions.find((devfileVersion) => {
607+
if (devfileVersion.Version === matchedVersion) {
608+
return devfileVersion;
600609
}
601-
return false;
602610
}
603611
);
604612
}

test/integration/alizerWrapper.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,4 @@ suite('./alizer/alizerWrapper.ts', function () {
140140

141141
});
142142

143-
test('deleteComponentConfiguration');
144143
});

0 commit comments

Comments
 (0)