mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-24 16:39:13 +00:00
fix: redirect to preset
This commit is contained in:
committed by
Alex Christoffer Rasmussen
parent
1af42b766d
commit
02243242f1
@@ -33,6 +33,11 @@ export function RedirectClientModal({ id, isOpen, name, currentPath, origin, onC
|
|||||||
if (newPath === '/' || newPath === currentPath) {
|
if (newPath === '/' || newPath === currentPath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newPath.startsWith('preset-')) {
|
||||||
|
setRedirect({ target: id, redirect: newPath });
|
||||||
|
}
|
||||||
|
|
||||||
setRedirect({ target: id, redirect: newPath });
|
setRedirect({ target: id, redirect: newPath });
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
@@ -45,7 +50,7 @@ export function RedirectClientModal({ id, isOpen, name, currentPath, origin, onC
|
|||||||
label: view.label,
|
label: view.label,
|
||||||
})),
|
})),
|
||||||
...enabledPresets.map((preset) => ({
|
...enabledPresets.map((preset) => ({
|
||||||
value: preset.search,
|
value: `preset-${preset.alias}`,
|
||||||
label: `URL Preset: ${preset.alias}`,
|
label: `URL Preset: ${preset.alias}`,
|
||||||
})),
|
})),
|
||||||
];
|
];
|
||||||
@@ -61,32 +66,11 @@ export function RedirectClientModal({ id, isOpen, name, currentPath, origin, onC
|
|||||||
<>
|
<>
|
||||||
<Info>
|
<Info>
|
||||||
Remotely redirect the client to a different URL. <br />
|
Remotely redirect the client to a different URL. <br />
|
||||||
Either by selecting a URL Preset or entering a custom path.
|
Either by entering a custom path or selecting a URL Preset.
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<AppLink search='settings=sharing__presets'>Manage URL Presets</AppLink>
|
<AppLink search='settings=sharing__presets'>Manage URL Presets</AppLink>
|
||||||
</Info>
|
</Info>
|
||||||
<div>
|
|
||||||
<span className={style.label}>Select View or URL Preset</span>
|
|
||||||
<div className={style.textEntry}>
|
|
||||||
<Select
|
|
||||||
fluid
|
|
||||||
options={viewOptions}
|
|
||||||
defaultValue={viewOptions[0].value}
|
|
||||||
onValueChange={(value) => setSelected(value)}
|
|
||||||
disabled={enabledPresets.length === 0}
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
variant='primary'
|
|
||||||
aria-label='Redirect to preset'
|
|
||||||
className={style.redirect}
|
|
||||||
disabled={enabledPresets.length === 0 || selected === '/'}
|
|
||||||
onClick={() => handleRedirect(selected)}
|
|
||||||
>
|
|
||||||
Redirect <IoArrowForward />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className={style.inlineEntry}>
|
<div className={style.inlineEntry}>
|
||||||
<span className={style.label}>Enter custom path</span>
|
<span className={style.label}>Enter custom path</span>
|
||||||
<label className={style.textEntry}>
|
<label className={style.textEntry}>
|
||||||
@@ -100,9 +84,34 @@ export function RedirectClientModal({ id, isOpen, name, currentPath, origin, onC
|
|||||||
className={style.redirect}
|
className={style.redirect}
|
||||||
onClick={() => handleRedirect(path)}
|
onClick={() => handleRedirect(path)}
|
||||||
>
|
>
|
||||||
Redirect <IoArrowForward />
|
Redirect
|
||||||
|
<IoArrowForward />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<span className={style.label}>Select View or URL Preset</span>
|
||||||
|
<div className={style.inlineEntry}>
|
||||||
|
<label className={style.textEntry}>
|
||||||
|
{origin}
|
||||||
|
<Select
|
||||||
|
fluid
|
||||||
|
options={viewOptions}
|
||||||
|
defaultValue={viewOptions[0].value}
|
||||||
|
onValueChange={(value) => setSelected(value)}
|
||||||
|
disabled={enabledPresets.length === 0}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<Button
|
||||||
|
variant='primary'
|
||||||
|
aria-label='Redirect to preset'
|
||||||
|
className={style.redirect}
|
||||||
|
disabled={enabledPresets.length === 0 || selected === '/'}
|
||||||
|
onClick={() => handleRedirect(selected)}
|
||||||
|
>
|
||||||
|
Redirect <IoArrowForward />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
+5
-1
@@ -14,4 +14,8 @@
|
|||||||
.copiable {
|
.copiable {
|
||||||
cursor: text ;
|
cursor: text ;
|
||||||
user-select: text;
|
user-select: text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.self {
|
||||||
|
background-color: $blue-1100;
|
||||||
|
}
|
||||||
|
|||||||
+3
-2
@@ -8,6 +8,7 @@ import { RenameClientModal } from '../../../../../common/components/client-modal
|
|||||||
import Tag from '../../../../../common/components/tag/Tag';
|
import Tag from '../../../../../common/components/tag/Tag';
|
||||||
import { setClientRemote } from '../../../../../common/hooks/useSocket';
|
import { setClientRemote } from '../../../../../common/hooks/useSocket';
|
||||||
import { useClientStore } from '../../../../../common/stores/clientStore';
|
import { useClientStore } from '../../../../../common/stores/clientStore';
|
||||||
|
import { cx } from '../../../../../common/utils/styleUtils';
|
||||||
import * as Panel from '../../../panel-utils/PanelUtils';
|
import * as Panel from '../../../panel-utils/PanelUtils';
|
||||||
|
|
||||||
import style from './ClientControlPanel.module.scss';
|
import style from './ClientControlPanel.module.scss';
|
||||||
@@ -71,13 +72,13 @@ export default function ClientList() {
|
|||||||
const { identify, name, path } = client;
|
const { identify, name, path } = client;
|
||||||
const isCurrent = id === key;
|
const isCurrent = id === key;
|
||||||
return (
|
return (
|
||||||
<tr key={key}>
|
<tr key={key} className={cx([isCurrent && style.self])}>
|
||||||
<Panel.InlineElements relation='inner' as='td'>
|
<Panel.InlineElements relation='inner' as='td'>
|
||||||
{isCurrent && <Tag>SELF</Tag>}
|
{isCurrent && <Tag>SELF</Tag>}
|
||||||
{name}
|
{name}
|
||||||
</Panel.InlineElements>
|
</Panel.InlineElements>
|
||||||
<td className={style.copiable}>{path}</td>
|
<td className={style.copiable}>{path}</td>
|
||||||
<Panel.InlineElements relation='inner'>
|
<Panel.InlineElements relation='inner' as='td'>
|
||||||
<Button
|
<Button
|
||||||
size='small'
|
size='small'
|
||||||
className={`${identify ? style.blink : ''}`}
|
className={`${identify ? style.blink : ''}`}
|
||||||
|
|||||||
Reference in New Issue
Block a user