X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Fuser_management%2Fsrc%2Fdashboard%2Fdashboard.jsx;h=a3b6a6398420a0b24e868406c7a66950202ea829;hb=2da8b7a246ba17396c5bc218a0b7f1685fb8d304;hp=c86d6b1cf7561ae082027919add7f7cda6fb6619;hpb=41f386a117ec725ad1eb49a9c571107a0c7d1c11;p=osm%2FUI.git diff --git a/skyquake/plugins/user_management/src/dashboard/dashboard.jsx b/skyquake/plugins/user_management/src/dashboard/dashboard.jsx index c86d6b1cf..a3b6a6398 100644 --- a/skyquake/plugins/user_management/src/dashboard/dashboard.jsx +++ b/skyquake/plugins/user_management/src/dashboard/dashboard.jsx @@ -10,7 +10,7 @@ import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx' import 'style/layout.scss'; import './userMgmt.scss'; import {Panel, PanelWrapper} from 'widgets/panel/panel'; - +import SkyquakeRBAC from 'widgets/skyquake_rbac/skyquakeRBAC.jsx'; import TextInput from 'widgets/form_controls/textInput.jsx'; import Input from 'widgets/form_controls/input.jsx'; @@ -18,15 +18,17 @@ import Button, {ButtonGroup} from 'widgets/button/sq-button.jsx'; import SelectOption from 'widgets/form_controls/selectOption.jsx'; import 'widgets/form_controls/formControls.scss'; import imgAdd from '../../node_modules/open-iconic/svg/plus.svg' -import imgRemove from '../../node_modules/open-iconic/svg/trash.svg' +import imgRemove from '../../node_modules/open-iconic/svg/trash.svg'; + +import ROLES from 'utils/roleConstants.js'; +const PLATFORM = ROLES.PLATFORM; class UserManagementDashboard extends React.Component { constructor(props) { super(props); this.Store = this.props.flux.stores.hasOwnProperty('UserManagementStore') ? this.props.flux.stores.UserManagementStore : this.props.flux.createStore(UserManagementStore); - this.Store.getUsers(); - this.state = this.Store.getState(); - this.actions = this.state.actions; + this.state = this.Store.getState(); + this.actions = this.state.actions; } componentDidUpdate() { let self = this; @@ -38,6 +40,7 @@ class UserManagementDashboard extends React.Component { } componentWillMount() { this.Store.listen(this.updateState); + this.Store.getUsers(); } componentWillUnmount() { this.Store.unlisten(this.updateState); @@ -78,7 +81,7 @@ class UserManagementDashboard extends React.Component { cancelEditUser = () => { this.actions.editUser(true) } - closePanel = () => { + osePanel = () => { this.actions.handleCloseUserPanel(); } // updateUser = (e) => { @@ -90,10 +93,13 @@ class UserManagementDashboard extends React.Component { deleteUser = (e) => { e.preventDefault(); e.stopPropagation(); - this.Store.deleteUser({ + if (confirm('Are you sure you want to delete this user?')) { + this.Store.deleteUser({ 'user-name': this.state['user-name'], 'user-domain': this.state['user-domain'] }); + } + } createUser = (e) => { e.preventDefault(); @@ -211,86 +217,91 @@ class UserManagementDashboard extends React.Component { ) ) } - html = ( - - { this.UserList = div}} className={`column userList expanded ${this.state.userOpen ? 'collapsed ' : ' '} ${this.state.hideColumns ? 'hideColumns ' : ' '}`}> - -
-
- Username -
-
- Domain + + + + + + { this.UserList = div}} className={`column userList expanded ${this.state.userOpen ? 'collapsed ' : ' '} ${this.state.hideColumns ? 'hideColumns ' : ' '}`}> + +
+
+ Username +
+
+ Domain +
-
- {state.users && state.users.map((u, k) => { - let platformRoles = []; - for(let role in u.platformRoles) { - platformRoles.push(
{`${role}: ${u.platformRoles[role]}`}
) - } - return ( -
this[`user-ref-${k}`] = el} className={`tableRow tableRow--data ${((self.state.activeIndex == k) && self.state.userOpen) ? 'tableRow--data-active' : ''}`} key={k}> -
{ + let platformRoles = []; + for(let role in u.platformRoles) { + platformRoles.push(
{`${role}: ${u.platformRoles[role]}`}
) + } + return ( +
this[`user-ref-${k}`] = el} className={`tableRow tableRow--data ${((self.state.activeIndex == k) && self.state.userOpen) ? 'tableRow--data-active' : ''}`} + key={k} onClick={self.viewUser.bind(null, u, k)}> - {u['user-name']} -
-
- {u['user-domain']} -
- +
+ {u['user-name']} +
+
+ {u['user-domain']} +
-
- ) - })} - - -
+ ) + })} + + + +