@spinnaker/amazon 0.11.1 → 0.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/dist/domain/IAmazonLaunchTemplate.d.ts +1 -1
- package/dist/domain/IAmazonServerGroup.d.ts +10 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/instance/awsInstanceType.service.d.ts +10 -2
- package/dist/instance/awsInstanceTypes.d.ts +10 -0
- package/dist/instance/details/CostFactor.d.ts +6 -0
- package/dist/reactShims/aws.react.injector.d.ts +2 -1
- package/dist/search/searchResultFormatter.d.ts +2 -2
- package/dist/serverGroup/configure/serverGroupCommandBuilder.service.d.ts +17 -2
- package/dist/serverGroup/configure/serverGroupConfiguration.service.d.ts +39 -0
- package/dist/serverGroup/configure/wizard/instanceType/CpuCreditsToggle.d.ts +3 -4
- package/dist/serverGroup/configure/wizard/instanceType/InstanceTypeSelector.d.ts +9 -0
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/AdvancedModeSelector.d.ts +13 -0
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceProfileSelector.d.ts +9 -0
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeRow.d.ts +11 -0
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTable.d.ts +14 -0
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableBody.d.ts +12 -0
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableParts.d.ts +15 -0
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.d.ts +8 -0
- package/dist/serverGroup/configure/wizard/instanceType/simpleMode/SimpleModeSelector.d.ts +8 -0
- package/dist/serverGroup/configure/wizard/pages/ServerGroupInstanceType.d.ts +9 -6
- package/dist/serverGroup/serverGroup.transformer.d.ts +2 -1
- package/package.json +5 -5
- package/src/domain/IAmazonLaunchTemplate.ts +1 -1
- package/src/domain/IAmazonServerGroup.ts +11 -0
- package/src/function/details/FunctionActions.spec.tsx +10 -9
- package/src/help/amazon.help.ts +9 -6
- package/src/image/image.reader.spec.ts +75 -0
- package/src/instance/awsInstanceType.service.spec.js +37 -71
- package/src/instance/awsInstanceType.service.ts +191 -0
- package/src/instance/awsInstanceTypes.ts +311 -0
- package/src/instance/details/CostFactor.tsx +29 -0
- package/src/instance/details/InstanceInformation.spec.tsx +2 -1
- package/src/instance/details/instance.details.controller.js +471 -473
- package/src/loadBalancer/details/loadBalancerDetails.controller.spec.ts +5 -3
- package/src/reactShims/aws.react.injector.ts +2 -1
- package/src/search/{searchResultFormatter.js → searchResultFormatter.ts} +5 -4
- package/src/serverGroup/configure/AmazonImageSelectInput.spec.tsx +10 -7
- package/src/serverGroup/configure/serverGroupCommandBuilder.aws.service.spec.js +302 -1
- package/src/serverGroup/configure/{serverGroupCommandBuilder.service.js → serverGroupCommandBuilder.service.ts} +182 -73
- package/src/serverGroup/configure/serverGroupCommandBuilder.spec.js +25 -8
- package/src/serverGroup/configure/serverGroupConfiguration.service.spec.ts +6 -13
- package/src/serverGroup/configure/serverGroupConfiguration.service.ts +53 -0
- package/src/serverGroup/configure/wizard/AmazonCloneServerGroupModal.tsx +1 -1
- package/src/serverGroup/configure/wizard/instanceType/CpuCreditsToggle.tsx +31 -31
- package/src/serverGroup/configure/wizard/instanceType/InstanceTypeSelector.tsx +133 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/AdvancedModeSelector.tsx +99 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceProfileSelector.tsx +36 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeRow.tsx +144 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTable.tsx +138 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableBody.tsx +135 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableParts.tsx +137 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.less +5 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.tsx +108 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/advancedMode.less +110 -0
- package/src/serverGroup/configure/wizard/instanceType/simpleMode/SimpleModeSelector.tsx +62 -0
- package/src/serverGroup/configure/wizard/pages/ServerGroupInstanceType.tsx +107 -62
- package/src/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsCommon.tsx +1 -1
- package/src/serverGroup/details/scalingPolicy/scalingPolicySummary.component.ts +6 -2
- package/src/serverGroup/details/scalingProcesses/AutoScalingProcessService.spec.ts +1 -2
- package/src/serverGroup/details/sections/InstancesDistributionDetailsSection.spec.tsx +8 -5
- package/src/serverGroup/details/sections/LaunchTemplateDetailsSection.spec.tsx +8 -5
- package/src/serverGroup/serverGroup.transformer.spec.ts +5 -3
- package/src/serverGroup/serverGroup.transformer.ts +24 -22
- package/src/subnet/SubnetSelectInput.spec.tsx +7 -4
- package/src/vpc/{VpcReader.spec.js → VpcReader.spec.ts} +2 -10
- package/src/vpc/VpcTag.spec.tsx +37 -0
- package/src/vpc/vpc.module.ts +6 -2
- package/dist/vpc/vpcTag.directive.d.ts +0 -2
- package/src/image/image.reader.spec.js +0 -123
- package/src/instance/awsInstanceType.service.js +0 -437
- package/src/vpc/vpcTag.directive.js +0 -34
- package/src/vpc/vpcTag.directive.spec.js +0 -60
|
@@ -17,152 +17,133 @@ import {
|
|
|
17
17
|
import { AmazonInstanceWriter } from '../amazon.instance.write.service';
|
|
18
18
|
import { AWSProviderSettings } from '../../aws.settings';
|
|
19
19
|
import { applyHealthCheckInfoToTargetGroups, getAllTargetGroups } from './utils';
|
|
20
|
-
import { AMAZON_VPC_VPCTAG_DIRECTIVE } from '../../vpc/vpcTag.directive';
|
|
21
20
|
|
|
22
21
|
export const AMAZON_INSTANCE_DETAILS_INSTANCE_DETAILS_CONTROLLER = 'spinnaker.amazon.instance.details.controller';
|
|
23
22
|
export const name = AMAZON_INSTANCE_DETAILS_INSTANCE_DETAILS_CONTROLLER; // for backwards compatibility
|
|
24
|
-
module(AMAZON_INSTANCE_DETAILS_INSTANCE_DETAILS_CONTROLLER, [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
instancePort: _.get(app, 'attributes.instancePort') || SETTINGS.defaultInstancePort || 80,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
$scope.application = app;
|
|
50
|
-
$scope.moniker = moniker;
|
|
51
|
-
$scope.environment = environment;
|
|
52
|
-
|
|
53
|
-
$scope.securityGroupsLabel = FirewallLabels.get('Firewalls');
|
|
54
|
-
|
|
55
|
-
function extractHealthMetrics(instance, latest) {
|
|
56
|
-
// do not backfill on standalone instances
|
|
57
|
-
if (app.isStandalone) {
|
|
58
|
-
instance.health = latest.health;
|
|
59
|
-
}
|
|
23
|
+
module(AMAZON_INSTANCE_DETAILS_INSTANCE_DETAILS_CONTROLLER, [UIROUTER_ANGULARJS, ANGULAR_UI_BOOTSTRAP]).controller(
|
|
24
|
+
'awsInstanceDetailsCtrl',
|
|
25
|
+
[
|
|
26
|
+
'$scope',
|
|
27
|
+
'$state',
|
|
28
|
+
'instance',
|
|
29
|
+
'app',
|
|
30
|
+
'moniker',
|
|
31
|
+
'environment',
|
|
32
|
+
'$q',
|
|
33
|
+
'overrides',
|
|
34
|
+
function ($scope, $state, instance, app, moniker, environment, $q, overrides) {
|
|
35
|
+
$scope.isDisabled = !AWSProviderSettings.adHocInfraWritesEnabled;
|
|
36
|
+
|
|
37
|
+
// needed for standalone instances
|
|
38
|
+
$scope.detailsTemplateUrl = CloudProviderRegistry.getValue('aws', 'instance.detailsTemplateUrl');
|
|
39
|
+
|
|
40
|
+
$scope.state = {
|
|
41
|
+
loading: true,
|
|
42
|
+
standalone: app.isStandalone,
|
|
43
|
+
instancePort: _.get(app, 'attributes.instancePort') || SETTINGS.defaultInstancePort || 80,
|
|
44
|
+
};
|
|
60
45
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
46
|
+
$scope.application = app;
|
|
47
|
+
$scope.moniker = moniker;
|
|
48
|
+
$scope.environment = environment;
|
|
65
49
|
|
|
66
|
-
|
|
67
|
-
// augment with target group healthcheck data
|
|
68
|
-
const targetGroups = getAllTargetGroups(
|
|
69
|
-
app.loadBalancers.data.filter(function (loadBalancer) {
|
|
70
|
-
return loadBalancer.cloudProvider === 'aws';
|
|
71
|
-
}),
|
|
72
|
-
);
|
|
73
|
-
applyHealthCheckInfoToTargetGroups(displayableMetrics, targetGroups, instance.account);
|
|
74
|
-
}
|
|
50
|
+
$scope.securityGroupsLabel = FirewallLabels.get('Firewalls');
|
|
75
51
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
52
|
+
function extractHealthMetrics(instance, latest) {
|
|
53
|
+
// do not backfill on standalone instances
|
|
54
|
+
if (app.isStandalone) {
|
|
55
|
+
instance.health = latest.health;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
instance.health = instance.health || [];
|
|
59
|
+
const displayableMetrics = instance.health.filter(function (metric) {
|
|
60
|
+
return metric.type !== 'Amazon' || metric.state !== 'Unknown';
|
|
85
61
|
});
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
loadBalancers = serverGroup.loadBalancers;
|
|
106
|
-
targetGroups = serverGroup.targetGroups;
|
|
107
|
-
account = serverGroup.account;
|
|
108
|
-
region = serverGroup.region;
|
|
109
|
-
vpcId = serverGroup.vpcId;
|
|
110
|
-
serverGroupDisabled = serverGroup.isDisabled;
|
|
111
|
-
extraData.serverGroup = serverGroup.name;
|
|
112
|
-
extraData.vpcId = serverGroup.vpcId;
|
|
113
|
-
return true;
|
|
62
|
+
|
|
63
|
+
if (!app.isStandalone) {
|
|
64
|
+
// augment with target group healthcheck data
|
|
65
|
+
const targetGroups = getAllTargetGroups(
|
|
66
|
+
app.loadBalancers.data.filter(function (loadBalancer) {
|
|
67
|
+
return loadBalancer.cloudProvider === 'aws';
|
|
68
|
+
}),
|
|
69
|
+
);
|
|
70
|
+
applyHealthCheckInfoToTargetGroups(displayableMetrics, targetGroups, instance.account);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// backfill details where applicable
|
|
74
|
+
if (latest.health) {
|
|
75
|
+
displayableMetrics.forEach(function (metric) {
|
|
76
|
+
const detailsMatch = latest.health.filter(function (latestHealth) {
|
|
77
|
+
return latestHealth.type === metric.type;
|
|
78
|
+
});
|
|
79
|
+
if (detailsMatch.length) {
|
|
80
|
+
_.defaults(metric, detailsMatch[0]);
|
|
114
81
|
}
|
|
115
82
|
});
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
83
|
+
}
|
|
84
|
+
$scope.healthMetrics = displayableMetrics;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function retrieveInstance() {
|
|
88
|
+
const extraData = {};
|
|
89
|
+
let instanceSummary, loadBalancers, targetGroups, account, region, vpcId, serverGroupDisabled;
|
|
90
|
+
if (!app.serverGroups) {
|
|
91
|
+
// standalone instance
|
|
92
|
+
instanceSummary = { id: instance.instanceId }; // terminate call expects `id` to be populated
|
|
93
|
+
loadBalancers = [];
|
|
94
|
+
targetGroups = [];
|
|
95
|
+
account = instance.account;
|
|
96
|
+
region = instance.region;
|
|
97
|
+
} else {
|
|
98
|
+
app.serverGroups.data.some(function (serverGroup) {
|
|
99
|
+
return serverGroup.instances.some(function (possibleInstance) {
|
|
100
|
+
if (possibleInstance.id === instance.instanceId) {
|
|
101
|
+
instanceSummary = possibleInstance;
|
|
102
|
+
loadBalancers = serverGroup.loadBalancers;
|
|
103
|
+
targetGroups = serverGroup.targetGroups;
|
|
104
|
+
account = serverGroup.account;
|
|
105
|
+
region = serverGroup.region;
|
|
106
|
+
vpcId = serverGroup.vpcId;
|
|
107
|
+
serverGroupDisabled = serverGroup.isDisabled;
|
|
108
|
+
extraData.serverGroup = serverGroup.name;
|
|
109
|
+
extraData.vpcId = serverGroup.vpcId;
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
if (!instanceSummary) {
|
|
115
|
+
// perhaps it is in a server group that is part of another app
|
|
116
|
+
app.loadBalancers.data.some(function (loadBalancer) {
|
|
117
|
+
return (
|
|
118
|
+
loadBalancer.instances.some(function (possibleInstance) {
|
|
133
119
|
if (possibleInstance.id === instance.instanceId) {
|
|
134
120
|
instanceSummary = possibleInstance;
|
|
135
|
-
|
|
121
|
+
loadBalancers = [loadBalancer.name];
|
|
136
122
|
account = loadBalancer.account;
|
|
137
123
|
region = loadBalancer.region;
|
|
138
124
|
vpcId = loadBalancer.vpcId;
|
|
139
125
|
return true;
|
|
140
126
|
}
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
});
|
|
145
|
-
if (!instanceSummary) {
|
|
146
|
-
// perhaps it is in a disabled server group via a load balancer
|
|
147
|
-
app.loadBalancers.data.some(function (loadBalancer) {
|
|
148
|
-
return (
|
|
149
|
-
loadBalancer.serverGroups.some(function (serverGroup) {
|
|
150
|
-
if (!serverGroup.isDisabled) {
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
return serverGroup.instances.some(function (possibleInstance) {
|
|
127
|
+
}) ||
|
|
128
|
+
loadBalancer.targetGroups.some(function (targetGroup) {
|
|
129
|
+
return targetGroup.instances.some(function (possibleInstance) {
|
|
154
130
|
if (possibleInstance.id === instance.instanceId) {
|
|
155
131
|
instanceSummary = possibleInstance;
|
|
156
|
-
|
|
132
|
+
targetGroups = [targetGroup.name];
|
|
157
133
|
account = loadBalancer.account;
|
|
158
134
|
region = loadBalancer.region;
|
|
159
135
|
vpcId = loadBalancer.vpcId;
|
|
160
136
|
return true;
|
|
161
137
|
}
|
|
162
138
|
});
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
|
|
139
|
+
})
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
if (!instanceSummary) {
|
|
143
|
+
// perhaps it is in a disabled server group via a load balancer
|
|
144
|
+
app.loadBalancers.data.some(function (loadBalancer) {
|
|
145
|
+
return (
|
|
146
|
+
loadBalancer.serverGroups.some(function (serverGroup) {
|
|
166
147
|
if (!serverGroup.isDisabled) {
|
|
167
148
|
return false;
|
|
168
149
|
}
|
|
@@ -176,413 +157,430 @@ module(AMAZON_INSTANCE_DETAILS_INSTANCE_DETAILS_CONTROLLER, [
|
|
|
176
157
|
return true;
|
|
177
158
|
}
|
|
178
159
|
});
|
|
179
|
-
})
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
160
|
+
}) ||
|
|
161
|
+
loadBalancer.targetGroups.some(function (targetGroup) {
|
|
162
|
+
targetGroup.serverGroups.some(function (serverGroup) {
|
|
163
|
+
if (!serverGroup.isDisabled) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
return serverGroup.instances.some(function (possibleInstance) {
|
|
167
|
+
if (possibleInstance.id === instance.instanceId) {
|
|
168
|
+
instanceSummary = possibleInstance;
|
|
169
|
+
loadBalancers = [loadBalancer.name];
|
|
170
|
+
account = loadBalancer.account;
|
|
171
|
+
region = loadBalancer.region;
|
|
172
|
+
vpcId = loadBalancer.vpcId;
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
})
|
|
178
|
+
);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
183
181
|
}
|
|
184
182
|
}
|
|
185
|
-
}
|
|
186
183
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
$scope.state.loading = false;
|
|
197
|
-
extractHealthMetrics(instanceSummary, details);
|
|
198
|
-
$scope.instance = _.defaults(details, instanceSummary);
|
|
199
|
-
$scope.instance.account = account;
|
|
200
|
-
$scope.instance.region = region;
|
|
201
|
-
$scope.instance.vpcId = vpcId;
|
|
202
|
-
$scope.instance.serverGroupDisabled = serverGroupDisabled;
|
|
203
|
-
$scope.instance.loadBalancers = loadBalancers;
|
|
204
|
-
$scope.instance.targetGroups = targetGroups;
|
|
205
|
-
if ($scope.instance.networkInterfaces) {
|
|
206
|
-
$scope.instance.ipv6Addresses = _.flatMap($scope.instance.networkInterfaces, (i) =>
|
|
207
|
-
i.ipv6Addresses.map((a) => ({
|
|
208
|
-
ip: a.ipv6Address,
|
|
209
|
-
url: `http://${a.ipv6Address}:${$scope.state.instancePort}`,
|
|
210
|
-
})),
|
|
211
|
-
);
|
|
212
|
-
|
|
213
|
-
const permanentNetworkInterfaces = $scope.instance.networkInterfaces.filter(
|
|
214
|
-
(f) => f.attachment.deleteOnTermination === false,
|
|
215
|
-
);
|
|
216
|
-
if (permanentNetworkInterfaces.length) {
|
|
217
|
-
$scope.instance.permanentIps = permanentNetworkInterfaces.map((f) => f.privateIpAddress);
|
|
184
|
+
if (instanceSummary && account && region) {
|
|
185
|
+
instanceSummary.account = account;
|
|
186
|
+
extraData.account = account;
|
|
187
|
+
extraData.region = region;
|
|
188
|
+
RecentHistoryService.addExtraDataToLatest('instances', extraData);
|
|
189
|
+
return InstanceReader.getInstanceDetails(account, region, instance.instanceId).then((details) => {
|
|
190
|
+
if ($scope.$$destroyed) {
|
|
191
|
+
return;
|
|
218
192
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
193
|
+
$scope.state.loading = false;
|
|
194
|
+
extractHealthMetrics(instanceSummary, details);
|
|
195
|
+
$scope.instance = _.defaults(details, instanceSummary);
|
|
196
|
+
$scope.instance.account = account;
|
|
197
|
+
$scope.instance.region = region;
|
|
198
|
+
$scope.instance.vpcId = vpcId;
|
|
199
|
+
$scope.instance.serverGroupDisabled = serverGroupDisabled;
|
|
200
|
+
$scope.instance.loadBalancers = loadBalancers;
|
|
201
|
+
$scope.instance.targetGroups = targetGroups;
|
|
202
|
+
if ($scope.instance.networkInterfaces) {
|
|
203
|
+
$scope.instance.ipv6Addresses = _.flatMap($scope.instance.networkInterfaces, (i) =>
|
|
204
|
+
i.ipv6Addresses.map((a) => ({
|
|
205
|
+
ip: a.ipv6Address,
|
|
206
|
+
url: `http://${a.ipv6Address}:${$scope.state.instancePort}`,
|
|
207
|
+
})),
|
|
208
|
+
);
|
|
226
209
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
210
|
+
const permanentNetworkInterfaces = $scope.instance.networkInterfaces.filter(
|
|
211
|
+
(f) => f.attachment.deleteOnTermination === false,
|
|
212
|
+
);
|
|
213
|
+
if (permanentNetworkInterfaces.length) {
|
|
214
|
+
$scope.instance.permanentIps = permanentNetworkInterfaces.map((f) => f.privateIpAddress);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
$scope.baseIpAddress = details.publicDnsName || details.privateIpAddress;
|
|
218
|
+
if (overrides.instanceDetailsLoaded) {
|
|
219
|
+
overrides.instanceDetailsLoaded();
|
|
220
|
+
}
|
|
221
|
+
}, autoClose);
|
|
222
|
+
}
|
|
231
223
|
|
|
232
|
-
|
|
233
|
-
|
|
224
|
+
if (!instanceSummary) {
|
|
225
|
+
$scope.instanceIdNotFound = instance.instanceId;
|
|
226
|
+
$scope.state.loading = false;
|
|
227
|
+
}
|
|
234
228
|
|
|
235
|
-
|
|
236
|
-
if ($scope.$$destroyed) {
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
if (app.isStandalone) {
|
|
240
|
-
$scope.state.loading = false;
|
|
241
|
-
$scope.instanceIdNotFound = instance.instanceId;
|
|
242
|
-
$scope.state.notFoundStandalone = true;
|
|
243
|
-
RecentHistoryService.removeLastItem('instances');
|
|
244
|
-
} else {
|
|
245
|
-
$state.go('^', { allowModalToStayOpen: true }, { location: 'replace' });
|
|
229
|
+
return $q.when(null);
|
|
246
230
|
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
this.canDeregisterFromLoadBalancer = function () {
|
|
250
|
-
const healthMetrics = $scope.instance.health || [];
|
|
251
|
-
return healthMetrics.some(function (health) {
|
|
252
|
-
return health.type === 'LoadBalancer';
|
|
253
|
-
});
|
|
254
|
-
};
|
|
255
231
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
232
|
+
function autoClose() {
|
|
233
|
+
if ($scope.$$destroyed) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (app.isStandalone) {
|
|
237
|
+
$scope.state.loading = false;
|
|
238
|
+
$scope.instanceIdNotFound = instance.instanceId;
|
|
239
|
+
$scope.state.notFoundStandalone = true;
|
|
240
|
+
RecentHistoryService.removeLastItem('instances');
|
|
241
|
+
} else {
|
|
242
|
+
$state.go('^', { allowModalToStayOpen: true }, { location: 'replace' });
|
|
243
|
+
}
|
|
261
244
|
}
|
|
262
|
-
const outOfService = healthMetrics.some(function (health) {
|
|
263
|
-
return health.type === 'LoadBalancer' && health.state === 'OutOfService';
|
|
264
|
-
});
|
|
265
|
-
const hasLoadBalancerHealth = healthMetrics.some(function (health) {
|
|
266
|
-
return health.type === 'LoadBalancer';
|
|
267
|
-
});
|
|
268
|
-
return outOfService || !hasLoadBalancerHealth;
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
this.canDeregisterFromTargetGroup = function () {
|
|
272
|
-
const healthMetrics = $scope.instance.health || [];
|
|
273
|
-
return healthMetrics.some(function (health) {
|
|
274
|
-
return health.type === 'TargetGroup' && health.state !== 'OutOfService';
|
|
275
|
-
});
|
|
276
|
-
};
|
|
277
245
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
const outOfService = healthMetrics.some(function (health) {
|
|
285
|
-
return health.type === 'TargetGroup' && health.state === 'OutOfService';
|
|
286
|
-
});
|
|
287
|
-
const hasTargetGroupHealth = healthMetrics.some(function (health) {
|
|
288
|
-
return health.type === 'TargetGroup';
|
|
289
|
-
});
|
|
290
|
-
return outOfService || !hasTargetGroupHealth;
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
this.canRegisterWithDiscovery = function () {
|
|
294
|
-
const instance = $scope.instance;
|
|
295
|
-
const healthMetrics = instance.health || [];
|
|
296
|
-
const discoveryHealth = healthMetrics.filter(function (health) {
|
|
297
|
-
return health.type === 'Discovery';
|
|
298
|
-
});
|
|
299
|
-
return discoveryHealth.length ? discoveryHealth[0].state === 'OutOfService' : false;
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
this.terminateInstance = function terminateInstance() {
|
|
303
|
-
const instance = $scope.instance;
|
|
304
|
-
|
|
305
|
-
const taskMonitor = {
|
|
306
|
-
application: app,
|
|
307
|
-
title: 'Terminating ' + instance.instanceId,
|
|
308
|
-
onTaskComplete: function () {
|
|
309
|
-
if ($state.includes('**.instanceDetails', { instanceId: instance.instanceId })) {
|
|
310
|
-
$state.go('^');
|
|
311
|
-
}
|
|
312
|
-
},
|
|
246
|
+
this.canDeregisterFromLoadBalancer = function () {
|
|
247
|
+
const healthMetrics = $scope.instance.health || [];
|
|
248
|
+
return healthMetrics.some(function (health) {
|
|
249
|
+
return health.type === 'LoadBalancer';
|
|
250
|
+
});
|
|
313
251
|
};
|
|
314
252
|
|
|
315
|
-
|
|
316
|
-
|
|
253
|
+
this.canRegisterWithLoadBalancer = function () {
|
|
254
|
+
const instance = $scope.instance;
|
|
255
|
+
const healthMetrics = instance.health || [];
|
|
256
|
+
if (!instance.loadBalancers || !instance.loadBalancers.length) {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
const outOfService = healthMetrics.some(function (health) {
|
|
260
|
+
return health.type === 'LoadBalancer' && health.state === 'OutOfService';
|
|
261
|
+
});
|
|
262
|
+
const hasLoadBalancerHealth = healthMetrics.some(function (health) {
|
|
263
|
+
return health.type === 'LoadBalancer';
|
|
264
|
+
});
|
|
265
|
+
return outOfService || !hasLoadBalancerHealth;
|
|
317
266
|
};
|
|
318
267
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
submitMethod: submitMethod,
|
|
325
|
-
});
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
this.terminateInstanceAndShrinkServerGroup = function terminateInstanceAndShrinkServerGroup() {
|
|
329
|
-
const instance = $scope.instance;
|
|
330
|
-
|
|
331
|
-
const taskMonitor = {
|
|
332
|
-
application: app,
|
|
333
|
-
title: 'Terminating ' + instance.instanceId + ' and shrinking server group',
|
|
334
|
-
onTaskComplete: function () {
|
|
335
|
-
if ($state.includes('**.instanceDetails', { instanceId: instance.instanceId })) {
|
|
336
|
-
$state.go('^');
|
|
337
|
-
}
|
|
338
|
-
},
|
|
268
|
+
this.canDeregisterFromTargetGroup = function () {
|
|
269
|
+
const healthMetrics = $scope.instance.health || [];
|
|
270
|
+
return healthMetrics.some(function (health) {
|
|
271
|
+
return health.type === 'TargetGroup' && health.state !== 'OutOfService';
|
|
272
|
+
});
|
|
339
273
|
};
|
|
340
274
|
|
|
341
|
-
|
|
342
|
-
|
|
275
|
+
this.canRegisterWithTargetGroup = function () {
|
|
276
|
+
const instance = $scope.instance;
|
|
277
|
+
const healthMetrics = instance.health || [];
|
|
278
|
+
if (!instance.targetGroups || !instance.targetGroups.length) {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
const outOfService = healthMetrics.some(function (health) {
|
|
282
|
+
return health.type === 'TargetGroup' && health.state === 'OutOfService';
|
|
283
|
+
});
|
|
284
|
+
const hasTargetGroupHealth = healthMetrics.some(function (health) {
|
|
285
|
+
return health.type === 'TargetGroup';
|
|
286
|
+
});
|
|
287
|
+
return outOfService || !hasTargetGroupHealth;
|
|
343
288
|
};
|
|
344
289
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
this.rebootInstance = function rebootInstance() {
|
|
355
|
-
const instance = $scope.instance;
|
|
356
|
-
|
|
357
|
-
const taskMonitor = {
|
|
358
|
-
application: app,
|
|
359
|
-
title: 'Rebooting ' + instance.instanceId,
|
|
290
|
+
this.canRegisterWithDiscovery = function () {
|
|
291
|
+
const instance = $scope.instance;
|
|
292
|
+
const healthMetrics = instance.health || [];
|
|
293
|
+
const discoveryHealth = healthMetrics.filter(function (health) {
|
|
294
|
+
return health.type === 'Discovery';
|
|
295
|
+
});
|
|
296
|
+
return discoveryHealth.length ? discoveryHealth[0].state === 'OutOfService' : false;
|
|
360
297
|
};
|
|
361
298
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
params.interestingHealthProviderNames = ['Amazon'];
|
|
365
|
-
}
|
|
299
|
+
this.terminateInstance = function terminateInstance() {
|
|
300
|
+
const instance = $scope.instance;
|
|
366
301
|
|
|
367
|
-
|
|
302
|
+
const taskMonitor = {
|
|
303
|
+
application: app,
|
|
304
|
+
title: 'Terminating ' + instance.instanceId,
|
|
305
|
+
onTaskComplete: function () {
|
|
306
|
+
if ($state.includes('**.instanceDetails', { instanceId: instance.instanceId })) {
|
|
307
|
+
$state.go('^');
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
const submitMethod = function () {
|
|
313
|
+
return AmazonInstanceWriter.terminateInstance(instance, app);
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
ConfirmationModalService.confirm({
|
|
317
|
+
header: 'Really terminate ' + instance.instanceId + '?',
|
|
318
|
+
buttonText: 'Terminate ' + instance.instanceId,
|
|
319
|
+
account: instance.account,
|
|
320
|
+
taskMonitorConfig: taskMonitor,
|
|
321
|
+
submitMethod: submitMethod,
|
|
322
|
+
});
|
|
368
323
|
};
|
|
369
324
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
buttonText: 'Reboot ' + instance.instanceId,
|
|
373
|
-
account: instance.account,
|
|
374
|
-
platformHealthOnlyShowOverride: app.attributes.platformHealthOnlyShowOverride,
|
|
375
|
-
platformHealthType: 'Amazon',
|
|
376
|
-
taskMonitorConfig: taskMonitor,
|
|
377
|
-
submitMethod: submitMethod,
|
|
378
|
-
});
|
|
379
|
-
};
|
|
325
|
+
this.terminateInstanceAndShrinkServerGroup = function terminateInstanceAndShrinkServerGroup() {
|
|
326
|
+
const instance = $scope.instance;
|
|
380
327
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
328
|
+
const taskMonitor = {
|
|
329
|
+
application: app,
|
|
330
|
+
title: 'Terminating ' + instance.instanceId + ' and shrinking server group',
|
|
331
|
+
onTaskComplete: function () {
|
|
332
|
+
if ($state.includes('**.instanceDetails', { instanceId: instance.instanceId })) {
|
|
333
|
+
$state.go('^');
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
const submitMethod = function () {
|
|
339
|
+
return AmazonInstanceWriter.terminateInstanceAndShrinkServerGroup(instance, app);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
ConfirmationModalService.confirm({
|
|
343
|
+
header: 'Really terminate ' + instance.instanceId + ' and shrink ' + instance.serverGroup + '?',
|
|
344
|
+
buttonText: 'Terminate ' + instance.instanceId + ' and shrink ' + instance.serverGroup,
|
|
345
|
+
account: instance.account,
|
|
346
|
+
taskMonitorConfig: taskMonitor,
|
|
347
|
+
submitMethod: submitMethod,
|
|
348
|
+
});
|
|
388
349
|
};
|
|
389
350
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
};
|
|
351
|
+
this.rebootInstance = function rebootInstance() {
|
|
352
|
+
const instance = $scope.instance;
|
|
393
353
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
taskMonitorConfig: taskMonitor,
|
|
399
|
-
submitMethod: submitMethod,
|
|
400
|
-
});
|
|
401
|
-
};
|
|
354
|
+
const taskMonitor = {
|
|
355
|
+
application: app,
|
|
356
|
+
title: 'Rebooting ' + instance.instanceId,
|
|
357
|
+
};
|
|
402
358
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
359
|
+
const submitMethod = (params = {}) => {
|
|
360
|
+
if (app.attributes && app.attributes.platformHealthOnlyShowOverride && app.attributes.platformHealthOnly) {
|
|
361
|
+
params.interestingHealthProviderNames = ['Amazon'];
|
|
362
|
+
}
|
|
406
363
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
364
|
+
return AmazonInstanceWriter.rebootInstance(instance, app, params);
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
ConfirmationModalService.confirm({
|
|
368
|
+
header: 'Really reboot ' + instance.instanceId + '?',
|
|
369
|
+
buttonText: 'Reboot ' + instance.instanceId,
|
|
370
|
+
account: instance.account,
|
|
371
|
+
platformHealthOnlyShowOverride: app.attributes.platformHealthOnlyShowOverride,
|
|
372
|
+
platformHealthType: 'Amazon',
|
|
373
|
+
taskMonitorConfig: taskMonitor,
|
|
374
|
+
submitMethod: submitMethod,
|
|
375
|
+
});
|
|
410
376
|
};
|
|
411
377
|
|
|
412
|
-
|
|
413
|
-
|
|
378
|
+
this.registerInstanceWithLoadBalancer = function registerInstanceWithLoadBalancer() {
|
|
379
|
+
const instance = $scope.instance;
|
|
380
|
+
const loadBalancerNames = instance.loadBalancers.join(' and ');
|
|
381
|
+
|
|
382
|
+
const taskMonitor = {
|
|
383
|
+
application: app,
|
|
384
|
+
title: 'Registering ' + instance.instanceId + ' with ' + loadBalancerNames,
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
const submitMethod = function () {
|
|
388
|
+
return AmazonInstanceWriter.registerInstanceWithLoadBalancer(instance, app);
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
ConfirmationModalService.confirm({
|
|
392
|
+
header: 'Really register ' + instance.instanceId + ' with ' + loadBalancerNames + '?',
|
|
393
|
+
buttonText: 'Register ' + instance.instanceId,
|
|
394
|
+
account: instance.account,
|
|
395
|
+
taskMonitorConfig: taskMonitor,
|
|
396
|
+
submitMethod: submitMethod,
|
|
397
|
+
});
|
|
414
398
|
};
|
|
415
399
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
400
|
+
this.deregisterInstanceFromLoadBalancer = function deregisterInstanceFromLoadBalancer() {
|
|
401
|
+
const instance = $scope.instance;
|
|
402
|
+
const loadBalancerNames = instance.loadBalancers.join(' and ');
|
|
403
|
+
|
|
404
|
+
const taskMonitor = {
|
|
405
|
+
application: app,
|
|
406
|
+
title: 'Deregistering ' + instance.instanceId + ' from ' + loadBalancerNames,
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
const submitMethod = function () {
|
|
410
|
+
return AmazonInstanceWriter.deregisterInstanceFromLoadBalancer(instance, app);
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
ConfirmationModalService.confirm({
|
|
414
|
+
header: 'Really deregister ' + instance.instanceId + ' from ' + loadBalancerNames + '?',
|
|
415
|
+
buttonText: 'Deregister ' + instance.instanceId,
|
|
416
|
+
account: instance.account,
|
|
417
|
+
taskMonitorConfig: taskMonitor,
|
|
418
|
+
submitMethod: submitMethod,
|
|
419
|
+
});
|
|
432
420
|
};
|
|
433
421
|
|
|
434
|
-
|
|
435
|
-
|
|
422
|
+
this.registerInstanceWithTargetGroup = function registerInstanceWithTargetGroup() {
|
|
423
|
+
const instance = $scope.instance;
|
|
424
|
+
const targetGroupNames = instance.targetGroups.join(' and ');
|
|
425
|
+
|
|
426
|
+
const taskMonitor = {
|
|
427
|
+
application: app,
|
|
428
|
+
title: 'Registering ' + instance.instanceId + ' with ' + targetGroupNames,
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
const submitMethod = function () {
|
|
432
|
+
return AmazonInstanceWriter.registerInstanceWithTargetGroup(instance, app);
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
ConfirmationModalService.confirm({
|
|
436
|
+
header: 'Really register ' + instance.instanceId + ' with ' + targetGroupNames + '?',
|
|
437
|
+
buttonText: 'Register ' + instance.instanceId,
|
|
438
|
+
account: instance.account,
|
|
439
|
+
taskMonitorConfig: taskMonitor,
|
|
440
|
+
submitMethod: submitMethod,
|
|
441
|
+
});
|
|
436
442
|
};
|
|
437
443
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
444
|
+
this.deregisterInstanceFromTargetGroup = function deregisterInstanceFromTargetGroup() {
|
|
445
|
+
const instance = $scope.instance;
|
|
446
|
+
const targetGroupNames = instance.targetGroups.join(' and ');
|
|
447
|
+
|
|
448
|
+
const taskMonitor = {
|
|
449
|
+
application: app,
|
|
450
|
+
title: 'Deregistering ' + instance.instanceId + ' from ' + targetGroupNames,
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
const submitMethod = function () {
|
|
454
|
+
return AmazonInstanceWriter.deregisterInstanceFromTargetGroup(instance, app);
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
ConfirmationModalService.confirm({
|
|
458
|
+
header: 'Really deregister ' + instance.instanceId + ' from ' + targetGroupNames + '?',
|
|
459
|
+
buttonText: 'Deregister ' + instance.instanceId,
|
|
460
|
+
account: instance.account,
|
|
461
|
+
taskMonitorConfig: taskMonitor,
|
|
462
|
+
submitMethod: submitMethod,
|
|
463
|
+
});
|
|
454
464
|
};
|
|
455
465
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
};
|
|
466
|
+
this.enableInstanceInDiscovery = function enableInstanceInDiscovery() {
|
|
467
|
+
const instance = $scope.instance;
|
|
459
468
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
taskMonitorConfig: taskMonitor,
|
|
465
|
-
submitMethod: submitMethod,
|
|
466
|
-
});
|
|
467
|
-
};
|
|
469
|
+
const taskMonitor = {
|
|
470
|
+
application: app,
|
|
471
|
+
title: 'Enabling ' + instance.instanceId + ' in discovery',
|
|
472
|
+
};
|
|
468
473
|
|
|
469
|
-
|
|
470
|
-
|
|
474
|
+
const submitMethod = function () {
|
|
475
|
+
return AmazonInstanceWriter.enableInstanceInDiscovery(instance, app);
|
|
476
|
+
};
|
|
471
477
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
478
|
+
ConfirmationModalService.confirm({
|
|
479
|
+
header: 'Really enable ' + instance.instanceId + ' in discovery?',
|
|
480
|
+
buttonText: 'Enable ' + instance.instanceId,
|
|
481
|
+
account: instance.account,
|
|
482
|
+
taskMonitorConfig: taskMonitor,
|
|
483
|
+
submitMethod: submitMethod,
|
|
484
|
+
});
|
|
475
485
|
};
|
|
476
486
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
};
|
|
487
|
+
this.disableInstanceInDiscovery = function disableInstanceInDiscovery() {
|
|
488
|
+
const instance = $scope.instance;
|
|
480
489
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
taskMonitorConfig: taskMonitor,
|
|
486
|
-
submitMethod: submitMethod,
|
|
487
|
-
});
|
|
488
|
-
};
|
|
490
|
+
const taskMonitor = {
|
|
491
|
+
application: app,
|
|
492
|
+
title: 'Disabling ' + instance.instanceId + ' in discovery',
|
|
493
|
+
};
|
|
489
494
|
|
|
490
|
-
|
|
491
|
-
|
|
495
|
+
const submitMethod = function () {
|
|
496
|
+
return AmazonInstanceWriter.disableInstanceInDiscovery(instance, app);
|
|
497
|
+
};
|
|
492
498
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
499
|
+
ConfirmationModalService.confirm({
|
|
500
|
+
header: 'Really disable ' + instance.instanceId + ' in discovery?',
|
|
501
|
+
buttonText: 'Disable ' + instance.instanceId,
|
|
502
|
+
account: instance.account,
|
|
503
|
+
taskMonitorConfig: taskMonitor,
|
|
504
|
+
submitMethod: submitMethod,
|
|
505
|
+
});
|
|
496
506
|
};
|
|
497
507
|
|
|
498
|
-
|
|
499
|
-
|
|
508
|
+
this.hasHealthState = function hasHealthState(healthProviderType, state) {
|
|
509
|
+
const instance = $scope.instance;
|
|
510
|
+
const healthMetrics = instance.health || [];
|
|
511
|
+
return healthMetrics.some(function (health) {
|
|
512
|
+
return health.type === healthProviderType && health.state === state;
|
|
513
|
+
});
|
|
500
514
|
};
|
|
501
515
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
516
|
+
const constructInstanceActions = (instance) => {
|
|
517
|
+
const constantActions = [
|
|
518
|
+
{ label: 'Reboot', triggerAction: this.rebootInstance },
|
|
519
|
+
{ label: 'Terminate', triggerAction: this.terminateInstance },
|
|
520
|
+
{ label: 'Terminate and Shrink Server Group', triggerAction: this.terminateInstanceAndShrinkServerGroup },
|
|
521
|
+
];
|
|
522
|
+
const conditionalActions = [];
|
|
523
|
+
|
|
524
|
+
if (this.canRegisterWithDiscovery() && !instance.serverGroupDisabled) {
|
|
525
|
+
conditionalActions.push({
|
|
526
|
+
label: 'Enable In Discovery',
|
|
527
|
+
triggerAction: this.enableInstanceInDiscovery,
|
|
528
|
+
});
|
|
529
|
+
}
|
|
510
530
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
const constructInstanceActions = (instance) => {
|
|
520
|
-
const constantActions = [
|
|
521
|
-
{ label: 'Reboot', triggerAction: this.rebootInstance },
|
|
522
|
-
{ label: 'Terminate', triggerAction: this.terminateInstance },
|
|
523
|
-
{ label: 'Terminate and Shrink Server Group', triggerAction: this.terminateInstanceAndShrinkServerGroup },
|
|
524
|
-
];
|
|
525
|
-
const conditionalActions = [];
|
|
526
|
-
|
|
527
|
-
if (this.canRegisterWithDiscovery() && !instance.serverGroupDisabled) {
|
|
528
|
-
conditionalActions.push({
|
|
529
|
-
label: 'Enable In Discovery',
|
|
530
|
-
triggerAction: this.enableInstanceInDiscovery,
|
|
531
|
-
});
|
|
532
|
-
}
|
|
531
|
+
if (this.hasHealthState('Discovery', 'Up') || this.hasHealthState('Discovery', 'Down')) {
|
|
532
|
+
conditionalActions.push({
|
|
533
|
+
label: 'Disable in Discovery',
|
|
534
|
+
triggerAction: this.disableInstanceInDiscovery,
|
|
535
|
+
});
|
|
536
|
+
}
|
|
533
537
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
538
|
+
if (this.canRegisterWithLoadBalancer()) {
|
|
539
|
+
conditionalActions.push({
|
|
540
|
+
label: 'Register with Load Balancer',
|
|
541
|
+
triggerAction: this.registerInstanceWithLoadBalancer,
|
|
542
|
+
});
|
|
543
|
+
}
|
|
540
544
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
545
|
+
if (this.canDeregisterFromLoadBalancer()) {
|
|
546
|
+
conditionalActions.push({
|
|
547
|
+
label: 'Deregister from Load Balancer',
|
|
548
|
+
triggerAction: this.deregisterInstanceFromLoadBalancer,
|
|
549
|
+
});
|
|
550
|
+
}
|
|
547
551
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
552
|
+
if (this.canRegisterWithTargetGroup()) {
|
|
553
|
+
conditionalActions.push({
|
|
554
|
+
label: 'Register with Target Group',
|
|
555
|
+
triggerAction: this.registerInstanceWithTargetGroup,
|
|
556
|
+
});
|
|
557
|
+
}
|
|
554
558
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
559
|
+
if (this.canDeregisterFromTargetGroup()) {
|
|
560
|
+
conditionalActions.push({
|
|
561
|
+
label: 'Deregister from Target Group',
|
|
562
|
+
triggerAction: this.deregisterInstanceFromTargetGroup,
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
return conditionalActions.concat(constantActions);
|
|
566
|
+
};
|
|
561
567
|
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
$scope.instanceActions = constructInstanceActions($scope.instance);
|
|
577
|
-
// Two things to look out for here:
|
|
578
|
-
// 1. If the retrieveInstance call completes *after* the user has navigated away from the view, there
|
|
579
|
-
// is no point in subscribing to the refresh
|
|
580
|
-
// 2. If this is a standalone instance, there is no application that will refresh
|
|
581
|
-
if (!$scope.$$destroyed && !app.isStandalone) {
|
|
582
|
-
app.serverGroups.onRefresh($scope, retrieveInstance);
|
|
583
|
-
}
|
|
584
|
-
});
|
|
568
|
+
const initialize = app.isStandalone
|
|
569
|
+
? retrieveInstance()
|
|
570
|
+
: $q.all([app.serverGroups.ready(), app.loadBalancers.ready()]).then(retrieveInstance);
|
|
571
|
+
|
|
572
|
+
initialize.then(() => {
|
|
573
|
+
$scope.instanceActions = constructInstanceActions($scope.instance);
|
|
574
|
+
// Two things to look out for here:
|
|
575
|
+
// 1. If the retrieveInstance call completes *after* the user has navigated away from the view, there
|
|
576
|
+
// is no point in subscribing to the refresh
|
|
577
|
+
// 2. If this is a standalone instance, there is no application that will refresh
|
|
578
|
+
if (!$scope.$$destroyed && !app.isStandalone) {
|
|
579
|
+
app.serverGroups.onRefresh($scope, retrieveInstance);
|
|
580
|
+
}
|
|
581
|
+
});
|
|
585
582
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
]
|
|
583
|
+
$scope.account = instance.account;
|
|
584
|
+
},
|
|
585
|
+
],
|
|
586
|
+
);
|