mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 19:14:45 +02:00
Hide task delay on frontend if queue driver is set to sync
(#375)
This commit is contained in:
parent
cd4fc1a95d
commit
ce1163d387
@ -27,6 +27,7 @@ class AssetComposer
|
|||||||
'enabled' => config('recaptcha.enabled', false),
|
'enabled' => config('recaptcha.enabled', false),
|
||||||
'siteKey' => config('recaptcha.website_key') ?? '',
|
'siteKey' => config('recaptcha.website_key') ?? '',
|
||||||
],
|
],
|
||||||
|
'usesSyncDriver' => config('queue.default') === 'sync',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import { ServerContext } from '@/state/server';
|
|||||||
import tw from 'twin.macro';
|
import tw from 'twin.macro';
|
||||||
import ConfirmationModal from '@/components/elements/ConfirmationModal';
|
import ConfirmationModal from '@/components/elements/ConfirmationModal';
|
||||||
import Icon from '@/components/elements/Icon';
|
import Icon from '@/components/elements/Icon';
|
||||||
|
import { useStoreState } from 'easy-peasy';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
schedule: Schedule;
|
schedule: Schedule;
|
||||||
@ -46,6 +47,7 @@ export default ({ schedule, task }: Props) => {
|
|||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
const appendSchedule = ServerContext.useStoreActions((actions) => actions.schedules.appendSchedule);
|
const appendSchedule = ServerContext.useStoreActions((actions) => actions.schedules.appendSchedule);
|
||||||
|
const usesSyncDriver = useStoreState((state) => state.settings.data!.usesSyncDriver);
|
||||||
|
|
||||||
const onConfirmDeletion = () => {
|
const onConfirmDeletion = () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
@ -109,7 +111,7 @@ export default ({ schedule, task }: Props) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{task.sequenceId > 1 && task.timeOffset > 0 && (
|
{!usesSyncDriver && task.sequenceId > 1 && task.timeOffset > 0 && (
|
||||||
<div css={tw`mr-6`}>
|
<div css={tw`mr-6`}>
|
||||||
<div css={tw`flex items-center px-2 py-1 bg-neutral-500 text-sm rounded-full`}>
|
<div css={tw`flex items-center px-2 py-1 bg-neutral-500 text-sm rounded-full`}>
|
||||||
<Icon icon={faClock} css={tw`w-3 h-3 mr-2`} />
|
<Icon icon={faClock} css={tw`w-3 h-3 mr-2`} />
|
||||||
|
@ -17,6 +17,7 @@ import Select from '@/components/elements/Select';
|
|||||||
import ModalContext from '@/context/ModalContext';
|
import ModalContext from '@/context/ModalContext';
|
||||||
import asModal from '@/hoc/asModal';
|
import asModal from '@/hoc/asModal';
|
||||||
import FormikSwitch from '@/components/elements/FormikSwitch';
|
import FormikSwitch from '@/components/elements/FormikSwitch';
|
||||||
|
import { useStoreState } from 'easy-peasy';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
schedule: Schedule;
|
schedule: Schedule;
|
||||||
@ -71,6 +72,7 @@ const TaskDetailsModal = ({ schedule, task }: Props) => {
|
|||||||
const uuid = ServerContext.useStoreState((state) => state.server.data!.uuid);
|
const uuid = ServerContext.useStoreState((state) => state.server.data!.uuid);
|
||||||
const appendSchedule = ServerContext.useStoreActions((actions) => actions.schedules.appendSchedule);
|
const appendSchedule = ServerContext.useStoreActions((actions) => actions.schedules.appendSchedule);
|
||||||
const backupLimit = ServerContext.useStoreState((state) => state.server.data!.featureLimits.backups);
|
const backupLimit = ServerContext.useStoreState((state) => state.server.data!.featureLimits.backups);
|
||||||
|
const usesSyncDriver = useStoreState((state) => state.settings.data!.usesSyncDriver);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
@ -121,7 +123,7 @@ const TaskDetailsModal = ({ schedule, task }: Props) => {
|
|||||||
<FlashMessageRender byKey={'schedule:task'} css={tw`mb-4`} />
|
<FlashMessageRender byKey={'schedule:task'} css={tw`mb-4`} />
|
||||||
<h2 css={tw`text-2xl mb-6`}>{task ? 'Edit Task' : 'Create Task'}</h2>
|
<h2 css={tw`text-2xl mb-6`}>{task ? 'Edit Task' : 'Create Task'}</h2>
|
||||||
<div css={tw`flex`}>
|
<div css={tw`flex`}>
|
||||||
<div css={tw`mr-2 w-1/3`}>
|
<div className={!usesSyncDriver ? 'mr-2 w-1/3' : 'w-full'}>
|
||||||
<Label>Action</Label>
|
<Label>Action</Label>
|
||||||
<ActionListener />
|
<ActionListener />
|
||||||
<FormikFieldWrapper name={'action'}>
|
<FormikFieldWrapper name={'action'}>
|
||||||
@ -132,6 +134,7 @@ const TaskDetailsModal = ({ schedule, task }: Props) => {
|
|||||||
</FormikField>
|
</FormikField>
|
||||||
</FormikFieldWrapper>
|
</FormikFieldWrapper>
|
||||||
</div>
|
</div>
|
||||||
|
{!usesSyncDriver && (
|
||||||
<div css={tw`flex-1 ml-6`}>
|
<div css={tw`flex-1 ml-6`}>
|
||||||
<Field
|
<Field
|
||||||
name={'timeOffset'}
|
name={'timeOffset'}
|
||||||
@ -141,6 +144,7 @@ const TaskDetailsModal = ({ schedule, task }: Props) => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div css={tw`mt-6`}>
|
<div css={tw`mt-6`}>
|
||||||
{values.action === 'command' ? (
|
{values.action === 'command' ? (
|
||||||
|
@ -55,7 +55,8 @@ export default () => {
|
|||||||
</div>
|
</div>
|
||||||
<div css={tw`ml-4`}>
|
<div css={tw`ml-4`}>
|
||||||
<a
|
<a
|
||||||
href={`sftp://${username}.${id}@${sftp.alias ? sftp.alias : ip(sftp.ip)}:${sftp.port
|
href={`sftp://${username}.${id}@${sftp.alias ? sftp.alias : ip(sftp.ip)}:${
|
||||||
|
sftp.port
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<Button.Text variant={Button.Variants.Secondary}>Launch SFTP</Button.Text>
|
<Button.Text variant={Button.Variants.Secondary}>Launch SFTP</Button.Text>
|
||||||
|
@ -7,6 +7,7 @@ export interface SiteSettings {
|
|||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
siteKey: string;
|
siteKey: string;
|
||||||
};
|
};
|
||||||
|
usesSyncDriver: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SettingsStore {
|
export interface SettingsStore {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user