🚨 Lint and prettier fix

This commit is contained in:
ajnart
2022-06-21 16:21:40 +02:00
parent 91a249d953
commit f0bae49830
5 changed files with 64 additions and 54 deletions

View File

@@ -20,11 +20,7 @@ export default function AppShelfMenu(props: any) {
onClose={() => setOpened(false)} onClose={() => setOpened(false)}
title="Modify a service" title="Modify a service"
> >
<AddAppShelfItemForm <AddAppShelfItemForm setOpened={setOpened} {...service} message="Save service" />
setOpened={setOpened}
{...service}
message="Save service"
/>
</Modal> </Modal>
<Menu <Menu
position="right" position="right"

View File

@@ -71,11 +71,13 @@ export default function CalendarComponent(props: any) {
const currentSonarrMedias: any[] = []; const currentSonarrMedias: any[] = [];
Promise.all( Promise.all(
sonarrServices.map((service) => sonarrServices.map((service) =>
getMedias(service, 'sonarr').then((res) => { getMedias(service, 'sonarr')
currentSonarrMedias.push(...res.data); .then((res) => {
}).catch(() => { currentSonarrMedias.push(...res.data);
currentSonarrMedias.push([]); })
}) .catch(() => {
currentSonarrMedias.push([]);
})
) )
).then(() => { ).then(() => {
setSonarrMedias(currentSonarrMedias); setSonarrMedias(currentSonarrMedias);
@@ -83,11 +85,13 @@ export default function CalendarComponent(props: any) {
const currentRadarrMedias: any[] = []; const currentRadarrMedias: any[] = [];
Promise.all( Promise.all(
radarrServices.map((service) => radarrServices.map((service) =>
getMedias(service, 'radarr').then((res) => { getMedias(service, 'radarr')
currentRadarrMedias.push(...res.data); .then((res) => {
}).catch(() => { currentRadarrMedias.push(...res.data);
currentRadarrMedias.push([]); })
}) .catch(() => {
currentRadarrMedias.push([]);
})
) )
).then(() => { ).then(() => {
setRadarrMedias(currentRadarrMedias); setRadarrMedias(currentRadarrMedias);
@@ -95,11 +99,13 @@ export default function CalendarComponent(props: any) {
const currentLidarrMedias: any[] = []; const currentLidarrMedias: any[] = [];
Promise.all( Promise.all(
lidarrServices.map((service) => lidarrServices.map((service) =>
getMedias(service, 'lidarr').then((res) => { getMedias(service, 'lidarr')
currentLidarrMedias.push(...res.data); .then((res) => {
}).catch(() => { currentLidarrMedias.push(...res.data);
currentLidarrMedias.push([]); })
}) .catch(() => {
currentLidarrMedias.push([]);
})
) )
).then(() => { ).then(() => {
setLidarrMedias(currentLidarrMedias); setLidarrMedias(currentLidarrMedias);
@@ -107,11 +113,13 @@ export default function CalendarComponent(props: any) {
const currentReadarrMedias: any[] = []; const currentReadarrMedias: any[] = [];
Promise.all( Promise.all(
readarrServices.map((service) => readarrServices.map((service) =>
getMedias(service, 'readarr').then((res) => { getMedias(service, 'readarr')
currentReadarrMedias.push(...res.data); .then((res) => {
}).catch(() => { currentReadarrMedias.push(...res.data);
currentReadarrMedias.push([]); })
}) .catch(() => {
currentReadarrMedias.push([]);
})
) )
).then(() => { ).then(() => {
setReadarrMedias(currentReadarrMedias); setReadarrMedias(currentReadarrMedias);

View File

@@ -23,19 +23,19 @@ export default function PingComponent(props: any) {
const exists = config.modules?.[PingModule.title]?.enabled ?? false; const exists = config.modules?.[PingModule.title]?.enabled ?? false;
function statusCheck(response: AxiosResponse) { function statusCheck(response: AxiosResponse) {
const { status }: {status: string[]} = props; const { status }: { status: string[] } = props;
//Default Status //Default Status
let acceptableStatus = ['200']; let acceptableStatus = ['200'];
if (status !== undefined && status.length) { if (status !== undefined && status.length) {
acceptableStatus = status; acceptableStatus = status;
} }
// Checks if reported status is in acceptable status array // Checks if reported status is in acceptable status array
if (acceptableStatus.indexOf((response.status).toString()) >= 0) { if (acceptableStatus.indexOf(response.status.toString()) >= 0) {
setOnline('online'); setOnline('online');
setResponse(response.status); setResponse(response.status);
} else { } else {
setOnline('down'); setOnline('down');
setResponse(response.status) setResponse(response.status);
} }
} }
@@ -59,7 +59,13 @@ export default function PingComponent(props: any) {
<Tooltip <Tooltip
radius="lg" radius="lg"
style={{ position: 'absolute', bottom: 20, right: 20 }} style={{ position: 'absolute', bottom: 20, right: 20 }}
label={isOnline === 'loading' ? 'Loading...' : isOnline === 'online' ? `Online - ${response}` : `Offline - ${response}`} label={
isOnline === 'loading'
? 'Loading...'
: isOnline === 'online'
? `Online - ${response}`
: `Offline - ${response}`
}
> >
<motion.div <motion.div
animate={{ animate={{

View File

@@ -44,9 +44,9 @@ async function Post(req: NextApiRequest, res: NextApiResponse) {
}); });
} }
// Get the origin URL // Get the origin URL
var { href: origin } = new URL(service.url); let { href: origin } = new URL(service.url);
if (origin.endsWith("/")) { if (origin.endsWith('/')) {
origin = origin.slice(0, -1) origin = origin.slice(0, -1);
} }
const pined = `${origin}${url?.url}?apiKey=${service.apiKey}&end=${nextMonth}&start=${lastMonth}`; const pined = `${origin}${url?.url}?apiKey=${service.apiKey}&end=${nextMonth}&start=${lastMonth}`;
const data = await axios.get( const data = await axios.get(

View File

@@ -33,30 +33,30 @@ interface ConfigModule {
} }
export const StatusCodes = [ export const StatusCodes = [
{value: '200', label: '200 - OK', group:'Sucessful responses'}, { value: '200', label: '200 - OK', group: 'Sucessful responses' },
{value: '204', label: '204 - No Content', group:'Sucessful responses'}, { value: '204', label: '204 - No Content', group: 'Sucessful responses' },
{value: '301', label: '301 - Moved Permanently', group:'Redirection responses'}, { value: '301', label: '301 - Moved Permanently', group: 'Redirection responses' },
{value: '302', label: '302 - Found / Moved Temporarily', group:'Redirection responses'}, { value: '302', label: '302 - Found / Moved Temporarily', group: 'Redirection responses' },
{value: '304', label: '304 - Not Modified', group:'Redirection responses'}, { value: '304', label: '304 - Not Modified', group: 'Redirection responses' },
{value: '307', label: '307 - Temporary Redirect', group:'Redirection responses'}, { value: '307', label: '307 - Temporary Redirect', group: 'Redirection responses' },
{value: '308', label: '308 - Permanent Redirect', group:'Redirection responses'}, { value: '308', label: '308 - Permanent Redirect', group: 'Redirection responses' },
{value: '400', label: '400 - Bad Request', group:'Client error responses'}, { value: '400', label: '400 - Bad Request', group: 'Client error responses' },
{value: '401', label: '401 - Unauthorized', group:'Client error responses'}, { value: '401', label: '401 - Unauthorized', group: 'Client error responses' },
{value: '403', label: '403 - Forbidden', group:'Client error responses'}, { value: '403', label: '403 - Forbidden', group: 'Client error responses' },
{value: '404', label: '404 - Not Found', group:'Client error responses'}, { value: '404', label: '404 - Not Found', group: 'Client error responses' },
{value: '408', label: '408 - Request Timeout', group:'Client error responses'}, { value: '408', label: '408 - Request Timeout', group: 'Client error responses' },
{value: '410', label: '410 - Gone', group:'Client error responses'}, { value: '410', label: '410 - Gone', group: 'Client error responses' },
{value: '429', label: '429 - Too Many Requests', group:'Client error responses'}, { value: '429', label: '429 - Too Many Requests', group: 'Client error responses' },
{value: '500', label: '500 - Internal Server Error', group:'Server error responses'}, { value: '500', label: '500 - Internal Server Error', group: 'Server error responses' },
{value: '502', label: '502 - Bad Gateway', group:'Server error responses'}, { value: '502', label: '502 - Bad Gateway', group: 'Server error responses' },
{value: '503', label: '503 - Service Unavailable', group:'Server error responses'}, { value: '503', label: '503 - Service Unavailable', group: 'Server error responses' },
{value: '054', label: '504 - Gateway Timeout Error', group:'Server error responses'}, { value: '054', label: '504 - Gateway Timeout Error', group: 'Server error responses' },
]; ];
export const Targets = [ export const Targets = [
{value: '_blank', label: 'New Tab'}, { value: '_blank', label: 'New Tab' },
{value: '_top', label: 'Same Window'} { value: '_top', label: 'Same Window' },
] ];
export const ServiceTypeList = [ export const ServiceTypeList = [
'Other', 'Other',