Skip to content

Commit

Permalink
perf(core): Support loading an application with ?expand=false (#5329)
Browse files Browse the repository at this point in the history
Significant improvement in load time for situations where you _do not_
need cluster, server group and load balancer names.
  • Loading branch information
ajordens committed May 16, 2018
1 parent c4ee1bf commit b99d403
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Expand Up @@ -93,7 +93,7 @@ export class ApplicationStateProvider implements IServiceProvider {
applicationModelBuilder: ApplicationModelBuilder,
) => {
return applicationReader
.getApplication($stateParams.application)
.getApplication($stateParams.application, false)
.then((app: Application): Application => {
inferredApplicationWarningService.checkIfInferredAndWarn(app);
return app || applicationModelBuilder.createNotFoundApplication($stateParams.application);
Expand Down
Expand Up @@ -65,7 +65,11 @@ describe('Service: applicationReader', function() {
if (dataSources !== undefined) {
response.attributes['dataSources'] = dataSources;
}
spyOn(API, 'one').and.returnValue({ get: () => $q.when(response) });
spyOn(API, 'one').and.returnValue({
withParams: () => {
return { get: () => $q.when(response) };
},
});
spyOn(securityGroupReader, 'loadSecurityGroupsByApplicationName').and.returnValue($q.when([]));
spyOn(loadBalancerReader, 'loadLoadBalancers').and.returnValue($q.when([]));
spyOn(clusterService, 'loadServerGroups').and.returnValue($q.when([]));
Expand Down
Expand Up @@ -59,8 +59,9 @@ export class ApplicationReader {
});
}

public getApplication(name: string): IPromise<Application> {
public getApplication(name: string, expand = true): IPromise<Application> {
return API.one('applications', name)
.withParams({ expand: expand })
.get()
.then((fromServer: Application) => {
const application: Application = new Application(
Expand Down

0 comments on commit b99d403

Please sign in to comment.