DatabaseProject/bin/main/public/static/js/main.4ee489f9.chunk.js.map
2024-04-15 18:28:13 +02:00

1 line
No EOL
28 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"sources":["theme.js","PalletProduction.js","PalletTableFilter.js","PalletTable.js","ResetDatabase.js","App.js","serviceWorker.js","index.js"],"names":["theme","createMuiTheme","palette","primary","main","secondary","error","red","A400","background","default","PalletProduction","state","cookie","handleInputChange","e","setState","target","name","value","handleSubmit","preventDefault","isFormValid","params","axios","post","then","res","console","log","data","id","message","props","setStatus","alert","status","refresh","catch","length","Paper","className","this","classes","PalletProductionPaper","Typography","color","variant","gutterBottom","Grid","container","direction","justify","alignItems","TextField","style","minWidth","select","label","onChange","SelectProps","native","cookies","map","c","key","Button","marginLeft","onClick","disabled","Component","withStyles","padding","marginBottom","PalletTableFilter","from","to","blocked","palletsFilter","handleClear","paddingLeft","marginTop","type","InputLabelProps","shrink","root","width","overflowX","table","header","Table","TableHead","TableRow","TableCell","TableBody","pallets","p","customer","component","scope","production_date","ResetDatabase","open","openDialog","closeDialog","resetDatabase","response","Dialog","onClose","aria-labelledby","aria-describedby","DialogTitle","DialogContent","DialogContentText","DialogActions","autoFocus","App","disconnected","cookieStatus","palletStatus","fetchCookies","fetchPallets","get","filter","Object","keys","k","forEach","setPalletsFilter","mainArea","statusMessage","join","defaults","baseURL","StatusPaper","Boolean","window","location","hostname","match","ReactDOM","render","ThemeProvider","CssBaseline","document","getElementById","navigator","serviceWorker","ready","registration","unregister"],"mappings":"wQAqBeA,EAjBDC,YAAe,CAC3BC,QAAS,CACPC,QAAS,CACPC,KAAM,WAERC,UAAW,CACTD,KAAM,WAERE,MAAO,CACLF,KAAMG,IAAIC,MAEZC,WAAY,CACVC,QAAS,W,4HCNTC,E,2MACJC,MAAQ,CACNC,OAAQ,I,EAGVC,kBAAoB,SAACC,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,c","file":"static/js/main.4ee489f9.chunk.js","sourcesContent":["import { red } from '@material-ui/core/colors';\nimport { createMuiTheme } from '@material-ui/core/styles';\n\n// A custom theme for this app\nconst theme = createMuiTheme({\n palette: {\n primary: {\n main: '#556cd6',\n },\n secondary: {\n main: '#19857b',\n },\n error: {\n main: red.A400,\n },\n background: {\n default: '#fff',\n },\n },\n});\n\nexport default theme;","import React, { Component } from 'react';\nimport axios from 'axios';\n\nimport TextField from '@material-ui/core/TextField';\nimport Button from '@material-ui/core/Button';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { withStyles } from '@material-ui/core/styles';\nimport Paper from '@material-ui/core/Paper';\n\nclass PalletProduction extends Component {\n state = {\n cookie: \"\",\n }\n\n handleInputChange = (e) => {\n this.setState({\n [e.target.name]: e.target.value\n });\n }\n\n handleSubmit = (e) => {\n e.preventDefault();\n if (this.isFormValid()) {\n const cookie = this.state.cookie\n const params = {cookie: cookie}\n axios.post('pallets', null, {params: params})\n .then(res => {\n console.log(res);\n if (res.data.id) {\n const message = \"A pallet of \" + cookie\n + \" was produced with id \" + res.data.id;\n this.props.setStatus(message)\n } else {\n alert('An error occured: ' + res.data.status\n + '. See console for more info.');\n }\n this.props.refresh();\n })\n .catch(error => {\n alert('An error occured. See console for more info.');\n console.log(error);\n });\n this.setState({cookie: \"\"});\n }\n }\n\n isFormValid = () => this.state.cookie.length > 0;\n\n render() {\n return (\n <Paper className={this.props.classes.PalletProductionPaper}>\n <Typography color=\"textSecondary\" variant=\"button\" gutterBottom>\n Production\n </Typography>\n <form>\n <Grid\n container\n direction=\"row\"\n justify=\"flex-start\"\n alignItems=\"flex-end\">\n <TextField\n style={{minWidth: \"140px\"}}\n id=\"cookie\"\n select\n label=\"Select Cookie\"\n value={this.state.cookie}\n onChange={this.handleInputChange}\n name=\"cookie\"\n SelectProps={{\n native: true\n }}>\n <option value=\"\"></option>\n {this.props.cookies.map(c =>\n <option key={c.name} value={c.name}>{c.name}</option>\n )}\n </TextField>\n <Button\n style={{marginLeft: \"10px\"}}\n variant=\"contained\"\n onClick={this.handleSubmit}\n disabled={!this.isFormValid()}>\n Produce pallet!\n </Button>\n </Grid>\n </form>\n </Paper>\n );\n }\n}\n\nconst styles = theme => ({\n PalletProductionPaper: {\n padding: \"10px\",\n marginBottom: \"15px\"\n }\n});\n\nexport default withStyles(styles)(PalletProduction);\n","import React, { Component } from 'react';\n\nimport TextField from '@material-ui/core/TextField';\nimport Button from '@material-ui/core/Button';\nimport Grid from '@material-ui/core/Grid';\n\nconst initialState = () => ({\n cookie: \"\",\n from: \"\",\n to: \"\",\n blocked: \"\"\n})\n\nclass PalletTableFilter extends Component {\n state = initialState()\n\n handleInputChange = (e) => {\n this.setState({\n [e.target.name]: e.target.value\n });\n }\n\n handleSubmit = () => {\n this.props.palletsFilter(this.state);\n }\n\n handleClear = () => {\n this.setState(initialState());\n this.props.palletsFilter({ });\n }\n\n render() {\n return (\n <form style={{paddingLeft: \"10px\", marginBottom: \"10px\", marginTop:\"5px\"}}>\n <Grid\n container\n direction=\"row\"\n justify=\"flex-start\"\n alignItems=\"flex-end\">\n <TextField\n style={{minWidth: \"140px\"}}\n id=\"cookie\"\n select\n label=\"Select Cookie\"\n value={this.state.cookie}\n onChange={this.handleInputChange}\n name=\"cookie\"\n SelectProps={{\n native: true\n }}>\n <option value=\"\"></option>\n {this.props.cookies.map(c =>\n <option key={c.name} value={c.name}>{c.name}</option>\n )}\n </TextField>\n <TextField\n style={{marginLeft: \"10px\"}}\n id=\"from\"\n label=\"From\"\n type=\"date\"\n value={this.state.from}\n onChange={this.handleInputChange}\n name=\"from\"\n InputLabelProps={{\n shrink: true,\n }}\n />\n <TextField\n style={{marginLeft: \"10px\"}}\n id=\"to\"\n label=\"To\"\n type=\"date\"\n value={this.state.to}\n onChange={this.handleInputChange}\n name=\"to\"\n InputLabelProps={{\n shrink: true,\n }}\n />\n <TextField\n style={{marginLeft: \"10px\", minWidth: \"90px\"}}\n id=\"blocked\"\n select\n label=\"Blocked?\"\n value={this.state.blocked}\n onChange={this.handleInputChange}\n name=\"blocked\"\n SelectProps={{\n native: true\n }}>\n <option value=\"\"></option>\n <option value=\"yes\">Yes</option>\n <option value=\"no\">No</option>\n </TextField>\n <Button\n style={{marginLeft: \"10px\"}}\n variant=\"contained\"\n onClick={this.handleSubmit}>\n Filter\n </Button>\n <Button\n style={{marginLeft: \"10px\"}}\n variant=\"contained\"\n onClick={this.handleClear}>\n Clear\n </Button>\n </Grid>\n </form>\n );\n }\n}\n\nexport default(PalletTableFilter);\n","import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport PalletTableFilter from './PalletTableFilter'\n\nimport { withStyles } from '@material-ui/core/styles';\nimport Table from '@material-ui/core/Table';\nimport TableBody from '@material-ui/core/TableBody';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableHead from '@material-ui/core/TableHead';\nimport TableRow from '@material-ui/core/TableRow';\nimport Paper from '@material-ui/core/Paper';\nimport Typography from '@material-ui/core/Typography';\n\nconst styles = theme => ({\n root: {\n width: '100%',\n overflowX: 'auto',\n },\n table: {\n minWidth: 400,\n },\n header: {\n marginLeft: '10px',\n marginTop: '10px'\n }\n});\n\nfunction PalletTable(props) {\n const { classes } = props;\n\n return (\n <Paper className={classes.root}>\n <Typography className={classes.header} color=\"textSecondary\" variant=\"button\" gutterBottom>\n Produced Pallets\n </Typography>\n <PalletTableFilter\n cookies={props.cookies}\n palletsFilter={props.palletsFilter} />\n <Table className={classes.table}>\n <TableHead>\n <TableRow>\n <TableCell>Name</TableCell>\n <TableCell>Production date</TableCell>\n <TableCell>Customer</TableCell>\n <TableCell>Blocked</TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n {props.pallets.map(p => {\n const customer = !p.customer || p.customer === 'null' ? '' : p.customer;\n return (\n <TableRow key={p.id}>\n <TableCell component=\"th\" scope=\"row\">\n {p.cookie}\n </TableCell>\n <TableCell>{p.production_date}</TableCell>\n <TableCell>{customer}</TableCell>\n <TableCell>{p.blocked}</TableCell>\n </TableRow>\n );\n })}\n </TableBody>\n </Table>\n </Paper>\n );\n}\n\nPalletTable.propTypes = {\n classes: PropTypes.object.isRequired,\n};\n\nexport default withStyles(styles)(PalletTable);\n","import React, { Component } from 'react';\nimport axios from 'axios';\nimport Button from '@material-ui/core/Button';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogContentText from '@material-ui/core/DialogContentText';\nimport DialogTitle from '@material-ui/core/DialogTitle';\n\nclass ResetDatabase extends Component {\n state = {\n open: false\n }\n\n openDialog = () => {\n this.setState({open: true})\n }\n\n closeDialog = () => {\n this.setState({open: false})\n }\n\n resetDatabase = () => {\n this.closeDialog();\n axios.post('reset', {})\n .then(response => {\n console.log(response);\n this.props.refresh();\n this.props.setStatus(\"The database was restored\");\n })\n .catch(error => {\n alert('An error occured. See console.');\n console.log(error);\n });\n }\n\n render() {\n return (\n <p>\n <Button variant=\"contained\" onClick={this.openDialog}>\n Reset database\n </Button>\n <Dialog\n open={this.state.open}\n onClose={this.closeDialog}\n aria-labelledby=\"alert-dialog-title\"\n aria-describedby=\"alert-dialog-description\">\n <DialogTitle id=\"alert-dialog-title\">{\"Reset database?\"}</DialogTitle>\n <DialogContent>\n <DialogContentText id=\"alert-dialog-description\">\n Do you want do reset the database?\n </DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button onClick={this.resetDatabase} color=\"primary\">\n Yes\n </Button>\n <Button onClick={this.closeDialog} color=\"primary\" autoFocus>\n No\n </Button>\n </DialogActions>\n </Dialog>\n </p>\n );\n }\n}\n\nexport default ResetDatabase;\n","import React, { Component } from 'react';\nimport axios from 'axios';\n\nimport { withStyles } from '@material-ui/core/styles';\nimport Paper from '@material-ui/core/Paper';\nimport Typography from '@material-ui/core/Typography';\n\nimport './App.css';\nimport PalletProduction from './PalletProduction';\nimport PalletTable from './PalletTable'\nimport ResetDatabase from './ResetDatabase';\n\nclass App extends Component {\n state = {\n cookies: [],\n pallets: [],\n palletsFilter: {},\n disconnected: false,\n cookieStatus: \"\",\n palletStatus: \"\"\n }\n\n componentDidMount() {\n this.refresh();\n }\n\n refresh = () => {\n this.fetchCookies();\n this.fetchPallets(this.state.palletsFilter);\n }\n\n fetchCookies = () => {\n axios.get(\"cookies\")\n .then(res => {\n if (res.data && res.data.cookies) {\n this.setState({ cookies: res.data.cookies, cookieStatus: (!res.data.cookies || res.data.cookies.length === 0) ? \"Cookie request success, but no cookies returned from API\": \"\"});\n } else {\n this.setState({ cookieStatus: \"Couldn't fetch cookies from REST server\"});\n }\n })\n .catch(error => {\n console.log(error);\n this.setState({disconnected: true})\n });\n }\n\n fetchPallets = (filter) => {\n // Only apply filters that are non-empty\n let params = {}\n Object.keys(filter)\n .filter(k => filter[k].length > 0)\n .forEach(k => params[k] = filter[k])\n\n axios.get(\"pallets\", {params: params})\n .then(res => {\n console.log(res);\n if (res.data && res.data.pallets) {\n this.setState({ pallets: res.data.pallets, palletStatus: (!res.data.pallets || res.data.pallets.length === 0) ? \"Pallet request success, but no pallets returned from API.\": \"\" });\n } else {\n this.setState({ palletStatus: \"Couldn't fetch pallets from REST server\"});\n }\n })\n .catch(error => {\n console.log(error);\n this.setState({disconnected: true})\n });\n }\n\n setStatus = (message) => {\n this.setState({status: message});\n }\n\n setPalletsFilter = (filter) => {\n this.setState({palletsFilter: filter});\n this.fetchPallets(filter);\n }\n\n mainArea = () => (\n <div>\n <PalletProduction\n cookies={this.state.cookies}\n refresh={this.refresh}\n setStatus={this.setStatus} />\n <PalletTable\n cookies={this.state.cookies}\n pallets={this.state.pallets}\n palletsFilter={this.setPalletsFilter} />\n <ResetDatabase\n refresh={this.refresh}\n setStatus={this.setStatus} />\n </div>\n )\n\n render() {\n let statusMessage = [this.state.cookieStatus, this.state.palletStatus].join(\" - \");\n if (this.state.disconnected) {\n statusMessage = (\n <b>Disconnected. Couldn't connect to REST server ({axios.defaults.baseURL})</b>\n )\n }\n\n let main = null;\n if (!this.state.disconnected) {\n main = this.mainArea();\n }\n\n return (\n <div className=\"App\">\n <Typography variant=\"h3\" gutterBottom>\n Krusty\n </Typography>\n\n <Paper className={this.props.classes.StatusPaper}>\n <div>\n <b>Status:</b> {statusMessage}\n </div>\n </Paper>\n\n {main}\n </div>\n );\n }\n\n}\n\nconst styles = theme => ({\n StatusPaper: {\n padding: \"10px\",\n marginBottom: \"15px\"\n }\n});\n\nexport default withStyles(styles)(App);\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.0/8 are considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\nexport function register(config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl, config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl, {\n headers: { 'Service-Worker': 'script' }\n })\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready\n .then(registration => {\n registration.unregister();\n })\n .catch(error => {\n console.error(error.message);\n });\n }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport CssBaseline from '@material-ui/core/CssBaseline';\nimport { ThemeProvider } from '@material-ui/core/styles'\nimport theme from './theme';\n\nimport App from './App';\nimport * as serviceWorker from './serviceWorker';\n\nimport axios from 'axios';\n\naxios.defaults.baseURL = '/api/v1';\n\nReactDOM.render(\n<ThemeProvider theme={theme}>\n {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}\n <CssBaseline />\n <App />\n </ThemeProvider>, document.getElementById('root'));\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"],"sourceRoot":""}