diff --git a/CHANGELOG.md b/CHANGELOG.md index da069082a29..69c5d61cb95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ 1. [13493](https://github.com/influxdata/influxdb/pull/13493): Add org profile tab with ability to edit organization name 1. [13510](https://github.com/influxdata/influxdb/pull/13510): Add org name to dahboard page title 1. [13520](https://github.com/influxdata/influxdb/pull/13520): Add cautioning to bucket renaming +1. [13560](https://github.com/influxdata/influxdb/pull/13560): Add option to generate all access token in tokens tab ### Bug Fixes diff --git a/ui/package-lock.json b/ui/package-lock.json index 2250cb45f45..269af196c19 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -1016,7 +1016,7 @@ } }, "@influxdata/influx": { - "version": "github:influxdata/influxdb2-js#c804fc64ccfa862fa8e19e4506e7f64f20329fe1", + "version": "github:influxdata/influxdb2-js#58a5c8a38feb8d00c947e57f2f03b91f16dcd598", "from": "github:influxdata/influxdb2-js#dev", "requires": { "axios": "^0.18.0" diff --git a/ui/src/authorizations/actions/index.ts b/ui/src/authorizations/actions/index.ts index a4bf0a8b476..7a1ad98cd77 100644 --- a/ui/src/authorizations/actions/index.ts +++ b/ui/src/authorizations/actions/index.ts @@ -1,22 +1,27 @@ +// Libraries +import {Dispatch} from 'react' + // API import {client} from 'src/utils/api' import * as authAPI from 'src/authorizations/apis' -// Types -import {RemoteDataState, AppState} from 'src/types' -import {Authorization} from '@influxdata/influx' -import {Dispatch} from 'redux-thunk' - // Actions import {notify} from 'src/shared/actions/notifications' +// Constants import { authorizationsGetFailed, authorizationCreateFailed, authorizationUpdateFailed, authorizationDeleteFailed, + authorizationCreateSuccess, } from 'src/shared/copy/v2/notifications' +// Types +import {RemoteDataState, GetState} from 'src/types' +import {Authorization} from '@influxdata/influx' +import {PublishNotificationAction} from 'src/types/actions/notifications' + export type Action = | SetAuthorizations | AddAuthorization @@ -77,9 +82,13 @@ export const removeAuthorization = (id: string): RemoveAuthorization => ({ payload: {id}, }) +type GetAuthorizations = ( + dispatch: Dispatch, + getState: GetState +) => Promise export const getAuthorizations = () => async ( - dispatch: Dispatch, - getState: () => AppState + dispatch: Dispatch, + getState: GetState ) => { try { dispatch(setAuthorizations(RemoteDataState.Loading)) @@ -98,11 +107,12 @@ export const getAuthorizations = () => async ( } export const createAuthorization = (auth: Authorization) => async ( - dispatch: Dispatch + dispatch: Dispatch ) => { try { const createdAuthorization = await authAPI.createAuthorization(auth) dispatch(addAuthorization(createdAuthorization)) + dispatch(notify(authorizationCreateSuccess())) } catch (e) { console.error(e) dispatch(notify(authorizationCreateFailed())) @@ -111,7 +121,7 @@ export const createAuthorization = (auth: Authorization) => async ( } export const updateAuthorization = (authorization: Authorization) => async ( - dispatch: Dispatch + dispatch: Dispatch ) => { try { await client.authorizations.update(authorization.id, authorization) @@ -124,7 +134,7 @@ export const updateAuthorization = (authorization: Authorization) => async ( } export const deleteAuthorization = (id: string, name: string = '') => async ( - dispatch: Dispatch + dispatch: Dispatch ) => { try { await client.authorizations.delete(id) diff --git a/ui/src/authorizations/components/AllAccessTokenOverlay.tsx b/ui/src/authorizations/components/AllAccessTokenOverlay.tsx new file mode 100644 index 00000000000..653525181c4 --- /dev/null +++ b/ui/src/authorizations/components/AllAccessTokenOverlay.tsx @@ -0,0 +1,141 @@ +import React, {PureComponent, ChangeEvent} from 'react' +import {connect} from 'react-redux' + +// Components +import {Overlay, Input, Form} from 'src/clockface' +import { + Alert, + IconFont, + ComponentColor, + ComponentSpacer, + AlignItems, + FlexDirection, + ComponentSize, + Button, + ButtonType, +} from '@influxdata/clockface' +import {withRouter, WithRouterProps} from 'react-router' + +// Actions +import {createAuthorization} from 'src/authorizations/actions' + +// Utils +import {allAccessPermissions} from 'src/authorizations/utils/permissions' + +// Decorators +import {ErrorHandling} from 'src/shared/decorators/errors' +import {Authorization} from '@influxdata/influx' + +interface DispatchProps { + onCreateAuthorization: typeof createAuthorization +} + +interface State { + description: string +} + +type Props = WithRouterProps & DispatchProps + +@ErrorHandling +class AllAccessTokenOverlay extends PureComponent { + public state = {description: ''} + + render() { + const {description} = this.state + + return ( + + + + +
+ + + + + + This token will be able to create, update, delete, read, and + write to anything in this organization + + + +