Fix browser session timeout input being uneditable (#SKY-7855) (#4805)
This commit is contained in:
@@ -64,7 +64,7 @@ function BrowserSessions() {
|
|||||||
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
|
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
|
||||||
const [sessionOptions, setSessionOptions] = useState<{
|
const [sessionOptions, setSessionOptions] = useState<{
|
||||||
proxyLocation: ProxyLocation;
|
proxyLocation: ProxyLocation;
|
||||||
timeoutMinutes: number;
|
timeoutMinutes: number | null;
|
||||||
}>({
|
}>({
|
||||||
proxyLocation: ProxyLocation.Residential,
|
proxyLocation: ProxyLocation.Residential,
|
||||||
timeoutMinutes: 60,
|
timeoutMinutes: 60,
|
||||||
@@ -350,25 +350,31 @@ function BrowserSessions() {
|
|||||||
<HelpTooltip content="Duration to keep the browser session open. Automatically extends as it is used." />
|
<HelpTooltip content="Duration to keep the browser session open. Automatically extends as it is used." />
|
||||||
</div>
|
</div>
|
||||||
<Input
|
<Input
|
||||||
value={sessionOptions.timeoutMinutes}
|
type="number"
|
||||||
|
min={5}
|
||||||
|
max={1440}
|
||||||
|
value={sessionOptions.timeoutMinutes ?? ""}
|
||||||
placeholder="timeout (minutes)"
|
placeholder="timeout (minutes)"
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
const value =
|
const value =
|
||||||
event.target.value === ""
|
event.target.value === ""
|
||||||
? null
|
? null
|
||||||
: Number(event.target.value);
|
: parseInt(event.target.value, 10);
|
||||||
|
setSessionOptions({
|
||||||
if (value) {
|
...sessionOptions,
|
||||||
setSessionOptions({
|
timeoutMinutes: value,
|
||||||
...sessionOptions,
|
});
|
||||||
timeoutMinutes: value,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
disabled={createBrowserSessionMutation.isPending}
|
disabled={
|
||||||
|
createBrowserSessionMutation.isPending ||
|
||||||
|
sessionOptions.timeoutMinutes === null ||
|
||||||
|
Number.isNaN(sessionOptions.timeoutMinutes) ||
|
||||||
|
sessionOptions.timeoutMinutes < 5 ||
|
||||||
|
sessionOptions.timeoutMinutes > 1440
|
||||||
|
}
|
||||||
className="mt-6 w-full"
|
className="mt-6 w-full"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
createBrowserSessionMutation.mutate({
|
createBrowserSessionMutation.mutate({
|
||||||
|
|||||||
Reference in New Issue
Block a user