Skip to content

Commit

Permalink
feat(frontend): various updates (BC Sans and look and feel) (#1804)
Browse files Browse the repository at this point in the history
Signed-off-by: OMPRAKASH MISHRA <omprakashmishra3978@gmail.com>
  • Loading branch information
mishraomp authored Feb 12, 2024
1 parent 3fdb9f4 commit 631c512
Show file tree
Hide file tree
Showing 12 changed files with 247 additions and 55 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ jobs:
helm rollback ${{ env.repo_release }} || \
helm uninstall ${{ env.repo_release }}
fi
# Clean previous deployments for PR pipeline, if any
if [[ '${{inputs.environment}}' == '' ]]; then
helm uninstall ${{ env.repo_release }} || true
fi
# Deploy Helm Chart
helm dependency update
helm package --app-version="${{ env.package_tag }}" --version=${{ inputs.tag }} .
Expand Down
2 changes: 2 additions & 0 deletions charts/quickstart-openshift/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ global:
#-- extra annotations for the pod, it is optional and is an object.
podAnnotations: |
app.kubernetes.io/timestamp: {{now | toString }}
imagestreams:
enabled: true
#-- the components of the application, backend.
backend:
#-- enable or disable a component deployment.
Expand Down
88 changes: 63 additions & 25 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@
"build": "vite build"
},
"dependencies": {
"@bcgov/bc-sans": "^2.1.0",
"@emotion/react": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.11.16",
"@mui/material": "^5.13.1",
"@mui/system": "^5.15.9",
"@mui/x-data-grid": "^6.19.4",
"@vitejs/plugin-react": "^4.0.0",
"axios": "^1.4.0",
"mui-datatables": "^4.3.0",
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const styles = {
marginLeft: '1em',
marginBottom: '5em',
height: '100%',
display: 'flex',
justifyContent: 'center',
alignItems: 'flex-start',
},
}
export default function App() {
Expand Down
Binary file added frontend/src/assets/BCID_H_rgb_pos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 97 additions & 15 deletions frontend/src/components/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,113 @@
import { useEffect, useState } from 'react'
import MUIDataTable from 'mui-datatables'
import apiService from '@/service/api-service'
import type UserDto from '@/interfaces/UserDto'
import type { AxiosResponse } from '~/axios'

const columns: string[] = ['Id', 'Name', 'Email']
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 { AxiosResponse } from '~/axios'

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([])
const [data, setData] = useState<any>([])

useEffect(() => {
apiService
.getAxiosInstance()
.get('/v1/users')
.then((response: AxiosResponse) => {
setData(
response.data.map((user: UserDto) => [
user.id,
user.name,
user.email,
]),
)
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)

return <MUIDataTable title={'User List'} data={data} columns={columns} />
const handleClose = () => {
setSelectedRow(null)
}
return (
<div
style={{
minHeight: '45em',
maxHeight: '45em',
width: '100%',
marginLeft: '4em',
}}
>
<DataGrid
slots={{ toolbar: GridToolbar }}
slotProps={{
toolbar: {
showQuickFilter: true,
},
}}
experimentalFeatures={{ ariaV7: true }}
checkboxSelection={false}
rows={data}
columns={columns}
pageSizeOptions={[5, 10, 20, 50, 100]}
getRowId={(row) => row['id']}
onRowClick={(params) => setSelectedRow(params.row)}
/>
<Dialog open={!!selectedRow} onClose={handleClose}>
<DialogTitle>Row Details</DialogTitle>
<DialogContent>
<Table>
<TableBody>
{selectedRow &&
Object.entries(selectedRow).map(([key, value]) => (
<TableRow key={key}>
<TableCell>{key}</TableCell>
<TableCell>{value}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</DialogContent>
<DialogActions>
<Button variant="contained" color="secondary" onClick={handleClose}>
Close
</Button>
</DialogActions>
</Dialog>
</div>
)
}
Loading

0 comments on commit 631c512

Please sign in to comment.