mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-20 14:39:06 +00:00
chore: format (#2030)
* chore: format * chore: add formatter in CI check --------- Co-authored-by: alex-Arc <omnivox@LAPTOP-RC5SNBVV.localdomain>
This commit is contained in:
committed by
GitHub
parent
7e3aaa8c30
commit
73eff20d08
@@ -33,6 +33,9 @@ jobs:
|
|||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
# Run code quality
|
# Run code quality
|
||||||
|
- name: Run formatter
|
||||||
|
run: pnpm format:check
|
||||||
|
|
||||||
- name: Run linter
|
- name: Run linter
|
||||||
run: pnpm lint
|
run: pnpm lint
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,10 @@ import { downloadBlob } from './utils';
|
|||||||
const customViewsPath = `${apiEntryUrl}/custom-views`;
|
const customViewsPath = `${apiEntryUrl}/custom-views`;
|
||||||
|
|
||||||
export async function getCustomViews(options?: RequestOptions): Promise<CustomViewsListResponse> {
|
export async function getCustomViews(options?: RequestOptions): Promise<CustomViewsListResponse> {
|
||||||
const response =
|
const response = await axios.get<CustomViewsListResponse>(customViewsPath, {
|
||||||
await axios.get<CustomViewsListResponse>(customViewsPath, {
|
signal: options?.signal,
|
||||||
signal: options?.signal,
|
timeout: options?.timeout ?? axiosConfig.shortTimeout,
|
||||||
timeout: options?.timeout ?? axiosConfig.shortTimeout,
|
});
|
||||||
})
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ export default function useCssOverride(enabled: boolean) {
|
|||||||
queryKey: CSS_OVERRIDE,
|
queryKey: CSS_OVERRIDE,
|
||||||
queryFn: ({ signal }) => getCSSContents({ signal }),
|
queryFn: ({ signal }) => getCSSContents({ signal }),
|
||||||
staleTime: MILLIS_PER_HOUR,
|
staleTime: MILLIS_PER_HOUR,
|
||||||
enabled
|
enabled,
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
data: data ?? '', status
|
data: data ?? '',
|
||||||
|
status,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,13 +105,7 @@ export function Field({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Description({
|
export function Description({ children, tone = 'default' }: { children: ReactNode; tone?: 'default' | 'warning' }) {
|
||||||
children,
|
|
||||||
tone = 'default',
|
|
||||||
}: {
|
|
||||||
children: ReactNode;
|
|
||||||
tone?: 'default' | 'warning';
|
|
||||||
}) {
|
|
||||||
return <div className={cx([style.fieldDescription, tone === 'warning' && style.warningText])}>{children}</div>;
|
return <div className={cx([style.fieldDescription, tone === 'warning' && style.warningText])}>{children}</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import { IoAdd, IoPencil, IoTrash } from 'react-icons/io5';
|
|||||||
import { deleteAutomation } from '../../../../common/api/automation';
|
import { deleteAutomation } from '../../../../common/api/automation';
|
||||||
import { maybeAxiosError } from '../../../../common/api/utils';
|
import { maybeAxiosError } from '../../../../common/api/utils';
|
||||||
import Button from '../../../../common/components/buttons/Button';
|
import Button from '../../../../common/components/buttons/Button';
|
||||||
import Info from '../../../../common/components/info/Info';
|
|
||||||
import IconButton from '../../../../common/components/buttons/IconButton';
|
import IconButton from '../../../../common/components/buttons/IconButton';
|
||||||
|
import Info from '../../../../common/components/info/Info';
|
||||||
import Tag from '../../../../common/components/tag/Tag';
|
import Tag from '../../../../common/components/tag/Tag';
|
||||||
import useAutomationSettings from '../../../../common/hooks-query/useAutomationSettings';
|
import useAutomationSettings from '../../../../common/hooks-query/useAutomationSettings';
|
||||||
import * as Panel from '../../panel-utils/PanelUtils';
|
import * as Panel from '../../panel-utils/PanelUtils';
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ export default function TriggersList(props: TriggersListProps) {
|
|||||||
<Panel.Divider />
|
<Panel.Divider />
|
||||||
<Panel.Section>
|
<Panel.Section>
|
||||||
{enabledAutomations === false && (
|
{enabledAutomations === false && (
|
||||||
<Info>Automations are disabled. You can still manage triggers here, but they will not run until enabled.</Info>
|
<Info>
|
||||||
|
Automations are disabled. You can still manage triggers here, but they will not run until enabled.
|
||||||
|
</Info>
|
||||||
)}
|
)}
|
||||||
{duplicates && (
|
{duplicates && (
|
||||||
<Panel.Error>
|
<Panel.Error>
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import ExternalLink from '../../../../common/components/link/external-link/Exter
|
|||||||
import useCustomViews from '../../../../common/hooks-query/useCustomViews';
|
import useCustomViews from '../../../../common/hooks-query/useCustomViews';
|
||||||
import * as Panel from '../../panel-utils/PanelUtils';
|
import * as Panel from '../../panel-utils/PanelUtils';
|
||||||
import CustomViewForm from './CustomViewForm';
|
import CustomViewForm from './CustomViewForm';
|
||||||
import CustomViewsList from './CustomViewsList';
|
|
||||||
import { customViewsDocs } from './customViews.utils';
|
import { customViewsDocs } from './customViews.utils';
|
||||||
|
import CustomViewsList from './CustomViewsList';
|
||||||
|
|
||||||
export default function CustomViews() {
|
export default function CustomViews() {
|
||||||
const { data, refetch, status } = useCustomViews();
|
const { data, refetch, status } = useCustomViews();
|
||||||
@@ -72,7 +72,6 @@ export default function CustomViews() {
|
|||||||
onMutate={() => refetch()}
|
onMutate={() => refetch()}
|
||||||
onError={setActionError}
|
onError={setActionError}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</Panel.Section>
|
</Panel.Section>
|
||||||
</Panel.Card>
|
</Panel.Card>
|
||||||
</Panel.Section>
|
</Panel.Section>
|
||||||
|
|||||||
@@ -25,13 +25,7 @@ export default function CustomViewsList({ views, onOpenUpload, onMutate, onError
|
|||||||
<tbody>
|
<tbody>
|
||||||
{views.length === 0 && <Panel.TableEmpty handleClick={onOpenUpload} label='No custom views yet' />}
|
{views.length === 0 && <Panel.TableEmpty handleClick={onOpenUpload} label='No custom views yet' />}
|
||||||
{views.map((view, index) => (
|
{views.map((view, index) => (
|
||||||
<CustomViewsListItem
|
<CustomViewsListItem key={view.slug} slug={view.slug} index={index} onMutate={onMutate} onError={onError} />
|
||||||
key={view.slug}
|
|
||||||
slug={view.slug}
|
|
||||||
index={index}
|
|
||||||
onMutate={onMutate}
|
|
||||||
onError={onError}
|
|
||||||
/>
|
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</Panel.Table>
|
</Panel.Table>
|
||||||
|
|||||||
+1
-2
@@ -1,9 +1,8 @@
|
|||||||
import Prism from 'virtual:prismjs';
|
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
import Editor from 'react-simple-code-editor';
|
import Editor from 'react-simple-code-editor';
|
||||||
|
import Prism from 'virtual:prismjs';
|
||||||
import 'prismjs/components/prism-css';
|
import 'prismjs/components/prism-css';
|
||||||
import 'prismjs/themes/prism-tomorrow.min.css';
|
import 'prismjs/themes/prism-tomorrow.min.css';
|
||||||
|
|
||||||
import style from './StyleEditor.module.scss';
|
import style from './StyleEditor.module.scss';
|
||||||
|
|
||||||
interface CodeEditorProps {
|
interface CodeEditorProps {
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ function GroupTimes() {
|
|||||||
const currentGroupId = useCurrentGroupId();
|
const currentGroupId = useCurrentGroupId();
|
||||||
const group = useEntry(currentGroupId) as OntimeGroup | null;
|
const group = useEntry(currentGroupId) as OntimeGroup | null;
|
||||||
|
|
||||||
const hasRunningTimer = phase !== TimerPhase.Pending && isPlaybackActive(playback) ;
|
const hasRunningTimer = phase !== TimerPhase.Pending && isPlaybackActive(playback);
|
||||||
|
|
||||||
// the group end time does not encode any day offsets so it is calculated with group start time and duration
|
// the group end time does not encode any day offsets so it is calculated with group start time and duration
|
||||||
const plannedGroupEnd = (() => {
|
const plannedGroupEnd = (() => {
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import { Fragment, useCallback, useMemo, useState } from 'react';
|
|||||||
import { IoAlertCircle, IoCheckmarkCircle, IoTrash } from 'react-icons/io5';
|
import { IoAlertCircle, IoCheckmarkCircle, IoTrash } from 'react-icons/io5';
|
||||||
|
|
||||||
import Button from '../../../../common/components/buttons/Button';
|
import Button from '../../../../common/components/buttons/Button';
|
||||||
|
import IconButton from '../../../../common/components/buttons/IconButton';
|
||||||
import * as Editor from '../../../../common/components/editor-utils/EditorUtils';
|
import * as Editor from '../../../../common/components/editor-utils/EditorUtils';
|
||||||
import Info from '../../../../common/components/info/Info';
|
import Info from '../../../../common/components/info/Info';
|
||||||
import IconButton from '../../../../common/components/buttons/IconButton';
|
|
||||||
import Select from '../../../../common/components/select/Select';
|
import Select from '../../../../common/components/select/Select';
|
||||||
import { useEntryActionsContext } from '../../../../common/context/EntryActionsContext';
|
import { useEntryActionsContext } from '../../../../common/context/EntryActionsContext';
|
||||||
import useAutomationSettings from '../../../../common/hooks-query/useAutomationSettings';
|
import useAutomationSettings from '../../../../common/hooks-query/useAutomationSettings';
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ export default defineConfig({
|
|||||||
}),
|
}),
|
||||||
prismjsPlugin({
|
prismjsPlugin({
|
||||||
manual: true,
|
manual: true,
|
||||||
languages: ['css',],
|
languages: ['css'],
|
||||||
css: true
|
css: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
server: {
|
server: {
|
||||||
|
|||||||
@@ -134,9 +134,7 @@ function makeFileMenu(askToQuit, serverUrl, redirectWindow, showDialog, download
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
isMac
|
isMac ? { role: 'close' } : { label: 'Quit', click: askToQuit, accelerator: 'Alt+F4' },
|
||||||
? { role: 'close' }
|
|
||||||
: { label: 'Quit', click: askToQuit, accelerator: 'Alt+F4' },
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ export async function shutdown(exitCode = 0): Promise<void> {
|
|||||||
|
|
||||||
shutdownPromise = performShutdown(exitCode);
|
shutdownPromise = performShutdown(exitCode);
|
||||||
return shutdownPromise;
|
return shutdownPromise;
|
||||||
};
|
}
|
||||||
|
|
||||||
const closeHttpServer = async (server: Server | null): Promise<void> => {
|
const closeHttpServer = async (server: Server | null): Promise<void> => {
|
||||||
if (!server) return;
|
if (!server) return;
|
||||||
@@ -344,7 +344,7 @@ async function performShutdown(exitCode: number): Promise<void> {
|
|||||||
logger.shutdown();
|
logger.shutdown();
|
||||||
process.exit(exitCode);
|
process.exit(exitCode);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
process.on('exit', (code) => consoleHighlight(`Ontime shutdown with code: ${code}`));
|
process.on('exit', (code) => consoleHighlight(`Ontime shutdown with code: ${code}`));
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -1,10 +1,13 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>Custom View E2E Test</title>
|
<title>Custom View E2E Test</title>
|
||||||
<style>
|
<style>
|
||||||
body { font-family: sans-serif; padding: 2rem; }
|
body {
|
||||||
|
font-family: sans-serif;
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
Reference in New Issue
Block a user