Skip to content

Commit 48c5b8e

Browse files
authored
fix: show only generation name in spaces:info output (#3128)
* fix: show only generation name in spaces:info output * test: test fixes for spaces:info and spaces:wait
1 parent 16e02a4 commit 48c5b8e

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

packages/cli/src/lib/spaces/spaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function renderInfo(space: SpaceWithOutboundIps, json: boolean) {
2828
State: space.state,
2929
Shield: displayShieldState(space),
3030
'Outbound IPs': displayNat(space.outbound_ips),
31-
Generation: space.generation,
31+
Generation: space.generation.name,
3232
'Created at': space.created_at,
3333
},
3434
['ID', 'Team', 'Region', 'CIDR', 'Data CIDR', 'State', 'Shield', 'Outbound IPs', 'Generation', 'Created at'],

packages/cli/src/lib/types/fir.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2407,7 +2407,10 @@ export interface Space {
24072407
*
24082408
* @example "fir"
24092409
*/
2410-
generation: string;
2410+
generation: {
2411+
id: string,
2412+
name: string,
2413+
}
24112414
}
24122415
/**
24132416
*

packages/cli/test/fixtures/spaces/fixtures.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const spaces: Record<string, SpaceWithOutboundIps> = {
2121
organization: {
2222
name: 'my-org',
2323
},
24-
generation: 'cedar',
24+
generation: {id: '123', name: 'cedar'},
2525
created_at: '2016-01-06T03:23:13Z',
2626
updated_at: '2016-01-06T03:23:13Z',
2727
},
@@ -43,7 +43,7 @@ export const spaces: Record<string, SpaceWithOutboundIps> = {
4343
organization: {
4444
name: 'my-org',
4545
},
46-
generation: 'cedar',
46+
generation: {id: '123', name: 'cedar'},
4747
created_at: '2016-01-06T03:23:13Z',
4848
updated_at: '2016-01-06T03:23:13Z',
4949
},
@@ -66,7 +66,7 @@ export const spaces: Record<string, SpaceWithOutboundIps> = {
6666
organization: {
6767
name: 'my-org',
6868
},
69-
generation: 'cedar',
69+
generation: {id: '123', name: 'cedar'},
7070
created_at: '2016-01-06T03:23:13Z',
7171
updated_at: '2016-01-06T03:23:13Z',
7272
},

packages/cli/test/unit/commands/spaces/info.unit.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('spaces:info', function () {
3434
Data CIDR: ${space.data_cidr}
3535
State: ${space.state}
3636
Shield: off
37-
Generation: ${space.generation}
37+
Generation: ${space.generation.name}
3838
Created at: ${space.created_at}
3939
`))
4040
})
@@ -74,7 +74,7 @@ describe('spaces:info', function () {
7474
State: ${space.state}
7575
Shield: off
7676
Outbound IPs: 123.456.789.123
77-
Generation: ${space.generation}
77+
Generation: ${space.generation.name}
7878
Created at: ${space.created_at}
7979
`))
8080
})
@@ -101,7 +101,7 @@ describe('spaces:info', function () {
101101
State: ${space.state}
102102
Shield: off
103103
Outbound IPs: disabled
104-
Generation: ${space.generation}
104+
Generation: ${space.generation.name}
105105
Created at: ${space.created_at}
106106
`))
107107
})
@@ -124,7 +124,7 @@ describe('spaces:info', function () {
124124
Data CIDR: ${space.data_cidr}
125125
State: ${space.state}
126126
Shield: off
127-
Generation: ${space.generation}
127+
Generation: ${space.generation.name}
128128
Created at: ${space.created_at}
129129
`))
130130
})
@@ -147,7 +147,7 @@ describe('spaces:info', function () {
147147
Data CIDR: ${shieldSpace.data_cidr}
148148
State: ${shieldSpace.state}
149149
Shield: on
150-
Generation: ${space.generation}
150+
Generation: ${space.generation.name}
151151
Created at: ${shieldSpace.created_at}
152152
`))
153153
})
@@ -169,7 +169,7 @@ describe('spaces:info', function () {
169169
Data CIDR: ${space.data_cidr}
170170
State: ${space.state}
171171
Shield: off
172-
Generation: ${space.generation}
172+
Generation: ${space.generation.name}
173173
Created at: ${space.created_at}
174174
`))
175175
})

packages/cli/test/unit/commands/spaces/wait.unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('spaces:wait', function () {
5656
State: ${allocatedSpace.state}
5757
Shield: off
5858
Outbound IPs: 123.456.789.123
59-
Generation: ${allocatedSpace.generation}
59+
Generation: ${allocatedSpace.generation.name}
6060
Created at: ${allocatedSpace.created_at}
6161
`))
6262
expect(notifySpy.called).to.be.true
@@ -115,7 +115,7 @@ describe('spaces:wait', function () {
115115
Data CIDR: ${allocatedSpace.data_cidr}
116116
State: ${allocatedSpace.state}
117117
Shield: off
118-
Generation: ${allocatedSpace.generation}
118+
Generation: ${allocatedSpace.generation.name}
119119
Created at: ${allocatedSpace.created_at}
120120
`))
121121
expect(notifySpy.called).to.be.true

0 commit comments

Comments
 (0)