generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from bcgov/fix-merge-issues
Fix merge issues
- Loading branch information
Showing
3 changed files
with
75 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,82 @@ | ||
// import apiService from '@/service/api-service' | ||
// import Button from '@mui/material/Button' | ||
// import Dialog from '@mui/material/Dialog' | ||
// import DialogActions from '@mui/material/DialogActions' | ||
// import DialogContent from '@mui/material/DialogContent' | ||
// import DialogTitle from '@mui/material/DialogTitle' | ||
// import Table from '@mui/material/Table' | ||
// import TableBody from '@mui/material/TableBody' | ||
// import TableCell from '@mui/material/TableCell' | ||
// import TableRow from '@mui/material/TableRow' | ||
// import { DataGrid, GridToolbar } from '@mui/x-data-grid' | ||
// import { useEffect, useState } from 'react' | ||
// import type { AxiosResponse } from '~/axios' | ||
import apiService from '@/service/api-service' | ||
import Button from '@mui/material/Button' | ||
import Dialog from '@mui/material/Dialog' | ||
import DialogActions from '@mui/material/DialogActions' | ||
import DialogContent from '@mui/material/DialogContent' | ||
import DialogTitle from '@mui/material/DialogTitle' | ||
import Table from '@mui/material/Table' | ||
import TableBody from '@mui/material/TableBody' | ||
import TableCell from '@mui/material/TableCell' | ||
import TableRow from '@mui/material/TableRow' | ||
import { DataGrid, GridToolbar } from '@mui/x-data-grid' | ||
import { useEffect, useState } from 'react' | ||
import type { AxiosResponse } from '~/axios' | ||
// import config from '../config' | ||
import _kc from '@/keycloak' | ||
import UserService from '@/service/user-service' | ||
|
||
// const columns = [ | ||
// { | ||
// field: 'id', | ||
// headerName: 'Employee ID', | ||
// sortable: true, | ||
// filterable: true, | ||
// flex: 1, | ||
// }, | ||
// { | ||
// field: 'name', | ||
// headerName: 'Employee Name', | ||
// sortable: true, | ||
// filterable: true, | ||
// flex: 1, | ||
// }, | ||
// { | ||
// field: 'email', | ||
// headerName: 'Employee Email', | ||
// sortable: true, | ||
// filterable: true, | ||
// flex: 1, | ||
// }, | ||
// ] | ||
const columns = [ | ||
{ | ||
field: 'id', | ||
headerName: 'Employee ID', | ||
sortable: true, | ||
filterable: true, | ||
flex: 1, | ||
}, | ||
{ | ||
field: 'name', | ||
headerName: 'Employee Name', | ||
sortable: true, | ||
filterable: true, | ||
flex: 1, | ||
}, | ||
{ | ||
field: 'email', | ||
headerName: 'Employee Email', | ||
sortable: true, | ||
filterable: true, | ||
flex: 1, | ||
}, | ||
] | ||
export default function Dashboard() { | ||
// const [data, setData] = useState<any>([]) | ||
const [data, setData] = useState<any>([]) | ||
|
||
// const data = [ | ||
// { | ||
// id: 1, | ||
// name: 'Michael', | ||
// email: '[email protected]', | ||
// }, | ||
// { | ||
// id: 2, | ||
// name: 'Test', | ||
// email: '[email protected]', | ||
// }, | ||
// { | ||
// id: 3, | ||
// name: 'User', | ||
// email: '[email protected]', | ||
// }, | ||
// ] | ||
useEffect(() => { | ||
apiService | ||
.getAxiosInstance() | ||
.get('/v1/users') | ||
.then((response: AxiosResponse) => { | ||
const users = [] | ||
for (const user of response.data) { | ||
const userDto = { | ||
id: user.id, | ||
name: user.name, | ||
email: user.email, | ||
} | ||
users.push(userDto) | ||
} | ||
setData(users) | ||
}) | ||
.catch((error) => { | ||
console.error(error) | ||
}) | ||
}, []) | ||
const [selectedRow, setSelectedRow] = useState(null) | ||
|
||
// useEffect(() => { | ||
// apiService | ||
// .getAxiosInstance() | ||
// .get('/v1/users') | ||
// .then((response: AxiosResponse) => { | ||
// const users = [] | ||
// for (const user of response.data) { | ||
// const userDto = { | ||
// id: user.id, | ||
// name: user.name, | ||
// email: user.email, | ||
// } | ||
// users.push(userDto) | ||
// } | ||
// setData(users) | ||
// }) | ||
// .catch((error) => { | ||
// console.error(error) | ||
// }) | ||
// }, []) | ||
// interface DataRow { | ||
// [key: string]: any | ||
// } | ||
const handleClose = () => { | ||
setSelectedRow(null) | ||
} | ||
|
||
// const [selectedRow, setSelectedRow] = useState<DataRow | null>(null) | ||
|
||
// const handleClose = () => { | ||
// setSelectedRow(null) | ||
// } | ||
return ( | ||
<div | ||
style={{ | ||
minHeight: '45em', | ||
maxHeight: '45em', | ||
width: '100%', | ||
width: '90%', | ||
marginLeft: '4em', | ||
}} | ||
> | ||
Dashboard | ||
{/* <DataGrid | ||
<DataGrid | ||
slots={{ toolbar: GridToolbar }} | ||
slotProps={{ | ||
toolbar: { | ||
|
@@ -130,7 +111,7 @@ export default function Dashboard() { | |
Close | ||
</Button> | ||
</DialogActions> | ||
</Dialog> */} | ||
</Dialog> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
import { FC } from "react"; | ||
import { Navigate, Outlet } from "react-router-dom"; | ||
import Roles from "../roles"; | ||
import Dashboard from "@/components/Dashboard"; | ||
import { Layout } from "@/components/Layout"; | ||
import { FC } from 'react' | ||
import { Navigate } from 'react-router-dom' | ||
import Roles from '../roles' | ||
import Dashboard from '@/pages/Dashboard' | ||
|
||
export const ProtectedRoutes: FC<{ roles: Array<Roles> }> = () => { | ||
let auth = { token: true } | ||
return auth.token ? ( | ||
<Dashboard/> | ||
) : ( | ||
<Navigate to="/not-authorized" /> | ||
) | ||
} | ||
let auth = { token: true } | ||
return auth.token ? <Dashboard /> : <Navigate to="/not-authorized" /> | ||
} |