Skip to content

Commit 094ba53

Browse files
authored
feat: Account Operator Pages (#3368)
* Account Operator: add name and change header of the account operator page -> also add 'account name' to the account list page * chore: updating tests to check for new account name information
1 parent 30a3b5a commit 094ba53

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

cypress/e2e/cloud/operator.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ describe('Operator Page', () => {
131131
expect(loc.pathname).to.eq('/operator/accounts/1')
132132
})
133133

134-
cy.getByTestID('account-view--header').contains('Account 1')
134+
cy.getByTestID('account-view--header').contains('operator1 (1)')
135135
// should not be able to delete undeletable accounts
136136
cy.getByTestID('account-delete--button').should('be.disabled')
137137

cypress/e2e/cloud/operatorRO.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@ describe('Operator Page', () => {
5353
expect(loc.pathname).to.eq('/operator/accounts')
5454
})
5555

56+
// testing that the "account name" column has been added, and that the first value is 'operator1'
57+
cy.getByTestID('table')
58+
.find('tr')
59+
.first()
60+
.find('th')
61+
.first()
62+
.should('contain.text', 'Account Name')
63+
64+
// make sure there is a name column with data:
65+
cy.getByTestID('name')
66+
.first()
67+
.should('contain.text', 'operator1')
68+
5669
cy.getByTestID('account-id')
5770
.first()
5871
.within(() => {
@@ -66,6 +79,7 @@ describe('Operator Page', () => {
6679
// make sure the buttons don't exist on the page
6780
cy.getByTestID('account-delete--button').should('not.exist')
6881
cy.getByTestID('remove-user--button').should('not.exist')
82+
cy.getByTestID('page-title').should('contain.text', 'operator1 (1)')
6983

7084
// go back to account listing
7185
cy.getByTestID('account-view--back-button').click()

src/operator/account/AccountView.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,20 @@ import PageSpinner from 'src/perf/components/PageSpinner'
1515
const AccountView: FC = () => {
1616
const {account, accountStatus} = useContext(AccountContext)
1717

18+
let accountTitle = 'loading....'
19+
if (account) {
20+
if (account?.name) {
21+
accountTitle = `${account.name} (${account.id})`
22+
} else {
23+
accountTitle = `Account ${account.id}`
24+
}
25+
}
26+
1827
return (
1928
<PageSpinner loading={accountStatus}>
2029
<AppWrapper>
21-
<Page titleTag={`Account ${account?.id}`} testID="account-view--header">
22-
<AppPageHeader title={`Account ${account?.id}`} />
30+
<Page titleTag={accountTitle} testID="account-view--header">
31+
<AppPageHeader title={accountTitle} />
2332
<Page.Contents scrollable={true}>
2433
<DeleteAccountOverlay />
2534
<AccountViewHeader />

src/operator/constants.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {CellInfo, ResourceInfo} from 'src/types'
33
import {Link} from 'react-router-dom'
44

55
export const accountHeaderInfo = [
6+
'Account Name',
67
'Company Name',
78
'Acct ID',
89
'Owner Email',
@@ -13,6 +14,11 @@ export const accountHeaderInfo = [
1314
]
1415

1516
export const accountColumnInfo: CellInfo[] = [
17+
{
18+
path: 'name',
19+
name: 'name',
20+
defaultValue: '',
21+
},
1622
{
1723
path: 'billingContact.companyName',
1824
name: 'company-name',

0 commit comments

Comments
 (0)