2023-02-14 20:08:54 +03:00
|
|
|
import { Button, Checkbox, Form, Input, Modal, Select, Space, Table, Typography } from 'antd';
|
|
|
|
import CodeMirror from '@uiw/react-codemirror';
|
|
|
|
import { bbedit } from '@uiw/codemirror-theme-bbedit';
|
|
|
|
import { html as codeMirrorHTML } from '@codemirror/lang-html';
|
2023-01-16 09:31:36 +03:00
|
|
|
import dynamic from 'next/dynamic';
|
2023-01-16 10:11:44 +03:00
|
|
|
import React, { ReactElement, useContext, useEffect, useState } from 'react';
|
2023-01-10 07:57:29 +03:00
|
|
|
import { FormStatusIndicator } from '../../components/admin/FormStatusIndicator';
|
2022-11-30 01:14:11 +03:00
|
|
|
import { ExternalAction } from '../../interfaces/external-action';
|
2021-03-16 01:27:19 +03:00
|
|
|
import {
|
|
|
|
API_EXTERNAL_ACTIONS,
|
2021-07-09 21:42:01 +03:00
|
|
|
postConfigUpdateToAPI,
|
2021-03-16 01:27:19 +03:00
|
|
|
RESET_TIMEOUT,
|
2022-04-20 05:57:27 +03:00
|
|
|
} from '../../utils/config-constants';
|
|
|
|
import { createInputStatus, STATUS_ERROR, STATUS_SUCCESS } from '../../utils/input-statuses';
|
|
|
|
import { ServerStatusContext } from '../../utils/server-status-context';
|
2023-04-17 00:17:13 +03:00
|
|
|
import { isValidUrl, DEFAULT_TEXTFIELD_URL_PATTERN } from '../../utils/validators';
|
2021-03-16 01:27:19 +03:00
|
|
|
|
2023-01-16 10:11:44 +03:00
|
|
|
import { AdminLayout } from '../../components/layouts/AdminLayout';
|
|
|
|
|
2021-03-16 01:27:19 +03:00
|
|
|
const { Title, Paragraph } = Typography;
|
2023-01-16 09:31:36 +03:00
|
|
|
|
|
|
|
// Lazy loaded components
|
|
|
|
|
|
|
|
const DeleteOutlined = dynamic(() => import('@ant-design/icons/DeleteOutlined'), {
|
|
|
|
ssr: false,
|
|
|
|
});
|
|
|
|
|
|
|
|
const EditOutlined = dynamic(() => import('@ant-design/icons/EditOutlined'), {
|
|
|
|
ssr: false,
|
|
|
|
});
|
|
|
|
|
2021-03-16 01:27:19 +03:00
|
|
|
let resetTimer = null;
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
onCancel: () => void;
|
2022-11-30 01:14:11 +03:00
|
|
|
onOk: (
|
|
|
|
oldAction: ExternalAction | null,
|
2023-02-14 20:08:54 +03:00
|
|
|
oldActionIndex: number | null,
|
2022-11-30 01:14:11 +03:00
|
|
|
actionUrl: string,
|
2023-02-14 20:08:54 +03:00
|
|
|
actionHTML: string,
|
2022-11-30 01:14:11 +03:00
|
|
|
actionTitle: string,
|
|
|
|
actionDescription: string,
|
|
|
|
actionIcon: string,
|
|
|
|
actionColor: string,
|
|
|
|
openExternally: boolean,
|
|
|
|
) => void;
|
2022-11-02 00:50:23 +03:00
|
|
|
open: boolean;
|
2022-11-30 01:14:11 +03:00
|
|
|
action: ExternalAction | null;
|
2023-02-14 20:08:54 +03:00
|
|
|
index: number | null;
|
2021-03-16 01:27:19 +03:00
|
|
|
}
|
|
|
|
|
2023-02-14 20:08:54 +03:00
|
|
|
// ActionType is only used here to save either only the URL or only the HTML.
|
|
|
|
type ActionType = 'url' | 'html';
|
|
|
|
|
2022-11-30 01:14:11 +03:00
|
|
|
const ActionModal = (props: Props) => {
|
|
|
|
const { onOk, onCancel, open, action } = props;
|
2021-03-16 01:27:19 +03:00
|
|
|
|
2023-02-14 20:08:54 +03:00
|
|
|
const [actionType, setActionType] = useState<ActionType>('url');
|
|
|
|
|
2021-03-16 01:27:19 +03:00
|
|
|
const [actionUrl, setActionUrl] = useState('');
|
2023-02-14 20:08:54 +03:00
|
|
|
const [actionHTML, setActionHTML] = useState('');
|
2021-03-16 01:27:19 +03:00
|
|
|
const [actionTitle, setActionTitle] = useState('');
|
|
|
|
const [actionDescription, setActionDescription] = useState('');
|
|
|
|
const [actionIcon, setActionIcon] = useState('');
|
|
|
|
const [actionColor, setActionColor] = useState('');
|
|
|
|
const [openExternally, setOpenExternally] = useState(false);
|
|
|
|
|
2022-11-30 01:14:11 +03:00
|
|
|
useEffect(() => {
|
2023-02-14 20:08:54 +03:00
|
|
|
setActionType((action?.html?.length || 0) > 0 ? 'html' : 'url');
|
2022-11-30 01:14:11 +03:00
|
|
|
setActionUrl(action?.url || '');
|
2023-02-14 20:08:54 +03:00
|
|
|
setActionHTML(action?.html || '');
|
2022-11-30 01:14:11 +03:00
|
|
|
setActionTitle(action?.title || '');
|
|
|
|
setActionDescription(action?.description || '');
|
|
|
|
setActionIcon(action?.icon || '');
|
|
|
|
setActionColor(action?.color || '');
|
|
|
|
setOpenExternally(action?.openExternally || false);
|
|
|
|
}, [action]);
|
|
|
|
|
2021-03-16 01:27:19 +03:00
|
|
|
function save() {
|
2022-11-30 01:14:11 +03:00
|
|
|
onOk(
|
|
|
|
action,
|
2023-02-14 20:08:54 +03:00
|
|
|
props.index,
|
|
|
|
// Save only one of the properties
|
|
|
|
actionType === 'html' ? '' : actionUrl,
|
|
|
|
actionType === 'html' ? actionHTML : '',
|
2022-11-30 01:14:11 +03:00
|
|
|
actionTitle,
|
|
|
|
actionDescription,
|
|
|
|
actionIcon,
|
|
|
|
actionColor,
|
|
|
|
openExternally,
|
|
|
|
);
|
2021-05-23 09:27:51 +03:00
|
|
|
setActionUrl('');
|
2023-02-14 20:08:54 +03:00
|
|
|
setActionHTML('');
|
2021-05-23 09:27:51 +03:00
|
|
|
setActionTitle('');
|
|
|
|
setActionDescription('');
|
|
|
|
setActionIcon('');
|
|
|
|
setActionColor('');
|
|
|
|
setOpenExternally(false);
|
2021-03-16 01:27:19 +03:00
|
|
|
}
|
|
|
|
|
2021-03-18 07:26:27 +03:00
|
|
|
function canSave(): Boolean {
|
2023-02-14 20:08:54 +03:00
|
|
|
if (actionType === 'html') {
|
|
|
|
return actionHTML !== '' && actionTitle !== '';
|
|
|
|
}
|
2022-12-15 10:33:32 +03:00
|
|
|
return isValidUrl(actionUrl, ['https:']) && actionTitle !== '';
|
2021-03-18 07:26:27 +03:00
|
|
|
}
|
|
|
|
|
2021-03-16 01:27:19 +03:00
|
|
|
const okButtonProps = {
|
2021-03-18 07:26:27 +03:00
|
|
|
disabled: !canSave(),
|
2021-03-16 01:27:19 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
const onOpenExternallyChanged = checkbox => {
|
|
|
|
setOpenExternally(checkbox.target.checked);
|
|
|
|
};
|
|
|
|
|
2023-02-14 20:08:54 +03:00
|
|
|
const onActionHTMLChanged = (newActionHTML: string) => {
|
|
|
|
setActionHTML(newActionHTML);
|
|
|
|
};
|
|
|
|
|
2021-03-16 01:27:19 +03:00
|
|
|
return (
|
|
|
|
<Modal
|
2022-11-30 01:14:11 +03:00
|
|
|
destroyOnClose
|
|
|
|
title={action == null ? 'Create New Action' : 'Edit Action'}
|
2022-11-02 00:50:23 +03:00
|
|
|
open={open}
|
2021-03-16 01:27:19 +03:00
|
|
|
onOk={save}
|
|
|
|
onCancel={onCancel}
|
|
|
|
okButtonProps={okButtonProps}
|
|
|
|
>
|
2022-11-30 01:14:11 +03:00
|
|
|
<Form initialValues={action}>
|
2021-03-23 06:43:25 +03:00
|
|
|
Add the URL for the external action you want to present.{' '}
|
2023-02-14 20:08:54 +03:00
|
|
|
<strong>Only HTTPS URLs and embeds are supported.</strong>
|
2021-03-23 06:43:25 +03:00
|
|
|
<p>
|
2022-01-14 02:17:09 +03:00
|
|
|
<a
|
|
|
|
href="https://owncast.online/thirdparty/actions/"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
2021-03-23 06:43:25 +03:00
|
|
|
Read more about external actions.
|
|
|
|
</a>
|
|
|
|
</p>
|
2023-02-14 20:08:54 +03:00
|
|
|
<Form.Item>
|
|
|
|
<Select
|
|
|
|
value={actionType}
|
|
|
|
onChange={setActionType}
|
|
|
|
placeholder="Select an action type"
|
|
|
|
options={[
|
|
|
|
{ label: 'Link or embed an URL', value: 'url' },
|
|
|
|
{ label: 'Custom HTML', value: 'html' },
|
|
|
|
]}
|
2021-03-16 01:27:19 +03:00
|
|
|
/>
|
2022-11-30 01:14:11 +03:00
|
|
|
</Form.Item>
|
2023-02-14 20:08:54 +03:00
|
|
|
{actionType === 'html' ? (
|
|
|
|
<Form.Item name="html">
|
|
|
|
<CodeMirror
|
|
|
|
value={actionHTML}
|
|
|
|
placeholder="HTML embed code (required)"
|
|
|
|
theme={bbedit}
|
|
|
|
height="200px"
|
|
|
|
extensions={[codeMirrorHTML()]}
|
|
|
|
onChange={onActionHTMLChanged}
|
|
|
|
/>
|
|
|
|
</Form.Item>
|
|
|
|
) : (
|
|
|
|
<Form.Item name="url">
|
|
|
|
<Input
|
|
|
|
required
|
|
|
|
placeholder="https://myserver.com/action (required)"
|
|
|
|
onChange={input => setActionUrl(input.currentTarget.value.trim())}
|
|
|
|
type="url"
|
|
|
|
pattern={DEFAULT_TEXTFIELD_URL_PATTERN}
|
|
|
|
/>
|
|
|
|
</Form.Item>
|
|
|
|
)}
|
2022-11-30 01:14:11 +03:00
|
|
|
<Form.Item name="title">
|
2021-03-16 01:27:19 +03:00
|
|
|
<Input
|
|
|
|
value={actionTitle}
|
|
|
|
required
|
|
|
|
placeholder="Your action title (required)"
|
|
|
|
onChange={input => setActionTitle(input.currentTarget.value)}
|
|
|
|
/>
|
2022-11-30 01:14:11 +03:00
|
|
|
</Form.Item>
|
|
|
|
<Form.Item name="description">
|
2021-03-16 01:27:19 +03:00
|
|
|
<Input
|
|
|
|
value={actionDescription}
|
|
|
|
placeholder="Optional description"
|
|
|
|
onChange={input => setActionDescription(input.currentTarget.value)}
|
|
|
|
/>
|
2022-11-30 01:14:11 +03:00
|
|
|
</Form.Item>
|
|
|
|
<Form.Item name="icon">
|
2021-03-16 01:27:19 +03:00
|
|
|
<Input
|
|
|
|
value={actionIcon}
|
|
|
|
placeholder="https://myserver.com/action/icon.png (optional)"
|
|
|
|
onChange={input => setActionIcon(input.currentTarget.value)}
|
|
|
|
/>
|
2022-11-30 01:14:11 +03:00
|
|
|
</Form.Item>
|
|
|
|
<div>
|
|
|
|
<Form.Item name="color" style={{ marginBottom: '0px' }}>
|
|
|
|
<Input
|
|
|
|
type="color"
|
|
|
|
value={actionColor}
|
|
|
|
onChange={input => setActionColor(input.currentTarget.value)}
|
|
|
|
/>
|
|
|
|
</Form.Item>
|
2021-03-18 07:26:27 +03:00
|
|
|
Optional background color of the action button.
|
2022-11-30 01:14:11 +03:00
|
|
|
</div>
|
2023-02-14 20:08:54 +03:00
|
|
|
{actionType === 'html' ? null : (
|
|
|
|
<Form.Item name="openExternally">
|
|
|
|
<Checkbox
|
|
|
|
checked={openExternally}
|
|
|
|
defaultChecked={openExternally}
|
|
|
|
onChange={onOpenExternallyChanged}
|
|
|
|
>
|
|
|
|
Open in a new tab instead of within your page.
|
|
|
|
</Checkbox>
|
|
|
|
</Form.Item>
|
|
|
|
)}
|
2022-11-30 01:14:11 +03:00
|
|
|
</Form>
|
2021-03-16 01:27:19 +03:00
|
|
|
</Modal>
|
|
|
|
);
|
2022-09-07 10:00:28 +03:00
|
|
|
};
|
2021-03-16 01:27:19 +03:00
|
|
|
|
2022-09-07 10:00:28 +03:00
|
|
|
const Actions = () => {
|
2021-03-16 01:27:19 +03:00
|
|
|
const serverStatusData = useContext(ServerStatusContext);
|
|
|
|
const { serverConfig, setFieldInConfigState } = serverStatusData || {};
|
|
|
|
const { externalActions } = serverConfig;
|
2022-11-30 01:14:11 +03:00
|
|
|
const [actions, setActions] = useState<ExternalAction[]>(null);
|
2022-11-02 00:50:23 +03:00
|
|
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
2021-03-16 01:27:19 +03:00
|
|
|
const [submitStatus, setSubmitStatus] = useState(null);
|
2022-11-30 01:14:11 +03:00
|
|
|
const [editAction, setEditAction] = useState<ExternalAction>(null);
|
2023-02-14 20:08:54 +03:00
|
|
|
const [editActionIndex, setEditActionIndex] = useState(-1);
|
2021-03-16 01:27:19 +03:00
|
|
|
|
|
|
|
const resetStates = () => {
|
|
|
|
setSubmitStatus(null);
|
|
|
|
resetTimer = null;
|
|
|
|
clearTimeout(resetTimer);
|
|
|
|
};
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
setActions(externalActions || []);
|
|
|
|
}, [externalActions]);
|
|
|
|
|
2021-07-09 21:42:01 +03:00
|
|
|
async function save(actionsData) {
|
|
|
|
await postConfigUpdateToAPI({
|
|
|
|
apiPath: API_EXTERNAL_ACTIONS,
|
|
|
|
data: { value: actionsData },
|
|
|
|
onSuccess: () => {
|
|
|
|
setFieldInConfigState({ fieldName: 'externalActions', value: actionsData, path: '' });
|
|
|
|
setSubmitStatus(createInputStatus(STATUS_SUCCESS, 'Updated.'));
|
|
|
|
resetTimer = setTimeout(resetStates, RESET_TIMEOUT);
|
2021-03-16 01:27:19 +03:00
|
|
|
},
|
2021-07-09 21:42:01 +03:00
|
|
|
onError: (message: string) => {
|
|
|
|
console.log(message);
|
|
|
|
setSubmitStatus(createInputStatus(STATUS_ERROR, message));
|
|
|
|
resetTimer = setTimeout(resetStates, RESET_TIMEOUT);
|
2021-03-16 01:27:19 +03:00
|
|
|
},
|
2021-07-09 21:42:01 +03:00
|
|
|
});
|
|
|
|
}
|
2021-03-16 01:27:19 +03:00
|
|
|
|
2023-05-21 07:15:25 +03:00
|
|
|
async function handleDelete(index) {
|
2021-07-09 21:42:01 +03:00
|
|
|
const actionsData = [...actions];
|
2021-03-16 01:27:19 +03:00
|
|
|
actionsData.splice(index, 1);
|
|
|
|
|
|
|
|
try {
|
2021-07-09 21:42:01 +03:00
|
|
|
setActions(actionsData);
|
|
|
|
save(actionsData);
|
2021-03-16 01:27:19 +03:00
|
|
|
} catch (error) {
|
|
|
|
console.error(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async function handleSave(
|
2023-05-21 07:15:25 +03:00
|
|
|
_oldAction: ExternalAction | null,
|
2023-02-14 20:08:54 +03:00
|
|
|
oldActionIndex: number,
|
2021-03-16 01:27:19 +03:00
|
|
|
url: string,
|
2023-02-14 20:08:54 +03:00
|
|
|
html: string,
|
2021-03-16 01:27:19 +03:00
|
|
|
title: string,
|
|
|
|
description: string,
|
|
|
|
icon: string,
|
|
|
|
color: string,
|
|
|
|
openExternally: boolean,
|
|
|
|
) {
|
|
|
|
try {
|
2021-07-09 21:42:01 +03:00
|
|
|
const actionsData = [...actions];
|
2022-11-30 01:14:11 +03:00
|
|
|
|
|
|
|
const newAction: ExternalAction = {
|
2021-03-18 07:26:27 +03:00
|
|
|
url,
|
2023-02-14 20:08:54 +03:00
|
|
|
html,
|
2021-03-18 07:26:27 +03:00
|
|
|
title,
|
|
|
|
description,
|
|
|
|
icon,
|
|
|
|
color,
|
|
|
|
openExternally,
|
2022-11-30 01:14:11 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
// Replace old action if edited or append the new action
|
2023-02-14 20:08:54 +03:00
|
|
|
if (oldActionIndex >= 0) {
|
|
|
|
actionsData[oldActionIndex] = newAction;
|
2022-11-30 01:14:11 +03:00
|
|
|
} else {
|
|
|
|
actionsData.push(newAction);
|
|
|
|
}
|
|
|
|
|
|
|
|
setActions(actionsData);
|
|
|
|
await save(actionsData);
|
2021-03-16 01:27:19 +03:00
|
|
|
} catch (error) {
|
|
|
|
console.error(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-14 20:08:54 +03:00
|
|
|
async function handleEdit(action: ExternalAction, index) {
|
|
|
|
setEditActionIndex(index);
|
2022-11-30 01:14:11 +03:00
|
|
|
setEditAction(action);
|
|
|
|
setIsModalOpen(true);
|
|
|
|
}
|
|
|
|
|
2021-03-16 01:27:19 +03:00
|
|
|
const showCreateModal = () => {
|
2022-11-30 01:14:11 +03:00
|
|
|
setEditAction(null);
|
2023-02-14 20:08:54 +03:00
|
|
|
setEditActionIndex(-1);
|
2022-11-02 00:50:23 +03:00
|
|
|
setIsModalOpen(true);
|
2021-03-16 01:27:19 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
const handleModalSaveButton = (
|
2022-11-30 01:14:11 +03:00
|
|
|
oldAction: ExternalAction | null,
|
2023-02-14 20:08:54 +03:00
|
|
|
oldActionIndex: number,
|
2021-03-16 01:27:19 +03:00
|
|
|
actionUrl: string,
|
2023-02-14 20:08:54 +03:00
|
|
|
actionHTML: string,
|
2021-03-16 01:27:19 +03:00
|
|
|
actionTitle: string,
|
|
|
|
actionDescription: string,
|
|
|
|
actionIcon: string,
|
|
|
|
actionColor: string,
|
|
|
|
openExternally: boolean,
|
|
|
|
) => {
|
2022-11-02 00:50:23 +03:00
|
|
|
setIsModalOpen(false);
|
2022-11-30 01:14:11 +03:00
|
|
|
handleSave(
|
|
|
|
oldAction,
|
2023-02-14 20:08:54 +03:00
|
|
|
oldActionIndex,
|
2022-11-30 01:14:11 +03:00
|
|
|
actionUrl,
|
2023-02-14 20:08:54 +03:00
|
|
|
actionHTML,
|
2022-11-30 01:14:11 +03:00
|
|
|
actionTitle,
|
|
|
|
actionDescription,
|
|
|
|
actionIcon,
|
|
|
|
actionColor,
|
|
|
|
openExternally,
|
|
|
|
);
|
|
|
|
setEditAction(null);
|
2023-02-14 20:08:54 +03:00
|
|
|
setEditActionIndex(-1);
|
2021-03-16 01:27:19 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
const handleModalCancelButton = () => {
|
2022-11-02 00:50:23 +03:00
|
|
|
setIsModalOpen(false);
|
2021-03-16 01:27:19 +03:00
|
|
|
};
|
|
|
|
|
2021-07-09 21:42:01 +03:00
|
|
|
const columns = [
|
|
|
|
{
|
|
|
|
title: '',
|
2022-11-30 01:14:11 +03:00
|
|
|
key: 'delete-edit',
|
2023-05-21 07:15:25 +03:00
|
|
|
render: (_, record, index) => (
|
2021-07-09 21:42:01 +03:00
|
|
|
<Space size="middle">
|
2023-05-21 07:15:25 +03:00
|
|
|
<Button onClick={() => handleDelete(index)} icon={<DeleteOutlined />} />
|
2023-02-14 20:08:54 +03:00
|
|
|
<Button onClick={() => handleEdit(record, index)} icon={<EditOutlined />} />
|
2021-07-09 21:42:01 +03:00
|
|
|
</Space>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Name',
|
|
|
|
dataIndex: 'title',
|
|
|
|
key: 'title',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Description',
|
|
|
|
dataIndex: 'description',
|
|
|
|
key: 'description',
|
|
|
|
},
|
|
|
|
{
|
2023-02-14 20:08:54 +03:00
|
|
|
title: 'URL / Embed',
|
2021-07-09 21:42:01 +03:00
|
|
|
key: 'url',
|
2023-02-14 20:08:54 +03:00
|
|
|
dataIndex: 'url',
|
2023-05-21 07:15:25 +03:00
|
|
|
render: (_, record) => (record.html ? 'HTML embed' : record.url),
|
2021-07-09 21:42:01 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Icon',
|
|
|
|
dataIndex: 'icon',
|
|
|
|
key: 'icon',
|
|
|
|
render: (url: string) => (url ? <img style={{ width: '2vw' }} src={url} alt="" /> : null),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Color',
|
|
|
|
dataIndex: 'color',
|
|
|
|
key: 'color',
|
|
|
|
render: (color: string) =>
|
|
|
|
color ? <div style={{ backgroundColor: color, height: '30px' }}>{color}</div> : null,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Opens',
|
|
|
|
key: 'openExternally',
|
2023-02-14 20:08:54 +03:00
|
|
|
dataIndex: 'openExternally',
|
2023-07-31 20:44:48 +03:00
|
|
|
// Note: embeds will always open in the same tab / in a modal
|
2023-02-14 20:08:54 +03:00
|
|
|
render: (openExternally: boolean, record) =>
|
|
|
|
!openExternally || record.html ? 'In the same tab' : 'In a new tab',
|
2021-07-09 21:42:01 +03:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2021-03-16 01:27:19 +03:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<Title>External Actions</Title>
|
2021-04-05 06:06:26 +03:00
|
|
|
<Paragraph>
|
|
|
|
External action URLs are 3rd party UI you can display, embedded, into your Owncast page when
|
|
|
|
a user clicks on a button to launch your action.
|
|
|
|
</Paragraph>
|
2021-03-16 01:27:19 +03:00
|
|
|
<Paragraph>
|
|
|
|
Read more about how to use actions, with examples, at{' '}
|
2021-05-23 09:27:51 +03:00
|
|
|
<a
|
|
|
|
href="https://owncast.online/thirdparty/?source=admin"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
|
|
|
our documentation
|
|
|
|
</a>
|
|
|
|
.
|
2021-03-16 01:27:19 +03:00
|
|
|
</Paragraph>
|
|
|
|
|
2021-05-23 09:27:51 +03:00
|
|
|
<Table
|
|
|
|
rowKey={record => `${record.title}-${record.url}`}
|
|
|
|
columns={columns}
|
|
|
|
dataSource={actions}
|
|
|
|
pagination={false}
|
|
|
|
/>
|
2021-03-16 01:27:19 +03:00
|
|
|
<br />
|
|
|
|
<Button type="primary" onClick={showCreateModal}>
|
|
|
|
Create New Action
|
|
|
|
</Button>
|
|
|
|
<FormStatusIndicator status={submitStatus} />
|
|
|
|
|
2022-11-30 01:14:11 +03:00
|
|
|
<ActionModal
|
|
|
|
action={editAction}
|
2023-02-14 20:08:54 +03:00
|
|
|
index={editActionIndex}
|
2022-11-02 00:50:23 +03:00
|
|
|
open={isModalOpen}
|
2021-03-16 01:27:19 +03:00
|
|
|
onOk={handleModalSaveButton}
|
|
|
|
onCancel={handleModalCancelButton}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
2022-09-07 10:00:28 +03:00
|
|
|
};
|
2023-01-16 10:11:44 +03:00
|
|
|
|
|
|
|
Actions.getLayout = function getLayout(page: ReactElement) {
|
|
|
|
return <AdminLayout page={page} />;
|
|
|
|
};
|
2022-09-07 10:00:28 +03:00
|
|
|
export default Actions;
|