Skip to content

Commit

Permalink
cleaned up
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksii Kurinnyi <[email protected]>
  • Loading branch information
akurinnoy committed Jul 14, 2020
1 parent f03bbe1 commit cb97575
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
20 changes: 5 additions & 15 deletions src/app/get-started/get-started-tab/get-started-tab.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import { DevfileRegistry, IDevfileMetaData } from '../../../components/api/devfi
import { CheNotification } from '../../../components/notification/che-notification.factory';
import { IChePfButtonProperties } from '../../../components/che-pf-widget/button/che-pf-button';
import { IGetStartedToolbarBindingProperties } from './toolbar/get-started-toolbar.component';
import { CheBranding } from '../../../components/branding/che-branding';
import { STORAGE_TYPE } from '../../../components/api/storage-type';
import { StorageType } from '../../../components/api/storage-type';


/**
Expand All @@ -34,7 +33,6 @@ export class GetStartedTabController {
'$log',
'cheNotification',
'cheWorkspace',
'cheBranding',
'createWorkspaceSvc',
'devfileRegistry'
];
Expand All @@ -46,7 +44,6 @@ export class GetStartedTabController {
// injected services
private $log: ng.ILogService;
private cheNotification: CheNotification;
private cheBranding: CheBranding;
private createWorkspaceSvc: CreateWorkspaceSvc;
private devfileRegistry: DevfileRegistry;

Expand All @@ -55,7 +52,6 @@ export class GetStartedTabController {
private devfileRegistryUrl: string;
private ephemeralMode: boolean;
private storageType: string;
private storageDescription: string;

/**
* Default constructor that is using resource
Expand All @@ -64,13 +60,11 @@ export class GetStartedTabController {
$log: ng.ILogService,
cheNotification: CheNotification,
cheWorkspace: CheWorkspace,
cheBranding: CheBranding,
createWorkspaceSvc: CreateWorkspaceSvc,
devfileRegistry: DevfileRegistry
) {
this.$log = $log;
this.cheNotification = cheNotification;
this.cheBranding = cheBranding;
this.createWorkspaceSvc = createWorkspaceSvc;
this.devfileRegistry = devfileRegistry;

Expand All @@ -87,9 +81,9 @@ export class GetStartedTabController {
this.devfileRegistryUrl = workspaceSettings && workspaceSettings.cheWorkspaceDevfileRegistryUrl;
this.ephemeralMode = workspaceSettings['che.workspace.persist_volumes.default'] === 'false';
if (this.ephemeralMode) {
this.storageType = STORAGE_TYPE.EPHEMERAL.label;
this.storageType = StorageType.EPHEMERAL;
} else {
this.storageType = STORAGE_TYPE.PERSISTENT.label;
this.storageType = StorageType.PERSISTENT;
}
this.toolbarProps.ephemeralMode = this.ephemeralMode;
return this.init();
Expand All @@ -112,7 +106,6 @@ export class GetStartedTabController {

onStorageTypeChange(type: string): void {
this.storageType = type;
this.storageDescription = type;
}

createWorkspace(devfileMetaData: IDevfileMetaData): void {
Expand All @@ -130,16 +123,13 @@ export class GetStartedTabController {
this.devfileRegistry.fetchDevfile(this.devfileRegistryUrl, selfLink)
.then(() => {
const devfile = this.devfileRegistry.getDevfile(this.devfileRegistryUrl, selfLink);
console.log('=======>>>>' + this.storageType);
if (this.storageType === STORAGE_TYPE.EPHEMERAL.label) {
console.log('=======>>>> 0000' + this.storageType);
if (this.storageType === StorageType.EPHEMERAL) {
if (!devfile.attributes) {
devfile.attributes = {};
}
devfile.attributes.persistVolumes = 'false';
}
if (this.storageType === STORAGE_TYPE.ASYNCHRONOUS.label) {
console.log('=======>>>> 1111' + this.storageType);
if (this.storageType === StorageType.ASYNCHRONOUS) {
if (!devfile.attributes) {
devfile.attributes = {};
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/index.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ initModule.config(['$routeProvider', ($routeProvider: che.route.IRouteProvider)

}]);

const DEV = true;
const DEV = false;

// configs
initModule.config(['$routeProvider', ($routeProvider: che.route.IRouteProvider) => {
Expand Down
18 changes: 9 additions & 9 deletions src/components/typings/che.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ declare namespace che {
}

export interface IRoute extends ng.route.IRoute {
title?: string | {(...args: any[]) : string};
title?: string | { (...args: any[]): string };
}

export interface IRouteProvider extends ng.route.IRouteProvider {
Expand Down Expand Up @@ -336,23 +336,23 @@ declare namespace che {
environments: {
[envName: string]: any;
};
projects?: Array <any>;
commands?: Array <any>;
projects?: Array<any>;
commands?: Array<any>;
attributes?: IWorkspaceConfigAttributes;
}

export interface IWorkspaceConfigAttributes {
persistVolumes?: 'false' | 'true'; // explicitly indicates turning the ephemeral mode on
asyncPersist?:'false' | 'true'; // explicitly indicates turning the asynchronus storage mode on
asyncPersist?: 'false' | 'true'; // explicitly indicates turning the asynchronous storage mode on
editor?: string;
plugins?: string;
}

export interface IWorkspaceDevfile {
apiVersion: string;
components?: Array<any>;
projects?: Array <any>;
commands?: Array <any>;
projects?: Array<any>;
commands?: Array<any>;
attributes?: che.IWorkspaceConfigAttributes;
metadata: {
name?: string;
Expand Down Expand Up @@ -452,9 +452,9 @@ declare namespace che {
}

export interface IProfileAttributes {
firstName?: string;
lastName?: string;
[propName: string]: string | number;
firstName?: string;
lastName?: string;
[propName: string]: string | number;
}

export interface IProfile extends ng.resource.IResource<any> {
Expand Down

0 comments on commit cb97575

Please sign in to comment.