Skip to content

Commit

Permalink
Merge pull request #306 from alex-chew/fix-account-field-names
Browse files Browse the repository at this point in the history
Fix account field names in frontend
  • Loading branch information
alex-chew authored Aug 29, 2019
2 parents 297976f + be626e9 commit 31e2eab
Show file tree
Hide file tree
Showing 9 changed files with 259 additions and 261 deletions.
70 changes: 31 additions & 39 deletions dev-portal/src/components/Admin/Accounts/AccountsTableColumns.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,95 +23,87 @@
*/

export const EmailAddress = {
id: 'emailAddress',
id: 'EmailAddress',
title: 'Email address',
render: account => account.emailAddress,
render: account => account.EmailAddress,
ordering: {
iteratee: 'emailAddress',
iteratee: 'EmailAddress',
},
filtering: {
accessor: 'emailAddress',
accessor: 'EmailAddress',
},
}

export const DateRegistered = {
id: 'dateRegistered',
id: 'DateRegistered',
title: 'Date registered',
render: account => formatDate(account.dateRegistered),
render: account => formatDate(account.DateRegistered),
ordering: {
iteratee: 'dateRegistered',
iteratee: 'DateRegistered',
},
}

export const RegistrationMethod = {
id: 'registrationMethod',
id: 'RegistrationMethod',
title: 'Registration method',
render: account => account.registrationMethod,
render: account => account.RegistrationMethod,
}

export const ApiKeyId = {
id: 'apiKeyId',
id: 'ApiKeyId',
title: 'API key ID',
render: account => account.apiKeyId,
render: account => account.ApiKeyId,
filtering: {
accessor: 'apiKeyId',
accessor: 'ApiKeyId',
},
}

export const Promoter = {
id: 'promoter',
id: 'Promoter',
title: 'Promoter',
render: ({ promoterIdentityPoolId, promoterEmailAddress }) =>
promoterIdentityPoolId
? `${promoterEmailAddress} (${promoterIdentityPoolId})`
: '',
render: ({ PromoterIdentityId, PromoterEmailAddress }) =>
PromoterIdentityId ? `${PromoterEmailAddress} (${PromoterIdentityId})` : '',
filtering: {
accessor: ({ promoterIdentityPoolId, promoterEmailAddress }) =>
promoterIdentityPoolId
? `${promoterEmailAddress} ${promoterIdentityPoolId}`
: '',
accessor: ({ PromoterIdentityId, PromoterEmailAddress }) =>
PromoterIdentityId ? `${PromoterEmailAddress} ${PromoterIdentityId}` : '',
},
}

export const Inviter = {
id: 'inviter',
id: 'Inviter',
title: 'Inviter',
render: ({ inviterIdentityPoolId, inviterEmailAddress }) =>
inviterIdentityPoolId
? `${inviterEmailAddress} (${inviterIdentityPoolId})`
: '',
render: ({ InviterIdentityId, InviterEmailAddress }) =>
InviterIdentityId ? `${InviterEmailAddress} (${InviterIdentityId})` : '',
filtering: {
accessor: ({ inviterIdentityPoolId, inviterEmailAddress }) =>
inviterIdentityPoolId
? `${inviterEmailAddress} ${inviterIdentityPoolId}`
: '',
accessor: ({ InviterIdentityId, InviterEmailAddress }) =>
InviterIdentityId ? `${InviterEmailAddress} ${InviterIdentityId}` : '',
},
}

export const DatePromoted = {
id: 'datePromoted',
id: 'DatePromoted',
title: 'Date promoted',
render: ({ datePromoted }) => (datePromoted ? formatDate(datePromoted) : ''),
render: ({ DatePromoted }) => (DatePromoted ? formatDate(DatePromoted) : ''),
ordering: {
iteratee: 'datePromoted',
iteratee: 'DatePromoted',
},
}

export const DateRequested = {
id: 'dateRequested',
id: 'DateRequested',
title: 'Date requested',
render: account => formatDate(account.dateRequested),
render: account => formatDate(account.DateRequested),
ordering: {
iteratee: 'dateRequested',
iteratee: 'DateRequested',
},
}

