Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Delete Button in All Users Admin Table #3073

Merged
merged 5 commits into from
Mar 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
1. [#2970](https://github.com/influxdata/chronograf/pull/2970): Fix hanging browser on docker host dashboard
1. [#3006](https://github.com/influxdata/chronograf/pull/3006): Fix Kapacitor Rules task enabled checkboxes to only toggle exactly as clicked
1. [#3048](https://github.com/influxdata/chronograf/pull/3048): Prevent Multi-Select Dropdown in InfluxDB Admin Users and Roles tabs from losing selection state
1. [#3073](https://github.com/influxdata/chronograf/pull/3073): Fix Delete button in All Users admin page
1. [#3068](https://github.com/influxdata/chronograf/pull/3068): Fix intermittent missing fill from graphs

## v1.4.2.3 [2018-03-08]
Expand Down
5 changes: 3 additions & 2 deletions ui/src/admin/components/chronograf/AllUsersTableRow.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react'
import PropTypes from 'prop-types'
import _ from 'lodash'

import Tags from 'shared/components/Tags'
import SlideToggle from 'shared/components/SlideToggle'
Expand Down Expand Up @@ -38,7 +37,9 @@ const AllUsersTableRow = ({
name: organizations.find(o => r.organization === o.id).name,
}))

const wrappedDelete = _.curry(onDelete, user)
const wrappedDelete = () => {
onDelete(user)
}

const removeWarning = userIsMe
? 'Delete your user record\nand log yourself out?'
Expand Down
19 changes: 13 additions & 6 deletions ui/src/admin/components/chronograf/UsersTableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'

import Dropdown from 'shared/components/Dropdown'
import DeleteConfirmTableCell from 'shared/components/DeleteConfirmTableCell'
import ConfirmButton from 'shared/components/ConfirmButton'

import {USER_ROLES} from 'src/admin/constants/chronografAdmin'
import {USERS_TABLE} from 'src/admin/constants/chronografTableSizing'
Expand All @@ -26,6 +26,12 @@ const UsersTableRow = ({

const userIsMe = user.id === meID

const wrappedDelete = () => {
onDelete(user)
}

const removeWarning = 'Remove this user\nfrom Current Org?'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd put this copy in a constant file but it's super minor


return (
<tr className={'chronograf-admin-table--user'}>
<td>
Expand All @@ -52,12 +58,13 @@ const UsersTableRow = ({
</td>
<td style={{width: colProvider}}>{user.provider}</td>
<td style={{width: colScheme}}>{user.scheme}</td>
<DeleteConfirmTableCell
<ConfirmButton
confirmText={removeWarning}
confirmAction={wrappedDelete}
size="btn-xs"
type="btn-danger"
text="Remove"
onDelete={onDelete}
item={user}
buttonSize="btn-xs"
disabled={userIsMe}
customClass="table--show-on-row-hover"
/>
</tr>
)
Expand Down