Skip to content

Commit f4aff5e

Browse files
committed
fix: make eslint happy
1 parent f7a8fec commit f4aff5e

File tree

10 files changed

+64
-40
lines changed

10 files changed

+64
-40
lines changed

frontend/src/components/Button.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ const Button = forwardRef(
8989
}
9090
)
9191

92+
Button.displayName = 'Button'
9293
Button.defaultProps = {
9394
iconOnRight: false,
9495
//component: 'button',

frontend/src/components/Dropdown.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,13 @@ const DropdownOption = ({
6464
currentValue,
6565
separator,
6666
disabled,
67-
active,
6867
...props
6968
}) => (
7069
<span>
7170
{separator && <hr />}
7271
<Button
7372
{...props}
74-
disabled={props.disabled || currentValue === props.value}
73+
disabled={disabled || currentValue === props.value}
7574
/>
7675
</span>
7776
)

frontend/src/components/InputDatetime.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ import Dialog from './Dialog'
88
import BaseInput from './BaseInput'
99
import Button from './Button'
1010

11-
//import "react-datepicker/dist/react-datepicker.css"
12-
1311
import './datepicker.sass'
1412

1513
const timeRegex = /^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/
1614
const dateRegex = /^(\d{4})-(\d{2})-(\d{2})$/
15+
//eslint-disable-next-line
1716
const allowedDateCharsRegex = /^[\d-\:\ ]*$/
1817

1918
const DateTimeWrapper = styled.div`

frontend/src/components/InputPassword.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ const InputPassword = forwardRef(
1515
)
1616
}
1717
)
18+
InputPassword.displayName = 'InputPassword'
1819

1920
export default InputPassword

frontend/src/components/InputText.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ const InputText = forwardRef(({ value, onChange, tooltip, ...props }, ref) => {
1313
/>
1414
)
1515
})
16+
InputText.displayName = 'InputText'
1617

1718
export default InputText

frontend/src/components/Video.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const Video = ({ src, style, showMarks, marks = {}, setMarks = () => {} }) => {
6868
const [videoPosition, setVideoPosition] = useState(0)
6969
const [videoDuration, setVideoDuration] = useState(0)
7070
const [trackbarPosition, setTrackbarPosition] = useState(0)
71-
const [maximize, setMaximize] = useState(false)
71+
//const [maximize, setMaximize] = useState(false)
7272

7373
const frameRate = 25
7474

frontend/src/containers/Browser/Browser.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ const BrowserTable = () => {
144144
}
145145

146146
useEffect(() => {
147+
// eslint-disable-next-line no-undef
147148
const token = PubSub.subscribe('objects_changed', handlePubSub)
149+
// eslint-disable-next-line no-undef
148150
return () => PubSub.unsubscribe(token)
149151
}, [])
150152

frontend/src/containers/Browser/Formatting.jsx

Lines changed: 52 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,67 @@ const getColumnWidth = (key) => {
4747

4848
// Field formatters
4949

50+
51+
const getDefaultFormatter = (key) => {
52+
const metaType = nebula.metaType(key)
53+
switch (metaType.type) {
54+
case 'boolean':
55+
// eslint-disable-next-line
56+
return (rowData, key) => <td>{rowData[key] ? '✓' : ''}</td>
57+
58+
case 'datetime':
59+
// eslint-disable-next-line
60+
return (rowData, key) => (
61+
<td>
62+
<Timestamp timestamp={rowData[key]} mode={metaType.mode} />{' '}
63+
</td>
64+
)
65+
66+
case 'select':
67+
// eslint-disable-next-line
68+
return (rowData, key) => {
69+
if (!metaType.cs) return <td>{rowData[key]}</td>
70+
71+
const option = nebula
72+
.csOptions(metaType.cs)
73+
.find((opt) => opt.value === rowData[key])
74+
75+
return <td>{option?.title}</td>
76+
}
77+
78+
case 'list':
79+
// eslint-disable-next-line
80+
return (rowData, key) => {
81+
if (!metaType.cs) return <td>{rowData[key].join(', ')}</td>
82+
const options = nebula
83+
.csOptions(metaType.cs)
84+
.filter((opt) => rowData[key].includes(opt.value))
85+
return <td>{options.map((opt) => opt.title).join(', ')}</td>
86+
}
87+
88+
default:
89+
// eslint-disable-next-line
90+
return (rowData, key) => <td>{rowData[key]}</td>
91+
} // switch metaType
92+
}
93+
94+
5095
const getFormatter = (key) => {
5196
if (['title', 'subtitle', 'description'].includes(key))
97+
// eslint-disable-next-line
5298
return (rowData, key) => <td>{rowData[key]}</td>
5399

54100
switch (key) {
55101
case 'qc/state':
102+
// eslint-disable-next-line
56103
return (rowData, key) => (
57104
<td>
58105
<QCState className={`qc-state-${rowData[key]}`} />
59106
</td>
60107
)
61108

62109
case 'id_folder':
110+
// eslint-disable-next-line
63111
return (rowData, key) => {
64112
const folder = nebula.settings.folders.find(
65113
(f) => f.id === rowData[key]
@@ -68,6 +116,7 @@ const getFormatter = (key) => {
68116
}
69117

70118
case 'duration':
119+
// eslint-disable-next-line
71120
return (rowData, key) => {
72121
const fps = rowData['video/fps_f'] || 25
73122
const duration = rowData[key] || 0
@@ -76,51 +125,19 @@ const getFormatter = (key) => {
76125
}
77126

78127
case 'created_by':
128+
// eslint-disable-next-line
79129
return (rowData, key) => {
80130
return <td>{nebula.getUserName(rowData[key])}</td>
81131
}
82132

83133
case 'updated_by':
134+
// eslint-disable-next-line
84135
return (rowData, key) => {
85136
return <td>{nebula.getUserName(rowData[key])}</td>
86137
}
87138

88139
default:
89-
const metaType = nebula.metaType(key)
90-
switch (metaType.type) {
91-
case 'boolean':
92-
return (rowData, key) => <td>{rowData[key] ? '✓' : ''}</td>
93-
94-
case 'datetime':
95-
return (rowData, key) => (
96-
<td>
97-
<Timestamp timestamp={rowData[key]} mode={metaType.mode} />{' '}
98-
</td>
99-
)
100-
101-
case 'select':
102-
return (rowData, key) => {
103-
if (!metaType.cs) return <td>{rowData[key]}</td>
104-
105-
const option = nebula
106-
.csOptions(metaType.cs)
107-
.find((opt) => opt.value === rowData[key])
108-
109-
return <td>{option?.title}</td>
110-
}
111-
112-
case 'list':
113-
return (rowData, key) => {
114-
if (!metaType.cs) return <td>{rowData[key].join(', ')}</td>
115-
const options = nebula
116-
.csOptions(metaType.cs)
117-
.filter((opt) => rowData[key].includes(opt.value))
118-
return <td>{options.map((opt) => opt.title).join(', ')}</td>
119-
}
120-
121-
default:
122-
return (rowData, key) => <td>{rowData[key]}</td>
123-
} // switch metaType
140+
return getDefaultFormatter(key)
124141
} // end switch key
125142
} // end getFormatter
126143

frontend/src/hooks.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const useConfirm = () => {
1313
const [message, setMessage] = useState('')
1414

1515
const confirm = (title, message) =>
16+
// eslint-disable-next-line
1617
new Promise((resolve, reject) => {
1718
setTitle(title)
1819
setMessage(message)

frontend/src/pages/JobsPage/JobsPage.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const JobsPage = () => {
5555
nebula.request('jobs', { abort: id }).then(() => loadJobs())
5656
}
5757

58+
// eslint-disable-next-line
5859
const formatAction = (rowData, key) => {
5960
if ([0, 1, 5].includes(rowData['status']))
6061
return (
@@ -168,7 +169,9 @@ const JobsPage = () => {
168169
} // handlePubSub
169170

170171
useEffect(() => {
172+
// eslint-disable-next-line no-undef
171173
const token = PubSub.subscribe('job_progress', handlePubSub)
174+
// eslint-disable-next-line no-undef
172175
return () => PubSub.unsubscribe(token)
173176
}, [])
174177

0 commit comments

Comments
 (0)