fix: modified components to display deleted as a status

pull/3460/head
Brandon 2 years ago committed by OwsleyJr
parent 05ea56188b
commit 16677a4cdf

@ -1053,7 +1053,7 @@ components:
status: status:
type: number type: number
example: 0 example: 0
description: Availability of the media. 1 = `UNKNOWN`, 2 = `PENDING`, 3 = `PROCESSING`, 4 = `PARTIALLY_AVAILABLE`, 5 = `AVAILABLE` description: Availability of the media. 1 = `UNKNOWN`, 2 = `PENDING`, 3 = `PROCESSING`, 4 = `PARTIALLY_AVAILABLE`, 5 = `AVAILABLE`, 6 = `DELETED`
requests: requests:
type: array type: array
readOnly: true readOnly: true
@ -4955,6 +4955,7 @@ paths:
processing, processing,
unavailable, unavailable,
failed, failed,
deleted,
] ]
- in: query - in: query
name: sort name: sort
@ -5694,7 +5695,16 @@ paths:
schema: schema:
type: string type: string
nullable: true nullable: true
enum: [all, available, partial, allavailable, processing, pending] enum:
[
all,
available,
partial,
allavailable,
processing,
pending,
deleted,
]
- in: query - in: query
name: sort name: sort
schema: schema:
@ -5753,7 +5763,7 @@ paths:
example: available example: available
schema: schema:
type: string type: string
enum: [available, partial, processing, pending, unknown] enum: [available, partial, processing, pending, unknown, deleted]
requestBody: requestBody:
content: content:
application/json: application/json:

@ -55,12 +55,17 @@ requestRoutes.get<Record<string, unknown>, RequestResultsResponse>(
case 'failed': case 'failed':
statusFilter = [MediaRequestStatus.FAILED]; statusFilter = [MediaRequestStatus.FAILED];
break; break;
case 'completed':
case 'deleted':
statusFilter = [MediaRequestStatus.COMPLETED];
break;
default: default:
statusFilter = [ statusFilter = [
MediaRequestStatus.PENDING, MediaRequestStatus.PENDING,
MediaRequestStatus.APPROVED, MediaRequestStatus.APPROVED,
MediaRequestStatus.DECLINED, MediaRequestStatus.DECLINED,
MediaRequestStatus.FAILED, MediaRequestStatus.FAILED,
MediaRequestStatus.COMPLETED,
]; ];
} }
@ -79,6 +84,9 @@ requestRoutes.get<Record<string, unknown>, RequestResultsResponse>(
MediaStatus.PARTIALLY_AVAILABLE, MediaStatus.PARTIALLY_AVAILABLE,
]; ];
break; break;
case 'deleted':
mediaStatusFilter = [MediaStatus.DELETED];
break;
default: default:
mediaStatusFilter = [ mediaStatusFilter = [
MediaStatus.UNKNOWN, MediaStatus.UNKNOWN,
@ -86,6 +94,7 @@ requestRoutes.get<Record<string, unknown>, RequestResultsResponse>(
MediaStatus.PROCESSING, MediaStatus.PROCESSING,
MediaStatus.PARTIALLY_AVAILABLE, MediaStatus.PARTIALLY_AVAILABLE,
MediaStatus.AVAILABLE, MediaStatus.AVAILABLE,
MediaStatus.DELETED,
]; ];
} }

@ -1,6 +1,11 @@
import Spinner from '@app/assets/spinner.svg'; import Spinner from '@app/assets/spinner.svg';
import { CheckCircleIcon } from '@heroicons/react/20/solid'; import { CheckCircleIcon } from '@heroicons/react/20/solid';
import { BellIcon, ClockIcon, MinusSmallIcon } from '@heroicons/react/24/solid'; import {
BellIcon,
ClockIcon,
MinusSmallIcon,
TrashIcon,
} from '@heroicons/react/24/solid';
import { MediaStatus } from '@server/constants/media'; import { MediaStatus } from '@server/constants/media';
interface StatusBadgeMiniProps { interface StatusBadgeMiniProps {
@ -50,6 +55,10 @@ const StatusBadgeMini = ({
); );
indicatorIcon = <MinusSmallIcon />; indicatorIcon = <MinusSmallIcon />;
break; break;
case MediaStatus.DELETED:
badgeStyle.push('bg-red-500 border-red-400 ring-red-400 text-red-100');
indicatorIcon = <TrashIcon />;
break;
} }
if (inProgress) { if (inProgress) {

@ -21,6 +21,8 @@ const RecentRequestsSlider = () => {
return null; return null;
} }
console.log({ requests });
return ( return (
<> <>
<div className="slider-header"> <div className="slider-header">

@ -204,6 +204,11 @@ const RequestBlock = ({ request, onUpdate }: RequestBlockProps) => {
{intl.formatMessage(globalMessages.failed)} {intl.formatMessage(globalMessages.failed)}
</Badge> </Badge>
)} )}
{request.status === MediaRequestStatus.COMPLETED && (
<Badge badgeType="success">
{intl.formatMessage(globalMessages.completed)}
</Badge>
)}
</div> </div>
</div> </div>
<div className="mt-2 flex items-center text-sm leading-5 sm:mt-0"> <div className="mt-2 flex items-center text-sm leading-5 sm:mt-0">

