diff --git a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-devfile-main.ts b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-devfile-main.ts index e7bcf6641..80e752d0d 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/browser/che-devfile-main.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/browser/che-devfile-main.ts @@ -42,8 +42,8 @@ export class CheDevfileMainImpl implements CheDevfileMain { await this.openFactoryWindow(factoryURI); } - async $get(): Promise { - return this.devfileService.get(); + async $get(onCluster?: boolean): Promise { + return this.devfileService.get(onCluster); } async $update(updatedDevfile: Devfile): Promise { diff --git a/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts b/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts index b65d0eb8b..a26c6c9ce 100644 --- a/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts +++ b/extensions/eclipse-che-theia-plugin/src/che-proposed.d.ts @@ -214,7 +214,7 @@ declare module '@eclipse-che/plugin' { sparseCheckoutDirs?: string[]; } export function update(updatedDevfile: Devfile): Promise; - export function get(): Promise; + export function get(onCluster?: boolean): Promise; export function getComponentStatuses(): Promise; export function createWorkspace(devfilePath: string): Promise; } diff --git a/extensions/eclipse-che-theia-remote-api/src/common/devfile-service.ts b/extensions/eclipse-che-theia-remote-api/src/common/devfile-service.ts index 9702916c4..ef29911db 100644 --- a/extensions/eclipse-che-theia-remote-api/src/common/devfile-service.ts +++ b/extensions/eclipse-che-theia-remote-api/src/common/devfile-service.ts @@ -180,10 +180,20 @@ export interface DevfileProject { } export interface DevfileService { - // Provides raw content of the devfile as a string + // Provides raw content of the flattened devfile as a string getRaw(): Promise; - // Get structured object of the devfile - get(): Promise; + + /** + * Get the structured object of the devfile. + * Typical use of the in-cluster devfile is operating on it and updating the DevWorkspace afterwards. + * Typical use of the flattened devfile is geting a complete intormation about the DevWorkspace. + * Since the flattened devfile defines everything in the workspace explicitly. + * + * @param onCluster if true - returns the original (on-cluster) devfile, + * if false - returns the flattened devfile. + */ + get(onCluster?: boolean): Promise; + getComponentStatuses(): Promise; // Update the devfile based on the given content diff --git a/extensions/eclipse-che-theia-remote-impl-k8s/src/node/k8s-devfile-service-impl.ts b/extensions/eclipse-che-theia-remote-impl-k8s/src/node/k8s-devfile-service-impl.ts index dcab63b49..cd814a1be 100644 --- a/extensions/eclipse-che-theia-remote-impl-k8s/src/node/k8s-devfile-service-impl.ts +++ b/extensions/eclipse-che-theia-remote-impl-k8s/src/node/k8s-devfile-service-impl.ts @@ -39,8 +39,8 @@ export class K8sDevfileServiceImpl implements DevfileService { return devfileContent; } - async get(fromCustomObject?: boolean): Promise { - if (fromCustomObject) { + async get(onCluster?: boolean): Promise { + if (onCluster) { const customObjectsApi = this.k8SService.makeApiClient(k8s.CustomObjectsApi); const group = 'workspace.devfile.io'; const version = 'v1alpha2'; diff --git a/plugins/workspace-plugin/src/devfile-service.ts b/plugins/workspace-plugin/src/devfile-service.ts index ffb6a171b..79acb2ad4 100644 --- a/plugins/workspace-plugin/src/devfile-service.ts +++ b/plugins/workspace-plugin/src/devfile-service.ts @@ -37,7 +37,7 @@ export class DevfileServiceImpl { }) .then(async () => { try { - const devfile = await che.devfile.get(); + const devfile = await che.devfile.get(true); this.updateOrCreateGitProject( devfile, @@ -77,7 +77,7 @@ export class DevfileServiceImpl { try { const relativePath = fileUri.toRelativePath(projectPath, this.projectsRoot); - const devfile = await che.devfile.get(); + const devfile = await che.devfile.get(true); const devfileChanged = this.deleteGitProject(devfile, relativePath); if (devfileChanged) { await che.devfile.update(devfile);