mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 01:44: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),
|
||||
'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 ConfirmationModal from '@/components/elements/ConfirmationModal';
|
||||
import Icon from '@/components/elements/Icon';
|
||||
import { useStoreState } from 'easy-peasy';
|
||||
|
||||
interface Props {
|
||||
schedule: Schedule;
|
||||
@ -46,6 +47,7 @@ export default ({ schedule, task }: Props) => {
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const appendSchedule = ServerContext.useStoreActions((actions) => actions.schedules.appendSchedule);
|
||||
const usesSyncDriver = useStoreState((state) => state.settings.data!.usesSyncDriver);
|
||||
|
||||
const onConfirmDeletion = () => {
|
||||
setIsLoading(true);
|
||||
@ -109,7 +111,7 @@ export default ({ schedule, task }: Props) => {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{task.sequenceId > 1 && task.timeOffset > 0 && (
|
||||
{!usesSyncDriver && task.sequenceId > 1 && task.timeOffset > 0 && (
|
||||
<div css={tw`mr-6`}>
|
||||
<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`} />
|
||||
|
@ -17,6 +17,7 @@ import Select from '@/components/elements/Select';
|
||||
import ModalContext from '@/context/ModalContext';
|
||||
import asModal from '@/hoc/asModal';
|
||||
import FormikSwitch from '@/components/elements/FormikSwitch';
|
||||
import { useStoreState } from 'easy-peasy';
|
||||
|
||||
interface Props {
|
||||
schedule: Schedule;
|
||||
@ -71,6 +72,7 @@ const TaskDetailsModal = ({ schedule, task }: Props) => {
|
||||
const uuid = ServerContext.useStoreState((state) => state.server.data!.uuid);
|
||||
const appendSchedule = ServerContext.useStoreActions((actions) => actions.schedules.appendSchedule);
|
||||
const backupLimit = ServerContext.useStoreState((state) => state.server.data!.featureLimits.backups);
|
||||
const usesSyncDriver = useStoreState((state) => state.settings.data!.usesSyncDriver);
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
@ -121,7 +123,7 @@ const TaskDetailsModal = ({ schedule, task }: Props) => {
|
||||
<FlashMessageRender byKey={'schedule:task'} css={tw`mb-4`} />
|
||||
<h2 css={tw`text-2xl mb-6`}>{task ? 'Edit Task' : 'Create Task'}</h2>
|
||||
<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>
|
||||
<ActionListener />
|
||||
<FormikFieldWrapper name={'action'}>
|
||||
@ -132,15 +134,17 @@ const TaskDetailsModal = ({ schedule, task }: Props) => {
|
||||
</FormikField>
|
||||
</FormikFieldWrapper>
|
||||
</div>
|
||||
<div css={tw`flex-1 ml-6`}>
|
||||
<Field
|
||||
name={'timeOffset'}
|
||||
label={'Time offset (in seconds)'}
|
||||
description={
|
||||
'The amount of time to wait after the previous task executes before running this one. If this is the first task on a schedule this will not be applied.'
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
{!usesSyncDriver && (
|
||||
<div css={tw`flex-1 ml-6`}>
|
||||
<Field
|
||||
name={'timeOffset'}
|
||||
label={'Time offset (in seconds)'}
|
||||
description={
|
||||
'The amount of time to wait after the previous task executes before running this one. If this is the first task on a schedule this will not be applied.'
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div css={tw`mt-6`}>
|
||||
{values.action === 'command' ? (
|
||||
|
@ -55,8 +55,9 @@ export default () => {
|
||||
</div>
|
||||
<div css={tw`ml-4`}>
|
||||
<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>
|
||||
</a>
|
||||
|
@ -7,6 +7,7 @@ export interface SiteSettings {
|
||||
enabled: boolean;
|
||||
siteKey: string;
|
||||
};
|
||||
usesSyncDriver: boolean;
|
||||
}
|
||||
|
||||
export interface SettingsStore {
|
||||
|
Loading…
x
Reference in New Issue
Block a user