feat(api): plex tv sync and recently added sync

This commit is contained in:
sct
2020-11-11 09:02:28 +00:00
parent 16221a46a7
commit 1390cc1f13
19 changed files with 554 additions and 76 deletions

View File

@@ -18,7 +18,6 @@ const LibraryItem: React.FC<LibraryItemProps> = ({
{name}
</div>
<div className="flex-shrink-0 pr-2">
{/* <!-- On: "bg-indigo-600", Off: "bg-gray-200" --> */}
<span
role="checkbox"
tabIndex={0}
@@ -33,14 +32,12 @@ const LibraryItem: React.FC<LibraryItemProps> = ({
isEnabled ? 'bg-indigo-600' : 'bg-cool-gray-700'
} relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:shadow-outline`}
>
{/* <!-- On: "translate-x-5", Off: "translate-x-0" --> */}
<span
aria-hidden="true"
className={`${
isEnabled ? 'translate-x-5' : 'translate-x-0'
} relative inline-block h-5 w-5 rounded-full bg-white shadow transform transition ease-in-out duration-200`}
>
{/* <!-- On: "opacity-0 ease-out duration-100", Off: "opacity-100 ease-in duration-200" --> */}
<span
className={`${
isEnabled
@@ -62,7 +59,6 @@ const LibraryItem: React.FC<LibraryItemProps> = ({
/>
</svg>
</span>
{/* <!-- On: "opacity-100 ease-in duration-200", Off: "opacity-0 ease-out duration-100" --> */}
<span
className={`${
isEnabled

View File

@@ -0,0 +1,70 @@
import React from 'react';
import useSWR from 'swr';
import LoadingSpinner from '../Common/LoadingSpinner';
import Badge from '../Common/Badge';
import { FormattedDate, FormattedRelativeTime } from 'react-intl';
import Button from '../Common/Button';
import { hasPermission } from '../../../server/lib/permissions';
import { Permission } from '../../hooks/useUser';
const SettingsJobs: React.FC = () => {
const { data, error } = useSWR<{ name: string; nextExecutionTime: string }[]>(
'/api/v1/settings/jobs'
);
if (!data && !error) {
return <LoadingSpinner />;
}
return (
<div className="flex flex-col">
<div className="my-2 overflow-x-auto -mx-6 sm:-mx-6 md:mx-4 lg:mx-4">
<div className="py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8">
<div className="shadow overflow-hidden sm:rounded-lg">
<table className="min-w-full">
<thead>
<tr>
<th className="px-6 py-3 bg-cool-gray-500 text-left text-xs leading-4 font-medium text-gray-200 uppercase tracking-wider">
Job Name
</th>
<th className="px-6 py-3 bg-cool-gray-500 text-left text-xs leading-4 font-medium text-gray-200 uppercase tracking-wider">
Next Execution
</th>
<th className="px-6 py-3 bg-cool-gray-500"></th>
</tr>
</thead>
<tbody className="bg-cool-gray-600 divide-y divide-cool-gray-700">
{data?.map((job, index) => (
<tr key={`job-list-${index}`}>
<td className="px-6 py-4 whitespace-no-wrap">
<div className="text-sm leading-5 text-white">
{job.name}
</div>
</td>
<td className="px-6 py-4 whitespace-no-wrap">
<div className="text-sm leading-5 text-white">
<FormattedRelativeTime
value={Math.floor(
(new Date(job.nextExecutionTime).getTime() -
Date.now()) /
1000
)}
updateIntervalInSeconds={1}
/>
</div>
</td>
<td className="px-6 py-4 whitespace-no-wrap text-right text-sm leading-5 font-medium">
<Button buttonType="primary">Run Now</Button>
</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
</div>
);
};
export default SettingsJobs;