Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.0.6 #62

Merged
merged 8 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/nebula/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "6.0.5"
__version__ = "6.0.6"
2 changes: 1 addition & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nebula"
version = "6.0.5"
version = "6.0.6"
description = "Open source broadcast automation system"
authors = ["Nebula Broadcast <[email protected]>"]

Expand Down
4 changes: 2 additions & 2 deletions backend/setup/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"views": VIEWS,
"meta_types": META_TYPES,
"storages": [],
"system": {},
"settings": {},
"cs": [],
}

Expand Down Expand Up @@ -74,7 +74,7 @@ async def setup_settings(db: DatabaseConnection) -> None:
# SetupServerModel

settings = SetupServerModel(
system=TEMPLATE.pop("system", {}),
system=TEMPLATE.pop("settings", {}),
playout_channels=TEMPLATE.pop("channels", []),
folders=TEMPLATE.pop("folders", []),
views=TEMPLATE.pop("views", []),
Expand Down
27 changes: 27 additions & 0 deletions frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"prettier"
],
"overrides": [
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"react",
"react-hooks",
"prettier",
"simple-import-sort"
],
"rules": {
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
}
}
7 changes: 7 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"lint": "eslint --fix 'src/**/*.{jsx,ts,tsx}'",
"format": "prettier --write ./src"
},
"dependencies": {
Expand Down Expand Up @@ -34,6 +35,12 @@
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-react": "^2.0.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^12.0.0",
"prettier": "^2.7.1",
"vite": "^5.1.5"
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const Button = forwardRef(
}
)

