diff --git a/backend/setup/defaults/views.py b/backend/setup/defaults/views.py index 61e227fe..31f47427 100644 --- a/backend/setup/defaults/views.py +++ b/backend/setup/defaults/views.py @@ -1,12 +1,21 @@ +from nebula.enum import ObjectStatus from nebula.settings.models import ViewSettings +normal_states = [ + ObjectStatus.OFFLINE, + ObjectStatus.ONLINE, + ObjectStatus.CREATING, + ObjectStatus.RESET, + ObjectStatus.CORRUPTED, +] + VIEWS: list[ViewSettings] = [ ViewSettings( id=1, name="Main", position=1, folders=[1, 2], - states=[0, 1, 2, 5, 11], + states=normal_states, columns=[ "qc/state", "title", @@ -22,7 +31,7 @@ name="Fill", position=2, folders=[5, 6, 7, 8], - states=[0, 1, 2, 5, 11], + states=normal_states, columns=[ "qc/state", "title", @@ -37,7 +46,7 @@ name="Music", position=3, folders=[4], - states=[0, 1, 2, 5, 11], + states=normal_states, columns=[ "qc/state", "title", @@ -51,7 +60,7 @@ name="Stories", position=4, folders=[3], - states=[0, 1, 2, 5, 11], + states=normal_states, columns=[ "qc/state", "title", @@ -64,7 +73,7 @@ name="Commercials", position=5, folders=[9, 10], - states=[0, 1, 2, 5, 11], + states=normal_states, columns=[ "qc/state", "title", @@ -90,7 +99,7 @@ name="Trash", separator=True, position=50, - states=[3], + states=[ObjectStatus.TRASHED], columns=[ "title", "subtitle", @@ -103,7 +112,7 @@ id=51, name="Archive", position=51, - states=[4, 11], + states=[ObjectStatus.ARCHIVED, ObjectStatus.RETRIEVING], columns=[ "title", "subtitle", diff --git a/frontend/src/components/table/cells.jsx b/frontend/src/components/table/cells.jsx index 940d6e13..d26fdbda 100644 --- a/frontend/src/components/table/cells.jsx +++ b/frontend/src/components/table/cells.jsx @@ -46,6 +46,7 @@ const DataRow = ({ columns, onRowClick, rowHighlightColor, + rowHighlightStyle, selected = false, }) => { const handleClick = (event) => { @@ -61,8 +62,11 @@ const DataRow = ({ // Left-border highlight color let highlightColor = null + let highlightStyle = null if (rowHighlightColor) highlightColor = rowHighlightColor(rowData) + if (rowHighlightStyle) highlightStyle = rowHighlightStyle(rowData) if (highlightColor) rowStyle['borderLeftColor'] = highlightColor + if (highlightStyle) rowStyle['borderLeftStyle'] = highlightStyle // Embedded progress bar if (rowData.progress && 100 > rowData.progress > 0) { diff --git a/frontend/src/components/table/index.jsx b/frontend/src/components/table/index.jsx index 1cdfa4f9..a8876af3 100644 --- a/frontend/src/components/table/index.jsx +++ b/frontend/src/components/table/index.jsx @@ -15,6 +15,7 @@ const Table = ({ onKeyDown, selection, rowHighlightColor, + rowHighlightStyle, sortBy, sortDirection, onSort, @@ -55,6 +56,7 @@ const Table = ({ columns={columns} onRowClick={onRowClick} rowHighlightColor={rowHighlightColor} + rowHighlightStyle={rowHighlightStyle} selected={selection && selection.includes(rowData[keyField])} key={keyField ? rowData[keyField] : idx} /> diff --git a/frontend/src/containers/Browser/Browser.jsx b/frontend/src/containers/Browser/Browser.jsx index 8bb5b144..f65123a1 100644 --- a/frontend/src/containers/Browser/Browser.jsx +++ b/frontend/src/containers/Browser/Browser.jsx @@ -20,6 +20,7 @@ import { getColumnWidth, getFormatter, formatRowHighlightColor, + formatRowHighlightStyle, } from './Formatting.jsx' const ROWS_PER_PAGE = 200 @@ -274,6 +275,7 @@ const BrowserTable = () => { onRowClick={onRowClick} onKeyDown={onKeyDown} rowHighlightColor={formatRowHighlightColor} + rowHighlightStyle={formatRowHighlightStyle} loading={loading} sortBy={sortBy} sortDirection={sortDirection} diff --git a/frontend/src/containers/Browser/Formatting.jsx b/frontend/src/containers/Browser/Formatting.jsx index 37b9df78..433c81f1 100644 --- a/frontend/src/containers/Browser/Formatting.jsx +++ b/frontend/src/containers/Browser/Formatting.jsx @@ -39,6 +39,18 @@ const formatRowHighlightColor = (rowData) => { } } +const formatRowHighlightStyle = (rowData) => { + switch (rowData['status']) { + case 5: + return 'dashed' + case 6: + return 'dashed' + default: + return 'solid' + } +} + + // Column width const getColumnWidth = (key) => { @@ -139,4 +151,4 @@ const getFormatter = (key) => { } // end switch key } // end getFormatter -export { getColumnWidth, getFormatter, formatRowHighlightColor } +export { getColumnWidth, getFormatter, formatRowHighlightColor, formatRowHighlightStyle }