lint for passing builds
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
/* eslint-disable react/no-unused-prop-types */
|
||||||
|
// TODO: This component should be cleaned up and usage should be re-examined. The types should be reconsidered as well.
|
||||||
|
|
||||||
import { Typography, Statistic, Card, Progress } from 'antd';
|
import { Typography, Statistic, Card, Progress } from 'antd';
|
||||||
|
|
||||||
const { Text } = Typography;
|
const { Text } = Typography;
|
||||||
@@ -5,7 +8,7 @@ const { Text } = Typography;
|
|||||||
interface StatisticItemProps {
|
interface StatisticItemProps {
|
||||||
title?: string;
|
title?: string;
|
||||||
value?: any;
|
value?: any;
|
||||||
prefix?: JSX.Element;
|
prefix?: any;
|
||||||
color?: string;
|
color?: string;
|
||||||
progress?: boolean;
|
progress?: boolean;
|
||||||
centered?: boolean;
|
centered?: boolean;
|
||||||
@@ -43,7 +46,7 @@ function ProgressView({ title, value, prefix, color }: StatisticItemProps) {
|
|||||||
'0%': color,
|
'0%': color,
|
||||||
'90%': endColor,
|
'90%': endColor,
|
||||||
}}
|
}}
|
||||||
format={percent => content}
|
format={() => content}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,11 +40,17 @@ function convertScopeStringToTag(scopeString) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function NewTokenModal(props) {
|
interface Props {
|
||||||
|
onCancel: () => void;
|
||||||
|
onOk: any; // todo: make better type
|
||||||
|
visible: boolean;
|
||||||
|
}
|
||||||
|
function NewTokenModal(props: Props) {
|
||||||
|
const { onOk, onCancel, visible } = props;
|
||||||
const [selectedScopes, setSelectedScopes] = useState([]);
|
const [selectedScopes, setSelectedScopes] = useState([]);
|
||||||
const [name, setName] = useState('');
|
const [name, setName] = useState('');
|
||||||
|
|
||||||
const scopes = Object.keys(availableScopes).map(function (key) {
|
const scopes = Object.keys(availableScopes).map(key => {
|
||||||
return { value: key, label: availableScopes[key].description };
|
return { value: key, label: availableScopes[key].description };
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -53,7 +59,7 @@ function NewTokenModal(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function saveToken() {
|
function saveToken() {
|
||||||
props.onOk(name, selectedScopes);
|
onOk(name, selectedScopes);
|
||||||
|
|
||||||
// Clear the modal
|
// Clear the modal
|
||||||
setSelectedScopes([]);
|
setSelectedScopes([]);
|
||||||
@@ -71,9 +77,9 @@ function NewTokenModal(props) {
|
|||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
title="Create New Access token"
|
title="Create New Access token"
|
||||||
visible={props.visible}
|
visible={visible}
|
||||||
onOk={saveToken}
|
onOk={saveToken}
|
||||||
onCancel={props.onCancel}
|
onCancel={onCancel}
|
||||||
okButtonProps={okButtonProps}
|
okButtonProps={okButtonProps}
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
@@ -85,7 +91,8 @@ function NewTokenModal(props) {
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Select the permissions this access token will have. It cannot be edited after it's created.
|
Select the permissions this access token will have. It cannot be edited after it's
|
||||||
|
created.
|
||||||
</p>
|
</p>
|
||||||
<Checkbox.Group options={scopes} value={selectedScopes} onChange={onChange} />
|
<Checkbox.Group options={scopes} value={selectedScopes} onChange={onChange} />
|
||||||
|
|
||||||
@@ -102,6 +109,47 @@ export default function AccessTokens() {
|
|||||||
const [tokens, setTokens] = useState([]);
|
const [tokens, setTokens] = useState([]);
|
||||||
const [isTokenModalVisible, setIsTokenModalVisible] = useState(false);
|
const [isTokenModalVisible, setIsTokenModalVisible] = useState(false);
|
||||||
|
|
||||||
|
function handleError(error) {
|
||||||
|
console.error('error', error);
|
||||||
|
alert(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getAccessTokens() {
|
||||||
|
try {
|
||||||
|
const result = await fetchData(ACCESS_TOKENS);
|
||||||
|
setTokens(result);
|
||||||
|
} catch (error) {
|
||||||
|
handleError(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getAccessTokens();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
async function handleDeleteToken(token) {
|
||||||
|
try {
|
||||||
|
await fetchData(DELETE_ACCESS_TOKEN, {
|
||||||
|
method: 'POST',
|
||||||
|
data: { token },
|
||||||
|
});
|
||||||
|
getAccessTokens();
|
||||||
|
} catch (error) {
|
||||||
|
handleError(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleSaveToken(name: string, scopes: string[]) {
|
||||||
|
try {
|
||||||
|
const newToken = await fetchData(CREATE_ACCESS_TOKEN, {
|
||||||
|
method: 'POST',
|
||||||
|
data: { name, scopes },
|
||||||
|
});
|
||||||
|
setTokens(tokens.concat(newToken));
|
||||||
|
} catch (error) {
|
||||||
|
handleError(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: '',
|
title: '',
|
||||||
@@ -121,7 +169,7 @@ export default function AccessTokens() {
|
|||||||
title: 'Token',
|
title: 'Token',
|
||||||
dataIndex: 'token',
|
dataIndex: 'token',
|
||||||
key: 'token',
|
key: 'token',
|
||||||
render: (text, record) => <Input.Password size="small" bordered={false} value={text} />,
|
render: text => <Input.Password size="small" bordered={false} value={text} />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Scopes',
|
title: 'Scopes',
|
||||||
@@ -149,48 +197,6 @@ export default function AccessTokens() {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const getAccessTokens = async () => {
|
|
||||||
try {
|
|
||||||
const result = await fetchData(ACCESS_TOKENS);
|
|
||||||
setTokens(result);
|
|
||||||
} catch (error) {
|
|
||||||
handleError(error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getAccessTokens();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
async function handleDeleteToken(token) {
|
|
||||||
try {
|
|
||||||
const result = await fetchData(DELETE_ACCESS_TOKEN, {
|
|
||||||
method: 'POST',
|
|
||||||
data: { token },
|
|
||||||
});
|
|
||||||
getAccessTokens();
|
|
||||||
} catch (error) {
|
|
||||||
handleError(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleSaveToken(name: string, scopes: string[]) {
|
|
||||||
try {
|
|
||||||
const newToken = await fetchData(CREATE_ACCESS_TOKEN, {
|
|
||||||
method: 'POST',
|
|
||||||
data: { name, scopes },
|
|
||||||
});
|
|
||||||
setTokens(tokens.concat(newToken));
|
|
||||||
} catch (error) {
|
|
||||||
handleError(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleError(error) {
|
|
||||||
console.error('error', error);
|
|
||||||
alert(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
const showCreateTokenModal = () => {
|
const showCreateTokenModal = () => {
|
||||||
setIsTokenModalVisible(true);
|
setIsTokenModalVisible(true);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
import React, { useContext } from 'react';
|
|
||||||
import { ServerStatusContext } from '../utils/server-status-context';
|
|
||||||
|
|
||||||
|
|
||||||
export default function BroadcastInfo() {
|
|
||||||
const context = useContext(ServerStatusContext);
|
|
||||||
const { broadcaster } = context || {};
|
|
||||||
const { remoteAddr, time, streamDetails } = broadcaster || {};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div style={{border: '1px solid green', width: '100%'}}>
|
|
||||||
<h2>Broadcast Info</h2>
|
|
||||||
<p>Remote Address: {remoteAddr}</p>
|
|
||||||
<p>Time: {(new Date(time)).toLocaleTimeString()}</p>
|
|
||||||
<p>Stream Details: {JSON.stringify(streamDetails)}</p>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -5,16 +5,17 @@ import { fetchData, FETCH_INTERVAL, HARDWARE_STATS } from '../utils/apis';
|
|||||||
import Chart from '../components/chart';
|
import Chart from '../components/chart';
|
||||||
import StatisticItem from '../components/statistic';
|
import StatisticItem from '../components/statistic';
|
||||||
|
|
||||||
interface TimedValue {
|
// TODO: FIX TS WARNING FROM THIS.
|
||||||
time: Date;
|
// interface TimedValue {
|
||||||
value: Number;
|
// time: Date;
|
||||||
}
|
// value: Number;
|
||||||
|
// }
|
||||||
|
|
||||||
export default function HardwareInfo() {
|
export default function HardwareInfo() {
|
||||||
const [hardwareStatus, setHardwareStatus] = useState({
|
const [hardwareStatus, setHardwareStatus] = useState({
|
||||||
cpu: Array<TimedValue>(),
|
cpu: [], // Array<TimedValue>(),
|
||||||
memory: Array<TimedValue>(),
|
memory: [], // Array<TimedValue>(),
|
||||||
disk: Array<TimedValue>(),
|
disk: [], // Array<TimedValue>(),
|
||||||
message: '',
|
message: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ import {
|
|||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default function Help() {
|
export default function Help() {
|
||||||
const questions = [
|
const questions = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,12 +37,19 @@ function convertEventStringToTag(eventString) {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
interface Props {
|
||||||
|
onCancel: () => void;
|
||||||
|
onOk: any; // todo: make better type
|
||||||
|
visible: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
function NewWebhookModal(props: Props) {
|
||||||
|
const { onOk, onCancel, visible } = props;
|
||||||
|
|
||||||
function NewWebhookModal(props) {
|
|
||||||
const [selectedEvents, setSelectedEvents] = useState([]);
|
const [selectedEvents, setSelectedEvents] = useState([]);
|
||||||
const [webhookUrl, setWebhookUrl] = useState('');
|
const [webhookUrl, setWebhookUrl] = useState('');
|
||||||
|
|
||||||
const events = Object.keys(availableEvents).map(function (key) {
|
const events = Object.keys(availableEvents).map(key => {
|
||||||
return { value: key, label: availableEvents[key].description };
|
return { value: key, label: availableEvents[key].description };
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -55,7 +62,7 @@ function NewWebhookModal(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
props.onOk(webhookUrl, selectedEvents);
|
onOk(webhookUrl, selectedEvents);
|
||||||
|
|
||||||
// Reset the modal
|
// Reset the modal
|
||||||
setWebhookUrl('');
|
setWebhookUrl('');
|
||||||
@@ -69,9 +76,9 @@ function NewWebhookModal(props) {
|
|||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
title="Create New Webhook"
|
title="Create New Webhook"
|
||||||
visible={props.visible}
|
visible={visible}
|
||||||
onOk={save}
|
onOk={save}
|
||||||
onCancel={props.onCancel}
|
onCancel={onCancel}
|
||||||
okButtonProps={okButtonProps}
|
okButtonProps={okButtonProps}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
@@ -127,14 +134,19 @@ export default function Webhooks() {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const getWebhooks = async () => {
|
function handleError(error) {
|
||||||
|
console.error('error', error);
|
||||||
|
alert(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getWebhooks() {
|
||||||
try {
|
try {
|
||||||
const result = await fetchData(WEBHOOKS);
|
const result = await fetchData(WEBHOOKS);
|
||||||
setWebhooks(result);
|
setWebhooks(result);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(error);
|
handleError(error);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getWebhooks();
|
getWebhooks();
|
||||||
@@ -142,7 +154,7 @@ export default function Webhooks() {
|
|||||||
|
|
||||||
async function handleDelete(id) {
|
async function handleDelete(id) {
|
||||||
try {
|
try {
|
||||||
const result = await fetchData(DELETE_WEBHOOK, { method: 'POST', data: { id: id } });
|
await fetchData(DELETE_WEBHOOK, { method: 'POST', data: { id } });
|
||||||
getWebhooks();
|
getWebhooks();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(error);
|
handleError(error);
|
||||||
@@ -153,7 +165,7 @@ export default function Webhooks() {
|
|||||||
try {
|
try {
|
||||||
const newHook = await fetchData(CREATE_WEBHOOK, {
|
const newHook = await fetchData(CREATE_WEBHOOK, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { url: url, events: events },
|
data: { url, events },
|
||||||
});
|
});
|
||||||
setWebhooks(webhooks.concat(newHook));
|
setWebhooks(webhooks.concat(newHook));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -161,11 +173,6 @@ export default function Webhooks() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleError(error) {
|
|
||||||
console.error('error', error);
|
|
||||||
alert(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
const showCreateModal = () => {
|
const showCreateModal = () => {
|
||||||
setIsModalVisible(true);
|
setIsModalVisible(true);
|
||||||
};
|
};
|
||||||
@@ -185,7 +192,7 @@ export default function Webhooks() {
|
|||||||
<Paragraph>
|
<Paragraph>
|
||||||
A webhook is a callback made to an external API in response to an event that takes place
|
A webhook is a callback made to an external API in response to an event that takes place
|
||||||
within Owncast. This can be used to build chat bots or sending automatic notifications that
|
within Owncast. This can be used to build chat bots or sending automatic notifications that
|
||||||
you've started streaming.
|
you've started streaming.
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Paragraph>
|
<Paragraph>
|
||||||
Read more about how to use webhooks, with examples, at{' '}
|
Read more about how to use webhooks, with examples, at{' '}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
// misc styling for various /pages
|
// misc styling for various /pages
|
||||||
|
|
||||||
|
|
||||||
.help-page {
|
// .help-page {
|
||||||
.ant-result-image {
|
// .ant-result-image {
|
||||||
height: 100px;
|
// height: 100px;
|
||||||
svg {
|
// svg {
|
||||||
height: 100%;
|
// height: 100%;
|
||||||
width: 100%;
|
// width: 100%;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
.upgrade-page {
|
.upgrade-page {
|
||||||
|
|||||||
Reference in New Issue
Block a user