Hide task delay on frontend if queue driver is set to sync (#375)

This commit is contained in:
Boy132 2024-06-13 08:23:24 +02:00 committed by GitHub
parent cd4fc1a95d
commit ce1163d387
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 22 additions and 13 deletions

View File

@ -27,6 +27,7 @@ class AssetComposer
'enabled' => config('recaptcha.enabled', false),
'siteKey' => config('recaptcha.website_key') ?? '',
],
'usesSyncDriver' => config('queue.default') === 'sync',
]);
}
}

View File

@ -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`} />

View File

@ -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,6 +134,7 @@ const TaskDetailsModal = ({ schedule, task }: Props) => {
</FormikField>
</FormikFieldWrapper>
</div>
{!usesSyncDriver && (
<div css={tw`flex-1 ml-6`}>
<Field
name={'timeOffset'}
@ -141,6 +144,7 @@ const TaskDetailsModal = ({ schedule, task }: Props) => {
}
/>
</div>
)}
</div>
<div css={tw`mt-6`}>
{values.action === 'command' ? (

View File

@ -55,7 +55,8 @@ 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>

View File

@ -7,6 +7,7 @@ export interface SiteSettings {
enabled: boolean;
siteKey: string;
};
usesSyncDriver: boolean;
}
export interface SettingsStore {