fix: rebase issues and code style
This commit is contained in:
parent
703c5d7c91
commit
c100c11a2f
20 changed files with 28 additions and 419 deletions
|
|
@ -2,14 +2,6 @@ const db = require('./db')
|
||||||
|
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
var sqls = [
|
var sqls = [
|
||||||
'create table server_logs ( ' +
|
|
||||||
'id uuid PRIMARY KEY, ' +
|
|
||||||
'device_id text, ' +
|
|
||||||
'log_level text, ' +
|
|
||||||
'timestamp timestamptz DEFAULT now(), ' +
|
|
||||||
'message text, ' +
|
|
||||||
'meta json)',
|
|
||||||
|
|
||||||
'CREATE TABLE IF NOT EXISTS user_config ( ' +
|
'CREATE TABLE IF NOT EXISTS user_config ( ' +
|
||||||
'id serial PRIMARY KEY, ' +
|
'id serial PRIMARY KEY, ' +
|
||||||
'type text NOT NULL, ' +
|
'type text NOT NULL, ' +
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,18 @@ var db = require('./db')
|
||||||
|
|
||||||
exports.up = function (next) {
|
exports.up = function (next) {
|
||||||
const sql =
|
const sql =
|
||||||
[`create table server_support_logs (
|
[
|
||||||
id uuid PRIMARY KEY,
|
'create table server_logs ( ' +
|
||||||
timestamp timestamptz not null default now() )`
|
'id uuid PRIMARY KEY, ' +
|
||||||
|
'device_id text, ' +
|
||||||
|
'log_level text, ' +
|
||||||
|
'timestamp timestamptz DEFAULT now(), ' +
|
||||||
|
'message text, ' +
|
||||||
|
'meta json)',
|
||||||
|
|
||||||
|
`create table server_support_logs (
|
||||||
|
id uuid PRIMARY KEY,
|
||||||
|
timestamp timestamptz not null default now() )`
|
||||||
]
|
]
|
||||||
|
|
||||||
db.multi(sql, next)
|
db.multi(sql, next)
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { floor, lowerCase, startCase } from 'lodash/fp'
|
||||||
import { makeStyles } from '@material-ui/core'
|
import { makeStyles } from '@material-ui/core'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
|
||||||
import { spring3, spring2, mistyRose, tomato, zircon, comet, white, fontSecondary } from '../styling/variables'
|
import { spring3, spring2, mistyRose, tomato, comet } from '../styling/variables'
|
||||||
import typographyStyles from './typography/styles'
|
import typographyStyles from './typography/styles'
|
||||||
const { label } = typographyStyles
|
const { label } = typographyStyles
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
import React, { useState } from 'react'
|
|
||||||
|
|
||||||
import {
|
|
||||||
Td,
|
|
||||||
Tr,
|
|
||||||
THead,
|
|
||||||
TBody,
|
|
||||||
Table
|
|
||||||
} from './Table'
|
|
||||||
|
|
||||||
import { Link } from '../../components/buttons'
|
|
||||||
|
|
||||||
const EditableRow = ({ elements, cancel, save }) => {
|
|
||||||
const [editing, setEditing] = useState(false)
|
|
||||||
const innerCancel = () => {
|
|
||||||
setEditing(false)
|
|
||||||
cancel()
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Tr>
|
|
||||||
{elements.map(({ size, edit, view }, idx) => (
|
|
||||||
<Td key={idx} size={size}>{editing ? edit : view}</Td>
|
|
||||||
))}
|
|
||||||
<Td>
|
|
||||||
{editing ? (
|
|
||||||
<>
|
|
||||||
<Link style={{ marginRight: '20px' }} color='secondary' onClick={innerCancel}>
|
|
||||||
Cancel
|
|
||||||
</Link>
|
|
||||||
<Link color='primary' onClick={save}>
|
|
||||||
Save
|
|
||||||
</Link>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<Link color='primary' onClick={() => setEditing(true)}>
|
|
||||||
Edit
|
|
||||||
</Link>
|
|
||||||
)}
|
|
||||||
</Td>
|
|
||||||
</Tr>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const EditableTable = ({ elements = [], data = [], cancel, save }) => {
|
|
||||||
return (
|
|
||||||
<Table>
|
|
||||||
<THead>
|
|
||||||
{elements.map(({ size, header }, idx) => (
|
|
||||||
<Td header key={idx} size={size}>{header}</Td>
|
|
||||||
))}
|
|
||||||
</THead>
|
|
||||||
<TBody>
|
|
||||||
{data.map((it, idx) => <EditableRow key={idx} elements={elements} cancel={cancel} save={save} />)}
|
|
||||||
</TBody>
|
|
||||||
</Table>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default EditableTable
|
|
||||||
|
|
@ -16,7 +16,7 @@ import {
|
||||||
|
|
||||||
import typographyStyles from '../typography/styles'
|
import typographyStyles from '../typography/styles'
|
||||||
|
|
||||||
const { label2, p, info2 } = typographyStyles
|
const { label2, p } = typographyStyles
|
||||||
|
|
||||||
const useStyles = makeStyles({
|
const useStyles = makeStyles({
|
||||||
body: {
|
body: {
|
||||||
|
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
import {
|
|
||||||
tableHeaderColor,
|
|
||||||
tableHeaderHeight,
|
|
||||||
spacer,
|
|
||||||
white
|
|
||||||
} from '../styling/variables'
|
|
||||||
|
|
||||||
import typographyStyles from './typography/styles'
|
|
||||||
|
|
||||||
const { label2 } = typographyStyles
|
|
||||||
|
|
||||||
export default {
|
|
||||||
tableBody: {
|
|
||||||
borderSpacing: '0 4px'
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
extend: label2,
|
|
||||||
backgroundColor: tableHeaderColor,
|
|
||||||
height: tableHeaderHeight,
|
|
||||||
textAlign: 'left',
|
|
||||||
color: white,
|
|
||||||
// display: 'flex'
|
|
||||||
display: 'table-row'
|
|
||||||
},
|
|
||||||
td: {
|
|
||||||
padding: `0 ${spacer * 3}px`
|
|
||||||
},
|
|
||||||
tdHeader: {
|
|
||||||
verticalAlign: 'middle',
|
|
||||||
display: 'table-cell',
|
|
||||||
padding: `0 ${spacer * 3}px`
|
|
||||||
},
|
|
||||||
summary: {
|
|
||||||
cursor: 'auto'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
import React, { memo } from 'react'
|
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
|
||||||
import Checkbox from '@material-ui/core/Checkbox'
|
|
||||||
import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank'
|
|
||||||
import CheckBoxIcon from '@material-ui/icons/CheckBox'
|
|
||||||
|
|
||||||
import { secondaryColor } from '../../styling/variables'
|
|
||||||
|
|
||||||
const useStyles = makeStyles({
|
|
||||||
root: {
|
|
||||||
color: secondaryColor,
|
|
||||||
'&$checked': {
|
|
||||||
color: secondaryColor
|
|
||||||
}
|
|
||||||
},
|
|
||||||
checked: {}
|
|
||||||
})
|
|
||||||
|
|
||||||
const CheckboxInput = memo(({ label, ...props }) => {
|
|
||||||
const classes = useStyles()
|
|
||||||
|
|
||||||
const { name, onChange, value } = props.field
|
|
||||||
const { values, touched, errors } = props.form
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Checkbox
|
|
||||||
id={name}
|
|
||||||
classes={{
|
|
||||||
root: classes.root,
|
|
||||||
checked: classes.checked
|
|
||||||
}}
|
|
||||||
onChange={onChange}
|
|
||||||
value={value}
|
|
||||||
checked={value}
|
|
||||||
icon={<CheckBoxOutlineBlankIcon style={{ marginLeft: 2, fontSize: 16 }} />}
|
|
||||||
checkedIcon={<CheckBoxIcon style={{ fontSize: 20 }} />}
|
|
||||||
disableRipple
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
export default CheckboxInput
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
import React from 'react'
|
|
||||||
|
|
||||||
function Radio ({ label, ...props }) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<label>
|
|
||||||
<input type='radio' className='with-gap' name='gruop1' />
|
|
||||||
<span>{label || ''}</span>
|
|
||||||
</label>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Radio
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
import React, { memo } from 'react'
|
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
|
||||||
import Switch from '@material-ui/core/Switch'
|
|
||||||
|
|
||||||
import { secondaryColor, offColor, disabledColor, disabledColor2 } from '../../styling/variables'
|
|
||||||
|
|
||||||
const useStyles = makeStyles(theme => ({
|
|
||||||
root: {
|
|
||||||
width: 32,
|
|
||||||
height: 20,
|
|
||||||
padding: 0,
|
|
||||||
margin: theme.spacing(1)
|
|
||||||
},
|
|
||||||
switchBase: {
|
|
||||||
padding: 2,
|
|
||||||
'&$disabled': {
|
|
||||||
color: disabledColor2,
|
|
||||||
'& + $track': {
|
|
||||||
backgroundColor: disabledColor,
|
|
||||||
opacity: 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'&$checked': {
|
|
||||||
color: theme.palette.common.white,
|
|
||||||
'& + $track': {
|
|
||||||
backgroundColor: secondaryColor,
|
|
||||||
opacity: 1,
|
|
||||||
border: 'none'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'&$focusVisible $thumb': {
|
|
||||||
border: '6px solid #fff'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
thumb: {
|
|
||||||
width: 16,
|
|
||||||
height: 16
|
|
||||||
},
|
|
||||||
track: {
|
|
||||||
borderRadius: 17,
|
|
||||||
border: 'none',
|
|
||||||
backgroundColor: offColor,
|
|
||||||
opacity: 1,
|
|
||||||
transition: theme.transitions.create(['background-color', 'border'])
|
|
||||||
},
|
|
||||||
disabled: {
|
|
||||||
},
|
|
||||||
checked: {
|
|
||||||
},
|
|
||||||
focusVisible: {
|
|
||||||
}
|
|
||||||
}))
|
|
||||||
|
|
||||||
const SwitchInput = memo(({ ...props }) => {
|
|
||||||
const classes = useStyles()
|
|
||||||
return (
|
|
||||||
<Switch
|
|
||||||
focusVisibleClassName={classes.focusVisible}
|
|
||||||
disableRipple
|
|
||||||
classes={{
|
|
||||||
root: classes.root,
|
|
||||||
switchBase: classes.switchBase,
|
|
||||||
thumb: classes.thumb,
|
|
||||||
track: classes.track,
|
|
||||||
checked: classes.checked,
|
|
||||||
disabled: classes.disabled
|
|
||||||
}}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
export default SwitchInput
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
import React, { memo } from 'react'
|
|
||||||
import TextField from '@material-ui/core/TextField'
|
|
||||||
import InputAdornment from '@material-ui/core/InputAdornment'
|
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
|
||||||
|
|
||||||
import { fontColor, inputFontSize, inputFontSizeLg, inputFontWeight } from '../../styling/variables'
|
|
||||||
|
|
||||||
const useStyles = makeStyles({
|
|
||||||
inputRoot: {
|
|
||||||
fontSize: inputFontSize,
|
|
||||||
color: fontColor,
|
|
||||||
fontWeight: inputFontWeight
|
|
||||||
},
|
|
||||||
inputRootLg: {
|
|
||||||
fontSize: inputFontSizeLg,
|
|
||||||
color: fontColor,
|
|
||||||
fontWeight: inputFontWeight
|
|
||||||
},
|
|
||||||
labelRoot: {
|
|
||||||
color: fontColor
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const TextInput = memo(({ suffix, large, ...props }) => {
|
|
||||||
const { name, onChange, onBlur, value } = props.field
|
|
||||||
const { touched, errors } = props.form
|
|
||||||
const classes = useStyles()
|
|
||||||
|
|
||||||
return (
|
|
||||||
<TextField
|
|
||||||
id={name}
|
|
||||||
onChange={onChange}
|
|
||||||
onBlur={onBlur}
|
|
||||||
error={!!(touched[name] && errors[name])}
|
|
||||||
value={value}
|
|
||||||
classes={{ root: classes.root }}
|
|
||||||
InputProps={{
|
|
||||||
className: large ? classes.inputRootLg : classes.inputRoot,
|
|
||||||
endAdornment: suffix ? (
|
|
||||||
<InputAdornment className={classes.inputRoot} disableTypography position='end'>
|
|
||||||
{suffix}
|
|
||||||
</InputAdornment>
|
|
||||||
) : null
|
|
||||||
}}
|
|
||||||
InputLabelProps={{ className: classes.labelRoot }}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
export default TextInput
|
|
||||||
|
|
@ -16,7 +16,7 @@ const AutocompleteMultiple = memo(
|
||||||
const [popperNode, setPopperNode] = useState(null)
|
const [popperNode, setPopperNode] = useState(null)
|
||||||
|
|
||||||
const onDelete = item => {
|
const onDelete = item => {
|
||||||
let selectedItem = (value || []).slice()
|
const selectedItem = (value || []).slice()
|
||||||
const index = selectedItem.indexOf(item)
|
const index = selectedItem.indexOf(item)
|
||||||
if (index === -1) return
|
if (index === -1) return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { memo } from 'react'
|
import React from 'react'
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
import Checkbox from '@material-ui/core/Checkbox'
|
import Checkbox from '@material-ui/core/Checkbox'
|
||||||
import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank'
|
import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank'
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { zircon, comet, white, fontSecondary } from '../../styling/variables'
|
import { zircon, comet, white } from '../../../styling/variables'
|
||||||
import typographyStyles from '../typography/styles'
|
import typographyStyles from '../../typography/styles'
|
||||||
|
|
||||||
const { select, regularLabel, label, label2 } = typographyStyles
|
const { select, regularLabel } = typographyStyles
|
||||||
|
|
||||||
const WIDTH = 152
|
const WIDTH = 152
|
||||||
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import Autocomplete from './autocomplete/Autocomplete'
|
import Autocomplete from './autocomplete/Autocomplete'
|
||||||
import AutocompleteMultiple from './autocomplete/AutocompleteMultiple'
|
import AutocompleteMultiple from './autocomplete/AutocompleteMultiple'
|
||||||
import Checkbox from './Checkbox'
|
import Checkbox from './base/Checkbox'
|
||||||
import Radio from './Radio'
|
import Radio from './base/Radio'
|
||||||
import TextInput from './TextInput'
|
import TextInput from './base/TextInput'
|
||||||
import Switch from './Switch'
|
import Switch from './base/Switch'
|
||||||
import Select from './Select'
|
import Select from './base/Select'
|
||||||
|
|
||||||
export { Autocomplete, AutocompleteMultiple, TextInput, Radio, Checkbox, Switch, Select }
|
export { Autocomplete, AutocompleteMultiple, TextInput, Radio, Checkbox, Switch, Select }
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@ import React, { memo } from 'react'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import { makeStyles } from '@material-ui/core/styles'
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
|
|
||||||
import { tableHeaderColor } from '../../styling/variables'
|
|
||||||
|
|
||||||
const useStyles = makeStyles({
|
const useStyles = makeStyles({
|
||||||
table: {
|
table: {
|
||||||
// backgroundColor: tableHeaderColor,
|
// backgroundColor: tableHeaderColor,
|
||||||
|
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
$spacer: 8;
|
|
||||||
$subheader-color: white;
|
|
||||||
$placeholder-color: white;
|
|
||||||
|
|
||||||
.wrapper {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main {
|
|
||||||
display: flex;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.firstSide {
|
|
||||||
margin: 0 ($spacer * 8px) 0 ($spacer * 6px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.secondSide {
|
|
||||||
margin-top: -49px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.coinTotal {
|
|
||||||
margin: ($spacer * 1.5px) 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.noMargin {
|
|
||||||
margin: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.leftSpacer {
|
|
||||||
margin-left: $spacer * 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.topSpacer {
|
|
||||||
margin-top: $spacer * 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.addressWrapper {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
flex: 1;
|
|
||||||
background-color: $subheader-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
.address {
|
|
||||||
width: 375px;
|
|
||||||
margin: ($spacer * 1.5px) ($spacer * 3px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.total {
|
|
||||||
margin-top: auto;
|
|
||||||
text-align: right;
|
|
||||||
margin-right: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.totalTitle {
|
|
||||||
color: $placeholder-color;
|
|
||||||
}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
.titleWrapper {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tableWrapper {
|
|
||||||
flex: 1;
|
|
||||||
margin-left: 40px;
|
|
||||||
display: block;
|
|
||||||
overflow-x: auto;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 78%;
|
|
||||||
max-height: 70vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table {
|
|
||||||
white-space: nowrap;
|
|
||||||
display: block;
|
|
||||||
& th {
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.dateColumn {
|
|
||||||
min-width: 160px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.levelColumn {
|
|
||||||
min-width: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fillColumn {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button {
|
|
||||||
margin: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.buttonsWrapper {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
@ -3,7 +3,7 @@ export default {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
flexDirection: 'row',
|
flexDirection: 'row'
|
||||||
},
|
},
|
||||||
wrapper: {
|
wrapper: {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
|
@ -28,10 +28,10 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dateColumn: {
|
dateColumn: {
|
||||||
minWidth: 160,
|
minWidth: 160
|
||||||
},
|
},
|
||||||
levelColumn: {
|
levelColumn: {
|
||||||
minWidth: 100,
|
minWidth: 100
|
||||||
},
|
},
|
||||||
fillColumn: {
|
fillColumn: {
|
||||||
width: '100%'
|
width: '100%'
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,12 @@ import { ReactComponent as Download } from '../styling/icons/button/download/zod
|
||||||
import { ReactComponent as DownloadActive } from '../styling/icons/button/download/white.svg'
|
import { ReactComponent as DownloadActive } from '../styling/icons/button/download/white.svg'
|
||||||
|
|
||||||
import { makeStyles } from '@material-ui/core'
|
import { makeStyles } from '@material-ui/core'
|
||||||
import typographyStyles from '../components/typography/styles'
|
import { regularLabel } from '../components/typography/styles'
|
||||||
|
|
||||||
import { comet } from '../styling/variables'
|
import { comet } from '../styling/variables'
|
||||||
import styles from './Logs.styles'
|
import styles from './Logs.styles'
|
||||||
import logPageHeaderStyles from './LogPageHeader.styles'
|
import logPageHeaderStyles from './LogPageHeader.styles'
|
||||||
|
|
||||||
const { regularLabel } = typographyStyles
|
|
||||||
const { tableWrapper } = styles
|
const { tableWrapper } = styles
|
||||||
const { titleAndButtonsContainer, buttonsWrapper } = logPageHeaderStyles
|
const { titleAndButtonsContainer, buttonsWrapper } = logPageHeaderStyles
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue