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

perf(kubernetes): Send server group and firewall requests in parallel #8500

Merged
merged 1 commit into from
Aug 17, 2020
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IController, IScope, module } from 'angular';
import { IController, IQService, IScope, module } from 'angular';
import { IModalService } from 'angular-ui-bootstrap';
import { StateService } from '@uirouter/angularjs';

Expand Down Expand Up @@ -26,14 +26,23 @@ class KubernetesSecurityGroupDetailsController implements IController {
public securityGroup: IKubernetesSecurityGroup;
public manifest: IManifest;

public static $inject = ['$uibModal', '$state', '$scope', 'securityGroupReader', 'resolvedSecurityGroup', 'app'];
public static $inject = [
'$uibModal',
'$state',
'$scope',
'securityGroupReader',
'resolvedSecurityGroup',
'app',
'$q',
];
constructor(
private $uibModal: IModalService,
private $state: StateService,
private $scope: IScope,
private securityGroupReader: SecurityGroupReader,
resolvedSecurityGroup: ISecurityGroupFromStateParams,
private app: Application,
private $q: IQService,
) {
const dataSource = app.getDataSource('securityGroups');
dataSource
Expand Down Expand Up @@ -74,24 +83,25 @@ class KubernetesSecurityGroupDetailsController implements IController {
}

private extractSecurityGroup({ accountId, name, region }: ISecurityGroupFromStateParams): void {
this.securityGroupReader
.getSecurityGroupDetails(
this.app,
accountId,
'kubernetes',
region,
'', // unused vpc id
name,
)
.then((securityGroup: ISecurityGroupDetail) => {
this.$q
.all([
this.securityGroupReader.getSecurityGroupDetails(
this.app,
accountId,
'kubernetes',
region,
'', // unused vpc id
name,
),
ManifestReader.getManifest(accountId, region, name),
])
.then(([securityGroup, manifest]: [ISecurityGroupDetail, IManifest]) => {
if (!securityGroup) {
return this.autoClose();
}
ManifestReader.getManifest(accountId, region, name).then((manifest: IManifest) => {
this.securityGroup = securityGroup as IKubernetesSecurityGroup;
this.manifest = manifest;
this.state.loading = false;
});
this.securityGroup = securityGroup as IKubernetesSecurityGroup;
this.manifest = manifest;
this.state.loading = false;
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IController, IScope, module } from 'angular';
import { IController, IQService, IScope, module } from 'angular';
import { IModalService } from 'angular-ui-bootstrap';
import { StateService } from '@uirouter/angularjs';

Expand Down Expand Up @@ -31,13 +31,14 @@ class KubernetesServerGroupDetailsController implements IController {
public manifest: IManifest;
public entityTagTargets: IOwnerOption[];

public static $inject = ['serverGroup', 'app', '$uibModal', '$scope', '$state'];
public static $inject = ['serverGroup', 'app', '$uibModal', '$scope', '$state', '$q'];
constructor(
serverGroup: IServerGroupFromStateParams,
public app: Application,
private $uibModal: IModalService,
private $scope: IScope,
private $state: StateService,
private $q: IQService,
) {
const dataSource = this.app.getDataSource('serverGroups');
dataSource
Expand Down Expand Up @@ -177,20 +178,20 @@ class KubernetesServerGroupDetailsController implements IController {
}

private extractServerGroup({ accountId, name, region }: IServerGroupFromStateParams): void {
ServerGroupReader.getServerGroup(this.app.name, accountId, region, name).then(
(serverGroupDetails: IServerGroup) => {
this.$q
.all([
ServerGroupReader.getServerGroup(this.app.name, accountId, region, name),
ManifestReader.getManifest(accountId, region, name),
])
.then(([serverGroupDetails, manifest]: [IServerGroup, IManifest]) => {
if (!serverGroupDetails) {
return this.autoClose();
}

ManifestReader.getManifest(accountId, region, name).then((manifest: IManifest) => {
this.manifest = manifest;
this.serverGroup = serverGroupDetails as IKubernetesServerGroup;
this.entityTagTargets = this.configureEntityTagTargets();
this.state.loading = false;
});
},
);
this.serverGroup = serverGroupDetails as IKubernetesServerGroup;
this.entityTagTargets = this.configureEntityTagTargets();
this.manifest = manifest;
this.state.loading = false;
});
}

private configureEntityTagTargets(): IOwnerOption[] {
Expand Down