Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
eclipse-che/che#11306 add 'Dto' suffix to Che specific objects
Browse files Browse the repository at this point in the history
Signed-off-by: Yevhen Vydolob <yvydolob@redhat.com>
  • Loading branch information
evidolob committed Dec 7, 2018
1 parent 702097f commit 8a5ca6d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/

import { CheApiMain, CheApiService, Factory } from '../common/che-protocol';
import { CheApiMain, CheApiService, FactoryDto } from '../common/che-protocol';
import { Workspace } from '@eclipse-che/plugin';
import { interfaces } from 'inversify';

Expand All @@ -26,7 +26,7 @@ export class CheApiPluginMainImpl implements CheApiMain {
});
}

$getFactoryById(id: string): Promise<Factory> {
$getFactoryById(id: string): Promise<FactoryDto> {
throw new Error('getFactoryById is not implemented');
}
}
68 changes: 34 additions & 34 deletions extensions/eclipse-che-theia-plugin-ext/src/common/che-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ export interface CheApiPlugin {
}

export interface CheApiMain {
$currentWorkspace(): Promise<Workspace>;
$currentWorkspace(): Promise<WorkspaceDto>;

$getFactoryById(id: string): Promise<Factory>;
$getFactoryById(id: string): Promise<FactoryDto>;
}

export interface Factory {
workspace: WorkspaceConfig;
export interface FactoryDto {
workspace: WorkspaceConfigDto;
ide?: {
onAppLoaded?: {
actions?: FactoryAction[]
actions?: FactoryActionDto[]
};
onProjectsLoaded?: {
actions?: FactoryAction[]
actions?: FactoryActionDto[]
};
onAppClosed?: {
actions?: FactoryAction[]
actions?: FactoryActionDto[]
};
}
}

export interface FactoryAction {
export interface FactoryActionDto {
id: string,
properties?: {
name?: string,
Expand All @@ -45,98 +45,98 @@ export interface FactoryAction {
}
}

export interface WorkspaceConfig {
export interface WorkspaceConfigDto {
name?: string;
description?: string;
defaultEnv: string;
environments: {
[environmentName: string]: any;
};
projects: ProjectConfig[];
commands?: Command[];
links?: Link[];
projects: ProjectConfigDto[];
commands?: CommandDto[];
links?: LinkDto[];
}
export interface ProjectConfig {
export interface ProjectConfigDto {
name: string;
path: string;
description?: string;
mixins?: string[];
attributes?: { [attrName: string]: string[] };
source?: SourceStorage;
problems?: ProjectProblem;
source?: SourceStorageDto;
problems?: ProjectProblemDto;
}

export interface SourceStorage {
export interface SourceStorageDto {
type: string;
location: string;
parameters: { [attrName: string]: string };
}

export interface ProjectProblem {
export interface ProjectProblemDto {
code: number;
message: string;
}

export interface Command {
export interface CommandDto {
name: string;
commandLine: string;
type: string;
attributes?: { [attrName: string]: string };
}

export interface Link {
export interface LinkDto {
href: string;
rel?: string;
method: string;
produces?: string;
consumes?: string;
parameters?: LinkParameter[];
parameters?: LinkParameterDto[];
requestBody?: RequestBodyDescriptor;
}

export interface Workspace {
export interface WorkspaceDto {
id?: string;
config: WorkspaceConfig;
config: WorkspaceConfigDto;
status: string | WorkspaceStatus;
namespace?: string;
temporary?: boolean;
attributes?: WorkspaceAttributes;
runtime?: Runtime;
attributes?: WorkspaceAttributesDto;
runtime?: RuntimeDto;
links?: { [attrName: string]: string };
}

export type WorkspaceStatus = 'STARTING' | 'RUNNING' | 'STOPPING' | 'STOPPED';

export interface Runtime {
export interface RuntimeDto {
activeEnv: string;
machines: { [attrName: string]: Machine };
machines: { [attrName: string]: MachineDto };
owner: string;
warnings?: Warning;
warnings?: WarningDto;
}

export interface Machine {
export interface MachineDto {
status: string | MachineStatus;
servers: { [attrName: string]: Server };
servers: { [attrName: string]: ServerDto };
attributes?: { [attrName: string]: string };
}

export type MachineStatus = 'STARTING' | 'RUNNING' | 'STOPPED' | 'FAILED';

export interface Server {
export interface ServerDto {
url: string;
status: string | ServerStatus;
attributes?: { [attrName: string]: string };
}

export type ServerStatus = 'RUNNING' | 'STOPPED' | 'UNKNOWN';

export interface Warning {
export interface WarningDto {
code: number;
message: string;
}


export interface WorkspaceAttributes {
export interface WorkspaceAttributesDto {
created: number;
updated?: number;
stackId?: string;
Expand All @@ -145,7 +145,7 @@ export interface WorkspaceAttributes {
}


export interface LinkParameter {
export interface LinkParameterDto {
name: string;
defaultValue?: string;
description?: string;
Expand All @@ -170,5 +170,5 @@ export const CheApiServicePath = '/che-api-service';

export const CheApiService = Symbol('CheApiService');
export interface CheApiService {
currentWorkspace(): Promise<Workspace>;
currentWorkspace(): Promise<WorkspaceDto>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
import { RPCProtocol } from '@theia/plugin-ext/lib/api/rpc-protocol';
import { PLUGIN_RPC_CONTEXT, CheApiMain, FactoryAction as CheFactoryAction, Factory as CheFactory, ProjectConfig } from '../common/che-protocol';
import { PLUGIN_RPC_CONTEXT, CheApiMain, FactoryActionDto as CheFactoryAction, FactoryDto as CheFactory, ProjectConfigDto } from '../common/che-protocol';
import * as che from '@eclipse-che/plugin';

export class CheApiPluginImpl {
Expand Down Expand Up @@ -67,7 +67,7 @@ class FactoryImpl implements che.Factory {
return [];
}

return this.factory.workspace.projects.map((project: ProjectConfig) => new ProjectImpl(project));
return this.factory.workspace.projects.map((project: ProjectConfigDto) => new ProjectImpl(project));
}
getOnProjectsImportedActions(): che.FactoryAction[] {
if (!this.factory || !this.factory.ide || !this.factory.ide.onProjectsLoaded || !this.factory.ide.onProjectsLoaded.actions) {
Expand Down Expand Up @@ -96,7 +96,7 @@ class FactoryImpl implements che.Factory {

class ProjectImpl implements che.FactoryProject {

constructor(private readonly project: ProjectConfig) {
constructor(private readonly project: ProjectConfigDto) {
}

getPath(): string {
Expand Down

0 comments on commit 8a5ca6d

Please sign in to comment.