2019-02-27 19:44:22 +08:00
|
|
|
// Import React!
|
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
import { Router } from '@reach/router';
|
|
|
|
import { siteRoot } from '../../utils/constants';
|
|
|
|
import SidePanel from './side-panel';
|
|
|
|
import OrgUsers from './org-users';
|
2019-03-13 10:32:38 +08:00
|
|
|
import OrgGroups from './org-groups';
|
2019-03-15 16:30:20 +08:00
|
|
|
import OrgLibraries from './org-libraries';
|
2019-03-18 13:15:08 +08:00
|
|
|
import OrgInfo from './org-info';
|
2019-03-26 16:56:15 +08:00
|
|
|
import OrgLinks from './org-links';
|
2019-04-01 13:38:25 +08:00
|
|
|
import OrgDepartments from './org-departments';
|
|
|
|
import OrgDepartmentsList from './org-departments-list';
|
|
|
|
import OrgDepartmentItem from './org-department-item';
|
2019-04-03 16:54:24 +08:00
|
|
|
import OrgLogs from './org-logs';
|
|
|
|
import OrgLogsFileAudit from './org-logs-file-audit';
|
|
|
|
import OrgLogsFileUpdate from './org-logs-file-update';
|
|
|
|
import OrgLogsPermAudit from './org-logs-perm-audit';
|
2019-02-27 19:44:22 +08:00
|
|
|
|
|
|
|
import '../../assets/css/fa-solid.css';
|
|
|
|
import '../../assets/css/fa-regular.css';
|
|
|
|
import '../../assets/css/fontawesome.css';
|
|
|
|
import '../../css/layout.css';
|
|
|
|
import '../../css/toolbar.css';
|
|
|
|
|
|
|
|
class Org extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
|
|
|
isSidePanelClosed: false,
|
|
|
|
currentTab: 'users',
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
let href = window.location.href.split('/');
|
|
|
|
let currentTab = href[href.length - 2];
|
|
|
|
if (currentTab == 'useradmin') {
|
|
|
|
currentTab = 'users';
|
|
|
|
}
|
2019-04-01 13:38:25 +08:00
|
|
|
if (currentTab > 0) {
|
|
|
|
currentTab = 'departmentadmin';
|
|
|
|
}
|
2019-02-27 19:44:22 +08:00
|
|
|
this.setState({currentTab: currentTab});
|
|
|
|
}
|
|
|
|
|
|
|
|
onCloseSidePanel = () => {
|
|
|
|
this.setState({isSidePanelClosed: !this.state.isSidePanelClosed});
|
|
|
|
}
|
|
|
|
|
|
|
|
tabItemClick = (param) => {
|
|
|
|
this.setState({currentTab: param});
|
2019-05-02 20:37:09 +08:00
|
|
|
}
|
2019-02-27 19:44:22 +08:00
|
|
|
|
2019-04-29 22:20:56 +08:00
|
|
|
render() {
|
2019-05-05 15:18:54 +08:00
|
|
|
let { isSidePanelClosed, currentTab } = this.state;
|
2019-02-27 19:44:22 +08:00
|
|
|
return (
|
|
|
|
<div id="main">
|
2019-05-02 20:37:09 +08:00
|
|
|
<SidePanel
|
|
|
|
isSidePanelClosed={isSidePanelClosed}
|
|
|
|
onCloseSidePanel={this.onCloseSidePanel}
|
2019-04-29 22:20:56 +08:00
|
|
|
currentTab={currentTab}
|
2019-05-02 20:37:09 +08:00
|
|
|
tabItemClick={this.tabItemClick}
|
|
|
|
/>
|
|
|
|
<div className="main-panel o-hidden">
|
2019-04-01 14:46:14 +08:00
|
|
|
<Router className="reach-router">
|
2019-05-05 15:18:54 +08:00
|
|
|
<OrgInfo path={siteRoot + 'org/orgmanage'}/>
|
2019-02-27 19:44:22 +08:00
|
|
|
<OrgUsers
|
2019-03-13 15:16:05 +08:00
|
|
|
path={siteRoot + 'org/useradmin'}
|
2019-02-27 19:44:22 +08:00
|
|
|
currentTab={currentTab}
|
|
|
|
tabItemClick={this.tabItemClick}
|
2019-05-05 15:18:54 +08:00
|
|
|
/>
|
|
|
|
<OrgGroups path={siteRoot + 'org/groupadmin'}/>
|
|
|
|
<OrgLibraries path={siteRoot + 'org/repoadmin'}/>
|
|
|
|
<OrgLinks path={siteRoot + 'org/publinkadmin'}/>
|
|
|
|
<OrgDepartments path={siteRoot + 'org/departmentadmin'}>
|
|
|
|
<OrgDepartmentsList path='/'/>
|
|
|
|
<OrgDepartmentItem path='groups/:groupID'/>
|
2019-04-01 13:38:25 +08:00
|
|
|
</OrgDepartments>
|
2019-04-03 16:54:24 +08:00
|
|
|
<OrgLogs
|
|
|
|
path={siteRoot + 'org/logadmin'}
|
2019-05-05 15:18:54 +08:00
|
|
|
currentTab={currentTab}
|
2019-04-03 16:54:24 +08:00
|
|
|
tabItemClick={this.tabItemClick}
|
|
|
|
>
|
2019-05-05 15:18:54 +08:00
|
|
|
<OrgLogsFileAudit path='/'/>
|
|
|
|
<OrgLogsFileUpdate path={siteRoot + 'file-update'}/>
|
|
|
|
<OrgLogsPermAudit path={siteRoot + 'perm-audit'}/>
|
2019-04-03 16:54:24 +08:00
|
|
|
</OrgLogs>
|
2019-02-27 19:44:22 +08:00
|
|
|
</Router>
|
2019-05-02 20:37:09 +08:00
|
|
|
</div>
|
2019-02-27 19:44:22 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render(
|
2019-03-13 15:16:05 +08:00
|
|
|
<Org />,
|
2019-02-27 19:44:22 +08:00
|
|
|
document.getElementById('wrapper')
|
|
|
|
);
|