From 32d9c9f1dae4939191e183fef903503792522a0d Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Wed, 7 Feb 2018 12:32:44 -0800 Subject: [PATCH] let users add users to any organization and add additional orgs after the fact --- .../admin/components/chronograf/AllUsersTable.js | 16 ++++++++-------- .../components/chronograf/AllUsersTableRowNew.js | 14 ++++++-------- .../admin/containers/chronograf/AllUsersPage.js | 2 +- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/ui/src/admin/components/chronograf/AllUsersTable.js b/ui/src/admin/components/chronograf/AllUsersTable.js index 1a7f3455f..29de6b8cf 100644 --- a/ui/src/admin/components/chronograf/AllUsersTable.js +++ b/ui/src/admin/components/chronograf/AllUsersTable.js @@ -128,14 +128,6 @@ class AllUsersTable extends Component { - {isCreatingUser - ? - : null} {users.length ? users.map(user => No Users to display

} + {isCreatingUser + ? + : null} diff --git a/ui/src/admin/components/chronograf/AllUsersTableRowNew.js b/ui/src/admin/components/chronograf/AllUsersTableRowNew.js index c1e3aac68..29f340c9e 100644 --- a/ui/src/admin/components/chronograf/AllUsersTableRowNew.js +++ b/ui/src/admin/components/chronograf/AllUsersTableRowNew.js @@ -11,7 +11,7 @@ const { colActions, } = ALL_USERS_TABLE -const nullOrganization = {id: null, name: 'None'} +const undefinedOrganization = {id: undefined, name: 'None'} class AllUsersTableRowNew extends Component { constructor(props) { @@ -23,7 +23,7 @@ class AllUsersTableRowNew extends Component { scheme: 'oauth2', roles: [ { - ...nullOrganization, + ...undefinedOrganization, }, ], } @@ -36,7 +36,6 @@ class AllUsersTableRowNew extends Component { handleConfirmCreateUser = () => { const {onBlur, onCreateUser} = this.props const {name, provider, scheme, roles, superAdmin} = this.state - const newUser = { name, provider, @@ -44,7 +43,6 @@ class AllUsersTableRowNew extends Component { superAdmin, roles: roles[0].id === null ? [] : roles, } - onCreateUser(newUser) onBlur() } @@ -57,10 +55,10 @@ class AllUsersTableRowNew extends Component { const newRoles = [ newOrganization.id === null ? { - ...nullOrganization, + ...undefinedOrganization, } : { - id: newOrganization.id, + organization: newOrganization.id, name: '*', // '*' causes the server to determine the current defaultRole of the selected organization }, ] @@ -91,14 +89,14 @@ class AllUsersTableRowNew extends Component { const {name, provider, scheme, roles} = this.state const dropdownOrganizationsItems = [ - {...nullOrganization}, + {...undefinedOrganization}, ...organizations, ].map(o => ({ ...o, text: o.name, })) const selectedRole = dropdownOrganizationsItems.find( - o => roles[0].id === o.id + o => roles[0].organization === o.id ) const preventCreate = !name || !provider diff --git a/ui/src/admin/containers/chronograf/AllUsersPage.js b/ui/src/admin/containers/chronograf/AllUsersPage.js index f7bf07531..8cc482444 100644 --- a/ui/src/admin/containers/chronograf/AllUsersPage.js +++ b/ui/src/admin/containers/chronograf/AllUsersPage.js @@ -24,7 +24,7 @@ class AllUsersPage extends Component { handleCreateUser = user => { const {links, actionsAdmin: {createUserAsync}} = this.props - createUserAsync(links.users, user) + createUserAsync(links.allUsers, user) } handleUpdateUserRoles = (user, roles, successMessage) => {