diff --git a/src/alizer/types.ts b/src/alizer/types.ts index 56e218c84..2002cfd37 100644 --- a/src/alizer/types.ts +++ b/src/alizer/types.ts @@ -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; diff --git a/src/webview/create-component/createComponentLoader.ts b/src/webview/create-component/createComponentLoader.ts index 4a7216401..a775d735c 100644 --- a/src/webview/create-component/createComponentLoader.ts +++ b/src/webview/create-component/createComponentLoader.ts @@ -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 { @@ -594,11 +594,19 @@ async function getCompDescription(devfile: AlizerAnalyzeResponse): Promise { - 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; } ); } diff --git a/test/integration/alizerWrapper.test.ts b/test/integration/alizerWrapper.test.ts index 0cdf2f262..e729d76ba 100644 --- a/test/integration/alizerWrapper.test.ts +++ b/test/integration/alizerWrapper.test.ts @@ -140,5 +140,4 @@ suite('./alizer/alizerWrapper.ts', function () { }); - test('deleteComponentConfiguration'); });