@ -264,7 +264,9 @@ const RequestButton = ({
// Standard request button // Standard request button
if ( if (
(!media || media.status === MediaStatus.UNKNOWN) && (!media ||
media.status === MediaStatus.UNKNOWN ||
media.status === MediaStatus.DELETED) &&
hasPermission( hasPermission(
[ [
Permission.REQUEST, Permission.REQUEST,
@ -307,7 +309,9 @@ const RequestButton = ({
// 4K request button // 4K request button
if ( if (
(!media || media.status4k === MediaStatus.UNKNOWN) && (!media ||
media.status4k === MediaStatus.UNKNOWN ||
media.status4k === MediaStatus.DELETED) &&
hasPermission( hasPermission(
[ [
Permission.REQUEST_4K, Permission.REQUEST_4K,

@ -34,6 +34,7 @@ enum Filter {
AVAILABLE = 'available', AVAILABLE = 'available',
UNAVAILABLE = 'unavailable', UNAVAILABLE = 'unavailable',
FAILED = 'failed', FAILED = 'failed',
DELETED = 'deleted',
} }
type Sort = 'added' | 'modified'; type Sort = 'added' | 'modified';
@ -99,6 +100,10 @@ const RequestList = () => {
); );
}, [currentFilter, currentSort, currentPageSize]); }, [currentFilter, currentSort, currentPageSize]);
console.log({ currentFilter });
console.log({ data });
if (!data && !error) { if (!data && !error) {
return <LoadingSpinner />; return <LoadingSpinner />;
} }
@ -177,6 +182,9 @@ const RequestList = () => {
<option value="unavailable"> <option value="unavailable">
{intl.formatMessage(globalMessages.unavailable)} {intl.formatMessage(globalMessages.unavailable)}
</option> </option>
<option value="deleted">
{intl.formatMessage(globalMessages.deleted)}
</option>
</select> </select>
</div> </div>
<div className="mb-2 flex flex-grow sm:mb-0 lg:flex-grow-0"> <div className="mb-2 flex flex-grow sm:mb-0 lg:flex-grow-0">

@ -569,7 +569,9 @@ const TvRequestModal = ({
(sn) => (sn) =>
sn.seasonNumber === season.seasonNumber && sn.seasonNumber === season.seasonNumber &&
sn[is4k ? 'status4k' : 'status'] !== sn[is4k ? 'status4k' : 'status'] !==
MediaStatus.UNKNOWN MediaStatus.UNKNOWN &&
sn[is4k ? 'status4k' : 'status'] !==
MediaStatus.DELETED
); );
return ( return (
<tr key={`season-${season.id}`}> <tr key={`season-${season.id}`}>

@ -299,6 +299,17 @@ const StatusBadge = ({
</Tooltip> </Tooltip>
); );
case MediaStatus.DELETED:
return (
<Tooltip content={mediaLinkDescription}>
<Badge badgeType="danger">
{intl.formatMessage(is4k ? messages.status4k : messages.status, {
status: intl.formatMessage(globalMessages.deleted),
})}
</Badge>
</Tooltip>
);
default: default:
return null; return null;
} }

@ -647,6 +647,18 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
</div> </div>
</> </>
)} )}
{mSeason?.status === MediaStatus.DELETED && (
<>
<div className="hidden md:flex">
<Badge badgeType="danger">
{intl.formatMessage(globalMessages.deleted)}
</Badge>
</div>
<div className="flex md:hidden">
<StatusBadgeMini status={MediaStatus.DELETED} />
</div>
</>
)}
{((!mSeason4k && {((!mSeason4k &&
request4k?.status === request4k?.status ===
MediaRequestStatus.APPROVED) || MediaRequestStatus.APPROVED) ||
@ -733,6 +745,26 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
</div> </div>
</> </>
)} )}
{mSeason4k?.status4k === MediaStatus.DELETED &&
show4k && (
<>
<div className="hidden md:flex">
<Badge badgeType="danger">
{intl.formatMessage(messages.status4k, {
status: intl.formatMessage(
globalMessages.deleted
),
})}
</Badge>
</div>
<div className="flex md:hidden">
<StatusBadgeMini
status={MediaStatus.DELETED}
is4k={true}
/>
</div>
</>
)}
<ChevronDownIcon <ChevronDownIcon
className={`${ className={`${
open ? 'rotate-180' : '' open ? 'rotate-180' : ''

@ -3,6 +3,7 @@ import { defineMessages } from 'react-intl';
const globalMessages = defineMessages({ const globalMessages = defineMessages({
available: 'Available', available: 'Available',
partiallyavailable: 'Partially Available', partiallyavailable: 'Partially Available',
deleted: 'Deleted',
processing: 'Processing', processing: 'Processing',
unavailable: 'Unavailable', unavailable: 'Unavailable',
notrequested: 'Not Requested', notrequested: 'Not Requested',
@ -14,6 +15,7 @@ const globalMessages = defineMessages({
pending: 'Pending', pending: 'Pending',
declined: 'Declined', declined: 'Declined',
approved: 'Approved', approved: 'Approved',
completed: 'Completed',
movie: 'Movie', movie: 'Movie',
movies: 'Movies', movies: 'Movies',
collection: 'Collection', collection: 'Collection',

Loading…
Cancel
Save