Button.displayName = 'Button'
Button.defaultProps = {
iconOnRight: false,
//component: 'button',
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/Dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,13 @@ const DropdownOption = ({
currentValue,
separator,
disabled,
active,
...props
}) => (
<span>
{separator && <hr />}
<Button
{...props}
disabled={props.disabled || currentValue === props.value}
disabled={disabled || currentValue === props.value}
/>
</span>
)
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/InputDatetime.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import Dialog from './Dialog'
import BaseInput from './BaseInput'
import Button from './Button'

//import "react-datepicker/dist/react-datepicker.css"

import './datepicker.sass'

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

const DateTimeWrapper = styled.div`
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/InputPassword.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ const InputPassword = forwardRef(
)
}
)
InputPassword.displayName = 'InputPassword'

export default InputPassword
1 change: 1 addition & 0 deletions frontend/src/components/InputText.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ const InputText = forwardRef(({ value, onChange, tooltip, ...props }, ref) => {
/>
)
})
InputText.displayName = 'InputText'

export default InputText
2 changes: 1 addition & 1 deletion frontend/src/components/Video.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const Video = ({ src, style, showMarks, marks = {}, setMarks = () => {} }) => {
const [videoPosition, setVideoPosition] = useState(0)
const [videoDuration, setVideoDuration] = useState(0)
const [trackbarPosition, setTrackbarPosition] = useState(0)
const [maximize, setMaximize] = useState(false)
//const [maximize, setMaximize] = useState(false)

const frameRate = 25

Expand Down
2 changes: 2 additions & 0 deletions frontend/src/containers/Browser/Browser.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ const BrowserTable = () => {
}

useEffect(() => {
// eslint-disable-next-line no-undef
const token = PubSub.subscribe('objects_changed', handlePubSub)
// eslint-disable-next-line no-undef
return () => PubSub.unsubscribe(token)
}, [])

Expand Down
87 changes: 52 additions & 35 deletions frontend/src/containers/Browser/Formatting.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,67 @@ const getColumnWidth = (key) => {

// Field formatters


const getDefaultFormatter = (key) => {
const metaType = nebula.metaType(key)
switch (metaType.type) {
case 'boolean':
// eslint-disable-next-line
return (rowData, key) => <td>{rowData[key] ? '✓' : ''}</td>

case 'datetime':
// eslint-disable-next-line
return (rowData, key) => (
<td>
<Timestamp timestamp={rowData[key]} mode={metaType.mode} />{' '}
</td>
)

case 'select':
// eslint-disable-next-line
return (rowData, key) => {
if (!metaType.cs) return <td>{rowData[key]}</td>

const option = nebula
.csOptions(metaType.cs)
.find((opt) => opt.value === rowData[key])

return <td>{option?.title}</td>
}

case 'list':
// eslint-disable-next-line
return (rowData, key) => {
if (!metaType.cs) return <td>{rowData[key].join(', ')}</td>
const options = nebula
.csOptions(metaType.cs)
.filter((opt) => rowData[key].includes(opt.value))
return <td>{options.map((opt) => opt.title).join(', ')}</td>
}

default:
// eslint-disable-next-line
return (rowData, key) => <td>{rowData[key]}</td>
} // switch metaType
}


const getFormatter = (key) => {
if (['title', 'subtitle', 'description'].includes(key))
// eslint-disable-next-line
return (rowData, key) => <td>{rowData[key]}</td>

switch (key) {
case 'qc/state':
// eslint-disable-next-line
return (rowData, key) => (
<td>
<QCState className={`qc-state-${rowData[key]}`} />
</td>
)

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

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

case 'created_by':
// eslint-disable-next-line
return (rowData, key) => {
return <td>{nebula.getUserName(rowData[key])}</td>
}

case 'updated_by':
// eslint-disable-next-line
return (rowData, key) => {
return <td>{nebula.getUserName(rowData[key])}</td>
}

default:
const metaType = nebula.metaType(key)
switch (metaType.type) {
case 'boolean':
return (rowData, key) => <td>{rowData[key] ? '✓' : ''}</td>

case 'datetime':
return (rowData, key) => (
<td>
<Timestamp timestamp={rowData[key]} mode={metaType.mode} />{' '}
</td>
)

case 'select':
return (rowData, key) => {
if (!metaType.cs) return <td>{rowData[key]}</td>

const option = nebula
.csOptions(metaType.cs)
.find((opt) => opt.value === rowData[key])

return <td>{option?.title}</td>
}

case 'list':
return (rowData, key) => {
if (!metaType.cs) return <td>{rowData[key].join(', ')}</td>
const options = nebula
.csOptions(metaType.cs)
.filter((opt) => rowData[key].includes(opt.value))
return <td>{options.map((opt) => opt.title).join(', ')}</td>
}

default:
return (rowData, key) => <td>{rowData[key]}</td>
} // switch metaType
return getDefaultFormatter(key)
} // end switch key
} // end getFormatter

Expand Down
1 change: 1 addition & 0 deletions frontend/src/hooks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const useConfirm = () => {
const [message, setMessage] = useState('')

const confirm = (title, message) =>
// eslint-disable-next-line
new Promise((resolve, reject) => {
setTitle(title)
setMessage(message)
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/pages/JobsPage/JobsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const JobsPage = () => {
nebula.request('jobs', { abort: id }).then(() => loadJobs())
}

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

useEffect(() => {
// eslint-disable-next-line no-undef
const token = PubSub.subscribe('job_progress', handlePubSub)
// eslint-disable-next-line no-undef
return () => PubSub.unsubscribe(token)
}, [])

Expand Down
2 changes: 2 additions & 0 deletions frontend/src/pages/ServicesPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const ServicesPage = () => {
)
}

//eslint-disable-next-line
const formatAction = (rowData, key) => {
const status = rowData.status
let b = null
Expand Down Expand Up @@ -104,6 +105,7 @@ const ServicesPage = () => {
label="Kill"
/>
)
break
default:
b = <Button disabled={true} label="Please wait..." />
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/websocket.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useEffect, useState } from 'react'
import useWebSocket, { ReadyState } from 'react-use-websocket'
import PubSub from '/src/pubsub'
import { arrayEquals } from '/src/utils'
import { toast } from 'react-toastify'

const proto = window.location.protocol.replace('http', 'ws')
const wsAddress = `${proto}//${window.location.host}/ws`
Expand Down
Loading