This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
1,064 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM docker.io/library/node:20.6.0-bookworm | ||
|
||
RUN apt-get update \ | ||
&& apt-get install --yes --no-install-recommends \ | ||
sqlite3 pre-commit |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Your React App</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { useQuery, gql, DocumentNode } from "@apollo/client"; | ||
import React from "react"; | ||
import { Pagination, Table, theme } from "@diamondlightsource/ui-components" | ||
import { ChakraProvider } from "@chakra-ui/react"; | ||
|
||
const GET_INFO: DocumentNode = gql` | ||
query pinInfo { | ||
libraryPins { | ||
barcode, | ||
loopSize, | ||
status | ||
} | ||
} | ||
`; | ||
|
||
function DisplayPinInfo(): React.JSX.Element { | ||
const { loading, error, data } = useQuery(GET_INFO); | ||
|
||
if (loading) return <p>Loading...</p>; | ||
if (error) return <p>Error : {error.message} {error.extraInfo}</p>; | ||
|
||
return ( | ||
<><Table | ||
headers={[ | ||
{ | ||
key: 'barcode', | ||
label: 'Barcode' | ||
}, | ||
{ | ||
key: 'loopSize', | ||
label: 'Loop Size' | ||
}, | ||
{ | ||
key: 'status', | ||
label: 'Status' | ||
} | ||
]} | ||
data={data.libraryPins} /> | ||
<Pagination | ||
total={6} onPageChange={(page) => { | ||
console.log(`On page: ${page}`) | ||
}} | ||
/> | ||
</> | ||
); | ||
} | ||
|
||
export default function App(): React.JSX.Element { | ||
return ( | ||
<ChakraProvider theme={theme}> | ||
<DisplayPinInfo /> | ||
</ChakraProvider> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React, { Component } from 'react'; | ||
import '../styles/Table.css'; | ||
|
||
class BarcodeTable extends Component { | ||
render() { | ||
// Sample data for the table | ||
const data = [ | ||
{ barcode: '0123456789-0123456789', loopSize: '90', status: 'Ready' }, | ||
{ barcode: '0123456789-0123456789', loopSize: '75', status: 'Occupied' }, | ||
{ barcode: '0123456789-0123456789', loopSize: '90', status: 'Dirty' }, | ||
{ barcode: '0123456789-0123456789', loopSize: '75', status: 'Broken' } | ||
]; | ||
|
||
return ( | ||
<div> | ||
<h2 className='wrapper'>Pin Library</h2> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th className={'wrapper th-td-spacing'}>Barcode</th> | ||
<th className={'wrapper th-td-spacing'}>Loop Size</th> | ||
<th className={'wrapper th-td-spacing'}>Status</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{data.map((item, index) => ( | ||
<tr key={index}> | ||
<td className={'wrapper item-vspacing'}>{item.barcode}</td> | ||
<td className={'wrapper item-vspacing'}>{item.loopSize}</td> | ||
<td className={'status-wrapper item-vspacing'}>{item.status}</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default BarcodeTable; |
Empty file.
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from "react"; | ||
import * as ReactDOM from "react-dom/client"; | ||
import { ApolloClient, InMemoryCache, ApolloProvider, createHttpLink, ApolloLink, NormalizedCacheObject } from "@apollo/client"; | ||
import App from "./App"; | ||
import { setContext } from '@apollo/client/link/context'; | ||
|
||
|
||
const httpLink: ApolloLink = createHttpLink({ | ||
uri: '/api', | ||
}); | ||
|
||
const authLink: ApolloLink = setContext((_, { headers }) => { | ||
const token: string = "ValidToken"; | ||
return { | ||
headers: { | ||
...headers, | ||
authorization: token ? `Bearer ${token}` : "", | ||
} | ||
} | ||
}); | ||
|
||
const client: ApolloClient<NormalizedCacheObject> = new ApolloClient({ | ||
link: authLink.concat(httpLink), | ||
cache: new InMemoryCache() | ||
}); | ||
|
||
const root: ReactDOM.Root = ReactDOM.createRoot(document.getElementById("root")); | ||
|
||
root.render( | ||
<ApolloProvider client={client}> | ||
<App /> | ||
</ApolloProvider> | ||
); |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { createProxyMiddleware } = require ('http-proxy-middleware'); | ||
|
||
module.exports = function(app) { | ||
app.use( | ||
'/api', | ||
createProxyMiddleware({ | ||
target: 'http://backend', | ||
changeOrigin: true, | ||
pathRewrite: {'^/api' : ''} | ||
}) | ||
); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.wrapper { | ||
padding-left: 10px; | ||
} | ||
|
||
.status-wrapper { | ||
padding-left: 30px; | ||
} | ||
|
||
.item-vspacing { | ||
padding-top: 0px; | ||
} | ||
|
||
.th-td-spacing { | ||
padding-left: 10px | ||
} | ||
|
||
.barcode-spacing { | ||
padding-bottom: 10px; | ||
padding-left: 0px; | ||
} |
Oops, something went wrong.