mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-18 21:54:09 +00:00
refactor: only allow testing saved URLs
This commit is contained in:
committed by
Carlos Valente
parent
bc4d913ba7
commit
fba20b889e
@@ -153,6 +153,10 @@ export default function UrlPresetsForm() {
|
|||||||
{fields.map((preset, index) => {
|
{fields.map((preset, index) => {
|
||||||
const maybeAliasError = errors.data?.[index]?.alias?.message;
|
const maybeAliasError = errors.data?.[index]?.alias?.message;
|
||||||
const maybeUrlError = errors.data?.[index]?.pathAndParams?.message;
|
const maybeUrlError = errors.data?.[index]?.pathAndParams?.message;
|
||||||
|
// only saved and enabled URLs can be tested
|
||||||
|
const canTest =
|
||||||
|
preset.alias && preset.enabled && preset.pathAndParams && !maybeAliasError && !maybeUrlError;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<tr key={preset.id}>
|
<tr key={preset.id}>
|
||||||
<td className={style.fit}>
|
<td className={style.fit}>
|
||||||
@@ -191,6 +195,7 @@ export default function UrlPresetsForm() {
|
|||||||
<td className={style.flex}>
|
<td className={style.flex}>
|
||||||
<TooltipActionBtn
|
<TooltipActionBtn
|
||||||
size='sm'
|
size='sm'
|
||||||
|
isDisabled={!canTest}
|
||||||
clickHandler={(event) => handleLinks(event, preset.alias)}
|
clickHandler={(event) => handleLinks(event, preset.alias)}
|
||||||
tooltip='Test preset'
|
tooltip='Test preset'
|
||||||
aria-label='Test preset'
|
aria-label='Test preset'
|
||||||
|
|||||||
Reference in New Issue
Block a user