diff --git a/frontend/src/Activity/Blocklist/BlocklistRow.js b/frontend/src/Activity/Blocklist/BlocklistRow.js index cea880fd4..571ba5d8d 100644 --- a/frontend/src/Activity/Blocklist/BlocklistRow.js +++ b/frontend/src/Activity/Blocklist/BlocklistRow.js @@ -5,6 +5,7 @@ import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellCo import TableRowCell from 'Components/Table/Cells/TableRowCell'; import TableSelectCell from 'Components/Table/Cells/TableSelectCell'; import TableRow from 'Components/Table/TableRow'; +import EpisodeFormats from 'Episode/EpisodeFormats'; import EpisodeLanguage from 'Episode/EpisodeLanguage'; import EpisodeQuality from 'Episode/EpisodeQuality'; import { icons, kinds } from 'Helpers/Props'; @@ -46,6 +47,7 @@ class BlocklistRow extends Component { sourceTitle, language, quality, + customFormats, date, protocol, indexer, @@ -120,6 +122,16 @@ class BlocklistRow extends Component { ); } + if (name === 'customFormats') { + return ( + + + + ); + } + if (name === 'date') { return ( : null } @@ -163,7 +163,7 @@ function HistoryDetails(props) { if (eventType === 'downloadFolderImported') { const { - preferredWordScore, + customFormatScore, droppedPath, importedPath } = data; @@ -197,10 +197,10 @@ function HistoryDetails(props) { } { - preferredWordScore && preferredWordScore !== '0' ? + customFormatScore && customFormatScore !== '0' ? : null } @@ -211,7 +211,7 @@ function HistoryDetails(props) { if (eventType === 'episodeFileDeleted') { const { reason, - preferredWordScore + customFormatScore } = data; let reasonMessage = ''; @@ -243,10 +243,10 @@ function HistoryDetails(props) { /> { - preferredWordScore && preferredWordScore !== '0' ? + customFormatScore && customFormatScore !== '0' ? : null } diff --git a/frontend/src/Activity/History/HistoryRow.css b/frontend/src/Activity/History/HistoryRow.css index 07a392d71..039804b63 100644 --- a/frontend/src/Activity/History/HistoryRow.css +++ b/frontend/src/Activity/History/HistoryRow.css @@ -10,7 +10,7 @@ width: 80px; } -.preferredWordScore { +.customFormatScore { composes: cell from '~Components/Table/Cells/TableRowCell.css'; width: 55px; diff --git a/frontend/src/Activity/History/HistoryRow.js b/frontend/src/Activity/History/HistoryRow.js index db16aec05..8ad1c07f7 100644 --- a/frontend/src/Activity/History/HistoryRow.js +++ b/frontend/src/Activity/History/HistoryRow.js @@ -5,6 +5,7 @@ import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellCo import TableRowCell from 'Components/Table/Cells/TableRowCell'; import TableRow from 'Components/Table/TableRow'; import episodeEntities from 'Episode/episodeEntities'; +import EpisodeFormats from 'Episode/EpisodeFormats'; import EpisodeLanguage from 'Episode/EpisodeLanguage'; import EpisodeQuality from 'Episode/EpisodeQuality'; import EpisodeTitleLink from 'Episode/EpisodeTitleLink'; @@ -61,6 +62,7 @@ class HistoryRow extends Component { language, languageCutoffNotMet, quality, + customFormats, qualityCutoffNotMet, eventType, sourceTitle, @@ -164,6 +166,16 @@ class HistoryRow extends Component { ); } + if (name === 'customFormats') { + return ( + + + + ); + } + if (name === 'date') { return ( - {formatPreferredWordScore(data.preferredWordScore)} + {formatPreferredWordScore(data.customFormatScore)} ); } @@ -269,6 +281,7 @@ HistoryRow.propTypes = { language: PropTypes.object.isRequired, languageCutoffNotMet: PropTypes.bool.isRequired, quality: PropTypes.object.isRequired, + customFormats: PropTypes.arrayOf(PropTypes.object), qualityCutoffNotMet: PropTypes.bool.isRequired, eventType: PropTypes.string.isRequired, sourceTitle: PropTypes.string.isRequired, diff --git a/frontend/src/Activity/Queue/QueueRow.js b/frontend/src/Activity/Queue/QueueRow.js index b42a669b3..67b8b9b3c 100644 --- a/frontend/src/Activity/Queue/QueueRow.js +++ b/frontend/src/Activity/Queue/QueueRow.js @@ -8,6 +8,7 @@ import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellCo import TableRowCell from 'Components/Table/Cells/TableRowCell'; import TableSelectCell from 'Components/Table/Cells/TableSelectCell'; import TableRow from 'Components/Table/TableRow'; +import EpisodeFormats from 'Episode/EpisodeFormats'; import EpisodeLanguage from 'Episode/EpisodeLanguage'; import EpisodeQuality from 'Episode/EpisodeQuality'; import EpisodeTitleLink from 'Episode/EpisodeTitleLink'; @@ -89,6 +90,7 @@ class QueueRow extends Component { episode, language, quality, + customFormats, protocol, indexer, outputPath, @@ -247,6 +249,16 @@ class QueueRow extends Component { ); } + if (name === 'customFormats') { + return ( + + + + ); + } + if (name === 'protocol') { return ( @@ -400,6 +412,7 @@ QueueRow.propTypes = { episode: PropTypes.object, language: PropTypes.object.isRequired, quality: PropTypes.object.isRequired, + customFormats: PropTypes.arrayOf(PropTypes.object), protocol: PropTypes.string.isRequired, indexer: PropTypes.string, outputPath: PropTypes.string, diff --git a/frontend/src/App/AppRoutes.js b/frontend/src/App/AppRoutes.js index ebee670e9..004d49381 100644 --- a/frontend/src/App/AppRoutes.js +++ b/frontend/src/App/AppRoutes.js @@ -13,6 +13,7 @@ import SeasonPassConnector from 'SeasonPass/SeasonPassConnector'; import SeriesDetailsPageConnector from 'Series/Details/SeriesDetailsPageConnector'; import SeriesEditorConnector from 'Series/Editor/SeriesEditorConnector'; import SeriesIndexConnector from 'Series/Index/SeriesIndexConnector'; +import CustomFormatSettingsConnector from 'Settings/CustomFormats/CustomFormatSettingsConnector'; import DownloadClientSettingsConnector from 'Settings/DownloadClients/DownloadClientSettingsConnector'; import GeneralSettingsConnector from 'Settings/General/GeneralSettingsConnector'; import ImportListSettingsConnector from 'Settings/ImportLists/ImportListSettingsConnector'; @@ -161,6 +162,11 @@ function AppRoutes(props) { component={QualityConnector} /> + + { + this._input = ref; + }; + + selectionChange() { + if (this._selectionTimeout) { + this._selectionTimeout = clearTimeout(this._selectionTimeout); + } + + this._selectionTimeout = setTimeout(() => { + const selectionStart = this._input.selectionStart; + const selectionEnd = this._input.selectionEnd; + + const selectionChanged = ( + this._selectionStart !== selectionStart || + this._selectionEnd !== selectionEnd + ); + + this._selectionStart = selectionStart; + this._selectionEnd = selectionEnd; + + if (this.props.onSelectionChange && selectionChanged) { + this.props.onSelectionChange(selectionStart, selectionEnd); + } + }, 10); + } + + // + // Listeners + + onChange = (event) => { + const { + name, + onChange + } = this.props; + + const payload = { + name, + value: event.target.value + }; + + onChange(payload); + }; + + onFocus = (event) => { + if (this.props.onFocus) { + this.props.onFocus(event); + } + + this.selectionChange(); + }; + + onKeyUp = () => { + this.selectionChange(); + }; + + onMouseDown = () => { + this._isMouseTarget = true; + }; + + onMouseUp = () => { + this.selectionChange(); + }; + + onDocumentMouseUp = () => { + if (this._isMouseTarget) { + this.selectionChange(); + } + + this._isMouseTarget = false; + }; + + // + // Render + + render() { + const { + className, + readOnly, + autoFocus, + placeholder, + name, + value, + hasError, + hasWarning, + onBlur + } = this.props; + + return ( +