diff --git a/CHANGELOG.md b/CHANGELOG.md index 559725aa7e7..03373ad2988 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ 1. [12827](https://github.com/influxdata/influxdb/pull/12827): Fix screen tearing bug in Raw Data View 1. [12843](https://github.com/influxdata/influxdb/pull/12843): Add copy to clipboard button to export overlays 1. [12826](https://github.com/influxdata/influxdb/pull/12826): Enable copying error messages to the clipboard from dashboard cells +1. [12876](https://github.com/influxdata/influxdb/pull/12876): Add the ability to update token's status in Token list ### Bug Fixes diff --git a/ui/src/me/components/account/TokenRow.tsx b/ui/src/me/components/account/TokenRow.tsx index f356970858f..35c68d65e2d 100644 --- a/ui/src/me/components/account/TokenRow.tsx +++ b/ui/src/me/components/account/TokenRow.tsx @@ -3,10 +3,13 @@ import React, {PureComponent} from 'react' import {connect} from 'react-redux' // Actions -import {deleteAuthorization} from 'src/authorizations/actions' +import { + deleteAuthorization, + updateAuthorization, +} from 'src/authorizations/actions' // Components -import {Alignment, ComponentSize} from '@influxdata/clockface' +import {Alignment, ComponentSize, SlideToggle} from '@influxdata/clockface' import {IndexList, ComponentSpacer, ConfirmationButton} from 'src/clockface' // Types @@ -19,13 +22,14 @@ interface OwnProps { interface DispatchProps { onDelete: typeof deleteAuthorization + onUpdate: typeof updateAuthorization } type Props = DispatchProps & OwnProps class TokenRow extends PureComponent { public render() { - const {description, status, id} = this.props.auth + const {description, id} = this.props.auth return ( @@ -38,7 +42,13 @@ class TokenRow extends PureComponent { {description} - {status} + + + { ) } + private get isTokenEnbled(): boolean { + const {auth} = this.props + return auth.status === Authorization.StatusEnum.Active + } + + private changeToggle = () => { + const {auth, onUpdate} = this.props + if (auth.status === Authorization.StatusEnum.Active) { + auth.status = Authorization.StatusEnum.Inactive + } else { + auth.status = Authorization.StatusEnum.Active + } + onUpdate(auth) + } + private handleDelete = () => { const {id, description} = this.props.auth this.props.onDelete(id, description) @@ -66,6 +91,7 @@ class TokenRow extends PureComponent { const mdtp = { onDelete: deleteAuthorization, + onUpdate: updateAuthorization, } export default connect<{}, DispatchProps, OwnProps>(