export const DateInvited = {
id: 'dateInvited',
id: 'DateInvited',
title: 'Date invited',
render: account => formatDate(account.dateInvited),
render: account => formatDate(account.DateInvited),
ordering: {
iteratee: 'dateInvited',
iteratee: 'DateInvited',
},
}

Expand Down
10 changes: 4 additions & 6 deletions dev-portal/src/pages/Admin/Accounts/PendingInvites.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ const PendingInvites = () => {
setLoading(true)
closeDeleteModal()
try {
await AccountService.deleteInviteByIdentityPoolId(
selectedAccount.identityPoolId,
)
await AccountService.deleteInviteByIdentityId(selectedAccount.IdentityId)
sendMessage(dismiss => (
<DeleteSuccessMessage account={selectedAccount} dismiss={dismiss} />
))
Expand Down Expand Up @@ -224,7 +222,7 @@ const DeleteInviteModal = ({ account, onConfirm, open, onClose }) =>
<Modal.Content>
<p>
Are you sure you want to delete this account invite for{' '}
<strong>{account.emailAddress}</strong>? This action is irreversible.
<strong>{account.EmailAddress}</strong>? This action is irreversible.
</p>
</Modal.Content>
<Modal.Actions>
Expand Down Expand Up @@ -258,7 +256,7 @@ const CreateFailureMessage = ({ emailAddress, errorMessage, dismiss }) => (
const DeleteSuccessMessage = ({ account, dismiss }) => (
<Message onDismiss={dismiss} positive>
<Message.Content>
Deleted account invite for <strong>{account.emailAddress}</strong>.
Deleted account invite for <strong>{account.EmailAddress}</strong>.
</Message.Content>
</Message>
)
Expand All @@ -268,7 +266,7 @@ const DeleteFailureMessage = ({ account, errorMessage, dismiss }) => (
<Message.Content>
<p>
Failed to delete account invite for{' '}
<strong>{account.emailAddress}</strong>.
<strong>{account.EmailAddress}</strong>.
</p>
{errorMessage && <p>Error message: {errorMessage}</p>}
</Message.Content>
Expand Down
18 changes: 9 additions & 9 deletions dev-portal/src/pages/Admin/Accounts/PendingRequests.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const PendingRequests = () => {
const onConfirmApprove = useCallback(async () => {
setLoading(true)
try {
await AccountService.approveAccountRequestByIdentityPoolId(
selectedAccount.identityPoolId,
await AccountService.approveAccountRequestByIdentityId(
selectedAccount.IdentityId,
)
sendMessage(dismiss => (
<ApproveSuccessMessage account={selectedAccount} dismiss={dismiss} />
Expand All @@ -54,8 +54,8 @@ const PendingRequests = () => {
setLoading(true)
setDenyModalOpen(false)
try {
await AccountService.denyAccountRequestByIdentityPoolId(
selectedAccount.identityPoolId,
await AccountService.denyAccountRequestByIdentityId(
selectedAccount.IdentityId,
)
sendMessage(dismiss => (
<DenySuccessMessage account={selectedAccount} dismiss={dismiss} />
Expand Down Expand Up @@ -127,7 +127,7 @@ const DenyAccountModal = React.memo(
<Modal.Content>
<p>
Are you sure you want to deny this account request? The request will
be permanently deleted, and <strong>{account.emailAddress}</strong>{' '}
be permanently deleted, and <strong>{account.EmailAddress}</strong>{' '}
will need to sign up again in order to request an account.
</p>
</Modal.Content>
Expand All @@ -144,7 +144,7 @@ const DenyAccountModal = React.memo(
const ApproveSuccessMessage = React.memo(({ account, dismiss }) => (
<Message onDismiss={dismiss} positive>
<Message.Content>
Approved account request for <strong>{account.emailAddress}</strong>.
Approved account request for <strong>{account.EmailAddress}</strong>.
</Message.Content>
</Message>
))
Expand All @@ -155,7 +155,7 @@ const ApproveFailureMessage = React.memo(
<Message.Content>
<p>
Failed to approve account request for{' '}
<strong>{account.emailAddress}</strong>.
<strong>{account.EmailAddress}</strong>.
</p>
{errorMessage && <p>Error message: {errorMessage}</p>}
</Message.Content>
Expand All @@ -166,7 +166,7 @@ const ApproveFailureMessage = React.memo(
const DenySuccessMessage = React.memo(({ account, dismiss }) => (
<Message onDismiss={dismiss} positive>
<Message.Content>
Denied account request for <strong>{account.emailAddress}</strong>.
Denied account request for <strong>{account.EmailAddress}</strong>.
</Message.Content>
</Message>
))
Expand All @@ -176,7 +176,7 @@ const DenyFailureMessage = React.memo(({ account, errorMessage, dismiss }) => (
<Message.Content>
<p>
Failed to deny account request for{' '}
<strong>{account.emailAddress}</strong>.
<strong>{account.EmailAddress}</strong>.
</p>
{errorMessage && <p>Error message: {errorMessage}</p>}
</Message.Content>
Expand Down
20 changes: 9 additions & 11 deletions dev-portal/src/pages/Admin/Accounts/RegisteredAccounts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ const RegisteredAccounts = () => {
setLoading(true)
setDeleteModalOpen(false)
try {
await AccountService.deleteAccountByIdentityPoolId(
selectedAccount.identityPoolId,
)
await AccountService.deleteAccountByIdentityId(selectedAccount.IdentityId)
sendMessage(dismiss => (
<DeleteSuccessMessage account={selectedAccount} dismiss={dismiss} />
))
Expand All @@ -56,8 +54,8 @@ const RegisteredAccounts = () => {
setLoading(true)
setPromoteModalOpen(false)
try {
await AccountService.promoteAccountByIdentityPoolId(
selectedAccount.identityPoolId,
await AccountService.promoteAccountByIdentityId(
selectedAccount.IdentityId,
)
sendMessage(dismiss => (
<PromoteSuccessMessage account={selectedAccount} dismiss={dismiss} />
Expand Down Expand Up @@ -136,7 +134,7 @@ const DeleteAccountModal = React.memo(
<Modal.Content>
<p>
Are you sure you want to delete the account{' '}
<strong>{account.emailAddress}</strong>, and de-activate the
<strong>{account.EmailAddress}</strong>, and de-activate the
associated API key? This action is irreversible.
</p>
</Modal.Content>
Expand All @@ -158,7 +156,7 @@ const PromoteAccountModal = React.memo(
<Modal.Content>
<p>
Are you sure you want to promote the account{' '}
<strong>{account.emailAddress}</strong> to Admin? This will allow
<strong>{account.EmailAddress}</strong> to Admin? This will allow
the account to perform any Admin actions, including deleting and
promoting other accounts.
</p>
Expand All @@ -180,7 +178,7 @@ const PromoteAccountModal = React.memo(
const DeleteSuccessMessage = React.memo(({ account, dismiss }) => (
<Message onDismiss={dismiss} positive>
<Message.Content>
Deleted account <strong>{account.emailAddress}</strong>.
Deleted account <strong>{account.EmailAddress}</strong>.
</Message.Content>
</Message>
))
Expand All @@ -190,7 +188,7 @@ const DeleteFailureMessage = React.memo(
<Message onDismiss={dismiss} negative>
<Message.Content>
<p>
Failed to delete account <strong>{account.emailAddress}</strong>.
Failed to delete account <strong>{account.EmailAddress}</strong>.
</p>
{errorMessage && <p>Error message: {errorMessage}</p>}
</Message.Content>
Expand All @@ -201,7 +199,7 @@ const DeleteFailureMessage = React.memo(
const PromoteSuccessMessage = React.memo(({ account, dismiss }) => (
<Message onDismiss={dismiss} positive>
<Message.Content>
Promoted account <strong>{account.emailAddress}</strong>.
Promoted account <strong>{account.EmailAddress}</strong>.
</Message.Content>
</Message>
))
Expand All @@ -211,7 +209,7 @@ const PromoteFailureMessage = React.memo(
<Message onDismiss={dismiss} negative>
<Message.Content>
<p>
Failed to promote account <strong>{account.emailAddress}</strong>.
Failed to promote account <strong>{account.EmailAddress}</strong>.
</p>
{errorMessage && <p>Error message: {errorMessage}</p>}
</Message.Content>
Expand Down
Loading

0 comments on commit 31e2eab

Please sign in to comment.