Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): expose clusterService in react injector #7043

Merged
merged 1 commit into from
May 23, 2019
Merged
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
6 changes: 4 additions & 2 deletions app/scripts/modules/core/src/reactShims/react.injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import IInjectorService = angular.auto.IInjectorService;
import { StateParams, StateService, UIRouter } from '@uirouter/core';

import { CacheInitializerService } from '../cache/cacheInitializer.service';
import { ClusterService } from '../cluster/cluster.service';
import { ConfirmationModalService } from '../confirmationModal/confirmationModal.service';
import { ExecutionDetailsSectionService } from 'core/pipeline/details/executionDetailsSection.service';
import { ExecutionService } from '../pipeline/service/execution.service';
import { ImageReader } from 'core/image/image.reader';
import { InfrastructureSearchService } from '../search/infrastructure/infrastructureSearch.service';
import { InsightFilterStateModel } from '../insight/insightFilterState.model';
import { InstanceTypeService, InstanceWriter } from 'core/instance';
Expand All @@ -16,9 +18,8 @@ import { PageTitleService } from 'core/pageTitle';
import { ProviderServiceDelegate } from '../cloudProvider/providerService.delegate';
import { SecurityGroupReader } from '../securityGroup/securityGroupReader.service';
import { ServerGroupWriter } from '../serverGroup/serverGroupWriter.service';
import { ImageReader } from 'core/image/image.reader';
import { StateEvents } from './state.events';
import { SkinSelectionService } from '../cloudProvider/skinSelection/skinSelection.service';
import { StateEvents } from './state.events';

export abstract class ReactInject {
protected $injector: IInjectorService;
Expand All @@ -45,6 +46,7 @@ export class CoreReactInject extends ReactInject {
public get $uiRouter() { return this.$injector.get('$uiRouter') as UIRouter; }
public get cacheInitializer() { return this.$injector.get('cacheInitializer') as CacheInitializerService; }
public get confirmationModalService() { return this.$injector.get('confirmationModalService') as ConfirmationModalService; }
public get clusterService() { return this.$injector.get('clusterService') as ClusterService; }
public get executionDetailsSectionService() { return this.$injector.get('executionDetailsSectionService') as ExecutionDetailsSectionService; }
public get executionService() { return this.$injector.get('executionService') as ExecutionService; }
public get imageReader() { return this.$injector.get('imageReader') as ImageReader; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,9 @@ module.exports = angular
return service ? service.convertServerGroupCommandToDeployConfiguration(base) : null;
}

// strips out Angular bits (see angular.js#toJsonReplacer), as well as executions and running tasks
function jsonReplacer(key, value) {
var val = value;

if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {
val = undefined;
}

if (key === 'executions' || key === 'runningTasks') {
val = undefined;
}

return val;
}

return {
normalizeServerGroup: normalizeServerGroup,
convertServerGroupCommandToDeployConfiguration: convertServerGroupCommandToDeployConfiguration,
jsonReplacer: jsonReplacer,
normalizeServerGroup,
convertServerGroupCommandToDeployConfiguration,
};
},
]);