Skip to content

Commit 1a00852

Browse files
authored
fix(ec2): show terminated icon on terminated instances. (#6092)
## Problem The AWS SDK returns terminated instances for a short period and we display a `pending` icon in this case. <img width="705" alt="image" src="https://github.com/user-attachments/assets/2f2568ce-3abc-4002-938e-6864594bf6ac"> ## Solution Display a specific icon that indicates the instance is terminated. <img width="606" alt="image" src="https://github.com/user-attachments/assets/9bcaf466-6043-400e-bea2-394c3f7ec2fc"> ## Alternative Solution We could have avoided showing terminated instances at all. However, by showing them terminated it provides consistency with the console(since it also shows terminated instances for a short period), and greater visibility. --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent f91092a commit 1a00852

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

packages/core/src/awsService/ec2/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export function getIconCode(instance: SafeEc2Instance) {
1818
return 'circle-slash'
1919
}
2020

21+
if (instance.LastSeenStatus === 'terminated') {
22+
return 'stop'
23+
}
24+
2125
return 'loading~spin'
2226
}
2327

packages/core/src/test/awsService/ec2/utils.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,14 @@ describe('utils', async function () {
2828
InstanceId: 'XX',
2929
LastSeenStatus: 'stopped',
3030
}
31+
const terminatedInstance: SafeEc2Instance = {
32+
InstanceId: 'XXX',
33+
LastSeenStatus: 'terminated',
34+
}
3135

3236
assert.strictEqual(getIconCode(runningInstance), 'pass')
3337
assert.strictEqual(getIconCode(stoppedInstance), 'circle-slash')
38+
assert.strictEqual(getIconCode(terminatedInstance), 'stop')
3439
})
3540

3641
it('defaults to loading~spin', function () {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "EC2: terminated instances no longer show pending icon"
4+
}

0 commit comments

Comments
 (0)