1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-05 05:45:22 +02:00

fix(app/edge): updater/rollback calendar visual issues (#8386)

This commit is contained in:
LP B 2023-02-02 16:57:53 +01:00 committed by GitHub
parent 9b53960906
commit 921e9cfc6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 152 additions and 60 deletions

View file

@ -12,6 +12,7 @@ import {
import { FormControl } from '@@/form-components/FormControl';
import { Input } from '@@/form-components/Input';
import { TextTip } from '@@/Tip/TextTip';
import { FormValues } from './types';
@ -30,23 +31,34 @@ export function ScheduledTimeField({ disabled }: Props) {
}
return (
<FormControl label="Schedule date & time" errors={error}>
{!disabled ? (
<DateTimePicker
format="y-MM-dd HH:mm:ss"
className="form-control [&>div]:border-0"
onChange={(date) => setValue(isoDate(date.valueOf()))}
name={name}
value={dateValue}
calendarIcon={<Calendar className="lucide" />}
clearIcon={<X className="lucide" />}
disableClock
minDate={new Date(Date.now() - 24 * 60 * 60 * 1000)}
/>
) : (
<Input defaultValue={value} disabled />
<>
<FormControl label="Schedule date & time" errors={error}>
{!disabled ? (
<DateTimePicker
format="y-MM-dd HH:mm:ss"
className="form-control [&>div]:border-0"
onChange={(date) => {
const dateToSave =
date || new Date(Date.now() + 24 * 60 * 60 * 1000);
setValue(isoDate(dateToSave.valueOf()));
}}
name={name}
value={dateValue}
calendarIcon={<Calendar className="lucide" />}
clearIcon={<X className="lucide" />}
disableClock
minDate={new Date(Date.now() - 24 * 60 * 60 * 1000)}
/>
) : (
<Input defaultValue={value} disabled />
)}
</FormControl>
{!disabled && value && (
<TextTip color="blue">
If time zone is not set on edge agent then UTC+0 will be used.
</TextTip>
)}
</FormControl>
</>
);
}