From 2e5f8eab756f1c3c675d4cd39a5ef73e5787c8cf Mon Sep 17 00:00:00 2001 From: navaneeth Date: Thu, 22 Apr 2021 21:50:36 +0530 Subject: [PATCH] Move users & permissions to a new page from modal --- frontend/src/App/App.jsx | 2 + frontend/src/HomePage/HomePage.jsx | 5 +- frontend/src/HomePage/ManageOrgUsers.jsx | 118 -------------- .../src/ManageOrgUsers/ManageOrgUsers.jsx | 151 ++++++++++++++++++ frontend/src/ManageOrgUsers/index.js | 1 + 5 files changed, 157 insertions(+), 120 deletions(-) delete mode 100644 frontend/src/HomePage/ManageOrgUsers.jsx create mode 100644 frontend/src/ManageOrgUsers/ManageOrgUsers.jsx create mode 100644 frontend/src/ManageOrgUsers/index.js diff --git a/frontend/src/App/App.jsx b/frontend/src/App/App.jsx index 0cb9120ba9..c47a0eac18 100644 --- a/frontend/src/App/App.jsx +++ b/frontend/src/App/App.jsx @@ -10,6 +10,7 @@ import { Editor, Viewer } from '@/Editor'; import '@/_styles/theme.scss'; import { ToastContainer, toast } from 'react-toastify'; import 'react-toastify/dist/ReactToastify.css'; +import { ManageOrgUsers } from '@/ManageOrgUsers'; class App extends React.Component { constructor(props) { @@ -45,6 +46,7 @@ class App extends React.Component { + diff --git a/frontend/src/HomePage/HomePage.jsx b/frontend/src/HomePage/HomePage.jsx index da790128cd..1d2b2ada66 100644 --- a/frontend/src/HomePage/HomePage.jsx +++ b/frontend/src/HomePage/HomePage.jsx @@ -1,7 +1,6 @@ import React from 'react'; import { appService, authenticationService } from '@/_services'; import { Link } from 'react-router-dom'; -import { ManageOrgUsers } from './ManageOrgUsers'; import Skeleton from 'react-loading-skeleton'; class HomePage extends React.Component { @@ -47,7 +46,9 @@ class HomePage extends React.Component {
diff --git a/frontend/src/HomePage/ManageOrgUsers.jsx b/frontend/src/HomePage/ManageOrgUsers.jsx deleted file mode 100644 index 5283396100..0000000000 --- a/frontend/src/HomePage/ManageOrgUsers.jsx +++ /dev/null @@ -1,118 +0,0 @@ -import React from 'react'; -import { organizationService } from '@/_services'; -import Modal from 'react-bootstrap/Modal'; -import Button from 'react-bootstrap/Button'; -import { toast } from 'react-toastify'; -import 'react-toastify/dist/ReactToastify.css'; -import Skeleton from 'react-loading-skeleton'; - -class ManageOrgUsers extends React.Component { - constructor(props) { - super(props); - - this.state = { - showModal: false, - appId: props.appId, - isLoading: true, - addingUser: false - }; - } - - componentDidMount() { - - const appId = this.props.appId; - - organizationService.getUsers(appId).then(data => this.setState({ - users: data.users, - isLoading: false, - })); - - this.setState({ appId }); - } - - hideModal = () => { - this.setState({ - showModal: false - }); - } - - render() { - const { showModal, isLoading, users } = this.state; - - return ( -
- - {!showModal && } - - - - - - Users and permissions - -
- - - -
- -
- - - {isLoading ? -
- -
- : -
- - - - - - - - - - - {users.map((user) => - - - - - - - )} - - -
NameEmailRole
{user.name} - {user.email} - - {user.role} - - Remove -
-
- } - -
- - - - -
-
- - ) - } -} - -export { ManageOrgUsers }; diff --git a/frontend/src/ManageOrgUsers/ManageOrgUsers.jsx b/frontend/src/ManageOrgUsers/ManageOrgUsers.jsx new file mode 100644 index 0000000000..733e6e4d09 --- /dev/null +++ b/frontend/src/ManageOrgUsers/ManageOrgUsers.jsx @@ -0,0 +1,151 @@ +import React from 'react'; +import { organizationService } from '@/_services'; +import { authenticationService } from '@/_services'; +import 'react-toastify/dist/ReactToastify.css'; +import { Link } from 'react-router-dom'; +import Skeleton from 'react-loading-skeleton'; + +class ManageOrgUsers extends React.Component { + constructor(props) { + super(props); + + this.state = { + currentUser: authenticationService.currentUserValue, + showModal: false, + isLoading: true, + addingUser: false + }; + } + + componentDidMount() { + organizationService.getUsers(null).then(data => this.setState({ + users: data.users, + isLoading: false, + })); + } + + hideModal = () => { + this.setState({ + showModal: false + }); + } + + render() { + const { isLoading, users } = this.state; + + return ( +
+
+
+ +

+ + + +

+
+ +
+ +
+
+
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus ad amet consectetur exercitationem fugiat in ipsa ipsum, natus odio quidem quod repudiandae sapiente. Amet debitis et magni maxime necessitatibus ullam. +
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+ {/* Dashboard */} +
+

+ Users & Permissions +

+
+
+
+ Add User +
+
+
+
+
+ +
+
+ {isLoading ? +
+ +
+ : +
+
+ + + + + + + + + + + {users.map((user) => + + + + + + + )} + +
NameEmailRole
{user.name} + {user.email} + + {user.role} + + Remove +
+
+
+ } +
+
+
+
+ + ) + } +} + +export { ManageOrgUsers }; diff --git a/frontend/src/ManageOrgUsers/index.js b/frontend/src/ManageOrgUsers/index.js new file mode 100644 index 0000000000..1181633604 --- /dev/null +++ b/frontend/src/ManageOrgUsers/index.js @@ -0,0 +1 @@ +export * from './ManageOrgUsers';