Skip to content

Commit d772e1f

Browse files
authored
feat: add storage type to org profile page (#6460)
* feat: add storage type to org profile page * chore: remove unnecessary selector and defaults from org profile page * chore: add capitalization * chore: fix variable names for storage typing * chore: remove toLowerCase
1 parent 98ecbc1 commit d772e1f

File tree

4 files changed

+55
-7
lines changed

4 files changed

+55
-7
lines changed

cypress/e2e/cloud/about.test.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {makeQuartzUseIDPEOrgID} from 'cypress/support/Utils'
2+
import {Organization} from 'src/client'
23

34
const deleteOrgsFeatureFlags = {
45
createDeleteOrgs: true,
@@ -7,6 +8,15 @@ const deleteOrgsFeatureFlags = {
78
// This variable stores the current IDPE orgid and syncs it with the quartz-mock orgid.
89
let idpeOrgID: string
910

11+
const spoofStorageType = (storageType: Organization['defaultStorageType']) => {
12+
cy.intercept('GET', 'api/v2/orgs', req => {
13+
req.continue(res => {
14+
res.body.orgs[0].defaultStorageType = storageType
15+
res.send(res)
16+
})
17+
})
18+
}
19+
1020
const getOrgCreationAllowance = (allowanceFixture: string) => {
1121
cy.intercept('GET', 'api/v2/quartz/allowances/orgs/create', {
1222
fixture: allowanceFixture,
@@ -203,6 +213,35 @@ const upgradeAccount = () => {
203213
.contains('Your account upgrade inquiry has been submitted.')
204214
}
205215

216+
describe('Storage types', () => {
217+
it('identifies the storage type as iox in an iox org', () => {
218+
spoofStorageType('iox')
219+
setupTest({
220+
accountType: 'pay_as_you_go',
221+
canCreateOrgs: true,
222+
orgHasOtherUsers: false,
223+
})
224+
225+
cy.getByTestID('org-profile--labeled-data').within(() => {
226+
cy.getByTestID('heading').contains('Storage Type')
227+
cy.contains('IOx')
228+
})
229+
})
230+
231+
it('identifies the storage type as tsm in a tsm org', () => {
232+
spoofStorageType('tsm')
233+
setupTest({
234+
accountType: 'contract',
235+
canCreateOrgs: false,
236+
orgHasOtherUsers: true,
237+
})
238+
cy.getByTestID('org-profile--labeled-data').within(() => {
239+
cy.getByTestID('heading').contains('Storage Type')
240+
cy.contains('TSM')
241+
})
242+
})
243+
})
244+
206245
describe('Free account', () => {
207246
it('displays a `must remove users` warning if trying to delete an org with multiple users in a multi-org free account', () => {
208247
setupTest({

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"cy": "CYPRESS_dexUrl=https://$INGRESS_HOST:$PORT_HTTPS CYPRESS_baseUrl=http://localhost:9999 cypress open",
5454
"cy:dev": "source ../monitor-ci/.env && CYPRESS_dexUrl=CLOUD CYPRESS_baseUrl=https://$INGRESS_HOST:$PORT_HTTPS cypress open --config testFiles='{cloud,shared}/**/*.*'",
5555
"cy:dev-oss": "source ../monitor-ci/.env && CYPRESS_dexUrl=OSS CYPRESS_baseUrl=https://$INGRESS_HOST:$PORT_HTTPS cypress open --config testFiles='{oss,shared}/**/*.*'",
56-
"generate": "export SHA=00a445641ae596ea69e9cb74fd774bf92b9a2175 && export REMOTE=https://raw.githubusercontent.com/influxdata/openapi/${SHA}/ && yarn generate-meta",
56+
"generate": "export SHA=19b89d0e168edb6a27f801c6161f89ead6600401 && export REMOTE=https://raw.githubusercontent.com/influxdata/openapi/${SHA}/ && yarn generate-meta",
5757
"generate-local": "export REMOTE=../openapi/ && yarn generate-meta",
5858
"generate-local-cloud": "export REMOTE=../openapi/ && yarn generate-meta-cloud",
5959
"generate-meta": "if [ -z \"${CLOUD_URL}\" ]; then yarn generate-meta-oss; else yarn generate-meta-cloud; fi",

src/organizations/components/OrgProfileTab/index.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ const OrgProfileTab: FC = () => {
4646
const me = useSelector(getMe)
4747
const org = useSelector(getOrg)
4848
const quartzOrg = useSelector(selectCurrentOrg)
49-
const dispatch = useDispatch()
49+
const storageType = org?.defaultStorageType
5050
const {users} = useContext(UsersContext)
5151

52+
const dispatch = useDispatch()
53+
5254
// Data about the user's organization is intentionally re-fetched when this component mounts again.
5355
const [orgDetailsStatus, setOrgDetailsStatus] = useState(
5456
RemoteDataState.NotStarted
@@ -81,6 +83,14 @@ const OrgProfileTab: FC = () => {
8183
const allowSelfRemoval = users.length > 1
8284
const showLeaveOrgButton = isFlagEnabled('createDeleteOrgs')
8385
const hasFetchedOrgDetails = orgDetailsStatus === RemoteDataState.Done
86+
const hasFetchedStorageType = Boolean(storageType)
87+
88+
const storageTypeMap = {
89+
iox: 'IOx',
90+
tsm: 'TSM',
91+
}
92+
93+
const formattedStorageType = storageTypeMap[storageType] || storageType
8494

8595
const OrgProfile = () => (
8696
<FlexBox.Child
@@ -107,6 +117,9 @@ const OrgProfileTab: FC = () => {
107117
<LabeledData label="Cloud Provider" src={quartzOrg.provider} />
108118
<LabeledData label="Region" src={quartzOrg.regionCode} />
109119
<LabeledData label="Location" src={quartzOrg.regionName} />
120+
{hasFetchedStorageType && (
121+
<LabeledData label="Storage Type" src={formattedStorageType} />
122+
)}
110123
</FlexBox>
111124
<CopyableLabeledData
112125
id="clusterUrl"

src/organizations/selectors/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ import {get} from 'lodash'
44
// Types
55
import {AppState, Organization} from 'src/types'
66

7-
interface OrganizationWithStorageType extends Organization {
8-
defaultStorageType?: string
9-
}
10-
117
export const isOrgIOx = (state: AppState): boolean => {
12-
const org: OrganizationWithStorageType = getOrg(state)
8+
const org: Organization = getOrg(state)
139

1410
return Boolean(
1511
org &&

0 commit comments

Comments
 (0)