diff --git a/dashboard/src/app/workspaces/create-workspace/devfile-selector/devfile-selector.controller.ts b/dashboard/src/app/workspaces/create-workspace/devfile-selector/devfile-selector.controller.ts index 345b04f1a54..4fd40254293 100644 --- a/dashboard/src/app/workspaces/create-workspace/devfile-selector/devfile-selector.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/devfile-selector/devfile-selector.controller.ts @@ -33,14 +33,28 @@ export class DevfileSelectorController { constructor(devfileRegistry: DevfileRegistry, cheWorkspace: CheWorkspace) { this.devfileRegistry = devfileRegistry; this.cheWorkspace = cheWorkspace; + this.devfiles = []; this.loadDevfiles(); } loadDevfiles(): void { - let location = this.cheWorkspace.getWorkspaceSettings().cheWorkspaceDevfileRegistryUrl; - this.devfileRegistry.fetchDevfiles(location).then((data: Array) => { - this.devfiles = data; + const location = this.cheWorkspace.getWorkspaceSettings().cheWorkspaceDevfileRegistryUrl; + const urls = location.split(" "); + let promises = []; + + for (const url of urls) { + promises.push(this.devfileRegistry.fetchDevfiles(url).then((data: Array) => { + if (data && data.length > 0) { + data.forEach((devfile)=> { + // Set the origin url as the location + devfile.location = url; + this.devfiles.push(devfile); + }); + } + })); + } + Promise.all(promises).then(() => { if (this.devfiles && this.devfiles.length > 0) { this.devfileOnClick(this.devfiles[0]); } @@ -49,14 +63,12 @@ export class DevfileSelectorController { devfileOnClick(devfile: any): void { this.selectedDevfile = devfile; - - let location = this.cheWorkspace.getWorkspaceSettings().cheWorkspaceDevfileRegistryUrl; - let devfileContent = this.devfileRegistry.getDevfile(location, devfile.links.self); + let devfileContent = this.devfileRegistry.getDevfile(devfile.location, devfile.links.self); if (devfileContent) { this.onDevfileSelect({devfile: devfileContent}); } else { - this.devfileRegistry.fetchDevfile(location, devfile.links.self).then((devfileContent: che.IWorkspaceDevfile) => { + this.devfileRegistry.fetchDevfile(devfile.location, devfile.links.self).then((devfileContent: che.IWorkspaceDevfile) => { this.onDevfileSelect({devfile: devfileContent}); }); } diff --git a/dashboard/src/components/api/devfile-registry.factory.ts b/dashboard/src/components/api/devfile-registry.factory.ts index a8cc65c9384..47990d47466 100644 --- a/dashboard/src/components/api/devfile-registry.factory.ts +++ b/dashboard/src/components/api/devfile-registry.factory.ts @@ -17,6 +17,7 @@ export interface IDevfileMetaData { globalMemoryLimit: string; icon: string; links: any; + location: string; }