diff --git a/CHANGELOG.md b/CHANGELOG.md index c5b38e79772..f8c0236936c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## v2.0.0-alpha.8 [unreleased] ### Features +1. [13024](https://github.com/influxdata/influxdb/pull/13024): Add the ability to edit token's description ### Bug Fixes diff --git a/ui/src/authorizations/actions/index.ts b/ui/src/authorizations/actions/index.ts index 844ef12c64d..403d6b34a44 100644 --- a/ui/src/authorizations/actions/index.ts +++ b/ui/src/authorizations/actions/index.ts @@ -60,7 +60,9 @@ interface EditAuthorization { } } -export const editLabel = (authorization: Authorization): EditAuthorization => ({ +export const editAuthorization = ( + authorization: Authorization +): EditAuthorization => ({ type: 'EDIT_AUTH', payload: {authorization}, }) @@ -106,12 +108,9 @@ export const updateAuthorization = (authorization: Authorization) => async ( dispatch: Dispatch ) => { try { - const label = await client.authorizations.update( - authorization.id, - authorization - ) + await client.authorizations.update(authorization.id, authorization) - dispatch(editLabel(label)) + dispatch(getAuthorizations()) } catch (e) { console.error(e) dispatch(notify(authorizationUpdateFailed(authorization.id))) diff --git a/ui/src/me/components/account/TokenRow.tsx b/ui/src/me/components/account/TokenRow.tsx index 35c68d65e2d..1e727c78392 100644 --- a/ui/src/me/components/account/TokenRow.tsx +++ b/ui/src/me/components/account/TokenRow.tsx @@ -11,6 +11,7 @@ import { // Components import {Alignment, ComponentSize, SlideToggle} from '@influxdata/clockface' import {IndexList, ComponentSpacer, ConfirmationButton} from 'src/clockface' +import EditableName from 'src/shared/components/EditableName' // Types import {Authorization} from '@influxdata/influx' @@ -29,18 +30,17 @@ type Props = DispatchProps & OwnProps class TokenRow extends PureComponent { public render() { - const {description, id} = this.props.auth + const {description} = this.props.auth return ( - - {description} - + { const {onClickDescription, auth} = this.props onClickDescription(auth.id) } + + private handleUpdateName = async (value: string) => { + const {auth, onUpdate} = this.props + await onUpdate({...auth, description: value}) + } } const mdtp = {