diff --git a/frontend/src/Activity/Queue/QueueRow.css b/frontend/src/Activity/Queue/QueueRow.css index 16805dbf6..6636f2f9d 100644 --- a/frontend/src/Activity/Queue/QueueRow.css +++ b/frontend/src/Activity/Queue/QueueRow.css @@ -16,6 +16,12 @@ width: 150px; } +.customFormatScore { + composes: cell from '~Components/Table/Cells/TableRowCell.css'; + + width: 55px; +} + .actions { composes: cell from '~Components/Table/Cells/TableRowCell.css'; diff --git a/frontend/src/Activity/Queue/QueueRow.css.d.ts b/frontend/src/Activity/Queue/QueueRow.css.d.ts index be7fcd916..13d67ea3a 100644 --- a/frontend/src/Activity/Queue/QueueRow.css.d.ts +++ b/frontend/src/Activity/Queue/QueueRow.css.d.ts @@ -2,6 +2,7 @@ // Please do not change this file! interface CssExports { 'actions': string; + 'customFormatScore': string; 'progress': string; 'protocol': string; 'quality': string; diff --git a/frontend/src/Activity/Queue/QueueRow.js b/frontend/src/Activity/Queue/QueueRow.js index cf513c8ea..cb3f90ac8 100644 --- a/frontend/src/Activity/Queue/QueueRow.js +++ b/frontend/src/Activity/Queue/QueueRow.js @@ -17,6 +17,7 @@ import Popover from 'Components/Tooltip/Popover'; import { icons, kinds, tooltipPositions } from 'Helpers/Props'; import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal'; import formatBytes from 'Utilities/Number/formatBytes'; +import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore'; import translate from 'Utilities/String/translate'; import QueueStatusCell from './QueueStatusCell'; import RemoveQueueItemModal from './RemoveQueueItemModal'; @@ -91,6 +92,7 @@ class QueueRow extends Component { book, quality, customFormats, + customFormatScore, protocol, indexer, outputPath, @@ -222,6 +224,17 @@ class QueueRow extends Component { ); } + if (name === 'customFormatScore') { + return ( + + {formatPreferredWordScore(customFormatScore)} + + ); + } + if (name === 'protocol') { return ( @@ -392,6 +405,7 @@ QueueRow.propTypes = { book: PropTypes.object, quality: PropTypes.object.isRequired, customFormats: PropTypes.arrayOf(PropTypes.object), + customFormatScore: PropTypes.number.isRequired, protocol: PropTypes.string.isRequired, indexer: PropTypes.string, outputPath: PropTypes.string, diff --git a/frontend/src/Store/Actions/queueActions.js b/frontend/src/Store/Actions/queueActions.js index fd2cd94a4..002bb7bd3 100644 --- a/frontend/src/Store/Actions/queueActions.js +++ b/frontend/src/Store/Actions/queueActions.js @@ -1,7 +1,9 @@ import _ from 'lodash'; +import React from 'react'; import { createAction } from 'redux-actions'; import { batchActions } from 'redux-batched-actions'; -import { sortDirections } from 'Helpers/Props'; +import Icon from 'Components/Icon'; +import { icons, sortDirections } from 'Helpers/Props'; import { createThunk, handleThunks } from 'Store/thunks'; import createAjaxRequest from 'Utilities/createAjaxRequest'; import serverSideCollectionHandlers from 'Utilities/serverSideCollectionHandlers'; @@ -93,6 +95,15 @@ export const defaultState = { isSortable: false, isVisible: true }, + { + name: 'customFormatScore', + columnLabel: translate('CustomFormatScore'), + label: React.createElement(Icon, { + name: icons.SCORE, + title: translate('CustomFormatScore') + }), + isVisible: false + }, { name: 'protocol', label: translate('Protocol'), diff --git a/src/Readarr.Api.V1/Queue/QueueResource.cs b/src/Readarr.Api.V1/Queue/QueueResource.cs index ed0720197..0c62e242a 100644 --- a/src/Readarr.Api.V1/Queue/QueueResource.cs +++ b/src/Readarr.Api.V1/Queue/QueueResource.cs @@ -20,6 +20,7 @@ namespace Readarr.Api.V1.Queue public BookResource Book { get; set; } public QualityModel Quality { get; set; } public List CustomFormats { get; set; } + public int CustomFormatScore { get; set; } public decimal Size { get; set; } public string Title { get; set; } public decimal Sizeleft { get; set; } @@ -47,6 +48,9 @@ namespace Readarr.Api.V1.Queue return null; } + var customFormats = model.RemoteBook?.CustomFormats; + var customFormatScore = model.RemoteBook?.Author?.QualityProfile?.Value?.CalculateCustomFormatScore(customFormats) ?? 0; + return new QueueResource { Id = model.Id, @@ -55,7 +59,8 @@ namespace Readarr.Api.V1.Queue Author = includeAuthor && model.Author != null ? model.Author.ToResource() : null, Book = includeBook && model.Book != null ? model.Book.ToResource() : null, Quality = model.Quality, - CustomFormats = model.RemoteBook?.CustomFormats?.ToResource(false), + CustomFormats = customFormats?.ToResource(false), + CustomFormatScore = customFormatScore, Size = model.Size, Title = model.Title, Sizeleft = model.Sizeleft,