Browse Source

Merge pull request 'Dev-Farhan' (#48) from Dev-Farhan into staging

Reviewed-on: ibnu/generic-ospro-frontend#48
pull/1/head
farhantock 10 months ago
parent
commit
9321c212a1
  1. 3
      public/index.html
  2. 28
      src/App.js
  3. 49
      src/containers/DefaultLayout/DefaultHeader.js
  4. 61
      src/containers/DefaultLayout/DefaultLayout.js
  5. 1
      src/views/Pages/Login/Login.js
  6. 33
      src/views/Pages/Page403/Page403.js
  7. 9
      src/views/Pages/Page403/Page403.test.js
  8. 6
      src/views/Pages/Page403/package.json
  9. 35
      src/views/Pages/Page404/Page404.js
  10. 9
      src/views/Pages/Page404/Page404.test.js
  11. 6
      src/views/Pages/Page404/package.json
  12. 35
      src/views/Pages/Page500/Page500.js
  13. 9
      src/views/Pages/Page500/Page500.test.js
  14. 6
      src/views/Pages/Page500/package.json
  15. 68
      src/views/Pages/Register/Register.js
  16. 9
      src/views/Pages/Register/Register.test.js
  17. 6
      src/views/Pages/Register/package.json
  18. 46
      src/views/Users/User.js
  19. 15
      src/views/Users/User.test.js
  20. 78
      src/views/Users/Users.js
  21. 10
      src/views/Users/Users.test.js
  22. 31
      src/views/Users/UsersData.js
  23. 6
      src/views/Users/package.json

3
public/index.html

@ -14,7 +14,7 @@
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/ homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
--> -->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"> <link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/OSPRO.ico"> <link rel="shortcut icon" href="">
<!-- <link rel="shortcut icon" href="%PUBLIC_URL%/favicon_bmd_denpasar.ico"> --> <!-- <link rel="shortcut icon" href="%PUBLIC_URL%/favicon_bmd_denpasar.ico"> -->
<link rel="stylesheet" href="https://unpkg.com/@coreui/icons@1.0.0/css/all.min.css"> <link rel="stylesheet" href="https://unpkg.com/@coreui/icons@1.0.0/css/all.min.css">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
@ -35,7 +35,6 @@
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-118965717-3"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-118965717-3"></script>
<script> <script>
window.dataLayer = window.dataLayer || []; window.dataLayer = window.dataLayer || [];
function gtag() { function gtag() {
dataLayer.push(arguments); dataLayer.push(arguments);
} }

28
src/App.js

@ -11,29 +11,10 @@ const loading = () => <div className="animated fadeIn pt-3 text-center">Loading.
const DefaultLayout = React.lazy(() => import('./containers/DefaultLayout')); const DefaultLayout = React.lazy(() => import('./containers/DefaultLayout'));
const Login = React.lazy(() => import('./views/Pages/Login')); const Login = React.lazy(() => import('./views/Pages/Login'));
const Register = React.lazy(() => import('./views/Pages/Register'));
const Page403 = React.lazy(() => import('./views/Pages/Page403'));
const Page404 = React.lazy(() => import('./views/Pages/Page404'));
const Page500 = React.lazy(() => import('./views/Pages/Page500'));
const SiopasMap = React.lazy(() => import('./views/Map')); const SiopasMap = React.lazy(() => import('./views/Map'));
class App extends Component { class App extends Component {
componentDidMount() {
try {
const storedData = localStorage.getItem('configApp');
if (storedData !== null) {
const data = JSON.parse(storedData);
const htmlTitle = data.html_title || 'OSPRO';
document.title = htmlTitle;
} else {
document.title = 'OSPRO';
}
} catch (error) {
document.title = 'OSPRO';
}
}
render() { render() {
return ( return (
@ -42,14 +23,7 @@ class App extends Component {
<React.Suspense fallback={loading()}> <React.Suspense fallback={loading()}>
<Switch> <Switch>
<Route exact path="/login" name="Login Page" render={props => <Login {...props} />} /> <Route exact path="/login" name="Login Page" render={props => <Login {...props} />} />
{/* <Route exact path="/home" name="Home" render={props => <DefaultLayout {...props}/>} /> */}
<Route exact path="/register" name="Register Page" render={props => <Register {...props} />} />
<Route exact path="/404" name="Page 404" render={props => <Page404 {...props} />} />
<Route exact path="/403" name="Page 403" render={props => <Page403 {...props} />} />
<Route exact path="/500" name="Page 500" render={props => <Page500 {...props} />} />
<Route exact path="/map/view" name="Map" render={props => <SiopasMap {...props} />} /> <Route exact path="/map/view" name="Map" render={props => <SiopasMap {...props} />} />
{/*<Route exact path="/layerswitcher" name="Layer Switcher" render={props => <LayerSwitcherExample {...props}/>} />*/}
{/*<Route exact path="/muidt" name="Mui Datatable Example" render={props => <MuiDatatablesExample {...props}/>} />*/}
<Route path="/" name="Home" render={props => <DefaultLayout {...props} />} /> <Route path="/" name="Home" render={props => <DefaultLayout {...props} />} />
</Switch> </Switch>
</React.Suspense> </React.Suspense>

49
src/containers/DefaultLayout/DefaultHeader.js

@ -3,23 +3,17 @@ import { NavLink } from 'react-router-dom';
import { Badge, Nav, NavItem } from 'reactstrap'; import { Badge, Nav, NavItem } from 'reactstrap';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Menu, Dropdown } from 'antd' import { Menu, Dropdown } from 'antd'
import { ALERTUSER_SEARCH, ALERT_SEARCH, ALERTUSER_STATUSVIEW, ALERT_STATUSVIEW, APP_MODE } from '../../const/ApiConst'; import { ALERTUSER_SEARCH, ALERT_SEARCH, ALERTUSER_STATUSVIEW, ALERT_STATUSVIEW, APP_MODE, BASE_SIMPRO_LUMEN_IMAGE } from '../../const/ApiConst';
import { AppAsideToggler, AppNavbarBrand, AppSidebarToggler } from '@coreui/react'; import { AppAsideToggler, AppNavbarBrand, AppSidebarToggler } from '@coreui/react';
import logo_ospro from '../../assets/img/OSPRO.png' import logo_ospro from '../../assets/img/OSPRO.png'
import axios from 'axios'; import axios from 'axios';
import './Default.css' import './Default.css'
const token = window.localStorage.getItem('token');
const propTypes = { const propTypes = {
children: PropTypes.node, children: PropTypes.node,
}; };
const config = {
headers:
{
Authorization: `Bearer ${token}`,
"Content-type": `application/json`
}
};
const defaultProps = {}; const defaultProps = {};
@ -42,8 +36,32 @@ class DefaultHeader extends Component {
componentDidMount() { componentDidMount() {
this.getHeaderMenu(); this.getHeaderMenu();
const token = window.localStorage.getItem('token');
const role = window.localStorage.getItem('role_name');
if (role !== 'Super Admin') {
this.setState({
configApp: JSON.parse(window.localStorage.getItem('configApp')),
});
}
this.setState({
config: {
headers: {
Authorization: `Bearer ${token}`,
'Content-type': `application/json`,
},
},
});
} }
getLogoHeaderContent = () => {
const { configApp } = this.state;
const logoHeaderContent = configApp && configApp.logo_header ? configApp.logo_header.content : null;
return logoHeaderContent
? `${BASE_SIMPRO_LUMEN_IMAGE}/${logoHeaderContent}`
: logo_ospro;
};
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
if (this.state.listReadNotif !== prevState.listReadNotif) { if (this.state.listReadNotif !== prevState.listReadNotif) {
if (this.state.listReadNotif.length > 0) { if (this.state.listReadNotif.length > 0) {
@ -107,7 +125,7 @@ class DefaultHeader extends Component {
} }
const result = await axios const result = await axios
.post(url, payload, config) .post(url, payload, this.state.config)
.then(res => res) .then(res => res)
.catch((error) => error.response); .catch((error) => error.response);
if (result && result.data && result.data.code == 200) { if (result && result.data && result.data.code == 200) {
@ -178,14 +196,14 @@ class DefaultHeader extends Component {
if (parseInt(localStorage.getItem('role_id')) === 1) { if (parseInt(localStorage.getItem('role_id')) === 1) {
data.map((val, index) => { data.map((val, index) => {
let url = ALERT_STATUSVIEW(val) let url = ALERT_STATUSVIEW(val)
promises.push(axios.put(url, payload, config) promises.push(axios.put(url, payload, this.state.config)
.then(res => result.push(res))); .then(res => result.push(res)));
}); });
} else { } else {
data.map((val, index) => { data.map((val, index) => {
let url = ALERTUSER_STATUSVIEW(val) let url = ALERTUSER_STATUSVIEW(val)
promises.push(axios.put(url, payload, config) promises.push(axios.put(url, payload, this.state.config)
.then(res => result.push(res))) .then(res => result.push(res)))
}); });
} }
@ -199,11 +217,14 @@ class DefaultHeader extends Component {
getLogo = () => { getLogo = () => {
return ( return (
<div style={{ width: '10%', display: 'flex', justifyContent: 'center' }}> <div style={{ width: '10%', display: 'flex', justifyContent: 'center' }}>
<img style={{ width: '100%', height: '100%' }} src={logo_ospro} /> <img
style={{ width: '100%', height: '100%' }}
src={this.getLogoHeaderContent()}
/>
</div> </div>
) )
} }
// logo_ospro
getHeaderMenu = () => { getHeaderMenu = () => {
const { fullname, u_group } = this.state; const { fullname, u_group } = this.state;
if (u_group == 'kominfo') { if (u_group == 'kominfo') {

61
src/containers/DefaultLayout/DefaultLayout.js

@ -3,7 +3,7 @@ import { Redirect, Route, Switch, withRouter } from 'react-router-dom';
import * as router from 'react-router-dom'; import * as router from 'react-router-dom';
import { Button, Container, UncontrolledDropdown, DropdownItem, DropdownMenu, DropdownToggle, Nav, NavItem } from 'reactstrap'; import { Button, Container, UncontrolledDropdown, DropdownItem, DropdownMenu, DropdownToggle, Nav, NavItem } from 'reactstrap';
import axios from 'axios'; import axios from 'axios';
import { ALERTUSER_SEARCH, ALERT_SEARCH, MENU_SEARCH, ROLEMENU_SEARCH, ALERTUSER_STATUSVIEW, ALERT_STATUSVIEW, MENU_MANAGEMENT, CONTROL_MONITORING_SEARCH } from '../../const/ApiConst'; import { BASE_SIMPRO_LUMEN_IMAGE, MENU_MANAGEMENT } from '../../const/ApiConst';
import { handleChangeLng } from "../../utils/LangUtils"; import { handleChangeLng } from "../../utils/LangUtils";
import { import {
AppAside, AppAside,
@ -63,8 +63,6 @@ class DefaultLayout extends Component {
company_id: company_id company_id: company_id
}; };
} }
async componentDidMount() { async componentDidMount() {
const menu = localStorage.getItem("menu_login") const menu = localStorage.getItem("menu_login")
if (menu) this.setMenu(JSON.parse(menu)) if (menu) this.setMenu(JSON.parse(menu))
@ -72,6 +70,53 @@ class DefaultLayout extends Component {
if (!localStorage.getItem("token")) { if (!localStorage.getItem("token")) {
this.signOut(); this.signOut();
} }
window.myData = "Data dari komponen React";
try {
const storedData = localStorage.getItem('configApp');
if (storedData !== null) {
const data = JSON.parse(storedData);
const faviconContent = data && data.favicon_image ? `${BASE_SIMPRO_LUMEN_IMAGE}/${data.favicon_image.content}` : null;
const htmlTitle = data.html_title || 'OSPRO';
document.title = htmlTitle;
if (faviconContent) {
this.setFavicon(faviconContent);
}
} else {
document.title = 'OSPRO';
}
} catch (error) {
document.title = 'OSPRO';
}
}
setFavicon = (faviconContent) => {
const existingFavicon = document.querySelector("link[rel='icon']");
if (existingFavicon) {
document.head.removeChild(existingFavicon);
}
const faviconElement = document.createElement('link');
faviconElement.rel = 'icon';
const fileExtension = faviconContent ? faviconContent.split('.').pop().toLowerCase() : '';
switch (fileExtension) {
case 'svg':
faviconElement.type = 'image/svg+xml';
break;
case 'ico':
faviconElement.type = 'image/x-icon';
break;
default:
faviconElement.type = 'image/png';
}
console.log('faviconElement.type', faviconElement.type);
console.log('faviconContent', faviconContent);
faviconElement.href = faviconContent || `${process.env.PUBLIC_URL}/OSPRO.ico`;
document.head.appendChild(faviconElement);
} }
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
@ -120,6 +165,7 @@ class DefaultLayout extends Component {
await localStorage.removeItem("role_id"); await localStorage.removeItem("role_id");
await localStorage.removeItem("company_id"); await localStorage.removeItem("company_id");
document.getElementById('title').innerText = 'OSPRO'; document.getElementById('title').innerText = 'OSPRO';
this.setFavicon(`${process.env.PUBLIC_URL}/OSPRO.ico`);
await window.localStorage.clear(); await window.localStorage.clear();
this.props.history.replace('/login') this.props.history.replace('/login')
} }
@ -269,9 +315,12 @@ class DefaultLayout extends Component {
return ( return (
<div className="app"> <div className="app">
{/* <AppHeader fixed> {!window.location.href.includes("false-header") && (
<DefaultHeader /> <AppHeader fixed>
</AppHeader> */} <DefaultHeader />
</AppHeader>
)
}
<div className="app-body"> <div className="app-body">
{!window.location.href.includes("dashboard-project") || renderSidebar ? ( {!window.location.href.includes("dashboard-project") || renderSidebar ? (
<AppSidebar minimized={this.state.minimized} fixed display="lg"> <AppSidebar minimized={this.state.minimized} fixed display="lg">

1
src/views/Pages/Login/Login.js

@ -64,7 +64,6 @@ class Login extends Component {
if (storedData !== null) { if (storedData !== null) {
const data = JSON.parse(storedData); const data = JSON.parse(storedData);
const htmlTitle = data.html_title || 'OSPRO'; const htmlTitle = data.html_title || 'OSPRO';
console.log('htmlTitle', htmlTitle);
document.getElementById('title').innerText = htmlTitle; document.getElementById('title').innerText = htmlTitle;
} else { } else {
document.title = 'OSPRO'; document.title = 'OSPRO';

33
src/views/Pages/Page403/Page403.js

@ -1,33 +0,0 @@
import React, { Component } from 'react';
import { Button, Col, Container, Input, InputGroup, InputGroupAddon, InputGroupText, Row } from 'reactstrap';
class Page403 extends Component {
logOut = () => {
window.localStorage.clear();
this.props.history.push('/login')
}
render() {
return (
<div className="app flex-row align-items-center">
<Container>
<Row className="justify-content-center">
<Col md="6">
<div className="clearfix">
<h1 className="float-left display-3 mr-4">403</h1>
<h4 className="pt-3">Oops! <br></br>Kamu pergi ke halaman yang terlarang!</h4>
<p className="text-muted float-left">Halaman tidak bisa di akses!</p>
</div>
<div style={{alignItems:'center'}}>
<Button size="sm" color="warning" onClick={() => this.logOut()}>Back To Login</Button>
</div>
</Col>
</Row>
</Container>
</div>
);
}
}
export default Page403;

9
src/views/Pages/Page403/Page403.test.js

@ -1,9 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import Page404 from './Page403';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<Page403 />, div);
ReactDOM.unmountComponentAtNode(div);
});

6
src/views/Pages/Page403/package.json

@ -1,6 +0,0 @@
{
"name": "Page403",
"version": "0.0.0",
"private": true,
"main": "./Page403.js"
}

35
src/views/Pages/Page404/Page404.js

@ -1,35 +0,0 @@
import React, { Component } from 'react';
import { Button, Col, Container, Input, InputGroup, InputGroupAddon, InputGroupText, Row } from 'reactstrap';
class Page404 extends Component {
render() {
return (
<div className="app flex-row align-items-center">
<Container>
<Row className="justify-content-center">
<Col md="6">
<div className="clearfix">
<h1 className="float-left display-3 mr-4">404</h1>
<h4 className="pt-3">Oops! You're lost.</h4>
<p className="text-muted float-left">The page you are looking for was not found.</p>
</div>
<InputGroup className="input-prepend">
<InputGroupAddon addonType="prepend">
<InputGroupText>
<i className="fa fa-search"></i>
</InputGroupText>
</InputGroupAddon>
<Input size="16" type="text" placeholder="What are you looking for?" />
<InputGroupAddon addonType="append">
<Button color="info">Search</Button>
</InputGroupAddon>
</InputGroup>
</Col>
</Row>
</Container>
</div>
);
}
}
export default Page404;

9
src/views/Pages/Page404/Page404.test.js

@ -1,9 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import Page404 from './Page404';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<Page404 />, div);
ReactDOM.unmountComponentAtNode(div);
});

6
src/views/Pages/Page404/package.json

@ -1,6 +0,0 @@
{
"name": "Page404",
"version": "0.0.0",
"private": true,
"main": "./Page404.js"
}

35
src/views/Pages/Page500/Page500.js

@ -1,35 +0,0 @@
import React, { Component } from 'react';
import { Button, Col, Container, Input, InputGroup, InputGroupAddon, InputGroupText, Row } from 'reactstrap';
class Page500 extends Component {
render() {
return (
<div className="app flex-row align-items-center">
<Container>
<Row className="justify-content-center">
<Col md="6">
<span className="clearfix">
<h1 className="float-left display-3 mr-4">500</h1>
<h4 className="pt-3">Houston, we have a problem!</h4>
<p className="text-muted float-left">The page you are looking for is temporarily unavailable.</p>
</span>
<InputGroup className="input-prepend">
<InputGroupAddon addonType="prepend">
<InputGroupText>
<i className="fa fa-search"></i>
</InputGroupText>
</InputGroupAddon>
<Input size="16" type="text" placeholder="What are you looking for?" />
<InputGroupAddon addonType="append">
<Button color="info">Search</Button>
</InputGroupAddon>
</InputGroup>
</Col>
</Row>
</Container>
</div>
);
}
}
export default Page500;

9
src/views/Pages/Page500/Page500.test.js

@ -1,9 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import Page500 from './Page500';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<Page500 />, div);
ReactDOM.unmountComponentAtNode(div);
});

6
src/views/Pages/Page500/package.json

@ -1,6 +0,0 @@
{
"name": "Page500",
"version": "0.0.0",
"private": true,
"main": "./Page500.js"
}

68
src/views/Pages/Register/Register.js

@ -1,68 +0,0 @@
import React, { Component } from 'react';
import { Button, Card, CardBody, CardFooter, Col, Container, Form, Input, InputGroup, InputGroupAddon, InputGroupText, Row } from 'reactstrap';
class Register extends Component {
render() {
return (
<div className="app flex-row align-items-center">
<Container>
<Row className="justify-content-center">
<Col md="9" lg="7" xl="6">
<Card className="mx-4">
<CardBody className="p-4">
<Form>
<h1>Register</h1>
<p className="text-muted">Create your account</p>
<InputGroup className="mb-3">
<InputGroupAddon addonType="prepend">
<InputGroupText>
<i className="icon-user"></i>
</InputGroupText>
</InputGroupAddon>
<Input type="text" placeholder="Username" autoComplete="username" />
</InputGroup>
<InputGroup className="mb-3">
<InputGroupAddon addonType="prepend">
<InputGroupText>@</InputGroupText>
</InputGroupAddon>
<Input type="text" placeholder="Email" autoComplete="email" />
</InputGroup>
<InputGroup className="mb-3">
<InputGroupAddon addonType="prepend">
<InputGroupText>
<i className="icon-lock"></i>
</InputGroupText>
</InputGroupAddon>
<Input type="password" placeholder="Password" autoComplete="new-password" />
</InputGroup>
<InputGroup className="mb-4">
<InputGroupAddon addonType="prepend">
<InputGroupText>
<i className="icon-lock"></i>
</InputGroupText>
</InputGroupAddon>
<Input type="password" placeholder="Repeat password" autoComplete="new-password" />
</InputGroup>
<Button color="success" block>Create Account</Button>
</Form>
</CardBody>
<CardFooter className="p-4">
<Row>
<Col xs="12" sm="6">
<Button className="btn-facebook mb-1" block><span>facebook</span></Button>
</Col>
<Col xs="12" sm="6">
<Button className="btn-twitter mb-1" block><span>twitter</span></Button>
</Col>
</Row>
</CardFooter>
</Card>
</Col>
</Row>
</Container>
</div>
);
}
}
export default Register;

9
src/views/Pages/Register/Register.test.js

@ -1,9 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import Register from './Register';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<Register />, div);
ReactDOM.unmountComponentAtNode(div);
});

6
src/views/Pages/Register/package.json

@ -1,6 +0,0 @@
{
"name": "Register",
"version": "0.0.0",
"private": true,
"main": "./Register.js"
}

46
src/views/Users/User.js

@ -1,46 +0,0 @@
import React, { Component } from 'react';
import { Card, CardBody, CardHeader, Col, Row, Table } from 'reactstrap';
import usersData from './UsersData'
class User extends Component {
render() {
const user = usersData.find(user => user.id.toString() === this.props.match.params.id)
const userDetails = user ? Object.entries(user) : [['id', (<span><i className="text-muted icon-ban"></i> Not found</span>)]]
return (
<div className="animated fadeIn">
<Row>
<Col lg={6}>
<Card>
<CardHeader>
<strong><i className="icon-info pr-1"></i>User id: {this.props.match.params.id}</strong>
</CardHeader>
<CardBody>
<Table responsive striped hover>
<tbody>
{
userDetails.map(([key, value]) => {
return (
<tr key={key}>
<td>{`${key}:`}</td>
<td><strong>{value}</strong></td>
</tr>
)
})
}
</tbody>
</Table>
</CardBody>
</Card>
</Col>
</Row>
</div>
)
}
}
export default User;

15
src/views/Users/User.test.js

@ -1,15 +0,0 @@
import React from 'react';
import {MemoryRouter} from 'react-router-dom';
import { mount } from 'enzyme'
import User from './User';
it('renders without crashing', () => {
const wrapper = mount(
<MemoryRouter>
<User match={{params: {id: "1"}, isExact: true, path: "/users/:id", name: "User details"}}/>
</MemoryRouter>
);
expect(wrapper.containsMatchingElement(<strong>Samppa Nori</strong>)).toEqual(true)
wrapper.unmount()
});

78
src/views/Users/Users.js

@ -1,78 +0,0 @@
import React, { Component } from 'react'
import DataTable from '../../components/DataTableEditDialog'
import { API_LIST_DATA_USERS, API_INSERT_DATA_USERS, API_UPDATE_DATA_USERS, API_DELETE_DATA_USERS } from '../../const/ApiConst'
const columns = [{
dataField: 'id',
alias: "Id",
showInput: false,
type: "number",
state: 0
}, {
dataField: 'fullname',
alias: "Fullname",
showInput: true,
type: "text",
state: ""
}, {
dataField: 'username',
alias: "Username",
showInput: true,
type: "text",
state: ""
}, {
dataField: 'password',
alias: "Password",
showInput: true,
type: "password",
state: ""
}, {
dataField: 'created_time',
alias: "Created Time",
showInput: false,
type: "text",
state: ""
}, {
dataField: 'modified_time',
alias: "Modified Time",
showInput: false,
type: "text",
state: ""
}, {
dataField: 'created_by',
alias: "Created By",
showInput: false,
type: "text",
state: "admin"
}];
class Users extends Component {
constructor(props) {
super(props)
this.state = {
columns: null,
dataTable: []
}
}
componentDidMount() {
}
render() {
let dataTable = this.state.dataTable
return (
<div>
<DataTable
title="User"
columns={columns}
urlParamGet={API_LIST_DATA_USERS}
urlParamInsert={API_INSERT_DATA_USERS}
urlParamUpdate={API_UPDATE_DATA_USERS}
urlParamDelete={API_DELETE_DATA_USERS}
/>
</div>
)
}
}
export default Users;

10
src/views/Users/Users.test.js

@ -1,10 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { MemoryRouter } from 'react-router-dom';
import Users from './Users';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<MemoryRouter><Users /></MemoryRouter>, div);
ReactDOM.unmountComponentAtNode(div);
});

31
src/views/Users/UsersData.js

@ -1,31 +0,0 @@
const usersData = [
{id: 0, name: 'John Doe', registered: '2018/01/01', role: 'Guest', status: 'Pending'},
{id: 1, name: 'Samppa Nori', registered: '2018/01/01', role: 'Member', status: 'Active'},
{id: 2, name: 'Estavan Lykos', registered: '2018/02/01', role: 'Staff', status: 'Banned'},
{id: 3, name: 'Chetan Mohamed', registered: '2018/02/01', role: 'Admin', status: 'Inactive'},
{id: 4, name: 'Derick Maximinus', registered: '2018/03/01', role: 'Member', status: 'Pending'},
{id: 5, name: 'Friderik Dávid', registered: '2018/01/21', role: 'Staff', status: 'Active'},
{id: 6, name: 'Yiorgos Avraamu', registered: '2018/01/01', role: 'Member', status: 'Active'},
{id: 7, name: 'Avram Tarasios', registered: '2018/02/01', role: 'Staff', status: 'Banned'},
{id: 8, name: 'Quintin Ed', registered: '2018/02/01', role: 'Admin', status: 'Inactive'},
{id: 9, name: 'Enéas Kwadwo', registered: '2018/03/01', role: 'Member', status: 'Pending'},
{id: 10, name: 'Agapetus Tadeáš', registered: '2018/01/21', role: 'Staff', status: 'Active'},
{id: 11, name: 'Carwyn Fachtna', registered: '2018/01/01', role: 'Member', status: 'Active'},
{id: 12, name: 'Nehemiah Tatius', registered: '2018/02/01', role: 'Staff', status: 'Banned'},
{id: 13, name: 'Ebbe Gemariah', registered: '2018/02/01', role: 'Admin', status: 'Inactive'},
{id: 14, name: 'Eustorgios Amulius', registered: '2018/03/01', role: 'Member', status: 'Pending'},
{id: 15, name: 'Leopold Gáspár', registered: '2018/01/21', role: 'Staff', status: 'Active'},
{id: 16, name: 'Pompeius René', registered: '2018/01/01', role: 'Member', status: 'Active'},
{id: 17, name: 'Paĉjo Jadon', registered: '2018/02/01', role: 'Staff', status: 'Banned'},
{id: 18, name: 'Micheal Mercurius', registered: '2018/02/01', role: 'Admin', status: 'Inactive'},
{id: 19, name: 'Ganesha Dubhghall', registered: '2018/03/01', role: 'Member', status: 'Pending'},
{id: 20, name: 'Hiroto Šimun', registered: '2018/01/21', role: 'Staff', status: 'Active'},
{id: 21, name: 'Vishnu Serghei', registered: '2018/01/01', role: 'Member', status: 'Active'},
{id: 22, name: 'Zbyněk Phoibos', registered: '2018/02/01', role: 'Staff', status: 'Banned'},
{id: 23, name: 'Einar Randall', registered: '2018/02/01', role: 'Admin', status: 'Inactive'},
{id: 24, name: 'Félix Troels', registered: '2018/03/21', role: 'Staff', status: 'Active'},
{id: 25, name: 'Aulus Agmundr', registered: '2018/01/01', role: 'Member', status: 'Pending'},
{id: 42, name: 'Ford Prefex', registered: '2001/05/21', role: 'Alien', status: 'Don\'t panic!'}
]
export default usersData

6
src/views/Users/package.json

@ -1,6 +0,0 @@
{
"name": "Users",
"version": "0.0.0",
"private": true,
"main": "./Users.js"
}
Loading…
Cancel
Save