New: Custom Format Score column in queue

Closes #5780
pull/5789/head
jack-mil 1 year ago committed by GitHub
parent 96b7aa6585
commit a6f2db9139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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';

@ -2,6 +2,7 @@
// Please do not change this file!
interface CssExports {
'actions': string;
'customFormatScore': string;
'progress': string;
'protocol': string;
'quality': string;

@ -17,6 +17,7 @@ import { icons, kinds } from 'Helpers/Props';
import InteractiveImportModal from 'InteractiveImport/InteractiveImportModal';
import SeriesTitleLink from 'Series/SeriesTitleLink';
import formatBytes from 'Utilities/Number/formatBytes';
import formatPreferredWordScore from 'Utilities/Number/formatPreferredWordScore';
import QueueStatusCell from './QueueStatusCell';
import RemoveQueueItemModal from './RemoveQueueItemModal';
import TimeleftCell from './TimeleftCell';
@ -91,6 +92,7 @@ class QueueRow extends Component {
languages,
quality,
customFormats,
customFormatScore,
protocol,
indexer,
outputPath,
@ -259,6 +261,17 @@ class QueueRow extends Component {
);
}
if (name === 'customFormatScore') {
return (
<TableRowCell
key={name}
className={styles.customFormatScore}
>
{formatPreferredWordScore(customFormatScore)}
</TableRowCell>
);
}
if (name === 'protocol') {
return (
<TableRowCell key={name}>
@ -413,6 +426,7 @@ QueueRow.propTypes = {
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
quality: PropTypes.object.isRequired,
customFormats: PropTypes.arrayOf(PropTypes.object),
customFormatScore: PropTypes.number.isRequired,
protocol: PropTypes.string.isRequired,
indexer: PropTypes.string,
outputPath: PropTypes.string,

@ -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';
@ -104,6 +106,15 @@ export const defaultState = {
isSortable: false,
isVisible: true
},
{
name: 'customFormatScore',
columnLabel: 'Custom Format Score',
label: React.createElement(Icon, {
name: icons.SCORE,
title: 'Custom format score'
}),
isVisible: false
},
{
name: 'protocol',
label: 'Protocol',

@ -23,6 +23,7 @@ namespace Sonarr.Api.V3.Queue
public List<Language> Languages { get; set; }
public QualityModel Quality { get; set; }
public List<CustomFormatResource> CustomFormats { get; set; }
public int CustomFormatScore { get; set; }
public decimal Size { get; set; }
public string Title { get; set; }
public decimal Sizeleft { get; set; }
@ -50,6 +51,9 @@ namespace Sonarr.Api.V3.Queue
return null;
}
var customFormats = model.RemoteEpisode?.CustomFormats;
var customFormatScore = model.Series.QualityProfile.Value.CalculateCustomFormatScore(customFormats);
return new QueueResource
{
Id = model.Id,
@ -60,7 +64,8 @@ namespace Sonarr.Api.V3.Queue
Episode = includeEpisode && model.Episode != null ? model.Episode.ToResource() : null,
Languages = model.Languages,
Quality = model.Quality,
CustomFormats = model.RemoteEpisode?.CustomFormats?.ToResource(false),
CustomFormats = customFormats?.ToResource(false),
CustomFormatScore = customFormatScore,
Size = model.Size,
Title = model.Title,
Sizeleft = model.Sizeleft,

Loading…
Cancel
Save