Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export class CheDevfileMainImpl implements CheDevfileMain {
await this.openFactoryWindow(factoryURI);
}

async $get(): Promise<Devfile> {
return this.devfileService.get();
async $get(onCluster?: boolean): Promise<Devfile> {
return this.devfileService.get(onCluster);
}

async $update(updatedDevfile: Devfile): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ declare module '@eclipse-che/plugin' {
sparseCheckoutDirs?: string[];
}
export function update(updatedDevfile: Devfile): Promise<void>;
export function get(): Promise<Devfile>;
export function get(onCluster?: boolean): Promise<Devfile>;
export function getComponentStatuses(): Promise<DevfileComponentStatus[]>;
export function createWorkspace(devfilePath: string): Promise<void>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>;
// Get structured object of the devfile
get(): Promise<Devfile>;

/**
* 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<Devfile>;

getComponentStatuses(): Promise<DevfileComponentStatus[]>;

// Update the devfile based on the given content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export class K8sDevfileServiceImpl implements DevfileService {
return devfileContent;
}

async get(fromCustomObject?: boolean): Promise<Devfile> {
if (fromCustomObject) {
async get(onCluster?: boolean): Promise<Devfile> {
if (onCluster) {
const customObjectsApi = this.k8SService.makeApiClient(k8s.CustomObjectsApi);
const group = 'workspace.devfile.io';
const version = 'v1alpha2';
Expand Down
4 changes: 2 additions & 2 deletions plugins/workspace-plugin/src/devfile-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down