mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-10-04 03:40:10 +00:00
Compare commits
28 Commits
react
...
5c08a2391d
Author | SHA1 | Date | |
---|---|---|---|
|
5c08a2391d | ||
|
409c166c67 | ||
|
645b363330 | ||
|
188193a22d | ||
|
f2b9a66459 | ||
|
72b8aee234 | ||
|
cd6b2ef98f | ||
|
f1b0e816b6 | ||
|
db639c333b | ||
|
d558594031 | ||
|
4240e00a46 | ||
|
f39efb3e63 | ||
|
53507f88b3 | ||
|
553178aa6b | ||
|
17f40dd8b2 | ||
|
68b23938a8 | ||
|
2b88f56d22 | ||
|
e44748e46f | ||
|
538d28d32d | ||
|
a7d4fd55d9 | ||
|
9682de1830 | ||
|
cde7460b5e | ||
|
ca84e3a146 | ||
|
fa11945235 | ||
|
432afe73ad | ||
|
5a01da2916 | ||
|
ebd9148813 | ||
|
a12553fec7 |
@@ -1,7 +1,7 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://nginxproxymanager.com/github.png">
|
<img src="https://nginxproxymanager.com/github.png">
|
||||||
<br><br>
|
<br><br>
|
||||||
<img src="https://img.shields.io/badge/version-2.13.0-green.svg?style=for-the-badge">
|
<img src="https://img.shields.io/badge/version-2.12.6-green.svg?style=for-the-badge">
|
||||||
<a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager">
|
<a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager">
|
||||||
<img src="https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge">
|
<img src="https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge">
|
||||||
</a>
|
</a>
|
||||||
|
@@ -64,8 +64,7 @@
|
|||||||
"useUniqueElementIds": "off"
|
"useUniqueElementIds": "off"
|
||||||
},
|
},
|
||||||
"suspicious": {
|
"suspicious": {
|
||||||
"noExplicitAny": "off",
|
"noExplicitAny": "off"
|
||||||
"noArrayIndexKey": "off"
|
|
||||||
},
|
},
|
||||||
"performance": {
|
"performance": {
|
||||||
"noDelete": "off"
|
"noDelete": "off"
|
||||||
|
@@ -53,7 +53,7 @@ export interface AccessList {
|
|||||||
meta: Record<string, any>;
|
meta: Record<string, any>;
|
||||||
satisfyAny: boolean;
|
satisfyAny: boolean;
|
||||||
passAuth: boolean;
|
passAuth: boolean;
|
||||||
proxyHostCount?: number;
|
proxyHostCount: number;
|
||||||
// Expansions:
|
// Expansions:
|
||||||
owner?: User;
|
owner?: User;
|
||||||
items?: AccessListItem[];
|
items?: AccessListItem[];
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { Button } from "src/components";
|
import { Button } from "src/components";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
export function ErrorNotFound() {
|
export function ErrorNotFound() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -8,15 +8,11 @@ export function ErrorNotFound() {
|
|||||||
return (
|
return (
|
||||||
<div className="container-tight py-4">
|
<div className="container-tight py-4">
|
||||||
<div className="empty">
|
<div className="empty">
|
||||||
<p className="empty-title">
|
<p className="empty-title">{intl.formatMessage({ id: "notfound.title" })}</p>
|
||||||
<T id="notfound.title" />
|
<p className="empty-subtitle text-secondary">{intl.formatMessage({ id: "notfound.text" })}</p>
|
||||||
</p>
|
|
||||||
<p className="empty-subtitle text-secondary">
|
|
||||||
<T id="notfound.text" />
|
|
||||||
</p>
|
|
||||||
<div className="empty-action">
|
<div className="empty-action">
|
||||||
<Button type="button" size="md" onClick={() => navigate("/")}>
|
<Button type="button" size="md" onClick={() => navigate("/")}>
|
||||||
<T id="notfound.action" />
|
{intl.formatMessage({ id: "notfound.action" })}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,99 +0,0 @@
|
|||||||
import { IconLock, IconLockOpen2 } from "@tabler/icons-react";
|
|
||||||
import { Field, useFormikContext } from "formik";
|
|
||||||
import type { ReactNode } from "react";
|
|
||||||
import Select, { type ActionMeta, components, type OptionProps } from "react-select";
|
|
||||||
import type { AccessList } from "src/api/backend";
|
|
||||||
import { useAccessLists } from "src/hooks";
|
|
||||||
import { DateTimeFormat, intl, T } from "src/locale";
|
|
||||||
|
|
||||||
interface AccessOption {
|
|
||||||
readonly value: number;
|
|
||||||
readonly label: string;
|
|
||||||
readonly subLabel: string;
|
|
||||||
readonly icon: ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Option = (props: OptionProps<AccessOption>) => {
|
|
||||||
return (
|
|
||||||
<components.Option {...props}>
|
|
||||||
<div className="flex-fill">
|
|
||||||
<div className="font-weight-medium">
|
|
||||||
{props.data.icon} <strong>{props.data.label}</strong>
|
|
||||||
</div>
|
|
||||||
<div className="text-secondary mt-1 ps-3">{props.data.subLabel}</div>
|
|
||||||
</div>
|
|
||||||
</components.Option>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
id?: string;
|
|
||||||
name?: string;
|
|
||||||
label?: string;
|
|
||||||
}
|
|
||||||
export function AccessField({ name = "accessListId", label = "access.title", id = "accessListId" }: Props) {
|
|
||||||
const { isLoading, isError, error, data } = useAccessLists();
|
|
||||||
const { setFieldValue } = useFormikContext();
|
|
||||||
|
|
||||||
const handleChange = (newValue: any, _actionMeta: ActionMeta<AccessOption>) => {
|
|
||||||
setFieldValue(name, newValue?.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const options: AccessOption[] =
|
|
||||||
data?.map((item: AccessList) => ({
|
|
||||||
value: item.id || 0,
|
|
||||||
label: item.name,
|
|
||||||
subLabel: intl.formatMessage(
|
|
||||||
{ id: "access.subtitle" },
|
|
||||||
{
|
|
||||||
users: item?.items?.length,
|
|
||||||
rules: item?.clients?.length,
|
|
||||||
date: item?.createdOn ? DateTimeFormat(item?.createdOn) : "N/A",
|
|
||||||
},
|
|
||||||
),
|
|
||||||
icon: <IconLock size={14} className="text-lime" />,
|
|
||||||
})) || [];
|
|
||||||
|
|
||||||
// Public option
|
|
||||||
options?.unshift({
|
|
||||||
value: 0,
|
|
||||||
label: intl.formatMessage({ id: "access.public" }),
|
|
||||||
subLabel: "No basic auth required",
|
|
||||||
icon: <IconLockOpen2 size={14} className="text-red" />,
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Field name={name}>
|
|
||||||
{({ field, form }: any) => (
|
|
||||||
<div className="mb-3">
|
|
||||||
<label className="form-label" htmlFor={id}>
|
|
||||||
<T id={label} />
|
|
||||||
</label>
|
|
||||||
{isLoading ? <div className="placeholder placeholder-lg col-12 my-3 placeholder-glow" /> : null}
|
|
||||||
{isError ? <div className="invalid-feedback">{`${error}`}</div> : null}
|
|
||||||
{!isLoading && !isError ? (
|
|
||||||
<Select
|
|
||||||
className="react-select-container"
|
|
||||||
classNamePrefix="react-select"
|
|
||||||
defaultValue={options.find((o) => o.value === field.value) || options[0]}
|
|
||||||
options={options}
|
|
||||||
components={{ Option }}
|
|
||||||
styles={{
|
|
||||||
option: (base) => ({
|
|
||||||
...base,
|
|
||||||
height: "100%",
|
|
||||||
}),
|
|
||||||
}}
|
|
||||||
onChange={handleChange}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
{form.errors[field.name] ? (
|
|
||||||
<div className="invalid-feedback">
|
|
||||||
{form.errors[field.name] && form.touched[field.name] ? form.errors[field.name] : null}
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Field>
|
|
||||||
);
|
|
||||||
}
|
|
@@ -1,36 +0,0 @@
|
|||||||
import { useFormikContext } from "formik";
|
|
||||||
import { T } from "src/locale";
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
id?: string;
|
|
||||||
name?: string;
|
|
||||||
}
|
|
||||||
export function BasicAuthField({ name = "items", id = "items" }: Props) {
|
|
||||||
const { setFieldValue } = useFormikContext();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div className="row">
|
|
||||||
<div className="col-6">
|
|
||||||
<label className="form-label" htmlFor="...">
|
|
||||||
<T id="username" />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div className="col-6">
|
|
||||||
<label className="form-label" htmlFor="...">
|
|
||||||
<T id="password" />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="row mb-3">
|
|
||||||
<div className="col-6">
|
|
||||||
<input id="name" type="text" required autoComplete="off" className="form-control" />
|
|
||||||
</div>
|
|
||||||
<div className="col-6">
|
|
||||||
<input id="pw" type="password" required autoComplete="off" className="form-control" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button className="btn">+</button>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
@@ -10,6 +10,7 @@ interface DNSProviderOption {
|
|||||||
readonly label: string;
|
readonly label: string;
|
||||||
readonly credentials: string;
|
readonly credentials: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DNSProviderFields() {
|
export function DNSProviderFields() {
|
||||||
const { values, setFieldValue } = useFormikContext();
|
const { values, setFieldValue } = useFormikContext();
|
||||||
const { data: dnsProviders, isLoading } = useDnsProviders();
|
const { data: dnsProviders, isLoading } = useDnsProviders();
|
||||||
@@ -99,7 +100,6 @@ export function DNSProviderFields() {
|
|||||||
<input
|
<input
|
||||||
id="propagationSeconds"
|
id="propagationSeconds"
|
||||||
type="number"
|
type="number"
|
||||||
x
|
|
||||||
className="form-control"
|
className="form-control"
|
||||||
min={0}
|
min={0}
|
||||||
max={600}
|
max={600}
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
import { Field, useFormikContext } from "formik";
|
import { Field, useFormikContext } from "formik";
|
||||||
import type { ReactNode } from "react";
|
|
||||||
import type { ActionMeta, MultiValue } from "react-select";
|
import type { ActionMeta, MultiValue } from "react-select";
|
||||||
import CreatableSelect from "react-select/creatable";
|
import CreatableSelect from "react-select/creatable";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { validateDomain, validateDomains } from "src/modules/Validations";
|
import { validateDomain, validateDomains } from "src/modules/Validations";
|
||||||
|
|
||||||
type SelectOption = {
|
export type SelectOption = {
|
||||||
label: string;
|
label: string;
|
||||||
value: string;
|
value: string;
|
||||||
color?: string;
|
color?: string;
|
||||||
@@ -36,14 +35,14 @@ export function DomainNamesField({
|
|||||||
setFieldValue(name, doms);
|
setFieldValue(name, doms);
|
||||||
};
|
};
|
||||||
|
|
||||||
const helperTexts: ReactNode[] = [];
|
const helperTexts: string[] = [];
|
||||||
if (maxDomains) {
|
if (maxDomains) {
|
||||||
helperTexts.push(<T id="domain-names.max" data={{ count: maxDomains }} />);
|
helperTexts.push(intl.formatMessage({ id: "domain-names.max" }, { count: maxDomains }));
|
||||||
}
|
}
|
||||||
if (!isWildcardPermitted) {
|
if (!isWildcardPermitted) {
|
||||||
helperTexts.push(<T id="domain-names.wildcards-not-permitted" />);
|
helperTexts.push(intl.formatMessage({ id: "domain-names.wildcards-not-permitted" }));
|
||||||
} else if (!dnsProviderWildcardSupported) {
|
} else if (!dnsProviderWildcardSupported) {
|
||||||
helperTexts.push(<T id="domain-names.wildcards-not-supported" />);
|
helperTexts.push(intl.formatMessage({ id: "domain-names.wildcards-not-supported" }));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -51,7 +50,7 @@ export function DomainNamesField({
|
|||||||
{({ field, form }: any) => (
|
{({ field, form }: any) => (
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<label className="form-label" htmlFor={id}>
|
<label className="form-label" htmlFor={id}>
|
||||||
<T id={label} />
|
{intl.formatMessage({ id: label })}
|
||||||
</label>
|
</label>
|
||||||
<CreatableSelect
|
<CreatableSelect
|
||||||
className="react-select-container"
|
className="react-select-container"
|
||||||
@@ -69,8 +68,8 @@ export function DomainNamesField({
|
|||||||
{form.errors[field.name] && form.touched[field.name] ? (
|
{form.errors[field.name] && form.touched[field.name] ? (
|
||||||
<small className="text-danger">{form.errors[field.name]}</small>
|
<small className="text-danger">{form.errors[field.name]}</small>
|
||||||
) : helperTexts.length ? (
|
) : helperTexts.length ? (
|
||||||
helperTexts.map((i, idx) => (
|
helperTexts.map((i) => (
|
||||||
<small key={idx} className="text-info">
|
<small key={i} className="text-info">
|
||||||
{i}
|
{i}
|
||||||
</small>
|
</small>
|
||||||
))
|
))
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import CodeEditor from "@uiw/react-textarea-code-editor";
|
import CodeEditor from "@uiw/react-textarea-code-editor";
|
||||||
import { Field } from "formik";
|
import { Field } from "formik";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
id?: string;
|
id?: string;
|
||||||
@@ -17,7 +17,7 @@ export function NginxConfigField({
|
|||||||
{({ field }: any) => (
|
{({ field }: any) => (
|
||||||
<div className="mt-3">
|
<div className="mt-3">
|
||||||
<label htmlFor={id} className="form-label">
|
<label htmlFor={id} className="form-label">
|
||||||
<T id={label} />
|
{intl.formatMessage({ id: label })}
|
||||||
</label>
|
</label>
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
language="nginx"
|
language="nginx"
|
||||||
|
@@ -3,7 +3,7 @@ import { Field, useFormikContext } from "formik";
|
|||||||
import Select, { type ActionMeta, components, type OptionProps } from "react-select";
|
import Select, { type ActionMeta, components, type OptionProps } from "react-select";
|
||||||
import type { Certificate } from "src/api/backend";
|
import type { Certificate } from "src/api/backend";
|
||||||
import { useCertificates } from "src/hooks";
|
import { useCertificates } from "src/hooks";
|
||||||
import { DateTimeFormat, T } from "src/locale";
|
import { DateTimeFormat, intl } from "src/locale";
|
||||||
|
|
||||||
interface CertOption {
|
interface CertOption {
|
||||||
readonly value: number | "new";
|
readonly value: number | "new";
|
||||||
@@ -106,7 +106,7 @@ export function SSLCertificateField({
|
|||||||
{({ field, form }: any) => (
|
{({ field, form }: any) => (
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<label className="form-label" htmlFor={id}>
|
<label className="form-label" htmlFor={id}>
|
||||||
<T id={label} />
|
{intl.formatMessage({ id: label })}
|
||||||
</label>
|
</label>
|
||||||
{isLoading ? <div className="placeholder placeholder-lg col-12 my-3 placeholder-glow" /> : null}
|
{isLoading ? <div className="placeholder placeholder-lg col-12 my-3 placeholder-glow" /> : null}
|
||||||
{isError ? <div className="invalid-feedback">{`${error}`}</div> : null}
|
{isError ? <div className="invalid-feedback">{`${error}`}</div> : null}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import cn from "classnames";
|
import cn from "classnames";
|
||||||
import { Field, useFormikContext } from "formik";
|
import { Field, useFormikContext } from "formik";
|
||||||
import { DNSProviderFields, DomainNamesField } from "src/components";
|
import { DNSProviderFields, DomainNamesField } from "src/components";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
forHttp?: boolean; // the sslForced, http2Support, hstsEnabled, hstsSubdomains fields
|
forHttp?: boolean; // the sslForced, http2Support, hstsEnabled, hstsSubdomains fields
|
||||||
@@ -49,7 +49,7 @@ export function SSLOptionsFields({ forHttp = true, forceDNSForNew, requireDomain
|
|||||||
disabled={!hasCertificate}
|
disabled={!hasCertificate}
|
||||||
/>
|
/>
|
||||||
<span className="form-check-label">
|
<span className="form-check-label">
|
||||||
<T id="domains.force-ssl" />
|
{intl.formatMessage({ id: "domains.force-ssl" })}
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
)}
|
)}
|
||||||
@@ -67,7 +67,7 @@ export function SSLOptionsFields({ forHttp = true, forceDNSForNew, requireDomain
|
|||||||
disabled={!hasCertificate}
|
disabled={!hasCertificate}
|
||||||
/>
|
/>
|
||||||
<span className="form-check-label">
|
<span className="form-check-label">
|
||||||
<T id="domains.http2-support" />
|
{intl.formatMessage({ id: "domains.http2-support" })}
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
)}
|
)}
|
||||||
@@ -87,7 +87,7 @@ export function SSLOptionsFields({ forHttp = true, forceDNSForNew, requireDomain
|
|||||||
disabled={!hasCertificate || !sslForced}
|
disabled={!hasCertificate || !sslForced}
|
||||||
/>
|
/>
|
||||||
<span className="form-check-label">
|
<span className="form-check-label">
|
||||||
<T id="domains.hsts-enabled" />
|
{intl.formatMessage({ id: "domains.hsts-enabled" })}
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
)}
|
)}
|
||||||
@@ -105,7 +105,7 @@ export function SSLOptionsFields({ forHttp = true, forceDNSForNew, requireDomain
|
|||||||
disabled={!hasCertificate || !hstsEnabled}
|
disabled={!hasCertificate || !hstsEnabled}
|
||||||
/>
|
/>
|
||||||
<span className="form-check-label">
|
<span className="form-check-label">
|
||||||
<T id="domains.hsts-subdomains" />
|
{intl.formatMessage({ id: "domains.hsts-subdomains" })}
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
)}
|
)}
|
||||||
@@ -131,7 +131,7 @@ export function SSLOptionsFields({ forHttp = true, forceDNSForNew, requireDomain
|
|||||||
onChange={(e) => handleToggleChange(e, field.name)}
|
onChange={(e) => handleToggleChange(e, field.name)}
|
||||||
/>
|
/>
|
||||||
<span className="form-check-label">
|
<span className="form-check-label">
|
||||||
<T id="domains.use-dns" />
|
{intl.formatMessage({ id: "domains.use-dns" })}
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
)}
|
)}
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
export * from "./AccessField";
|
|
||||||
export * from "./BasicAuthField";
|
|
||||||
export * from "./DNSProviderFields";
|
export * from "./DNSProviderFields";
|
||||||
export * from "./DomainNamesField";
|
export * from "./DomainNamesField";
|
||||||
export * from "./NginxConfigField";
|
export * from "./NginxConfigField";
|
||||||
|
@@ -2,7 +2,7 @@ import type { ReactNode } from "react";
|
|||||||
import Alert from "react-bootstrap/Alert";
|
import Alert from "react-bootstrap/Alert";
|
||||||
import { Loading, LoadingPage } from "src/components";
|
import { Loading, LoadingPage } from "src/components";
|
||||||
import { useUser } from "src/hooks";
|
import { useUser } from "src/hooks";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
permission: string;
|
permission: string;
|
||||||
@@ -64,11 +64,7 @@ function HasPermission({
|
|||||||
return <>{children}</>;
|
return <>{children}</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !hideError ? (
|
return !hideError ? <Alert variant="danger">{intl.formatMessage({ id: "no-permission-error" })}</Alert> : null;
|
||||||
<Alert variant="danger">
|
|
||||||
<T id="no-permission-error" />
|
|
||||||
</Alert>
|
|
||||||
) : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export { HasPermission };
|
export { HasPermission };
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
import type { ReactNode } from "react";
|
import { intl } from "src/locale";
|
||||||
import { T } from "src/locale";
|
|
||||||
import styles from "./Loading.module.css";
|
import styles from "./Loading.module.css";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
label?: string | ReactNode;
|
label?: string;
|
||||||
noLogo?: boolean;
|
noLogo?: boolean;
|
||||||
}
|
}
|
||||||
export function Loading({ label, noLogo }: Props) {
|
export function Loading({ label, noLogo }: Props) {
|
||||||
@@ -14,7 +13,7 @@ export function Loading({ label, noLogo }: Props) {
|
|||||||
<img className={styles.logo} src="/images/logo-no-text.svg" alt="" />
|
<img className={styles.logo} src="/images/logo-no-text.svg" alt="" />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="text-secondary mb-3">{label || <T id="loading" />}</div>
|
<div className="text-secondary mb-3">{label || intl.formatMessage({ id: "loading" })}</div>
|
||||||
<div className="progress progress-sm">
|
<div className="progress progress-sm">
|
||||||
<div className="progress-bar progress-bar-indeterminate" />
|
<div className="progress-bar progress-bar-indeterminate" />
|
||||||
</div>
|
</div>
|
||||||
|
@@ -2,7 +2,7 @@ import cn from "classnames";
|
|||||||
import { Flag } from "src/components";
|
import { Flag } from "src/components";
|
||||||
import { useLocaleState } from "src/context";
|
import { useLocaleState } from "src/context";
|
||||||
import { useTheme } from "src/hooks";
|
import { useTheme } from "src/hooks";
|
||||||
import { changeLocale, getFlagCodeForLocale, localeOptions, T } from "src/locale";
|
import { changeLocale, getFlagCodeForLocale, intl, localeOptions } from "src/locale";
|
||||||
import styles from "./LocalePicker.module.css";
|
import styles from "./LocalePicker.module.css";
|
||||||
|
|
||||||
function LocalePicker() {
|
function LocalePicker() {
|
||||||
@@ -35,13 +35,34 @@ function LocalePicker() {
|
|||||||
changeTo(item[0]);
|
changeTo(item[0]);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flag countryCode={getFlagCodeForLocale(item[0])} /> <T id={`locale-${item[1]}`} />
|
<Flag countryCode={getFlagCodeForLocale(item[0])} />{" "}
|
||||||
|
{intl.formatMessage({ id: `locale-${item[1]}` })}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// <div className={className}>
|
||||||
|
// <Menu>
|
||||||
|
// <MenuButton as={Button} {...additionalProps}>
|
||||||
|
// <Flag countryCode={getFlagCodeForLocale(locale)} />
|
||||||
|
// </MenuButton>
|
||||||
|
// <MenuList>
|
||||||
|
// {localeOptions.map((item) => {
|
||||||
|
// return (
|
||||||
|
// <MenuItem
|
||||||
|
// icon={<Flag countryCode={getFlagCodeForLocale(item[0])} />}
|
||||||
|
// onClick={() => changeTo(item[0])}
|
||||||
|
// key={`locale-${item[0]}`}>
|
||||||
|
// <span>{intl.formatMessage({ id: `locale-${item[1]}` })}</span>
|
||||||
|
// </MenuItem>
|
||||||
|
// );
|
||||||
|
// })}
|
||||||
|
// </MenuList>
|
||||||
|
// </Menu>
|
||||||
|
// </Box>
|
||||||
}
|
}
|
||||||
|
|
||||||
export { LocalePicker };
|
export { LocalePicker };
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { useHealth } from "src/hooks";
|
import { useHealth } from "src/hooks";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
export function SiteFooter() {
|
export function SiteFooter() {
|
||||||
const health = useHealth();
|
const health = useHealth();
|
||||||
@@ -25,7 +25,7 @@ export function SiteFooter() {
|
|||||||
className="link-secondary"
|
className="link-secondary"
|
||||||
rel="noopener"
|
rel="noopener"
|
||||||
>
|
>
|
||||||
<T id="footer.github-fork" />
|
{intl.formatMessage({ id: "footer.github-fork" })}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@@ -3,7 +3,7 @@ import { useState } from "react";
|
|||||||
import { LocalePicker, ThemeSwitcher } from "src/components";
|
import { LocalePicker, ThemeSwitcher } from "src/components";
|
||||||
import { useAuthState } from "src/context";
|
import { useAuthState } from "src/context";
|
||||||
import { useUser } from "src/hooks";
|
import { useUser } from "src/hooks";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { ChangePasswordModal, UserModal } from "src/modals";
|
import { ChangePasswordModal, UserModal } from "src/modals";
|
||||||
import styles from "./SiteHeader.module.css";
|
import styles from "./SiteHeader.module.css";
|
||||||
|
|
||||||
@@ -66,7 +66,9 @@ export function SiteHeader() {
|
|||||||
<div className="d-none d-xl-block ps-2">
|
<div className="d-none d-xl-block ps-2">
|
||||||
<div>{currentUser?.nickname}</div>
|
<div>{currentUser?.nickname}</div>
|
||||||
<div className="mt-1 small text-secondary">
|
<div className="mt-1 small text-secondary">
|
||||||
<T id={isAdmin ? "role.admin" : "role.standard-user"} />
|
{intl.formatMessage({
|
||||||
|
id: isAdmin ? "role.admin" : "role.standard-user",
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
@@ -80,7 +82,7 @@ export function SiteHeader() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconUser width={18} />
|
<IconUser width={18} />
|
||||||
<T id="user.edit-profile" />
|
{intl.formatMessage({ id: "user.edit-profile" })}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
href="?"
|
href="?"
|
||||||
@@ -91,7 +93,7 @@ export function SiteHeader() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconLock width={18} />
|
<IconLock width={18} />
|
||||||
<T id="user.change-password" />
|
{intl.formatMessage({ id: "user.change-password" })}
|
||||||
</a>
|
</a>
|
||||||
<div className="dropdown-divider" />
|
<div className="dropdown-divider" />
|
||||||
<a
|
<a
|
||||||
@@ -103,7 +105,7 @@ export function SiteHeader() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconLogout width={18} />
|
<IconLogout width={18} />
|
||||||
<T id="user.logout" />
|
{intl.formatMessage({ id: "user.logout" })}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -10,7 +10,7 @@ import {
|
|||||||
import cn from "classnames";
|
import cn from "classnames";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { HasPermission, NavLink } from "src/components";
|
import { HasPermission, NavLink } from "src/components";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface MenuItem {
|
interface MenuItem {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -108,9 +108,7 @@ const getMenuItem = (item: MenuItem, onClick?: () => void) => {
|
|||||||
<span className="nav-link-icon d-md-none d-lg-inline-block">
|
<span className="nav-link-icon d-md-none d-lg-inline-block">
|
||||||
{item.icon && React.createElement(item.icon, { height: 24, width: 24 })}
|
{item.icon && React.createElement(item.icon, { height: 24, width: 24 })}
|
||||||
</span>
|
</span>
|
||||||
<span className="nav-link-title">
|
<span className="nav-link-title">{intl.formatMessage({ id: item.label })}</span>
|
||||||
<T id={item.label} />
|
|
||||||
</span>
|
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</li>
|
</li>
|
||||||
</HasPermission>
|
</HasPermission>
|
||||||
@@ -138,9 +136,7 @@ const getMenuDropown = (item: MenuItem, onClick?: () => void) => {
|
|||||||
<span className="nav-link-icon d-md-none d-lg-inline-block">
|
<span className="nav-link-icon d-md-none d-lg-inline-block">
|
||||||
<IconDeviceDesktop height={24} width={24} />
|
<IconDeviceDesktop height={24} width={24} />
|
||||||
</span>
|
</span>
|
||||||
<span className="nav-link-title">
|
<span className="nav-link-title">{intl.formatMessage({ id: item.label })}</span>
|
||||||
<T id={item.label} />
|
|
||||||
</span>
|
|
||||||
</a>
|
</a>
|
||||||
<div className="dropdown-menu">
|
<div className="dropdown-menu">
|
||||||
{item.items?.map((subitem, idx) => {
|
{item.items?.map((subitem, idx) => {
|
||||||
@@ -152,7 +148,7 @@ const getMenuDropown = (item: MenuItem, onClick?: () => void) => {
|
|||||||
hideError
|
hideError
|
||||||
>
|
>
|
||||||
<NavLink to={subitem.to} isDropdownItem onClick={onClick}>
|
<NavLink to={subitem.to} isDropdownItem onClick={onClick}>
|
||||||
<T id={subitem.label} />
|
{intl.formatMessage({ id: subitem.label })}
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</HasPermission>
|
</HasPermission>
|
||||||
);
|
);
|
||||||
|
@@ -1,9 +1,13 @@
|
|||||||
import type { Certificate } from "src/api/backend";
|
import type { Certificate } from "src/api/backend";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
certificate?: Certificate;
|
certificate?: Certificate;
|
||||||
}
|
}
|
||||||
export function CertificateFormatter({ certificate }: Props) {
|
export function CertificateFormatter({ certificate }: Props) {
|
||||||
return <T id={certificate ? "lets-encrypt" : "http-only"} />;
|
if (certificate) {
|
||||||
|
return intl.formatMessage({ id: "lets-encrypt" });
|
||||||
|
}
|
||||||
|
|
||||||
|
return intl.formatMessage({ id: "http-only" });
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { DateTimeFormat, T } from "src/locale";
|
import { DateTimeFormat, intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
domains: string[];
|
domains: string[];
|
||||||
@@ -34,7 +34,7 @@ export function DomainsFormatter({ domains, createdOn }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
{createdOn ? (
|
{createdOn ? (
|
||||||
<div className="text-secondary mt-1">
|
<div className="text-secondary mt-1">
|
||||||
<T id="created-on" data={{ date: DateTimeFormat(createdOn) }} />
|
{intl.formatMessage({ id: "created-on" }, { date: DateTimeFormat(createdOn) })}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,13 +1,11 @@
|
|||||||
import cn from "classnames";
|
import { intl } from "src/locale";
|
||||||
import { T } from "src/locale";
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
}
|
}
|
||||||
export function EnabledFormatter({ enabled }: Props) {
|
export function EnabledFormatter({ enabled }: Props) {
|
||||||
return (
|
if (enabled) {
|
||||||
<span className={cn("badge", enabled ? "bg-lime-lt" : "bg-red-lt")}>
|
return <span className="badge bg-lime-lt">{intl.formatMessage({ id: "enabled" })}</span>;
|
||||||
<T id={enabled ? "enabled" : "disabled"} />
|
}
|
||||||
</span>
|
return <span className="badge bg-red-lt">{intl.formatMessage({ id: "disabled" })}</span>;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,10 @@
|
|||||||
import { IconArrowsCross, IconBolt, IconBoltOff, IconDisc, IconUser } from "@tabler/icons-react";
|
import { IconArrowsCross, IconBolt, IconBoltOff, IconDisc, IconUser } from "@tabler/icons-react";
|
||||||
import type { AuditLog } from "src/api/backend";
|
import type { AuditLog } from "src/api/backend";
|
||||||
import { DateTimeFormat, T } from "src/locale";
|
import { DateTimeFormat, intl } from "src/locale";
|
||||||
|
|
||||||
|
const getEventTitle = (event: AuditLog) => (
|
||||||
|
<span>{intl.formatMessage({ id: `event.${event.action}-${event.objectType}` })}</span>
|
||||||
|
);
|
||||||
|
|
||||||
const getEventValue = (event: AuditLog) => {
|
const getEventValue = (event: AuditLog) => {
|
||||||
switch (event.objectType) {
|
switch (event.objectType) {
|
||||||
@@ -59,9 +63,7 @@ export function EventFormatter({ row }: Props) {
|
|||||||
return (
|
return (
|
||||||
<div className="flex-fill">
|
<div className="flex-fill">
|
||||||
<div className="font-weight-medium">
|
<div className="font-weight-medium">
|
||||||
{getIcon(row)}
|
{getIcon(row)} {getEventTitle(row)} — <span className="badge">{getEventValue(row)}</span>
|
||||||
<T id={`event.${row.action}-${row.objectType}`} />
|
|
||||||
— <span className="badge">{getEventValue(row)}</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="text-secondary mt-1">{DateTimeFormat(row.createdOn)}</div>
|
<div className="text-secondary mt-1">{DateTimeFormat(row.createdOn)}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
roles: string[];
|
roles: string[];
|
||||||
@@ -12,7 +12,7 @@ export function RolesFormatter({ roles }: Props) {
|
|||||||
<>
|
<>
|
||||||
{r.map((role: string) => (
|
{r.map((role: string) => (
|
||||||
<span key={role} className="badge bg-yellow-lt me-1">
|
<span key={role} className="badge bg-yellow-lt me-1">
|
||||||
<T id={`role.${role}`} />
|
{intl.formatMessage({ id: `role.${role}` })}
|
||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
|
@@ -1,13 +1,11 @@
|
|||||||
import cn from "classnames";
|
import { intl } from "src/locale";
|
||||||
import { T } from "src/locale";
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
}
|
}
|
||||||
export function StatusFormatter({ enabled }: Props) {
|
export function StatusFormatter({ enabled }: Props) {
|
||||||
return (
|
if (enabled) {
|
||||||
<span className={cn("badge", enabled ? "bg-lime-lt" : "bg-red-lt")}>
|
return <span className="badge bg-lime-lt">{intl.formatMessage({ id: "online" })}</span>;
|
||||||
<T id={enabled ? "online" : "offline"} />
|
}
|
||||||
</span>
|
return <span className="badge bg-red-lt">{intl.formatMessage({ id: "offline" })}</span>;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { DateTimeFormat, T } from "src/locale";
|
import { DateTimeFormat, intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value: string;
|
value: string;
|
||||||
@@ -13,7 +13,9 @@ export function ValueWithDateFormatter({ value, createdOn, disabled }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
{createdOn ? (
|
{createdOn ? (
|
||||||
<div className={`text-secondary mt-1 ${disabled ? "text-red" : ""}`}>
|
<div className={`text-secondary mt-1 ${disabled ? "text-red" : ""}`}>
|
||||||
<T id={disabled ? "disabled" : "created-on"} data={{ date: DateTimeFormat(createdOn) }} />
|
{disabled
|
||||||
|
? intl.formatMessage({ id: "disabled" })
|
||||||
|
: intl.formatMessage({ id: "created-on" }, { date: DateTimeFormat(createdOn) })}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
export * from "./useAccessList";
|
|
||||||
export * from "./useAccessLists";
|
export * from "./useAccessLists";
|
||||||
export * from "./useAuditLog";
|
export * from "./useAuditLog";
|
||||||
export * from "./useAuditLogs";
|
export * from "./useAuditLogs";
|
||||||
|
@@ -1,53 +0,0 @@
|
|||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
||||||
import { type AccessList, createAccessList, getAccessList, updateAccessList } from "src/api/backend";
|
|
||||||
|
|
||||||
const fetchAccessList = (id: number | "new") => {
|
|
||||||
if (id === "new") {
|
|
||||||
return Promise.resolve({
|
|
||||||
id: 0,
|
|
||||||
createdOn: "",
|
|
||||||
modifiedOn: "",
|
|
||||||
ownerUserId: 0,
|
|
||||||
name: "",
|
|
||||||
satisfyAny: false,
|
|
||||||
passAuth: false,
|
|
||||||
meta: {},
|
|
||||||
} as AccessList);
|
|
||||||
}
|
|
||||||
return getAccessList(id, ["owner"]);
|
|
||||||
};
|
|
||||||
|
|
||||||
const useAccessList = (id: number | "new", options = {}) => {
|
|
||||||
return useQuery<AccessList, Error>({
|
|
||||||
queryKey: ["access-list", id],
|
|
||||||
queryFn: () => fetchAccessList(id),
|
|
||||||
staleTime: 60 * 1000, // 1 minute
|
|
||||||
...options,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const useSetAccessList = () => {
|
|
||||||
const queryClient = useQueryClient();
|
|
||||||
return useMutation({
|
|
||||||
mutationFn: (values: AccessList) => (values.id ? updateAccessList(values) : createAccessList(values)),
|
|
||||||
onMutate: (values: AccessList) => {
|
|
||||||
if (!values.id) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const previousObject = queryClient.getQueryData(["access-list", values.id]);
|
|
||||||
queryClient.setQueryData(["access-list", values.id], (old: AccessList) => ({
|
|
||||||
...old,
|
|
||||||
...values,
|
|
||||||
}));
|
|
||||||
return () => queryClient.setQueryData(["access-list", values.id], previousObject);
|
|
||||||
},
|
|
||||||
onError: (_, __, rollback: any) => rollback(),
|
|
||||||
onSuccess: async ({ id }: AccessList) => {
|
|
||||||
queryClient.invalidateQueries({ queryKey: ["access-list", id] });
|
|
||||||
queryClient.invalidateQueries({ queryKey: ["access-list"] });
|
|
||||||
queryClient.invalidateQueries({ queryKey: ["audit-logs"] });
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export { useAccessList, useSetAccessList };
|
|
@@ -61,10 +61,4 @@ const changeLocale = (locale: string): void => {
|
|||||||
document.documentElement.lang = locale;
|
document.documentElement.lang = locale;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is a translation component that wraps the translation in a span with a data
|
export { localeOptions, getFlagCodeForLocale, getLocale, createIntl, changeLocale, intl };
|
||||||
// attribute so devs can inspect the element to see the translation ID
|
|
||||||
const T = ({ id, data }: { id: string; data?: any }) => {
|
|
||||||
return <span data-translation-id={id}>{intl.formatMessage({ id }, data)}</span>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export { localeOptions, getFlagCodeForLocale, getLocale, createIntl, changeLocale, intl, T };
|
|
||||||
|
@@ -3,13 +3,9 @@
|
|||||||
"access.actions-title": "Access List #{id}",
|
"access.actions-title": "Access List #{id}",
|
||||||
"access.add": "Add Access List",
|
"access.add": "Add Access List",
|
||||||
"access.auth-count": "{count} Users",
|
"access.auth-count": "{count} Users",
|
||||||
"access.edit": "Edit Access",
|
|
||||||
"access.empty": "There are no Access Lists",
|
"access.empty": "There are no Access Lists",
|
||||||
"access.new": "New Access",
|
"access.satisfy-all": "All",
|
||||||
"access.pass-auth": "Pass Auth to Upstream",
|
"access.satisfy-any": "Any",
|
||||||
"access.public": "Publicly Accessible",
|
|
||||||
"access.satisfy-any": "Satisfy Any",
|
|
||||||
"access.subtitle": "{users} User, {rules} Rules - Created: {date}",
|
|
||||||
"access.title": "Access",
|
"access.title": "Access",
|
||||||
"action.delete": "Delete",
|
"action.delete": "Delete",
|
||||||
"action.disable": "Disable",
|
"action.disable": "Disable",
|
||||||
@@ -27,7 +23,6 @@
|
|||||||
"close": "Close",
|
"close": "Close",
|
||||||
"column.access": "Access",
|
"column.access": "Access",
|
||||||
"column.authorization": "Authorization",
|
"column.authorization": "Authorization",
|
||||||
"column.authorizations": "Authorizations",
|
|
||||||
"column.custom-locations": "Custom Locations",
|
"column.custom-locations": "Custom Locations",
|
||||||
"column.destination": "Destination",
|
"column.destination": "Destination",
|
||||||
"column.details": "Details",
|
"column.details": "Details",
|
||||||
@@ -40,10 +35,7 @@
|
|||||||
"column.protocol": "Protocol",
|
"column.protocol": "Protocol",
|
||||||
"column.provider": "Provider",
|
"column.provider": "Provider",
|
||||||
"column.roles": "Roles",
|
"column.roles": "Roles",
|
||||||
"column.rules": "Rules",
|
|
||||||
"column.satisfy": "Satisfy",
|
"column.satisfy": "Satisfy",
|
||||||
"column.satisfy-all": "All",
|
|
||||||
"column.satisfy-any": "Any",
|
|
||||||
"column.scheme": "Scheme",
|
"column.scheme": "Scheme",
|
||||||
"column.source": "Source",
|
"column.source": "Source",
|
||||||
"column.ssl": "SSL",
|
"column.ssl": "SSL",
|
||||||
@@ -96,11 +88,11 @@
|
|||||||
"event.updated-redirection-host": "Updated Redirection Host",
|
"event.updated-redirection-host": "Updated Redirection Host",
|
||||||
"event.updated-user": "Updated User",
|
"event.updated-user": "Updated User",
|
||||||
"footer.github-fork": "Fork me on Github",
|
"footer.github-fork": "Fork me on Github",
|
||||||
"generic.flags.title": "Options",
|
|
||||||
"host.flags.block-exploits": "Block Common Exploits",
|
"host.flags.block-exploits": "Block Common Exploits",
|
||||||
"host.flags.cache-assets": "Cache Assets",
|
"host.flags.cache-assets": "Cache Assets",
|
||||||
"host.flags.preserve-path": "Preserve Path",
|
"host.flags.preserve-path": "Preserve Path",
|
||||||
"host.flags.protocols": "Protocols",
|
"host.flags.protocols": "Protocols",
|
||||||
|
"host.flags.title": "Options",
|
||||||
"host.flags.websockets-upgrade": "Websockets Support",
|
"host.flags.websockets-upgrade": "Websockets Support",
|
||||||
"host.forward-port": "Forward Port",
|
"host.forward-port": "Forward Port",
|
||||||
"host.forward-scheme": "Scheme",
|
"host.forward-scheme": "Scheme",
|
||||||
@@ -115,7 +107,6 @@
|
|||||||
"notfound.action": "Take me home",
|
"notfound.action": "Take me home",
|
||||||
"notfound.text": "We are sorry but the page you are looking for was not found",
|
"notfound.text": "We are sorry but the page you are looking for was not found",
|
||||||
"notfound.title": "Oops… You just found an error page",
|
"notfound.title": "Oops… You just found an error page",
|
||||||
"notification.access-saved": "Access has been saved",
|
|
||||||
"notification.dead-host-saved": "404 Host has been saved",
|
"notification.dead-host-saved": "404 Host has been saved",
|
||||||
"notification.error": "Error",
|
"notification.error": "Error",
|
||||||
"notification.host-deleted": "Host has been deleted",
|
"notification.host-deleted": "Host has been deleted",
|
||||||
@@ -149,8 +140,6 @@
|
|||||||
"proxy-hosts.count": "{count} Proxy Hosts",
|
"proxy-hosts.count": "{count} Proxy Hosts",
|
||||||
"proxy-hosts.empty": "There are no Proxy Hosts",
|
"proxy-hosts.empty": "There are no Proxy Hosts",
|
||||||
"proxy-hosts.title": "Proxy Hosts",
|
"proxy-hosts.title": "Proxy Hosts",
|
||||||
"redirection-host.delete.content": "Are you sure you want to delete this Redirection host?",
|
|
||||||
"redirection-host.delete.title": "Delete Redirection Host",
|
|
||||||
"redirection-host.forward-domain": "Forward Domain",
|
"redirection-host.forward-domain": "Forward Domain",
|
||||||
"redirection-host.new": "New Redirection Host",
|
"redirection-host.new": "New Redirection Host",
|
||||||
"redirection-hosts.actions-title": "Redirection Host #{id}",
|
"redirection-hosts.actions-title": "Redirection Host #{id}",
|
||||||
@@ -168,7 +157,6 @@
|
|||||||
"ssl-certificate": "SSL Certificate",
|
"ssl-certificate": "SSL Certificate",
|
||||||
"stream.delete.content": "Are you sure you want to delete this Stream?",
|
"stream.delete.content": "Are you sure you want to delete this Stream?",
|
||||||
"stream.delete.title": "Delete Stream",
|
"stream.delete.title": "Delete Stream",
|
||||||
"stream.edit": "Edit Stream",
|
|
||||||
"stream.forward-host": "Forward Host",
|
"stream.forward-host": "Forward Host",
|
||||||
"stream.incoming-port": "Incoming Port",
|
"stream.incoming-port": "Incoming Port",
|
||||||
"stream.new": "New Stream",
|
"stream.new": "New Stream",
|
||||||
@@ -196,7 +184,6 @@
|
|||||||
"user.set-permissions": "Set Permissions for {name}",
|
"user.set-permissions": "Set Permissions for {name}",
|
||||||
"user.switch-dark": "Switch to Dark mode",
|
"user.switch-dark": "Switch to Dark mode",
|
||||||
"user.switch-light": "Switch to Light mode",
|
"user.switch-light": "Switch to Light mode",
|
||||||
"username": "Username",
|
|
||||||
"users.actions-title": "User #{id}",
|
"users.actions-title": "User #{id}",
|
||||||
"users.add": "Add User",
|
"users.add": "Add User",
|
||||||
"users.empty": "There are no Users",
|
"users.empty": "There are no Users",
|
||||||
|
@@ -11,26 +11,14 @@
|
|||||||
"access.auth-count": {
|
"access.auth-count": {
|
||||||
"defaultMessage": "{count} Users"
|
"defaultMessage": "{count} Users"
|
||||||
},
|
},
|
||||||
"access.edit": {
|
|
||||||
"defaultMessage": "Edit Access"
|
|
||||||
},
|
|
||||||
"access.empty": {
|
"access.empty": {
|
||||||
"defaultMessage": "There are no Access Lists"
|
"defaultMessage": "There are no Access Lists"
|
||||||
},
|
},
|
||||||
"access.new": {
|
"access.satisfy-all": {
|
||||||
"defaultMessage": "New Access"
|
"defaultMessage": "All"
|
||||||
},
|
|
||||||
"access.pass-auth": {
|
|
||||||
"defaultMessage": "Pass Auth to Upstream"
|
|
||||||
},
|
|
||||||
"access.public": {
|
|
||||||
"defaultMessage": "Publicly Accessible"
|
|
||||||
},
|
},
|
||||||
"access.satisfy-any": {
|
"access.satisfy-any": {
|
||||||
"defaultMessage": "Satisfy Any"
|
"defaultMessage": "Any"
|
||||||
},
|
|
||||||
"access.subtitle": {
|
|
||||||
"defaultMessage": "{users} User, {rules} Rules - Created: {date}"
|
|
||||||
},
|
},
|
||||||
"access.title": {
|
"access.title": {
|
||||||
"defaultMessage": "Access"
|
"defaultMessage": "Access"
|
||||||
@@ -83,9 +71,6 @@
|
|||||||
"column.authorization": {
|
"column.authorization": {
|
||||||
"defaultMessage": "Authorization"
|
"defaultMessage": "Authorization"
|
||||||
},
|
},
|
||||||
"column.authorizations": {
|
|
||||||
"defaultMessage": "Authorizations"
|
|
||||||
},
|
|
||||||
"column.custom-locations": {
|
"column.custom-locations": {
|
||||||
"defaultMessage": "Custom Locations"
|
"defaultMessage": "Custom Locations"
|
||||||
},
|
},
|
||||||
@@ -122,18 +107,9 @@
|
|||||||
"column.roles": {
|
"column.roles": {
|
||||||
"defaultMessage": "Roles"
|
"defaultMessage": "Roles"
|
||||||
},
|
},
|
||||||
"column.rules": {
|
|
||||||
"defaultMessage": "Rules"
|
|
||||||
},
|
|
||||||
"column.satisfy": {
|
"column.satisfy": {
|
||||||
"defaultMessage": "Satisfy"
|
"defaultMessage": "Satisfy"
|
||||||
},
|
},
|
||||||
"column.satisfy-all": {
|
|
||||||
"defaultMessage": "All"
|
|
||||||
},
|
|
||||||
"column.satisfy-any": {
|
|
||||||
"defaultMessage": "Any"
|
|
||||||
},
|
|
||||||
"column.scheme": {
|
"column.scheme": {
|
||||||
"defaultMessage": "Scheme"
|
"defaultMessage": "Scheme"
|
||||||
},
|
},
|
||||||
@@ -290,9 +266,6 @@
|
|||||||
"footer.github-fork": {
|
"footer.github-fork": {
|
||||||
"defaultMessage": "Fork me on Github"
|
"defaultMessage": "Fork me on Github"
|
||||||
},
|
},
|
||||||
"generic.flags.title": {
|
|
||||||
"defaultMessage": "Options"
|
|
||||||
},
|
|
||||||
"host.flags.block-exploits": {
|
"host.flags.block-exploits": {
|
||||||
"defaultMessage": "Block Common Exploits"
|
"defaultMessage": "Block Common Exploits"
|
||||||
},
|
},
|
||||||
@@ -305,6 +278,9 @@
|
|||||||
"host.flags.protocols": {
|
"host.flags.protocols": {
|
||||||
"defaultMessage": "Protocols"
|
"defaultMessage": "Protocols"
|
||||||
},
|
},
|
||||||
|
"host.flags.title": {
|
||||||
|
"defaultMessage": "Options"
|
||||||
|
},
|
||||||
"host.flags.websockets-upgrade": {
|
"host.flags.websockets-upgrade": {
|
||||||
"defaultMessage": "Websockets Support"
|
"defaultMessage": "Websockets Support"
|
||||||
},
|
},
|
||||||
@@ -347,9 +323,6 @@
|
|||||||
"notfound.title": {
|
"notfound.title": {
|
||||||
"defaultMessage": "Oops… You just found an error page"
|
"defaultMessage": "Oops… You just found an error page"
|
||||||
},
|
},
|
||||||
"notification.access-saved": {
|
|
||||||
"defaultMessage": "Access has been saved"
|
|
||||||
},
|
|
||||||
"notification.dead-host-saved": {
|
"notification.dead-host-saved": {
|
||||||
"defaultMessage": "404 Host has been saved"
|
"defaultMessage": "404 Host has been saved"
|
||||||
},
|
},
|
||||||
@@ -449,12 +422,6 @@
|
|||||||
"proxy-hosts.title": {
|
"proxy-hosts.title": {
|
||||||
"defaultMessage": "Proxy Hosts"
|
"defaultMessage": "Proxy Hosts"
|
||||||
},
|
},
|
||||||
"redirection-host.delete.content": {
|
|
||||||
"defaultMessage": "Are you sure you want to delete this Redirection host?"
|
|
||||||
},
|
|
||||||
"redirection-host.delete.title": {
|
|
||||||
"defaultMessage": "Delete Redirection Host"
|
|
||||||
},
|
|
||||||
"redirection-host.forward-domain": {
|
"redirection-host.forward-domain": {
|
||||||
"defaultMessage": "Forward Domain"
|
"defaultMessage": "Forward Domain"
|
||||||
},
|
},
|
||||||
@@ -506,9 +473,6 @@
|
|||||||
"stream.delete.title": {
|
"stream.delete.title": {
|
||||||
"defaultMessage": "Delete Stream"
|
"defaultMessage": "Delete Stream"
|
||||||
},
|
},
|
||||||
"stream.edit": {
|
|
||||||
"defaultMessage": "Edit Stream"
|
|
||||||
},
|
|
||||||
"stream.forward-host": {
|
"stream.forward-host": {
|
||||||
"defaultMessage": "Forward Host"
|
"defaultMessage": "Forward Host"
|
||||||
},
|
},
|
||||||
@@ -590,9 +554,6 @@
|
|||||||
"user.switch-light": {
|
"user.switch-light": {
|
||||||
"defaultMessage": "Switch to Light mode"
|
"defaultMessage": "Switch to Light mode"
|
||||||
},
|
},
|
||||||
"username": {
|
|
||||||
"defaultMessage": "Username"
|
|
||||||
},
|
|
||||||
"users.actions-title": {
|
"users.actions-title": {
|
||||||
"defaultMessage": "User #{id}"
|
"defaultMessage": "User #{id}"
|
||||||
},
|
},
|
||||||
|
@@ -1,243 +0,0 @@
|
|||||||
import cn from "classnames";
|
|
||||||
import { Field, Form, Formik } from "formik";
|
|
||||||
import { type ReactNode, useState } from "react";
|
|
||||||
import { Alert } from "react-bootstrap";
|
|
||||||
import Modal from "react-bootstrap/Modal";
|
|
||||||
import { BasicAuthField, Button, Loading } from "src/components";
|
|
||||||
import { useAccessList, useSetAccessList } from "src/hooks";
|
|
||||||
import { intl, T } from "src/locale";
|
|
||||||
import { validateString } from "src/modules/Validations";
|
|
||||||
import { showSuccess } from "src/notifications";
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
id: number | "new";
|
|
||||||
onClose: () => void;
|
|
||||||
}
|
|
||||||
export function AccessListModal({ id, onClose }: Props) {
|
|
||||||
const { data, isLoading, error } = useAccessList(id);
|
|
||||||
const { mutate: setAccessList } = useSetAccessList();
|
|
||||||
const [errorMsg, setErrorMsg] = useState<ReactNode | null>(null);
|
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
||||||
|
|
||||||
const onSubmit = async (values: any, { setSubmitting }: any) => {
|
|
||||||
if (isSubmitting) return;
|
|
||||||
setIsSubmitting(true);
|
|
||||||
setErrorMsg(null);
|
|
||||||
|
|
||||||
const { ...payload } = {
|
|
||||||
id: id === "new" ? undefined : id,
|
|
||||||
...values,
|
|
||||||
};
|
|
||||||
|
|
||||||
setAccessList(payload, {
|
|
||||||
onError: (err: any) => setErrorMsg(<T id={err.message} />),
|
|
||||||
onSuccess: () => {
|
|
||||||
showSuccess(intl.formatMessage({ id: "notification.access-saved" }));
|
|
||||||
onClose();
|
|
||||||
},
|
|
||||||
onSettled: () => {
|
|
||||||
setIsSubmitting(false);
|
|
||||||
setSubmitting(false);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const toggleClasses = "form-check-input";
|
|
||||||
const toggleEnabled = cn(toggleClasses, "bg-cyan");
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal show onHide={onClose} animation={false}>
|
|
||||||
{!isLoading && error && (
|
|
||||||
<Alert variant="danger" className="m-3">
|
|
||||||
{error?.message || "Unknown error"}
|
|
||||||
</Alert>
|
|
||||||
)}
|
|
||||||
{isLoading && <Loading noLogo />}
|
|
||||||
{!isLoading && data && (
|
|
||||||
<Formik
|
|
||||||
initialValues={
|
|
||||||
{
|
|
||||||
name: data?.name,
|
|
||||||
satisfyAny: data?.satisfyAny,
|
|
||||||
passAuth: data?.passAuth,
|
|
||||||
// todo: more? there's stuff missing here?
|
|
||||||
meta: data?.meta || {},
|
|
||||||
} as any
|
|
||||||
}
|
|
||||||
onSubmit={onSubmit}
|
|
||||||
>
|
|
||||||
{({ setFieldValue }: any) => (
|
|
||||||
<Form>
|
|
||||||
<Modal.Header closeButton>
|
|
||||||
<Modal.Title>
|
|
||||||
<T id={data?.id ? "access.edit" : "access.new"} />
|
|
||||||
</Modal.Title>
|
|
||||||
</Modal.Header>
|
|
||||||
<Modal.Body className="p-0">
|
|
||||||
<Alert variant="danger" show={!!errorMsg} onClose={() => setErrorMsg(null)} dismissible>
|
|
||||||
{errorMsg}
|
|
||||||
</Alert>
|
|
||||||
<div className="card m-0 border-0">
|
|
||||||
<div className="card-header">
|
|
||||||
<ul className="nav nav-tabs card-header-tabs" data-bs-toggle="tabs">
|
|
||||||
<li className="nav-item" role="presentation">
|
|
||||||
<a
|
|
||||||
href="#tab-details"
|
|
||||||
className="nav-link active"
|
|
||||||
data-bs-toggle="tab"
|
|
||||||
aria-selected="true"
|
|
||||||
role="tab"
|
|
||||||
>
|
|
||||||
<T id="column.details" />
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li className="nav-item" role="presentation">
|
|
||||||
<a
|
|
||||||
href="#tab-auth"
|
|
||||||
className="nav-link"
|
|
||||||
data-bs-toggle="tab"
|
|
||||||
aria-selected="false"
|
|
||||||
tabIndex={-1}
|
|
||||||
role="tab"
|
|
||||||
>
|
|
||||||
<T id="column.authorizations" />
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li className="nav-item" role="presentation">
|
|
||||||
<a
|
|
||||||
href="#tab-access"
|
|
||||||
className="nav-link"
|
|
||||||
data-bs-toggle="tab"
|
|
||||||
aria-selected="false"
|
|
||||||
tabIndex={-1}
|
|
||||||
role="tab"
|
|
||||||
>
|
|
||||||
<T id="column.rules" />
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div className="card-body">
|
|
||||||
<div className="tab-content">
|
|
||||||
<div className="tab-pane active show" id="tab-details" role="tabpanel">
|
|
||||||
<Field name="name" validate={validateString(8, 255)}>
|
|
||||||
{({ field }: any) => (
|
|
||||||
<div>
|
|
||||||
<label htmlFor="name" className="form-label">
|
|
||||||
<T id="column.name" />
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="name"
|
|
||||||
type="text"
|
|
||||||
required
|
|
||||||
autoComplete="off"
|
|
||||||
className="form-control"
|
|
||||||
{...field}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Field>
|
|
||||||
<div className="my-3">
|
|
||||||
<h3 className="py-2">
|
|
||||||
<T id="generic.flags.title" />
|
|
||||||
</h3>
|
|
||||||
<div className="divide-y">
|
|
||||||
<div>
|
|
||||||
<label className="row" htmlFor="satisfyAny">
|
|
||||||
<span className="col">
|
|
||||||
<T id="access.satisfy-any" />
|
|
||||||
</span>
|
|
||||||
<span className="col-auto">
|
|
||||||
<Field name="satisfyAny" type="checkbox">
|
|
||||||
{({ field }: any) => (
|
|
||||||
<label className="form-check form-check-single form-switch">
|
|
||||||
<input
|
|
||||||
id="satisfyAny"
|
|
||||||
className={
|
|
||||||
field.value
|
|
||||||
? toggleEnabled
|
|
||||||
: toggleClasses
|
|
||||||
}
|
|
||||||
type="checkbox"
|
|
||||||
name={field.name}
|
|
||||||
checked={field.value}
|
|
||||||
onChange={(e: any) => {
|
|
||||||
setFieldValue(
|
|
||||||
field.name,
|
|
||||||
e.target.checked,
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
)}
|
|
||||||
</Field>
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label className="row" htmlFor="passAuth">
|
|
||||||
<span className="col">
|
|
||||||
<T id="access.pass-auth" />
|
|
||||||
</span>
|
|
||||||
<span className="col-auto">
|
|
||||||
<Field name="passAuth" type="checkbox">
|
|
||||||
{({ field }: any) => (
|
|
||||||
<label className="form-check form-check-single form-switch">
|
|
||||||
<input
|
|
||||||
id="passAuth"
|
|
||||||
className={
|
|
||||||
field.value
|
|
||||||
? toggleEnabled
|
|
||||||
: toggleClasses
|
|
||||||
}
|
|
||||||
type="checkbox"
|
|
||||||
name={field.name}
|
|
||||||
checked={field.value}
|
|
||||||
onChange={(e: any) => {
|
|
||||||
setFieldValue(
|
|
||||||
field.name,
|
|
||||||
e.target.checked,
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
)}
|
|
||||||
</Field>
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="tab-pane" id="tab-auth" role="tabpanel">
|
|
||||||
<BasicAuthField />
|
|
||||||
</div>
|
|
||||||
<div className="tab-pane" id="tab-rules" role="tabpanel">
|
|
||||||
todo
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Modal.Body>
|
|
||||||
<Modal.Footer>
|
|
||||||
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
|
||||||
<T id="cancel" />
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
type="submit"
|
|
||||||
actionType="primary"
|
|
||||||
className="ms-auto bg-cyan"
|
|
||||||
data-bs-dismiss="modal"
|
|
||||||
isLoading={isSubmitting}
|
|
||||||
disabled={isSubmitting}
|
|
||||||
>
|
|
||||||
<T id="save" />
|
|
||||||
</Button>
|
|
||||||
</Modal.Footer>
|
|
||||||
</Form>
|
|
||||||
)}
|
|
||||||
</Formik>
|
|
||||||
)}
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
}
|
|
@@ -1,10 +1,10 @@
|
|||||||
import { Field, Form, Formik } from "formik";
|
import { Field, Form, Formik } from "formik";
|
||||||
import { type ReactNode, useState } from "react";
|
import { useState } from "react";
|
||||||
import { Alert } from "react-bootstrap";
|
import { Alert } from "react-bootstrap";
|
||||||
import Modal from "react-bootstrap/Modal";
|
import Modal from "react-bootstrap/Modal";
|
||||||
import { updateAuth } from "src/api/backend";
|
import { updateAuth } from "src/api/backend";
|
||||||
import { Button } from "src/components";
|
import { Button } from "src/components";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { validateString } from "src/modules/Validations";
|
import { validateString } from "src/modules/Validations";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -12,12 +12,12 @@ interface Props {
|
|||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
}
|
}
|
||||||
export function ChangePasswordModal({ userId, onClose }: Props) {
|
export function ChangePasswordModal({ userId, onClose }: Props) {
|
||||||
const [error, setError] = useState<ReactNode | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
const onSubmit = async (values: any, { setSubmitting }: any) => {
|
const onSubmit = async (values: any, { setSubmitting }: any) => {
|
||||||
if (values.new !== values.confirm) {
|
if (values.new !== values.confirm) {
|
||||||
setError(<T id="error.passwords-must-match" />);
|
setError(intl.formatMessage({ id: "error.passwords-must-match" }));
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ export function ChangePasswordModal({ userId, onClose }: Props) {
|
|||||||
await updateAuth(userId, values.new, values.current);
|
await updateAuth(userId, values.new, values.current);
|
||||||
onClose();
|
onClose();
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
setError(<T id={err.message} />);
|
setError(intl.formatMessage({ id: err.message }));
|
||||||
}
|
}
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
@@ -51,9 +51,7 @@ export function ChangePasswordModal({ userId, onClose }: Props) {
|
|||||||
{() => (
|
{() => (
|
||||||
<Form>
|
<Form>
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
<Modal.Title>
|
<Modal.Title>{intl.formatMessage({ id: "user.change-password" })}</Modal.Title>
|
||||||
<T id="user.change-password" />
|
|
||||||
</Modal.Title>
|
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body>
|
<Modal.Body>
|
||||||
<Alert variant="danger" show={!!error} onClose={() => setError(null)} dismissible>
|
<Alert variant="danger" show={!!error} onClose={() => setError(null)} dismissible>
|
||||||
@@ -74,7 +72,7 @@ export function ChangePasswordModal({ userId, onClose }: Props) {
|
|||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="current">
|
<label htmlFor="current">
|
||||||
<T id="user.current-password" />
|
{intl.formatMessage({ id: "user.current-password" })}
|
||||||
</label>
|
</label>
|
||||||
{form.errors.name ? (
|
{form.errors.name ? (
|
||||||
<div className="invalid-feedback">
|
<div className="invalid-feedback">
|
||||||
@@ -100,7 +98,7 @@ export function ChangePasswordModal({ userId, onClose }: Props) {
|
|||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="new">
|
<label htmlFor="new">
|
||||||
<T id="user.new-password" />
|
{intl.formatMessage({ id: "user.new-password" })}
|
||||||
</label>
|
</label>
|
||||||
{form.errors.new ? (
|
{form.errors.new ? (
|
||||||
<div className="invalid-feedback">
|
<div className="invalid-feedback">
|
||||||
@@ -131,7 +129,7 @@ export function ChangePasswordModal({ userId, onClose }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
<label htmlFor="confirm">
|
<label htmlFor="confirm">
|
||||||
<T id="user.confirm-password" />
|
{intl.formatMessage({ id: "user.confirm-password" })}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -140,7 +138,7 @@ export function ChangePasswordModal({ userId, onClose }: Props) {
|
|||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
<Modal.Footer>
|
<Modal.Footer>
|
||||||
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
||||||
<T id="cancel" />
|
{intl.formatMessage({ id: "cancel" })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -150,7 +148,7 @@ export function ChangePasswordModal({ userId, onClose }: Props) {
|
|||||||
isLoading={isSubmitting}
|
isLoading={isSubmitting}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
>
|
>
|
||||||
<T id="save" />
|
{intl.formatMessage({ id: "save" })}
|
||||||
</Button>
|
</Button>
|
||||||
</Modal.Footer>
|
</Modal.Footer>
|
||||||
</Form>
|
</Form>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { IconSettings } from "@tabler/icons-react";
|
import { IconSettings } from "@tabler/icons-react";
|
||||||
import { Form, Formik } from "formik";
|
import { Form, Formik } from "formik";
|
||||||
import { type ReactNode, useState } from "react";
|
import { useState } from "react";
|
||||||
import { Alert } from "react-bootstrap";
|
import { Alert } from "react-bootstrap";
|
||||||
import Modal from "react-bootstrap/Modal";
|
import Modal from "react-bootstrap/Modal";
|
||||||
import {
|
import {
|
||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
SSLOptionsFields,
|
SSLOptionsFields,
|
||||||
} from "src/components";
|
} from "src/components";
|
||||||
import { useDeadHost, useSetDeadHost } from "src/hooks";
|
import { useDeadHost, useSetDeadHost } from "src/hooks";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { showSuccess } from "src/notifications";
|
import { showSuccess } from "src/notifications";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -22,7 +22,7 @@ interface Props {
|
|||||||
export function DeadHostModal({ id, onClose }: Props) {
|
export function DeadHostModal({ id, onClose }: Props) {
|
||||||
const { data, isLoading, error } = useDeadHost(id);
|
const { data, isLoading, error } = useDeadHost(id);
|
||||||
const { mutate: setDeadHost } = useSetDeadHost();
|
const { mutate: setDeadHost } = useSetDeadHost();
|
||||||
const [errorMsg, setErrorMsg] = useState<ReactNode | null>(null);
|
const [errorMsg, setErrorMsg] = useState<string | null>(null);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
const onSubmit = async (values: any, { setSubmitting }: any) => {
|
const onSubmit = async (values: any, { setSubmitting }: any) => {
|
||||||
@@ -36,7 +36,7 @@ export function DeadHostModal({ id, onClose }: Props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
setDeadHost(payload, {
|
setDeadHost(payload, {
|
||||||
onError: (err: any) => setErrorMsg(<T id={err.message} />),
|
onError: (err: any) => setErrorMsg(err.message),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
showSuccess(intl.formatMessage({ id: "notification.dead-host-saved" }));
|
showSuccess(intl.formatMessage({ id: "notification.dead-host-saved" }));
|
||||||
onClose();
|
onClose();
|
||||||
@@ -76,13 +76,14 @@ export function DeadHostModal({ id, onClose }: Props) {
|
|||||||
<Form>
|
<Form>
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
<Modal.Title>
|
<Modal.Title>
|
||||||
<T id={data?.id ? "dead-host.edit" : "dead-host.new"} />
|
{intl.formatMessage({ id: data?.id ? "dead-host.edit" : "dead-host.new" })}
|
||||||
</Modal.Title>
|
</Modal.Title>
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body className="p-0">
|
<Modal.Body className="p-0">
|
||||||
<Alert variant="danger" show={!!errorMsg} onClose={() => setErrorMsg(null)} dismissible>
|
<Alert variant="danger" show={!!errorMsg} onClose={() => setErrorMsg(null)} dismissible>
|
||||||
{errorMsg}
|
{errorMsg}
|
||||||
</Alert>
|
</Alert>
|
||||||
|
|
||||||
<div className="card m-0 border-0">
|
<div className="card m-0 border-0">
|
||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
<ul className="nav nav-tabs card-header-tabs" data-bs-toggle="tabs">
|
<ul className="nav nav-tabs card-header-tabs" data-bs-toggle="tabs">
|
||||||
@@ -94,7 +95,7 @@ export function DeadHostModal({ id, onClose }: Props) {
|
|||||||
aria-selected="true"
|
aria-selected="true"
|
||||||
role="tab"
|
role="tab"
|
||||||
>
|
>
|
||||||
<T id="column.details" />
|
{intl.formatMessage({ id: "column.details" })}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-item" role="presentation">
|
<li className="nav-item" role="presentation">
|
||||||
@@ -106,7 +107,7 @@ export function DeadHostModal({ id, onClose }: Props) {
|
|||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
role="tab"
|
role="tab"
|
||||||
>
|
>
|
||||||
<T id="column.ssl" />
|
{intl.formatMessage({ id: "column.ssl" })}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-item ms-auto" role="presentation">
|
<li className="nav-item ms-auto" role="presentation">
|
||||||
@@ -146,7 +147,7 @@ export function DeadHostModal({ id, onClose }: Props) {
|
|||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
<Modal.Footer>
|
<Modal.Footer>
|
||||||
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
||||||
<T id="cancel" />
|
{intl.formatMessage({ id: "cancel" })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -156,7 +157,7 @@ export function DeadHostModal({ id, onClose }: Props) {
|
|||||||
isLoading={isSubmitting}
|
isLoading={isSubmitting}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
>
|
>
|
||||||
<T id="save" />
|
{intl.formatMessage({ id: "save" })}
|
||||||
</Button>
|
</Button>
|
||||||
</Modal.Footer>
|
</Modal.Footer>
|
||||||
</Form>
|
</Form>
|
||||||
|
@@ -3,7 +3,7 @@ import { type ReactNode, useState } from "react";
|
|||||||
import { Alert } from "react-bootstrap";
|
import { Alert } from "react-bootstrap";
|
||||||
import Modal from "react-bootstrap/Modal";
|
import Modal from "react-bootstrap/Modal";
|
||||||
import { Button } from "src/components";
|
import { Button } from "src/components";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -14,7 +14,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
export function DeleteConfirmModal({ title, children, onConfirm, onClose, invalidations }: Props) {
|
export function DeleteConfirmModal({ title, children, onConfirm, onClose, invalidations }: Props) {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const [error, setError] = useState<ReactNode | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
const onSubmit = async () => {
|
const onSubmit = async () => {
|
||||||
@@ -29,7 +29,7 @@ export function DeleteConfirmModal({ title, children, onConfirm, onClose, invali
|
|||||||
queryClient.invalidateQueries({ queryKey: inv });
|
queryClient.invalidateQueries({ queryKey: inv });
|
||||||
});
|
});
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
setError(<T id={err.message} />);
|
setError(intl.formatMessage({ id: err.message }));
|
||||||
}
|
}
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
};
|
};
|
||||||
@@ -37,9 +37,7 @@ export function DeleteConfirmModal({ title, children, onConfirm, onClose, invali
|
|||||||
return (
|
return (
|
||||||
<Modal show onHide={onClose} animation={false}>
|
<Modal show onHide={onClose} animation={false}>
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
<Modal.Title>
|
<Modal.Title>{title}</Modal.Title>
|
||||||
<T id={title} />
|
|
||||||
</Modal.Title>
|
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body>
|
<Modal.Body>
|
||||||
<Alert variant="danger" show={!!error} onClose={() => setError(null)} dismissible>
|
<Alert variant="danger" show={!!error} onClose={() => setError(null)} dismissible>
|
||||||
@@ -49,7 +47,7 @@ export function DeleteConfirmModal({ title, children, onConfirm, onClose, invali
|
|||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
<Modal.Footer>
|
<Modal.Footer>
|
||||||
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
||||||
<T id="cancel" />
|
{intl.formatMessage({ id: "cancel" })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -60,7 +58,7 @@ export function DeleteConfirmModal({ title, children, onConfirm, onClose, invali
|
|||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
onClick={onSubmit}
|
onClick={onSubmit}
|
||||||
>
|
>
|
||||||
<T id="action.delete" />
|
{intl.formatMessage({ id: "action.delete" })}
|
||||||
</Button>
|
</Button>
|
||||||
</Modal.Footer>
|
</Modal.Footer>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
@@ -2,7 +2,7 @@ import { Alert } from "react-bootstrap";
|
|||||||
import Modal from "react-bootstrap/Modal";
|
import Modal from "react-bootstrap/Modal";
|
||||||
import { Button, EventFormatter, GravatarFormatter, Loading } from "src/components";
|
import { Button, EventFormatter, GravatarFormatter, Loading } from "src/components";
|
||||||
import { useAuditLog } from "src/hooks";
|
import { useAuditLog } from "src/hooks";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
id: number;
|
id: number;
|
||||||
@@ -22,9 +22,7 @@ export function EventDetailsModal({ id, onClose }: Props) {
|
|||||||
{!isLoading && data && (
|
{!isLoading && data && (
|
||||||
<>
|
<>
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
<Modal.Title>
|
<Modal.Title>{intl.formatMessage({ id: "action.view-details" })}</Modal.Title>
|
||||||
<T id="action.view-details" />
|
|
||||||
</Modal.Title>
|
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body>
|
<Modal.Body>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
@@ -42,7 +40,7 @@ export function EventDetailsModal({ id, onClose }: Props) {
|
|||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
<Modal.Footer>
|
<Modal.Footer>
|
||||||
<Button data-bs-dismiss="modal" onClick={onClose}>
|
<Button data-bs-dismiss="modal" onClick={onClose}>
|
||||||
<T id="close" />
|
{intl.formatMessage({ id: "close" })}
|
||||||
</Button>
|
</Button>
|
||||||
</Modal.Footer>
|
</Modal.Footer>
|
||||||
</>
|
</>
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import { useQueryClient } from "@tanstack/react-query";
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
import cn from "classnames";
|
import cn from "classnames";
|
||||||
import { Field, Form, Formik } from "formik";
|
import { Field, Form, Formik } from "formik";
|
||||||
import { type ReactNode, useState } from "react";
|
import { useState } from "react";
|
||||||
import { Alert } from "react-bootstrap";
|
import { Alert } from "react-bootstrap";
|
||||||
import Modal from "react-bootstrap/Modal";
|
import Modal from "react-bootstrap/Modal";
|
||||||
import { setPermissions } from "src/api/backend";
|
import { setPermissions } from "src/api/backend";
|
||||||
import { Button, Loading } from "src/components";
|
import { Button, Loading } from "src/components";
|
||||||
import { useUser } from "src/hooks";
|
import { useUser } from "src/hooks";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
userId: number;
|
userId: number;
|
||||||
@@ -15,7 +15,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
export function PermissionsModal({ userId, onClose }: Props) {
|
export function PermissionsModal({ userId, onClose }: Props) {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const [errorMsg, setErrorMsg] = useState<ReactNode | null>(null);
|
const [errorMsg, setErrorMsg] = useState<string | null>(null);
|
||||||
const { data, isLoading, error } = useUser(userId);
|
const { data, isLoading, error } = useUser(userId);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
queryClient.invalidateQueries({ queryKey: ["users"] });
|
queryClient.invalidateQueries({ queryKey: ["users"] });
|
||||||
queryClient.invalidateQueries({ queryKey: ["user"] });
|
queryClient.invalidateQueries({ queryKey: ["user"] });
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
setErrorMsg(<T id={err.message} />);
|
setErrorMsg(intl.formatMessage({ id: err.message }));
|
||||||
}
|
}
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
@@ -50,7 +50,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
onChange={() => form.setFieldValue(field.name, "manage")}
|
onChange={() => form.setFieldValue(field.name, "manage")}
|
||||||
/>
|
/>
|
||||||
<label htmlFor={`${field.name}-manage`} className={cn("btn", { active: field.value === "manage" })}>
|
<label htmlFor={`${field.name}-manage`} className={cn("btn", { active: field.value === "manage" })}>
|
||||||
<T id="permissions.manage" />
|
{intl.formatMessage({ id: "permissions.manage" })}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="radio"
|
type="radio"
|
||||||
@@ -63,7 +63,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
onChange={() => form.setFieldValue(field.name, "view")}
|
onChange={() => form.setFieldValue(field.name, "view")}
|
||||||
/>
|
/>
|
||||||
<label htmlFor={`${field.name}-view`} className={cn("btn", { active: field.value === "view" })}>
|
<label htmlFor={`${field.name}-view`} className={cn("btn", { active: field.value === "view" })}>
|
||||||
<T id="permissions.view" />
|
{intl.formatMessage({ id: "permissions.view" })}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="radio"
|
type="radio"
|
||||||
@@ -76,7 +76,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
onChange={() => form.setFieldValue(field.name, "hidden")}
|
onChange={() => form.setFieldValue(field.name, "hidden")}
|
||||||
/>
|
/>
|
||||||
<label htmlFor={`${field.name}-hidden`} className={cn("btn", { active: field.value === "hidden" })}>
|
<label htmlFor={`${field.name}-hidden`} className={cn("btn", { active: field.value === "hidden" })}>
|
||||||
<T id="permissions.hidden" />
|
{intl.formatMessage({ id: "permissions.hidden" })}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -112,7 +112,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
<Form>
|
<Form>
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
<Modal.Title>
|
<Modal.Title>
|
||||||
<T id="user.set-permissions" data={{ name: data?.name }} />
|
{intl.formatMessage({ id: "user.set-permissions" }, { name: data?.name })}
|
||||||
</Modal.Title>
|
</Modal.Title>
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body>
|
<Modal.Body>
|
||||||
@@ -121,7 +121,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
</Alert>
|
</Alert>
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<label htmlFor="asd" className="form-label">
|
<label htmlFor="asd" className="form-label">
|
||||||
<T id="permissions.visibility.title" />
|
{intl.formatMessage({ id: "permissions.visibility.title" })}
|
||||||
</label>
|
</label>
|
||||||
<Field name="visibility">
|
<Field name="visibility">
|
||||||
{({ field, form }: any) => (
|
{({ field, form }: any) => (
|
||||||
@@ -140,7 +140,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
htmlFor={`${field.name}-user`}
|
htmlFor={`${field.name}-user`}
|
||||||
className={cn("btn", { active: field.value === "user" })}
|
className={cn("btn", { active: field.value === "user" })}
|
||||||
>
|
>
|
||||||
<T id="permissions.visibility.user" />
|
{intl.formatMessage({ id: "permissions.visibility.user" })}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="radio"
|
type="radio"
|
||||||
@@ -156,7 +156,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
htmlFor={`${field.name}-all`}
|
htmlFor={`${field.name}-all`}
|
||||||
className={cn("btn", { active: field.value === "all" })}
|
className={cn("btn", { active: field.value === "all" })}
|
||||||
>
|
>
|
||||||
<T id="permissions.visibility.all" />
|
{intl.formatMessage({ id: "permissions.visibility.all" })}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -166,7 +166,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
<>
|
<>
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<label htmlFor="ignored" className="form-label">
|
<label htmlFor="ignored" className="form-label">
|
||||||
<T id="proxy-hosts.title" />
|
{intl.formatMessage({ id: "proxy-hosts.title" })}
|
||||||
</label>
|
</label>
|
||||||
<Field name="proxyHosts">
|
<Field name="proxyHosts">
|
||||||
{({ field, form }: any) => getPermissionButtons(field, form)}
|
{({ field, form }: any) => getPermissionButtons(field, form)}
|
||||||
@@ -174,7 +174,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<label htmlFor="ignored" className="form-label">
|
<label htmlFor="ignored" className="form-label">
|
||||||
<T id="redirection-hosts.title" />
|
{intl.formatMessage({ id: "redirection-hosts.title" })}
|
||||||
</label>
|
</label>
|
||||||
<Field name="redirectionHosts">
|
<Field name="redirectionHosts">
|
||||||
{({ field, form }: any) => getPermissionButtons(field, form)}
|
{({ field, form }: any) => getPermissionButtons(field, form)}
|
||||||
@@ -182,7 +182,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<label htmlFor="ignored" className="form-label">
|
<label htmlFor="ignored" className="form-label">
|
||||||
<T id="dead-hosts.title" />
|
{intl.formatMessage({ id: "dead-hosts.title" })}
|
||||||
</label>
|
</label>
|
||||||
<Field name="deadHosts">
|
<Field name="deadHosts">
|
||||||
{({ field, form }: any) => getPermissionButtons(field, form)}
|
{({ field, form }: any) => getPermissionButtons(field, form)}
|
||||||
@@ -190,7 +190,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<label htmlFor="ignored" className="form-label">
|
<label htmlFor="ignored" className="form-label">
|
||||||
<T id="streams.title" />
|
{intl.formatMessage({ id: "streams.title" })}
|
||||||
</label>
|
</label>
|
||||||
<Field name="streams">
|
<Field name="streams">
|
||||||
{({ field, form }: any) => getPermissionButtons(field, form)}
|
{({ field, form }: any) => getPermissionButtons(field, form)}
|
||||||
@@ -198,7 +198,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<label htmlFor="ignored" className="form-label">
|
<label htmlFor="ignored" className="form-label">
|
||||||
<T id="access.title" />
|
{intl.formatMessage({ id: "access.title" })}
|
||||||
</label>
|
</label>
|
||||||
<Field name="accessLists">
|
<Field name="accessLists">
|
||||||
{({ field, form }: any) => getPermissionButtons(field, form)}
|
{({ field, form }: any) => getPermissionButtons(field, form)}
|
||||||
@@ -206,7 +206,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<label htmlFor="ignored" className="form-label">
|
<label htmlFor="ignored" className="form-label">
|
||||||
<T id="certificates.title" />
|
{intl.formatMessage({ id: "certificates.title" })}
|
||||||
</label>
|
</label>
|
||||||
<Field name="certificates">
|
<Field name="certificates">
|
||||||
{({ field, form }: any) => getPermissionButtons(field, form)}
|
{({ field, form }: any) => getPermissionButtons(field, form)}
|
||||||
@@ -217,7 +217,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
<Modal.Footer>
|
<Modal.Footer>
|
||||||
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
||||||
<T id="cancel" />
|
{intl.formatMessage({ id: "cancel" })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -227,7 +227,7 @@ export function PermissionsModal({ userId, onClose }: Props) {
|
|||||||
isLoading={isSubmitting}
|
isLoading={isSubmitting}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
>
|
>
|
||||||
<T id="save" />
|
{intl.formatMessage({ id: "save" })}
|
||||||
</Button>
|
</Button>
|
||||||
</Modal.Footer>
|
</Modal.Footer>
|
||||||
</Form>
|
</Form>
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
import { IconSettings } from "@tabler/icons-react";
|
import { IconSettings } from "@tabler/icons-react";
|
||||||
import cn from "classnames";
|
import cn from "classnames";
|
||||||
import { Field, Form, Formik } from "formik";
|
import { Field, Form, Formik } from "formik";
|
||||||
import { type ReactNode, useState } from "react";
|
import { useState } from "react";
|
||||||
import { Alert } from "react-bootstrap";
|
import { Alert } from "react-bootstrap";
|
||||||
import Modal from "react-bootstrap/Modal";
|
import Modal from "react-bootstrap/Modal";
|
||||||
import {
|
import {
|
||||||
AccessField,
|
|
||||||
Button,
|
Button,
|
||||||
DomainNamesField,
|
DomainNamesField,
|
||||||
Loading,
|
Loading,
|
||||||
@@ -14,7 +13,7 @@ import {
|
|||||||
SSLOptionsFields,
|
SSLOptionsFields,
|
||||||
} from "src/components";
|
} from "src/components";
|
||||||
import { useProxyHost, useSetProxyHost } from "src/hooks";
|
import { useProxyHost, useSetProxyHost } from "src/hooks";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { validateNumber, validateString } from "src/modules/Validations";
|
import { validateNumber, validateString } from "src/modules/Validations";
|
||||||
import { showSuccess } from "src/notifications";
|
import { showSuccess } from "src/notifications";
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@ interface Props {
|
|||||||
export function ProxyHostModal({ id, onClose }: Props) {
|
export function ProxyHostModal({ id, onClose }: Props) {
|
||||||
const { data, isLoading, error } = useProxyHost(id);
|
const { data, isLoading, error } = useProxyHost(id);
|
||||||
const { mutate: setProxyHost } = useSetProxyHost();
|
const { mutate: setProxyHost } = useSetProxyHost();
|
||||||
const [errorMsg, setErrorMsg] = useState<ReactNode | null>(null);
|
const [errorMsg, setErrorMsg] = useState<string | null>(null);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
const onSubmit = async (values: any, { setSubmitting }: any) => {
|
const onSubmit = async (values: any, { setSubmitting }: any) => {
|
||||||
@@ -39,7 +38,7 @@ export function ProxyHostModal({ id, onClose }: Props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
setProxyHost(payload, {
|
setProxyHost(payload, {
|
||||||
onError: (err: any) => setErrorMsg(<T id={err.message} />),
|
onError: (err: any) => setErrorMsg(err.message),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
showSuccess(intl.formatMessage({ id: "notification.proxy-host-saved" }));
|
showSuccess(intl.formatMessage({ id: "notification.proxy-host-saved" }));
|
||||||
onClose();
|
onClose();
|
||||||
@@ -91,13 +90,16 @@ export function ProxyHostModal({ id, onClose }: Props) {
|
|||||||
<Form>
|
<Form>
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
<Modal.Title>
|
<Modal.Title>
|
||||||
<T id={data?.id ? "proxy-host.edit" : "proxy-host.new"} />
|
{intl.formatMessage({
|
||||||
|
id: data?.id ? "proxy-host.edit" : "proxy-host.new",
|
||||||
|
})}
|
||||||
</Modal.Title>
|
</Modal.Title>
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body className="p-0">
|
<Modal.Body className="p-0">
|
||||||
<Alert variant="danger" show={!!errorMsg} onClose={() => setErrorMsg(null)} dismissible>
|
<Alert variant="danger" show={!!errorMsg} onClose={() => setErrorMsg(null)} dismissible>
|
||||||
{errorMsg}
|
{errorMsg}
|
||||||
</Alert>
|
</Alert>
|
||||||
|
|
||||||
<div className="card m-0 border-0">
|
<div className="card m-0 border-0">
|
||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
<ul className="nav nav-tabs card-header-tabs" data-bs-toggle="tabs">
|
<ul className="nav nav-tabs card-header-tabs" data-bs-toggle="tabs">
|
||||||
@@ -109,7 +111,7 @@ export function ProxyHostModal({ id, onClose }: Props) {
|
|||||||
aria-selected="true"
|
aria-selected="true"
|
||||||
role="tab"
|
role="tab"
|
||||||
>
|
>
|
||||||
<T id="column.details" />
|
{intl.formatMessage({ id: "column.details" })}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-item" role="presentation">
|
<li className="nav-item" role="presentation">
|
||||||
@@ -121,7 +123,7 @@ export function ProxyHostModal({ id, onClose }: Props) {
|
|||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
role="tab"
|
role="tab"
|
||||||
>
|
>
|
||||||
<T id="column.custom-locations" />
|
{intl.formatMessage({ id: "column.custom-locations" })}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-item" role="presentation">
|
<li className="nav-item" role="presentation">
|
||||||
@@ -133,7 +135,7 @@ export function ProxyHostModal({ id, onClose }: Props) {
|
|||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
role="tab"
|
role="tab"
|
||||||
>
|
>
|
||||||
<T id="column.ssl" />
|
{intl.formatMessage({ id: "column.ssl" })}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-item ms-auto" role="presentation">
|
<li className="nav-item ms-auto" role="presentation">
|
||||||
@@ -164,7 +166,9 @@ export function ProxyHostModal({ id, onClose }: Props) {
|
|||||||
className="form-label"
|
className="form-label"
|
||||||
htmlFor="forwardScheme"
|
htmlFor="forwardScheme"
|
||||||
>
|
>
|
||||||
<T id="host.forward-scheme" />
|
{intl.formatMessage({
|
||||||
|
id: "host.forward-scheme",
|
||||||
|
})}
|
||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
id="forwardScheme"
|
id="forwardScheme"
|
||||||
@@ -192,7 +196,9 @@ export function ProxyHostModal({ id, onClose }: Props) {
|
|||||||
{({ field, form }: any) => (
|
{({ field, form }: any) => (
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<label className="form-label" htmlFor="forwardHost">
|
<label className="form-label" htmlFor="forwardHost">
|
||||||
<T id="proxy-host.forward-host" />
|
{intl.formatMessage({
|
||||||
|
id: "proxy-host.forward-host",
|
||||||
|
})}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="forwardHost"
|
id="forwardHost"
|
||||||
@@ -219,7 +225,9 @@ export function ProxyHostModal({ id, onClose }: Props) {
|
|||||||
{({ field, form }: any) => (
|
{({ field, form }: any) => (
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<label className="form-label" htmlFor="forwardPort">
|
<label className="form-label" htmlFor="forwardPort">
|
||||||
<T id="host.forward-port" />
|
{intl.formatMessage({
|
||||||
|
id: "host.forward-port",
|
||||||
|
})}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="forwardPort"
|
id="forwardPort"
|
||||||
@@ -244,16 +252,17 @@ export function ProxyHostModal({ id, onClose }: Props) {
|
|||||||
</Field>
|
</Field>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<AccessField />
|
|
||||||
<div className="my-3">
|
<div className="my-3">
|
||||||
<h4 className="py-2">
|
<h4 className="py-2">
|
||||||
<T id="generic.flags.title" />
|
{intl.formatMessage({ id: "host.flags.title" })}
|
||||||
</h4>
|
</h4>
|
||||||
<div className="divide-y">
|
<div className="divide-y">
|
||||||
<div>
|
<div>
|
||||||
<label className="row" htmlFor="cachingEnabled">
|
<label className="row" htmlFor="cachingEnabled">
|
||||||
<span className="col">
|
<span className="col">
|
||||||
<T id="host.flags.cache-assets" />
|
{intl.formatMessage({
|
||||||
|
id: "host.flags.cache-assets",
|
||||||
|
})}
|
||||||
</span>
|
</span>
|
||||||
<span className="col-auto">
|
<span className="col-auto">
|
||||||
<Field name="cachingEnabled" type="checkbox">
|
<Field name="cachingEnabled" type="checkbox">
|
||||||
@@ -276,7 +285,9 @@ export function ProxyHostModal({ id, onClose }: Props) {
|
|||||||
<div>
|
<div>
|
||||||
<label className="row" htmlFor="blockExploits">
|
<label className="row" htmlFor="blockExploits">
|
||||||
<span className="col">
|
<span className="col">
|
||||||
<T id="host.flags.block-exploits" />
|
{intl.formatMessage({
|
||||||
|
id: "host.flags.block-exploits",
|
||||||
|
})}
|
||||||
</span>
|
</span>
|
||||||
<span className="col-auto">
|
<span className="col-auto">
|
||||||
<Field name="blockExploits" type="checkbox">
|
<Field name="blockExploits" type="checkbox">
|
||||||
@@ -299,7 +310,9 @@ export function ProxyHostModal({ id, onClose }: Props) {
|
|||||||
<div>
|
<div>
|
||||||
<label className="row" htmlFor="allowWebsocketUpgrade">
|
<label className="row" htmlFor="allowWebsocketUpgrade">
|
||||||
<span className="col">
|
<span className="col">
|
||||||
<T id="host.flags.websockets-upgrade" />
|
{intl.formatMessage({
|
||||||
|
id: "host.flags.websockets-upgrade",
|
||||||
|
})}
|
||||||
</span>
|
</span>
|
||||||
<span className="col-auto">
|
<span className="col-auto">
|
||||||
<Field name="allowWebsocketUpgrade" type="checkbox">
|
<Field name="allowWebsocketUpgrade" type="checkbox">
|
||||||
@@ -323,7 +336,7 @@ export function ProxyHostModal({ id, onClose }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="tab-pane" id="tab-locations" role="tabpanel">
|
<div className="tab-pane" id="tab-locations" role="tabpanel">
|
||||||
locations TODO
|
locations
|
||||||
</div>
|
</div>
|
||||||
<div className="tab-pane" id="tab-ssl" role="tabpanel">
|
<div className="tab-pane" id="tab-ssl" role="tabpanel">
|
||||||
<SSLCertificateField
|
<SSLCertificateField
|
||||||
@@ -342,7 +355,7 @@ export function ProxyHostModal({ id, onClose }: Props) {
|
|||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
<Modal.Footer>
|
<Modal.Footer>
|
||||||
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
||||||
<T id="cancel" />
|
{intl.formatMessage({ id: "cancel" })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -352,7 +365,7 @@ export function ProxyHostModal({ id, onClose }: Props) {
|
|||||||
isLoading={isSubmitting}
|
isLoading={isSubmitting}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
>
|
>
|
||||||
<T id="save" />
|
{intl.formatMessage({ id: "save" })}
|
||||||
</Button>
|
</Button>
|
||||||
</Modal.Footer>
|
</Modal.Footer>
|
||||||
</Form>
|
</Form>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { IconSettings } from "@tabler/icons-react";
|
import { IconSettings } from "@tabler/icons-react";
|
||||||
import cn from "classnames";
|
import cn from "classnames";
|
||||||
import { Field, Form, Formik } from "formik";
|
import { Field, Form, Formik } from "formik";
|
||||||
import { type ReactNode, useState } from "react";
|
import { useState } from "react";
|
||||||
import { Alert } from "react-bootstrap";
|
import { Alert } from "react-bootstrap";
|
||||||
import Modal from "react-bootstrap/Modal";
|
import Modal from "react-bootstrap/Modal";
|
||||||
import {
|
import {
|
||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
SSLOptionsFields,
|
SSLOptionsFields,
|
||||||
} from "src/components";
|
} from "src/components";
|
||||||
import { useRedirectionHost, useSetRedirectionHost } from "src/hooks";
|
import { useRedirectionHost, useSetRedirectionHost } from "src/hooks";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { validateString } from "src/modules/Validations";
|
import { validateString } from "src/modules/Validations";
|
||||||
import { showSuccess } from "src/notifications";
|
import { showSuccess } from "src/notifications";
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ interface Props {
|
|||||||
export function RedirectionHostModal({ id, onClose }: Props) {
|
export function RedirectionHostModal({ id, onClose }: Props) {
|
||||||
const { data, isLoading, error } = useRedirectionHost(id);
|
const { data, isLoading, error } = useRedirectionHost(id);
|
||||||
const { mutate: setRedirectionHost } = useSetRedirectionHost();
|
const { mutate: setRedirectionHost } = useSetRedirectionHost();
|
||||||
const [errorMsg, setErrorMsg] = useState<ReactNode | null>(null);
|
const [errorMsg, setErrorMsg] = useState<string | null>(null);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
const onSubmit = async (values: any, { setSubmitting }: any) => {
|
const onSubmit = async (values: any, { setSubmitting }: any) => {
|
||||||
@@ -38,7 +38,7 @@ export function RedirectionHostModal({ id, onClose }: Props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
setRedirectionHost(payload, {
|
setRedirectionHost(payload, {
|
||||||
onError: (err: any) => setErrorMsg(<T id={err.message} />),
|
onError: (err: any) => setErrorMsg(err.message),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
showSuccess(intl.formatMessage({ id: "notification.redirection-host-saved" }));
|
showSuccess(intl.formatMessage({ id: "notification.redirection-host-saved" }));
|
||||||
onClose();
|
onClose();
|
||||||
@@ -86,13 +86,16 @@ export function RedirectionHostModal({ id, onClose }: Props) {
|
|||||||
<Form>
|
<Form>
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
<Modal.Title>
|
<Modal.Title>
|
||||||
<T id={data?.id ? "redirection-host.edit" : "redirection-host.new"} />
|
{intl.formatMessage({
|
||||||
|
id: data?.id ? "redirection-host.edit" : "redirection-host.new",
|
||||||
|
})}
|
||||||
</Modal.Title>
|
</Modal.Title>
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body className="p-0">
|
<Modal.Body className="p-0">
|
||||||
<Alert variant="danger" show={!!errorMsg} onClose={() => setErrorMsg(null)} dismissible>
|
<Alert variant="danger" show={!!errorMsg} onClose={() => setErrorMsg(null)} dismissible>
|
||||||
{errorMsg}
|
{errorMsg}
|
||||||
</Alert>
|
</Alert>
|
||||||
|
|
||||||
<div className="card m-0 border-0">
|
<div className="card m-0 border-0">
|
||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
<ul className="nav nav-tabs card-header-tabs" data-bs-toggle="tabs">
|
<ul className="nav nav-tabs card-header-tabs" data-bs-toggle="tabs">
|
||||||
@@ -104,7 +107,7 @@ export function RedirectionHostModal({ id, onClose }: Props) {
|
|||||||
aria-selected="true"
|
aria-selected="true"
|
||||||
role="tab"
|
role="tab"
|
||||||
>
|
>
|
||||||
<T id="column.details" />
|
{intl.formatMessage({ id: "column.details" })}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-item" role="presentation">
|
<li className="nav-item" role="presentation">
|
||||||
@@ -116,7 +119,7 @@ export function RedirectionHostModal({ id, onClose }: Props) {
|
|||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
role="tab"
|
role="tab"
|
||||||
>
|
>
|
||||||
<T id="column.ssl" />
|
{intl.formatMessage({ id: "column.ssl" })}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-item ms-auto" role="presentation">
|
<li className="nav-item ms-auto" role="presentation">
|
||||||
@@ -147,7 +150,9 @@ export function RedirectionHostModal({ id, onClose }: Props) {
|
|||||||
className="form-label"
|
className="form-label"
|
||||||
htmlFor="forwardScheme"
|
htmlFor="forwardScheme"
|
||||||
>
|
>
|
||||||
<T id="host.forward-scheme" />
|
{intl.formatMessage({
|
||||||
|
id: "host.forward-scheme",
|
||||||
|
})}
|
||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
id="forwardScheme"
|
id="forwardScheme"
|
||||||
@@ -182,7 +187,9 @@ export function RedirectionHostModal({ id, onClose }: Props) {
|
|||||||
className="form-label"
|
className="form-label"
|
||||||
htmlFor="forwardDomainName"
|
htmlFor="forwardDomainName"
|
||||||
>
|
>
|
||||||
<T id="redirection-host.forward-domain" />
|
{intl.formatMessage({
|
||||||
|
id: "redirection-host.forward-domain",
|
||||||
|
})}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="forwardDomainName"
|
id="forwardDomainName"
|
||||||
@@ -207,13 +214,15 @@ export function RedirectionHostModal({ id, onClose }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="my-3">
|
<div className="my-3">
|
||||||
<h4 className="py-2">
|
<h4 className="py-2">
|
||||||
<T id="generic.flags.title" />
|
{intl.formatMessage({ id: "host.flags.title" })}
|
||||||
</h4>
|
</h4>
|
||||||
<div className="divide-y">
|
<div className="divide-y">
|
||||||
<div>
|
<div>
|
||||||
<label className="row" htmlFor="preservePath">
|
<label className="row" htmlFor="preservePath">
|
||||||
<span className="col">
|
<span className="col">
|
||||||
<T id="host.flags.preserve-path" />
|
{intl.formatMessage({
|
||||||
|
id: "host.flags.preserve-path",
|
||||||
|
})}
|
||||||
</span>
|
</span>
|
||||||
<span className="col-auto">
|
<span className="col-auto">
|
||||||
<Field name="preservePath" type="checkbox">
|
<Field name="preservePath" type="checkbox">
|
||||||
@@ -236,7 +245,9 @@ export function RedirectionHostModal({ id, onClose }: Props) {
|
|||||||
<div>
|
<div>
|
||||||
<label className="row" htmlFor="blockExploits">
|
<label className="row" htmlFor="blockExploits">
|
||||||
<span className="col">
|
<span className="col">
|
||||||
<T id="host.flags.block-exploits" />
|
{intl.formatMessage({
|
||||||
|
id: "host.flags.block-exploits",
|
||||||
|
})}
|
||||||
</span>
|
</span>
|
||||||
<span className="col-auto">
|
<span className="col-auto">
|
||||||
<Field name="blockExploits" type="checkbox">
|
<Field name="blockExploits" type="checkbox">
|
||||||
@@ -276,7 +287,7 @@ export function RedirectionHostModal({ id, onClose }: Props) {
|
|||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
<Modal.Footer>
|
<Modal.Footer>
|
||||||
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
||||||
<T id="cancel" />
|
{intl.formatMessage({ id: "cancel" })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -286,7 +297,7 @@ export function RedirectionHostModal({ id, onClose }: Props) {
|
|||||||
isLoading={isSubmitting}
|
isLoading={isSubmitting}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
>
|
>
|
||||||
<T id="save" />
|
{intl.formatMessage({ id: "save" })}
|
||||||
</Button>
|
</Button>
|
||||||
</Modal.Footer>
|
</Modal.Footer>
|
||||||
</Form>
|
</Form>
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { Field, Form, Formik } from "formik";
|
import { Field, Form, Formik } from "formik";
|
||||||
import { generate } from "generate-password-browser";
|
import { generate } from "generate-password-browser";
|
||||||
import { type ReactNode, useState } from "react";
|
import { useState } from "react";
|
||||||
import { Alert } from "react-bootstrap";
|
import { Alert } from "react-bootstrap";
|
||||||
import Modal from "react-bootstrap/Modal";
|
import Modal from "react-bootstrap/Modal";
|
||||||
import { updateAuth } from "src/api/backend";
|
import { updateAuth } from "src/api/backend";
|
||||||
import { Button } from "src/components";
|
import { Button } from "src/components";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { validateString } from "src/modules/Validations";
|
import { validateString } from "src/modules/Validations";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -13,18 +13,18 @@ interface Props {
|
|||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
}
|
}
|
||||||
export function SetPasswordModal({ userId, onClose }: Props) {
|
export function SetPasswordModal({ userId, onClose }: Props) {
|
||||||
const [error, setError] = useState<ReactNode | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [showPassword, setShowPassword] = useState(false);
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
const _onSubmit = async (values: any, { setSubmitting }: any) => {
|
const onSubmit = async (values: any, { setSubmitting }: any) => {
|
||||||
if (isSubmitting) return;
|
if (isSubmitting) return;
|
||||||
setError(null);
|
setError(null);
|
||||||
try {
|
try {
|
||||||
await updateAuth(userId, values.new);
|
await updateAuth(userId, values.new);
|
||||||
onClose();
|
onClose();
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
setError(<T id={err.message} />);
|
setError(intl.formatMessage({ id: err.message }));
|
||||||
}
|
}
|
||||||
setIsSubmitting(false);
|
setIsSubmitting(false);
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
@@ -38,14 +38,12 @@ export function SetPasswordModal({ userId, onClose }: Props) {
|
|||||||
new: "",
|
new: "",
|
||||||
} as any
|
} as any
|
||||||
}
|
}
|
||||||
onSubmit={_onSubmit}
|
onSubmit={onSubmit}
|
||||||
>
|
>
|
||||||
{() => (
|
{() => (
|
||||||
<Form>
|
<Form>
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
<Modal.Title>
|
<Modal.Title>{intl.formatMessage({ id: "user.set-password" })}</Modal.Title>
|
||||||
<T id="user.set-password" />
|
|
||||||
</Modal.Title>
|
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body>
|
<Modal.Body>
|
||||||
<Alert variant="danger" show={!!error} onClose={() => setError(null)} dismissible>
|
<Alert variant="danger" show={!!error} onClose={() => setError(null)} dismissible>
|
||||||
@@ -71,7 +69,9 @@ export function SetPasswordModal({ userId, onClose }: Props) {
|
|||||||
setShowPassword(true);
|
setShowPassword(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<T id="password.generate" />
|
{intl.formatMessage({
|
||||||
|
id: "password.generate",
|
||||||
|
})}
|
||||||
</a>{" "}
|
</a>{" "}
|
||||||
—{" "}
|
—{" "}
|
||||||
<a
|
<a
|
||||||
@@ -82,7 +82,9 @@ export function SetPasswordModal({ userId, onClose }: Props) {
|
|||||||
setShowPassword(!showPassword);
|
setShowPassword(!showPassword);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<T id={showPassword ? "password.hide" : "password.show"} />
|
{intl.formatMessage({
|
||||||
|
id: showPassword ? "password.hide" : "password.show",
|
||||||
|
})}
|
||||||
</a>
|
</a>
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
@@ -96,8 +98,9 @@ export function SetPasswordModal({ userId, onClose }: Props) {
|
|||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="new">
|
<label htmlFor="new">
|
||||||
<T id="user.new-password" />
|
{intl.formatMessage({ id: "user.new-password" })}
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
{form.errors.new ? (
|
{form.errors.new ? (
|
||||||
<div className="invalid-feedback">
|
<div className="invalid-feedback">
|
||||||
{form.errors.new && form.touched.new ? form.errors.new : null}
|
{form.errors.new && form.touched.new ? form.errors.new : null}
|
||||||
@@ -111,7 +114,7 @@ export function SetPasswordModal({ userId, onClose }: Props) {
|
|||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
<Modal.Footer>
|
<Modal.Footer>
|
||||||
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
||||||
<T id="cancel" />
|
{intl.formatMessage({ id: "cancel" })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -121,7 +124,7 @@ export function SetPasswordModal({ userId, onClose }: Props) {
|
|||||||
isLoading={isSubmitting}
|
isLoading={isSubmitting}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
>
|
>
|
||||||
<T id="save" />
|
{intl.formatMessage({ id: "save" })}
|
||||||
</Button>
|
</Button>
|
||||||
</Modal.Footer>
|
</Modal.Footer>
|
||||||
</Form>
|
</Form>
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { Field, Form, Formik } from "formik";
|
import { Field, Form, Formik } from "formik";
|
||||||
import { type ReactNode, useState } from "react";
|
import { useState } from "react";
|
||||||
import { Alert } from "react-bootstrap";
|
import { Alert } from "react-bootstrap";
|
||||||
import Modal from "react-bootstrap/Modal";
|
import Modal from "react-bootstrap/Modal";
|
||||||
import { Button, Loading, SSLCertificateField, SSLOptionsFields } from "src/components";
|
import { Button, Loading, SSLCertificateField, SSLOptionsFields } from "src/components";
|
||||||
import { useSetStream, useStream } from "src/hooks";
|
import { useSetStream, useStream } from "src/hooks";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { validateNumber, validateString } from "src/modules/Validations";
|
import { validateNumber, validateString } from "src/modules/Validations";
|
||||||
import { showSuccess } from "src/notifications";
|
import { showSuccess } from "src/notifications";
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ interface Props {
|
|||||||
export function StreamModal({ id, onClose }: Props) {
|
export function StreamModal({ id, onClose }: Props) {
|
||||||
const { data, isLoading, error } = useStream(id);
|
const { data, isLoading, error } = useStream(id);
|
||||||
const { mutate: setStream } = useSetStream();
|
const { mutate: setStream } = useSetStream();
|
||||||
const [errorMsg, setErrorMsg] = useState<ReactNode | null>(null);
|
const [errorMsg, setErrorMsg] = useState<string | null>(null);
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||||
|
|
||||||
const onSubmit = async (values: any, { setSubmitting }: any) => {
|
const onSubmit = async (values: any, { setSubmitting }: any) => {
|
||||||
@@ -29,7 +29,7 @@ export function StreamModal({ id, onClose }: Props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
setStream(payload, {
|
setStream(payload, {
|
||||||
onError: (err: any) => setErrorMsg(<T id={err.message} />),
|
onError: (err: any) => setErrorMsg(err.message),
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
showSuccess(intl.formatMessage({ id: "notification.stream-saved" }));
|
showSuccess(intl.formatMessage({ id: "notification.stream-saved" }));
|
||||||
onClose();
|
onClose();
|
||||||
@@ -68,7 +68,7 @@ export function StreamModal({ id, onClose }: Props) {
|
|||||||
<Form>
|
<Form>
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
<Modal.Title>
|
<Modal.Title>
|
||||||
<T id={data?.id ? "stream.edit" : "stream.new"} />
|
{intl.formatMessage({ id: data?.id ? "stream.edit" : "stream.new" })}
|
||||||
</Modal.Title>
|
</Modal.Title>
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body className="p-0">
|
<Modal.Body className="p-0">
|
||||||
@@ -87,7 +87,7 @@ export function StreamModal({ id, onClose }: Props) {
|
|||||||
aria-selected="true"
|
aria-selected="true"
|
||||||
role="tab"
|
role="tab"
|
||||||
>
|
>
|
||||||
<T id="column.details" />
|
{intl.formatMessage({ id: "column.details" })}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="nav-item" role="presentation">
|
<li className="nav-item" role="presentation">
|
||||||
@@ -99,7 +99,7 @@ export function StreamModal({ id, onClose }: Props) {
|
|||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
role="tab"
|
role="tab"
|
||||||
>
|
>
|
||||||
<T id="column.ssl" />
|
{intl.formatMessage({ id: "column.ssl" })}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -111,7 +111,7 @@ export function StreamModal({ id, onClose }: Props) {
|
|||||||
{({ field, form }: any) => (
|
{({ field, form }: any) => (
|
||||||
<div className="mb-3">
|
<div className="mb-3">
|
||||||
<label className="form-label" htmlFor="incomingPort">
|
<label className="form-label" htmlFor="incomingPort">
|
||||||
<T id="stream.incoming-port" />
|
{intl.formatMessage({ id: "stream.incoming-port" })}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="incomingPort"
|
id="incomingPort"
|
||||||
@@ -143,7 +143,9 @@ export function StreamModal({ id, onClose }: Props) {
|
|||||||
className="form-label"
|
className="form-label"
|
||||||
htmlFor="forwardingHost"
|
htmlFor="forwardingHost"
|
||||||
>
|
>
|
||||||
<T id="stream.forward-host" />
|
{intl.formatMessage({
|
||||||
|
id: "stream.forward-host",
|
||||||
|
})}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="forwardingHost"
|
id="forwardingHost"
|
||||||
@@ -176,7 +178,9 @@ export function StreamModal({ id, onClose }: Props) {
|
|||||||
className="form-label"
|
className="form-label"
|
||||||
htmlFor="forwardingPort"
|
htmlFor="forwardingPort"
|
||||||
>
|
>
|
||||||
<T id="stream.forward-port" />
|
{intl.formatMessage({
|
||||||
|
id: "host.forward-port",
|
||||||
|
})}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="forwardingPort"
|
id="forwardingPort"
|
||||||
@@ -203,13 +207,15 @@ export function StreamModal({ id, onClose }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="my-3">
|
<div className="my-3">
|
||||||
<h3 className="py-2">
|
<h3 className="py-2">
|
||||||
<T id="host.flags.protocols" />
|
{intl.formatMessage({ id: "host.flags.protocols" })}
|
||||||
</h3>
|
</h3>
|
||||||
<div className="divide-y">
|
<div className="divide-y">
|
||||||
<div>
|
<div>
|
||||||
<label className="row" htmlFor="tcpForwarding">
|
<label className="row" htmlFor="tcpForwarding">
|
||||||
<span className="col">
|
<span className="col">
|
||||||
<T id="streams.tcp" />
|
{intl.formatMessage({
|
||||||
|
id: "streams.tcp",
|
||||||
|
})}
|
||||||
</span>
|
</span>
|
||||||
<span className="col-auto">
|
<span className="col-auto">
|
||||||
<Field name="tcpForwarding" type="checkbox">
|
<Field name="tcpForwarding" type="checkbox">
|
||||||
@@ -243,7 +249,9 @@ export function StreamModal({ id, onClose }: Props) {
|
|||||||
<div>
|
<div>
|
||||||
<label className="row" htmlFor="udpForwarding">
|
<label className="row" htmlFor="udpForwarding">
|
||||||
<span className="col">
|
<span className="col">
|
||||||
<T id="streams.udp" />
|
{intl.formatMessage({
|
||||||
|
id: "streams.udp",
|
||||||
|
})}
|
||||||
</span>
|
</span>
|
||||||
<span className="col-auto">
|
<span className="col-auto">
|
||||||
<Field name="udpForwarding" type="checkbox">
|
<Field name="udpForwarding" type="checkbox">
|
||||||
@@ -297,7 +305,7 @@ export function StreamModal({ id, onClose }: Props) {
|
|||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
<Modal.Footer>
|
<Modal.Footer>
|
||||||
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
||||||
<T id="cancel" />
|
{intl.formatMessage({ id: "cancel" })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -307,7 +315,7 @@ export function StreamModal({ id, onClose }: Props) {
|
|||||||
isLoading={isSubmitting}
|
isLoading={isSubmitting}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
>
|
>
|
||||||
<T id="save" />
|
{intl.formatMessage({ id: "save" })}
|
||||||
</Button>
|
</Button>
|
||||||
</Modal.Footer>
|
</Modal.Footer>
|
||||||
</Form>
|
</Form>
|
||||||
|
@@ -4,7 +4,7 @@ import { Alert } from "react-bootstrap";
|
|||||||
import Modal from "react-bootstrap/Modal";
|
import Modal from "react-bootstrap/Modal";
|
||||||
import { Button, Loading } from "src/components";
|
import { Button, Loading } from "src/components";
|
||||||
import { useSetUser, useUser } from "src/hooks";
|
import { useSetUser, useUser } from "src/hooks";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { validateEmail, validateString } from "src/modules/Validations";
|
import { validateEmail, validateString } from "src/modules/Validations";
|
||||||
import { showSuccess } from "src/notifications";
|
import { showSuccess } from "src/notifications";
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ export function UserModal({ userId, onClose }: Props) {
|
|||||||
<Form>
|
<Form>
|
||||||
<Modal.Header closeButton>
|
<Modal.Header closeButton>
|
||||||
<Modal.Title>
|
<Modal.Title>
|
||||||
<T id={data?.id ? "user.edit" : "user.new"} />
|
{intl.formatMessage({ id: data?.id ? "user.edit" : "user.new" })}
|
||||||
</Modal.Title>
|
</Modal.Title>
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body>
|
<Modal.Body>
|
||||||
@@ -99,7 +99,7 @@ export function UserModal({ userId, onClose }: Props) {
|
|||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="name">
|
<label htmlFor="name">
|
||||||
<T id="user.full-name" />
|
{intl.formatMessage({ id: "user.full-name" })}
|
||||||
</label>
|
</label>
|
||||||
{form.errors.name ? (
|
{form.errors.name ? (
|
||||||
<div className="invalid-feedback">
|
<div className="invalid-feedback">
|
||||||
@@ -125,7 +125,7 @@ export function UserModal({ userId, onClose }: Props) {
|
|||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="nickname">
|
<label htmlFor="nickname">
|
||||||
<T id="user.nickname" />
|
{intl.formatMessage({ id: "user.nickname" })}
|
||||||
</label>
|
</label>
|
||||||
{form.errors.nickname ? (
|
{form.errors.nickname ? (
|
||||||
<div className="invalid-feedback">
|
<div className="invalid-feedback">
|
||||||
@@ -152,7 +152,7 @@ export function UserModal({ userId, onClose }: Props) {
|
|||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="email">
|
<label htmlFor="email">
|
||||||
<T id="email-address" />
|
{intl.formatMessage({ id: "email-address" })}
|
||||||
</label>
|
</label>
|
||||||
{form.errors.email ? (
|
{form.errors.email ? (
|
||||||
<div className="invalid-feedback">
|
<div className="invalid-feedback">
|
||||||
@@ -167,14 +167,12 @@ export function UserModal({ userId, onClose }: Props) {
|
|||||||
</div>
|
</div>
|
||||||
{currentUser && data && currentUser?.id !== data?.id ? (
|
{currentUser && data && currentUser?.id !== data?.id ? (
|
||||||
<div className="my-3">
|
<div className="my-3">
|
||||||
<h4 className="py-2">
|
<h4 className="py-2">{intl.formatMessage({ id: "user.flags.title" })}</h4>
|
||||||
<T id="user.flags.title" />
|
|
||||||
</h4>
|
|
||||||
<div className="divide-y">
|
<div className="divide-y">
|
||||||
<div>
|
<div>
|
||||||
<label className="row" htmlFor="isAdmin">
|
<label className="row" htmlFor="isAdmin">
|
||||||
<span className="col">
|
<span className="col">
|
||||||
<T id="role.admin" />
|
{intl.formatMessage({ id: "role.admin" })}
|
||||||
</span>
|
</span>
|
||||||
<span className="col-auto">
|
<span className="col-auto">
|
||||||
<Field name="isAdmin" type="checkbox">
|
<Field name="isAdmin" type="checkbox">
|
||||||
@@ -195,7 +193,7 @@ export function UserModal({ userId, onClose }: Props) {
|
|||||||
<div>
|
<div>
|
||||||
<label className="row" htmlFor="isDisabled">
|
<label className="row" htmlFor="isDisabled">
|
||||||
<span className="col">
|
<span className="col">
|
||||||
<T id="disabled" />
|
{intl.formatMessage({ id: "disabled" })}
|
||||||
</span>
|
</span>
|
||||||
<span className="col-auto">
|
<span className="col-auto">
|
||||||
<Field name="isDisabled" type="checkbox">
|
<Field name="isDisabled" type="checkbox">
|
||||||
@@ -219,7 +217,7 @@ export function UserModal({ userId, onClose }: Props) {
|
|||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
<Modal.Footer>
|
<Modal.Footer>
|
||||||
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
<Button data-bs-dismiss="modal" onClick={onClose} disabled={isSubmitting}>
|
||||||
<T id="cancel" />
|
{intl.formatMessage({ id: "cancel" })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -229,7 +227,7 @@ export function UserModal({ userId, onClose }: Props) {
|
|||||||
isLoading={isSubmitting}
|
isLoading={isSubmitting}
|
||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
>
|
>
|
||||||
<T id="save" />
|
{intl.formatMessage({ id: "save" })}
|
||||||
</Button>
|
</Button>
|
||||||
</Modal.Footer>
|
</Modal.Footer>
|
||||||
</Form>
|
</Form>
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
export * from "./AccessListModal";
|
|
||||||
export * from "./ChangePasswordModal";
|
export * from "./ChangePasswordModal";
|
||||||
export * from "./DeadHostModal";
|
export * from "./DeadHostModal";
|
||||||
export * from "./DeleteConfirmModal";
|
export * from "./DeleteConfirmModal";
|
||||||
|
@@ -1,34 +1,18 @@
|
|||||||
import type { Table as ReactTable } from "@tanstack/react-table";
|
import type { Table as ReactTable } from "@tanstack/react-table";
|
||||||
import { Button } from "src/components";
|
import { Button } from "src/components";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
tableInstance: ReactTable<any>;
|
tableInstance: ReactTable<any>;
|
||||||
onNew?: () => void;
|
|
||||||
isFiltered?: boolean;
|
|
||||||
}
|
}
|
||||||
export default function Empty({ tableInstance, onNew, isFiltered }: Props) {
|
export default function Empty({ tableInstance }: Props) {
|
||||||
return (
|
return (
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
||||||
<div className="text-center my-4">
|
<div className="text-center my-4">
|
||||||
{isFiltered ? (
|
<h2>{intl.formatMessage({ id: "access.empty" })}</h2>
|
||||||
<h2>
|
<p className="text-muted">{intl.formatMessage({ id: "empty-subtitle" })}</p>
|
||||||
<T id="empty.search" />
|
<Button className="btn-cyan my-3">{intl.formatMessage({ id: "access.add" })}</Button>
|
||||||
</h2>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<h2>
|
|
||||||
<T id="access.empty" />
|
|
||||||
</h2>
|
|
||||||
<p className="text-muted">
|
|
||||||
<T id="empty-subtitle" />
|
|
||||||
</p>
|
|
||||||
<Button className="btn-cyan my-3" onClick={onNew}>
|
|
||||||
<T id="access.add" />
|
|
||||||
</Button>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@@ -4,24 +4,23 @@ import { useMemo } from "react";
|
|||||||
import type { AccessList } from "src/api/backend";
|
import type { AccessList } from "src/api/backend";
|
||||||
import { GravatarFormatter, ValueWithDateFormatter } from "src/components";
|
import { GravatarFormatter, ValueWithDateFormatter } from "src/components";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import Empty from "./Empty";
|
import Empty from "./Empty";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
data: AccessList[];
|
data: AccessList[];
|
||||||
isFiltered?: boolean;
|
|
||||||
isFetching?: boolean;
|
isFetching?: boolean;
|
||||||
onEdit?: (id: number) => void;
|
|
||||||
onDelete?: (id: number) => void;
|
|
||||||
onNew?: () => void;
|
|
||||||
}
|
}
|
||||||
export default function Table({ data, isFetching, isFiltered, onEdit, onDelete, onNew }: Props) {
|
export default function Table({ data, isFetching }: Props) {
|
||||||
const columnHelper = createColumnHelper<AccessList>();
|
const columnHelper = createColumnHelper<AccessList>();
|
||||||
const columns = useMemo(
|
const columns = useMemo(
|
||||||
() => [
|
() => [
|
||||||
columnHelper.accessor((row: any) => row.owner, {
|
columnHelper.accessor((row: any) => row.owner, {
|
||||||
id: "owner",
|
id: "owner",
|
||||||
cell: (info: any) => <GravatarFormatter url={info.getValue().avatar} name={info.getValue().name} />,
|
cell: (info: any) => {
|
||||||
|
const value = info.getValue();
|
||||||
|
return <GravatarFormatter url={value.avatar} name={value.name} />;
|
||||||
|
},
|
||||||
meta: {
|
meta: {
|
||||||
className: "w-1",
|
className: "w-1",
|
||||||
},
|
},
|
||||||
@@ -29,29 +28,42 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
|||||||
columnHelper.accessor((row: any) => row, {
|
columnHelper.accessor((row: any) => row, {
|
||||||
id: "name",
|
id: "name",
|
||||||
header: intl.formatMessage({ id: "column.name" }),
|
header: intl.formatMessage({ id: "column.name" }),
|
||||||
cell: (info: any) => (
|
cell: (info: any) => {
|
||||||
<ValueWithDateFormatter value={info.getValue().name} createdOn={info.getValue().createdOn} />
|
const value = info.getValue();
|
||||||
),
|
// Bit of a hack to reuse the DomainsFormatter component
|
||||||
|
return <ValueWithDateFormatter value={value.name} createdOn={value.createdOn} />;
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor((row: any) => row.items, {
|
columnHelper.accessor((row: any) => row.items, {
|
||||||
id: "items",
|
id: "items",
|
||||||
header: intl.formatMessage({ id: "column.authorization" }),
|
header: intl.formatMessage({ id: "column.authorization" }),
|
||||||
cell: (info: any) => <T id="access.auth-count" data={{ count: info.getValue().length }} />,
|
cell: (info: any) => {
|
||||||
|
const value = info.getValue();
|
||||||
|
return intl.formatMessage({ id: "access.auth-count" }, { count: value.length });
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor((row: any) => row.clients, {
|
columnHelper.accessor((row: any) => row.clients, {
|
||||||
id: "clients",
|
id: "clients",
|
||||||
header: intl.formatMessage({ id: "column.access" }),
|
header: intl.formatMessage({ id: "column.access" }),
|
||||||
cell: (info: any) => <T id="access.access-count" data={{ count: info.getValue().length }} />,
|
cell: (info: any) => {
|
||||||
|
const value = info.getValue();
|
||||||
|
return intl.formatMessage({ id: "access.access-count" }, { count: value.length });
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor((row: any) => row.satisfyAny, {
|
columnHelper.accessor((row: any) => row.satisfyAny, {
|
||||||
id: "satisfyAny",
|
id: "satisfyAny",
|
||||||
header: intl.formatMessage({ id: "column.satisfy" }),
|
header: intl.formatMessage({ id: "column.satisfy" }),
|
||||||
cell: (info: any) => <T id={info.getValue() ? "column.satisfy-any" : "column.satisfy-all"} />,
|
cell: (info: any) => {
|
||||||
|
const t = info.getValue() ? "access.satisfy-any" : "access.satisfy-all";
|
||||||
|
return intl.formatMessage({ id: t });
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
columnHelper.accessor((row: any) => row.proxyHostCount, {
|
columnHelper.accessor((row: any) => row.proxyHostCount, {
|
||||||
id: "proxyHostCount",
|
id: "proxyHostCount",
|
||||||
header: intl.formatMessage({ id: "proxy-hosts.title" }),
|
header: intl.formatMessage({ id: "proxy-hosts.title" }),
|
||||||
cell: (info: any) => <T id="proxy-hosts.count" data={{ count: info.getValue() }} />,
|
cell: (info: any) => {
|
||||||
|
return intl.formatMessage({ id: "proxy-hosts.count" }, { count: info.getValue() });
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
columnHelper.display({
|
columnHelper.display({
|
||||||
id: "id", // todo: not needed for a display?
|
id: "id", // todo: not needed for a display?
|
||||||
@@ -68,30 +80,21 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
|||||||
</button>
|
</button>
|
||||||
<div className="dropdown-menu dropdown-menu-end">
|
<div className="dropdown-menu dropdown-menu-end">
|
||||||
<span className="dropdown-header">
|
<span className="dropdown-header">
|
||||||
<T id="access.actions-title" data={{ id: info.row.original.id }} />
|
{intl.formatMessage(
|
||||||
|
{
|
||||||
|
id: "access.actions-title",
|
||||||
|
},
|
||||||
|
{ id: info.row.original.id },
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
<a
|
<a className="dropdown-item" href="#">
|
||||||
className="dropdown-item"
|
|
||||||
href="#"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
onEdit?.(info.row.original.id);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<IconEdit size={16} />
|
<IconEdit size={16} />
|
||||||
<T id="action.edit" />
|
{intl.formatMessage({ id: "action.edit" })}
|
||||||
</a>
|
</a>
|
||||||
<div className="dropdown-divider" />
|
<div className="dropdown-divider" />
|
||||||
<a
|
<a className="dropdown-item" href="#">
|
||||||
className="dropdown-item"
|
|
||||||
href="#"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
onDelete?.(info.row.original.id);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<IconTrash size={16} />
|
<IconTrash size={16} />
|
||||||
<T id="action.delete" />
|
{intl.formatMessage({ id: "action.delete" })}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
@@ -102,7 +105,7 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
[columnHelper, onEdit, onDelete],
|
[columnHelper],
|
||||||
);
|
);
|
||||||
|
|
||||||
const tableInstance = useReactTable<AccessList>({
|
const tableInstance = useReactTable<AccessList>({
|
||||||
@@ -116,10 +119,5 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
|||||||
enableSortingRemoval: false,
|
enableSortingRemoval: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return <TableLayout tableInstance={tableInstance} emptyState={<Empty tableInstance={tableInstance} />} />;
|
||||||
<TableLayout
|
|
||||||
tableInstance={tableInstance}
|
|
||||||
emptyState={<Empty tableInstance={tableInstance} onNew={onNew} isFiltered={isFiltered} />}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
@@ -1,18 +1,11 @@
|
|||||||
import { IconSearch } from "@tabler/icons-react";
|
import { IconSearch } from "@tabler/icons-react";
|
||||||
import { useState } from "react";
|
|
||||||
import Alert from "react-bootstrap/Alert";
|
import Alert from "react-bootstrap/Alert";
|
||||||
import { deleteAccessList } from "src/api/backend";
|
|
||||||
import { Button, LoadingPage } from "src/components";
|
import { Button, LoadingPage } from "src/components";
|
||||||
import { useAccessLists } from "src/hooks";
|
import { useAccessLists } from "src/hooks";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { AccessListModal, DeleteConfirmModal } from "src/modals";
|
|
||||||
import { showSuccess } from "src/notifications";
|
|
||||||
import Table from "./Table";
|
import Table from "./Table";
|
||||||
|
|
||||||
export default function TableWrapper() {
|
export default function TableWrapper() {
|
||||||
const [search, setSearch] = useState("");
|
|
||||||
const [editId, setEditId] = useState(0 as number | "new");
|
|
||||||
const [deleteId, setDeleteId] = useState(0);
|
|
||||||
const { isFetching, isLoading, isError, error, data } = useAccessLists(["owner", "items", "clients"]);
|
const { isFetching, isLoading, isError, error, data } = useAccessLists(["owner", "items", "clients"]);
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
@@ -23,27 +16,6 @@ export default function TableWrapper() {
|
|||||||
return <Alert variant="danger">{error?.message || "Unknown error"}</Alert>;
|
return <Alert variant="danger">{error?.message || "Unknown error"}</Alert>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDelete = async () => {
|
|
||||||
await deleteAccessList(deleteId);
|
|
||||||
showSuccess(intl.formatMessage({ id: "notification.access-deleted" }));
|
|
||||||
};
|
|
||||||
|
|
||||||
let filtered = null;
|
|
||||||
if (search && data) {
|
|
||||||
filtered = data?.filter((_item) => {
|
|
||||||
return true;
|
|
||||||
// TODO
|
|
||||||
// return (
|
|
||||||
// `${item.incomingPort}`.includes(search) ||
|
|
||||||
// `${item.forwardingPort}`.includes(search) ||
|
|
||||||
// item.forwardingHost.includes(search)
|
|
||||||
// );
|
|
||||||
});
|
|
||||||
} else if (search !== "") {
|
|
||||||
// this can happen if someone deletes the last item while searching
|
|
||||||
setSearch("");
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card mt-4">
|
<div className="card mt-4">
|
||||||
<div className="card-status-top bg-cyan" />
|
<div className="card-status-top bg-cyan" />
|
||||||
@@ -51,52 +23,29 @@ export default function TableWrapper() {
|
|||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
<div className="row w-full">
|
<div className="row w-full">
|
||||||
<div className="col">
|
<div className="col">
|
||||||
<h2 className="mt-1 mb-0">
|
<h2 className="mt-1 mb-0">{intl.formatMessage({ id: "access.title" })}</h2>
|
||||||
<T id="access.title" />
|
|
||||||
</h2>
|
|
||||||
</div>
|
</div>
|
||||||
{data?.length ? (
|
<div className="col-md-auto col-sm-12">
|
||||||
<div className="col-md-auto col-sm-12">
|
<div className="ms-auto d-flex flex-wrap btn-list">
|
||||||
<div className="ms-auto d-flex flex-wrap btn-list">
|
<div className="input-group input-group-flat w-auto">
|
||||||
<div className="input-group input-group-flat w-auto">
|
<span className="input-group-text input-group-text-sm">
|
||||||
<span className="input-group-text input-group-text-sm">
|
<IconSearch size={16} />
|
||||||
<IconSearch size={16} />
|
</span>
|
||||||
</span>
|
<input
|
||||||
<input
|
id="advanced-table-search"
|
||||||
id="advanced-table-search"
|
type="text"
|
||||||
type="text"
|
className="form-control form-control-sm"
|
||||||
className="form-control form-control-sm"
|
autoComplete="off"
|
||||||
autoComplete="off"
|
/>
|
||||||
onChange={(e: any) => setSearch(e.target.value.toLowerCase().trim())}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<Button size="sm" className="btn-cyan" onClick={() => setEditId("new")}>
|
|
||||||
<T id="access.add" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
|
<Button size="sm" className="btn-cyan">
|
||||||
|
{intl.formatMessage({ id: "access.add" })}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Table
|
<Table data={data ?? []} isFetching={isFetching} />
|
||||||
data={filtered ?? data ?? []}
|
|
||||||
isFetching={isFetching}
|
|
||||||
isFiltered={!!filtered}
|
|
||||||
onEdit={(id: number) => setEditId(id)}
|
|
||||||
onDelete={(id: number) => setDeleteId(id)}
|
|
||||||
onNew={() => setEditId("new")}
|
|
||||||
/>
|
|
||||||
{editId ? <AccessListModal id={editId} onClose={() => setEditId(0)} /> : null}
|
|
||||||
{deleteId ? (
|
|
||||||
<DeleteConfirmModal
|
|
||||||
title="access.delete.title"
|
|
||||||
onConfirm={handleDelete}
|
|
||||||
onClose={() => setDeleteId(0)}
|
|
||||||
invalidations={[["access-lists"], ["access-list", deleteId]]}
|
|
||||||
>
|
|
||||||
<T id="access.delete.content" />
|
|
||||||
</DeleteConfirmModal>
|
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@@ -3,7 +3,7 @@ import { useMemo } from "react";
|
|||||||
import type { AuditLog } from "src/api/backend";
|
import type { AuditLog } from "src/api/backend";
|
||||||
import { EventFormatter, GravatarFormatter } from "src/components";
|
import { EventFormatter, GravatarFormatter } from "src/components";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
data: AuditLog[];
|
data: AuditLog[];
|
||||||
@@ -47,7 +47,7 @@ export default function Table({ data, isFetching, onSelectItem }: Props) {
|
|||||||
onSelectItem?.(info.row.original.id);
|
onSelectItem?.(info.row.original.id);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<T id="action.view-details" />
|
{intl.formatMessage({ id: "action.view-details" })}
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@@ -2,7 +2,7 @@ import { useState } from "react";
|
|||||||
import Alert from "react-bootstrap/Alert";
|
import Alert from "react-bootstrap/Alert";
|
||||||
import { LoadingPage } from "src/components";
|
import { LoadingPage } from "src/components";
|
||||||
import { useAuditLogs } from "src/hooks";
|
import { useAuditLogs } from "src/hooks";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { EventDetailsModal } from "src/modals";
|
import { EventDetailsModal } from "src/modals";
|
||||||
import Table from "./Table";
|
import Table from "./Table";
|
||||||
|
|
||||||
@@ -25,9 +25,7 @@ export default function TableWrapper() {
|
|||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
<div className="row w-full">
|
<div className="row w-full">
|
||||||
<div className="col">
|
<div className="col">
|
||||||
<h2 className="mt-1 mb-0">
|
<h2 className="mt-1 mb-0">{intl.formatMessage({ id: "auditlog.title" })}</h2>
|
||||||
<T id="auditlog.title" />
|
|
||||||
</h2>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,62 +1,34 @@
|
|||||||
import type { Table as ReactTable } from "@tanstack/react-table";
|
import type { Table as ReactTable } from "@tanstack/react-table";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This component should never render as there should always be 1 user minimum,
|
||||||
|
* but I'm keeping it for consistency.
|
||||||
|
*/
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
tableInstance: ReactTable<any>;
|
tableInstance: ReactTable<any>;
|
||||||
onNew?: () => void;
|
|
||||||
onNewCustom?: () => void;
|
|
||||||
isFiltered?: boolean;
|
|
||||||
}
|
}
|
||||||
export default function Empty({ tableInstance, onNew, onNewCustom, isFiltered }: Props) {
|
export default function Empty({ tableInstance }: Props) {
|
||||||
return (
|
return (
|
||||||
<tr>
|
<tr>
|
||||||
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
||||||
<div className="text-center my-4">
|
<div className="text-center my-4">
|
||||||
{isFiltered ? (
|
<h2>{intl.formatMessage({ id: "certificates.empty" })}</h2>
|
||||||
<h2>
|
<p className="text-muted">{intl.formatMessage({ id: "empty-subtitle" })}</p>
|
||||||
<T id="empty.search" />
|
<div className="dropdown">
|
||||||
</h2>
|
<button type="button" className="btn dropdown-toggle btn-pink my-3" data-bs-toggle="dropdown">
|
||||||
) : (
|
{intl.formatMessage({ id: "certificates.add" })}
|
||||||
<>
|
</button>
|
||||||
<h2>
|
<div className="dropdown-menu">
|
||||||
<T id="certificates.empty" />
|
<a className="dropdown-item" href="#">
|
||||||
</h2>
|
{intl.formatMessage({ id: "lets-encrypt" })}
|
||||||
<p className="text-muted">
|
</a>
|
||||||
<T id="empty-subtitle" />
|
<a className="dropdown-item" href="#">
|
||||||
</p>
|
{intl.formatMessage({ id: "certificates.custom" })}
|
||||||
<div className="dropdown">
|
</a>
|
||||||
<button
|
</div>
|
||||||
type="button"
|
</div>
|
||||||
className="btn dropdown-toggle btn-pink my-3"
|
|
||||||
data-bs-toggle="dropdown"
|
|
||||||
>
|
|
||||||
<T id="certificates.add" />
|
|
||||||
</button>
|
|
||||||
<div className="dropdown-menu">
|
|
||||||
<a
|
|
||||||
className="dropdown-item"
|
|
||||||
href="#"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
onNew?.();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<T id="lets-encrypt" />
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
className="dropdown-item"
|
|
||||||
href="#"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
onNewCustom?.();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<T id="certificates.custom" />
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@@ -4,7 +4,7 @@ import { useMemo } from "react";
|
|||||||
import type { Certificate } from "src/api/backend";
|
import type { Certificate } from "src/api/backend";
|
||||||
import { DomainsFormatter, GravatarFormatter } from "src/components";
|
import { DomainsFormatter, GravatarFormatter } from "src/components";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import Empty from "./Empty";
|
import Empty from "./Empty";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -69,20 +69,25 @@ export default function Table({ data, isFetching }: Props) {
|
|||||||
</button>
|
</button>
|
||||||
<div className="dropdown-menu dropdown-menu-end">
|
<div className="dropdown-menu dropdown-menu-end">
|
||||||
<span className="dropdown-header">
|
<span className="dropdown-header">
|
||||||
<T id="certificates.actions-title" data={{ id: info.row.original.id }} />
|
{intl.formatMessage(
|
||||||
|
{
|
||||||
|
id: "certificates.actions-title",
|
||||||
|
},
|
||||||
|
{ id: info.row.original.id },
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
<a className="dropdown-item" href="#">
|
<a className="dropdown-item" href="#">
|
||||||
<IconEdit size={16} />
|
<IconEdit size={16} />
|
||||||
<T id="action.edit" />
|
{intl.formatMessage({ id: "action.edit" })}
|
||||||
</a>
|
</a>
|
||||||
<a className="dropdown-item" href="#">
|
<a className="dropdown-item" href="#">
|
||||||
<IconPower size={16} />
|
<IconPower size={16} />
|
||||||
<T id="action.disable" />
|
{intl.formatMessage({ id: "action.disable" })}
|
||||||
</a>
|
</a>
|
||||||
<div className="dropdown-divider" />
|
<div className="dropdown-divider" />
|
||||||
<a className="dropdown-item" href="#">
|
<a className="dropdown-item" href="#">
|
||||||
<IconTrash size={16} />
|
<IconTrash size={16} />
|
||||||
<T id="action.delete" />
|
{intl.formatMessage({ id: "action.delete" })}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
@@ -2,7 +2,7 @@ import { IconSearch } from "@tabler/icons-react";
|
|||||||
import Alert from "react-bootstrap/Alert";
|
import Alert from "react-bootstrap/Alert";
|
||||||
import { LoadingPage } from "src/components";
|
import { LoadingPage } from "src/components";
|
||||||
import { useCertificates } from "src/hooks";
|
import { useCertificates } from "src/hooks";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import Table from "./Table";
|
import Table from "./Table";
|
||||||
|
|
||||||
export default function TableWrapper() {
|
export default function TableWrapper() {
|
||||||
@@ -28,9 +28,7 @@ export default function TableWrapper() {
|
|||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
<div className="row w-full">
|
<div className="row w-full">
|
||||||
<div className="col">
|
<div className="col">
|
||||||
<h2 className="mt-1 mb-0">
|
<h2 className="mt-1 mb-0">{intl.formatMessage({ id: "certificates.title" })}</h2>
|
||||||
<T id="certificates.title" />
|
|
||||||
</h2>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="col-md-auto col-sm-12">
|
<div className="col-md-auto col-sm-12">
|
||||||
<div className="ms-auto d-flex flex-wrap btn-list">
|
<div className="ms-auto d-flex flex-wrap btn-list">
|
||||||
@@ -51,14 +49,14 @@ export default function TableWrapper() {
|
|||||||
className="btn btn-sm dropdown-toggle btn-pink mt-1"
|
className="btn btn-sm dropdown-toggle btn-pink mt-1"
|
||||||
data-bs-toggle="dropdown"
|
data-bs-toggle="dropdown"
|
||||||
>
|
>
|
||||||
<T id="certificates.add" />
|
{intl.formatMessage({ id: "certificates.add" })}
|
||||||
</button>
|
</button>
|
||||||
<div className="dropdown-menu">
|
<div className="dropdown-menu">
|
||||||
<a className="dropdown-item" href="#">
|
<a className="dropdown-item" href="#">
|
||||||
<T id="lets-encrypt" />
|
{intl.formatMessage({ id: "lets-encrypt" })}
|
||||||
</a>
|
</a>
|
||||||
<a className="dropdown-item" href="#">
|
<a className="dropdown-item" href="#">
|
||||||
<T id="certificates.custom" />
|
{intl.formatMessage({ id: "certificates.custom" })}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { IconArrowsCross, IconBolt, IconBoltOff, IconDisc } from "@tabler/icons-react";
|
import { IconArrowsCross, IconBolt, IconBoltOff, IconDisc } from "@tabler/icons-react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useHostReport } from "src/hooks";
|
import { useHostReport } from "src/hooks";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
const Dashboard = () => {
|
const Dashboard = () => {
|
||||||
const { data: hostReport } = useHostReport();
|
const { data: hostReport } = useHostReport();
|
||||||
@@ -9,9 +9,7 @@ const Dashboard = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h2>
|
<h2>{intl.formatMessage({ id: "dashboard.title" })}</h2>
|
||||||
<T id="dashboard.title" />
|
|
||||||
</h2>
|
|
||||||
<div className="row row-deck row-cards">
|
<div className="row row-deck row-cards">
|
||||||
<div className="col-12 my-4">
|
<div className="col-12 my-4">
|
||||||
<div className="row row-cards">
|
<div className="row row-cards">
|
||||||
@@ -33,7 +31,10 @@ const Dashboard = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="col">
|
<div className="col">
|
||||||
<div className="font-weight-medium">
|
<div className="font-weight-medium">
|
||||||
<T id="proxy-hosts.count" data={{ count: hostReport?.proxy }} />
|
{intl.formatMessage(
|
||||||
|
{ id: "proxy-hosts.count" },
|
||||||
|
{ count: hostReport?.proxy },
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -57,7 +58,10 @@ const Dashboard = () => {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="col">
|
<div className="col">
|
||||||
<T id="redirection-hosts.count" data={{ count: hostReport?.redirection }} />
|
{intl.formatMessage(
|
||||||
|
{ id: "redirection-hosts.count" },
|
||||||
|
{ count: hostReport?.redirection },
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -80,7 +84,7 @@ const Dashboard = () => {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="col">
|
<div className="col">
|
||||||
<T id="streams.count" data={{ count: hostReport?.stream }} />
|
{intl.formatMessage({ id: "streams.count" }, { count: hostReport?.stream })}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -103,7 +107,10 @@ const Dashboard = () => {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="col">
|
<div className="col">
|
||||||
<T id="dead-hosts.count" data={{ count: hostReport?.dead }} />
|
{intl.formatMessage(
|
||||||
|
{ id: "dead-hosts.count" },
|
||||||
|
{ count: hostReport?.dead },
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -118,22 +125,12 @@ const Dashboard = () => {
|
|||||||
- check mobile
|
- check mobile
|
||||||
- add help docs for host types
|
- add help docs for host types
|
||||||
- REDO SCREENSHOTS in docs folder
|
- REDO SCREENSHOTS in docs folder
|
||||||
- translations for:
|
|
||||||
- src/components/Form/AccessField.tsx
|
|
||||||
- src/components/Form/SSLCertificateField.tsx
|
|
||||||
- src/components/Form/DNSProviderFields.tsx
|
|
||||||
- search codebase for "TODO"
|
|
||||||
- update documentation to add development notes for translations
|
|
||||||
- use syntax highligting for audit logs json output
|
|
||||||
- double check output of access field selection on proxy host dialog, after access lists are completed
|
|
||||||
- proxy host custom locations dialog
|
|
||||||
|
|
||||||
More for api, then implement here:
|
More for api, then implement here:
|
||||||
- Properly implement refresh tokens
|
- Properly implement refresh tokens
|
||||||
- Add error message_18n for all backend errors
|
- Add error message_18n for all backend errors
|
||||||
- minor: certificates expand with hosts needs to omit 'is_deleted'
|
- minor: certificates expand with hosts needs to omit 'is_deleted'
|
||||||
- properly wrap all logger.debug called in isDebug check
|
- properly wrap all logger.debug called in isDebug check
|
||||||
- add new api endpoint changes to swagger docs
|
|
||||||
|
|
||||||
`}</code>
|
`}</code>
|
||||||
</pre>
|
</pre>
|
||||||
|
@@ -5,7 +5,7 @@ import Alert from "react-bootstrap/Alert";
|
|||||||
import { Button, LocalePicker, Page, ThemeSwitcher } from "src/components";
|
import { Button, LocalePicker, Page, ThemeSwitcher } from "src/components";
|
||||||
import { useAuthState } from "src/context";
|
import { useAuthState } from "src/context";
|
||||||
import { useHealth } from "src/hooks";
|
import { useHealth } from "src/hooks";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { validateEmail, validateString } from "src/modules/Validations";
|
import { validateEmail, validateString } from "src/modules/Validations";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
@@ -57,9 +57,7 @@ export default function Login() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="card card-md">
|
<div className="card card-md">
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<h2 className="h2 text-center mb-4">
|
<h2 className="h2 text-center mb-4">{intl.formatMessage({ id: "login.title" })}</h2>
|
||||||
<T id="login.title" />
|
|
||||||
</h2>
|
|
||||||
{formErr !== "" && <Alert variant="danger">{formErr}</Alert>}
|
{formErr !== "" && <Alert variant="danger">{formErr}</Alert>}
|
||||||
<Formik
|
<Formik
|
||||||
initialValues={
|
initialValues={
|
||||||
@@ -76,7 +74,7 @@ export default function Login() {
|
|||||||
<Field name="email" validate={validateEmail()}>
|
<Field name="email" validate={validateEmail()}>
|
||||||
{({ field, form }: any) => (
|
{({ field, form }: any) => (
|
||||||
<label className="form-label">
|
<label className="form-label">
|
||||||
<T id="email-address" />
|
{intl.formatMessage({ id: "email-address" })}
|
||||||
<input
|
<input
|
||||||
{...field}
|
{...field}
|
||||||
ref={emailRef}
|
ref={emailRef}
|
||||||
@@ -95,7 +93,7 @@ export default function Login() {
|
|||||||
{({ field, form }: any) => (
|
{({ field, form }: any) => (
|
||||||
<>
|
<>
|
||||||
<label className="form-label">
|
<label className="form-label">
|
||||||
<T id="password" />
|
{intl.formatMessage({ id: "password" })}
|
||||||
<input
|
<input
|
||||||
{...field}
|
{...field}
|
||||||
type="password"
|
type="password"
|
||||||
@@ -113,7 +111,7 @@ export default function Login() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="form-footer">
|
<div className="form-footer">
|
||||||
<Button type="submit" fullWidth color="azure" isLoading={isSubmitting}>
|
<Button type="submit" fullWidth color="azure" isLoading={isSubmitting}>
|
||||||
<T id="sign-in" />
|
{intl.formatMessage({ id: "sign-in" })}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import type { Table as ReactTable } from "@tanstack/react-table";
|
import type { Table as ReactTable } from "@tanstack/react-table";
|
||||||
import { Button } from "src/components";
|
import { Button } from "src/components";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
tableInstance: ReactTable<any>;
|
tableInstance: ReactTable<any>;
|
||||||
@@ -13,19 +13,13 @@ export default function Empty({ tableInstance, onNew, isFiltered }: Props) {
|
|||||||
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
||||||
<div className="text-center my-4">
|
<div className="text-center my-4">
|
||||||
{isFiltered ? (
|
{isFiltered ? (
|
||||||
<h2>
|
<h2>{intl.formatMessage({ id: "empty-search" })}</h2>
|
||||||
<T id="empty.search" />
|
|
||||||
</h2>
|
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<h2>
|
<h2>{intl.formatMessage({ id: "dead-hosts.empty" })}</h2>
|
||||||
<T id="dead-hosts.empty" />
|
<p className="text-muted">{intl.formatMessage({ id: "empty-subtitle" })}</p>
|
||||||
</h2>
|
|
||||||
<p className="text-muted">
|
|
||||||
<T id="empty-subtitle" />
|
|
||||||
</p>
|
|
||||||
<Button className="btn-red my-3" onClick={onNew}>
|
<Button className="btn-red my-3" onClick={onNew}>
|
||||||
<T id="dead-hosts.add" />
|
{intl.formatMessage({ id: "dead-hosts.add" })}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
@@ -4,7 +4,7 @@ import { useMemo } from "react";
|
|||||||
import type { DeadHost } from "src/api/backend";
|
import type { DeadHost } from "src/api/backend";
|
||||||
import { CertificateFormatter, DomainsFormatter, GravatarFormatter, StatusFormatter } from "src/components";
|
import { CertificateFormatter, DomainsFormatter, GravatarFormatter, StatusFormatter } from "src/components";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import Empty from "./Empty";
|
import Empty from "./Empty";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -67,7 +67,12 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
</button>
|
</button>
|
||||||
<div className="dropdown-menu dropdown-menu-end">
|
<div className="dropdown-menu dropdown-menu-end">
|
||||||
<span className="dropdown-header">
|
<span className="dropdown-header">
|
||||||
<T id="dead-hosts.actions-title" data={{ id: info.row.original.id }} />
|
{intl.formatMessage(
|
||||||
|
{
|
||||||
|
id: "dead-hosts.actions-title",
|
||||||
|
},
|
||||||
|
{ id: info.row.original.id },
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
<a
|
<a
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
@@ -78,7 +83,7 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconEdit size={16} />
|
<IconEdit size={16} />
|
||||||
<T id="action.edit" />
|
{intl.formatMessage({ id: "action.edit" })}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
@@ -89,7 +94,9 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconPower size={16} />
|
<IconPower size={16} />
|
||||||
<T id={info.row.original.enabled ? "action.disable" : "action.enable"} />
|
{intl.formatMessage({
|
||||||
|
id: info.row.original.enabled ? "action.disable" : "action.enable",
|
||||||
|
})}
|
||||||
</a>
|
</a>
|
||||||
<div className="dropdown-divider" />
|
<div className="dropdown-divider" />
|
||||||
<a
|
<a
|
||||||
@@ -101,7 +108,7 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconTrash size={16} />
|
<IconTrash size={16} />
|
||||||
<T id="action.delete" />
|
{intl.formatMessage({ id: "action.delete" })}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
@@ -5,7 +5,7 @@ import Alert from "react-bootstrap/Alert";
|
|||||||
import { deleteDeadHost, toggleDeadHost } from "src/api/backend";
|
import { deleteDeadHost, toggleDeadHost } from "src/api/backend";
|
||||||
import { Button, LoadingPage } from "src/components";
|
import { Button, LoadingPage } from "src/components";
|
||||||
import { useDeadHosts } from "src/hooks";
|
import { useDeadHosts } from "src/hooks";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { DeadHostModal, DeleteConfirmModal } from "src/modals";
|
import { DeadHostModal, DeleteConfirmModal } from "src/modals";
|
||||||
import { showSuccess } from "src/notifications";
|
import { showSuccess } from "src/notifications";
|
||||||
import Table from "./Table";
|
import Table from "./Table";
|
||||||
@@ -54,9 +54,7 @@ export default function TableWrapper() {
|
|||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
<div className="row w-full">
|
<div className="row w-full">
|
||||||
<div className="col">
|
<div className="col">
|
||||||
<h2 className="mt-1 mb-0">
|
<h2 className="mt-1 mb-0">{intl.formatMessage({ id: "dead-hosts.title" })}</h2>
|
||||||
<T id="dead-hosts.title" />
|
|
||||||
</h2>
|
|
||||||
</div>
|
</div>
|
||||||
{data?.length ? (
|
{data?.length ? (
|
||||||
<div className="col-md-auto col-sm-12">
|
<div className="col-md-auto col-sm-12">
|
||||||
@@ -73,8 +71,9 @@ export default function TableWrapper() {
|
|||||||
onChange={(e: any) => setSearch(e.target.value.toLowerCase().trim())}
|
onChange={(e: any) => setSearch(e.target.value.toLowerCase().trim())}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button size="sm" className="btn-red" onClick={() => setEditId("new")}>
|
<Button size="sm" className="btn-red" onClick={() => setEditId("new")}>
|
||||||
<T id="dead-hosts.add" />
|
{intl.formatMessage({ id: "dead-hosts.add" })}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -93,12 +92,12 @@ export default function TableWrapper() {
|
|||||||
{editId ? <DeadHostModal id={editId} onClose={() => setEditId(0)} /> : null}
|
{editId ? <DeadHostModal id={editId} onClose={() => setEditId(0)} /> : null}
|
||||||
{deleteId ? (
|
{deleteId ? (
|
||||||
<DeleteConfirmModal
|
<DeleteConfirmModal
|
||||||
title="dead-host.delete.title"
|
title={intl.formatMessage({ id: "dead-host.delete.title" })}
|
||||||
onConfirm={handleDelete}
|
onConfirm={handleDelete}
|
||||||
onClose={() => setDeleteId(0)}
|
onClose={() => setDeleteId(0)}
|
||||||
invalidations={[["dead-hosts"], ["dead-host", deleteId]]}
|
invalidations={[["dead-hosts"], ["dead-host", deleteId]]}
|
||||||
>
|
>
|
||||||
<T id="dead-host.delete.content" />
|
{intl.formatMessage({ id: "dead-host.delete.content" })}
|
||||||
</DeleteConfirmModal>
|
</DeleteConfirmModal>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import type { Table as ReactTable } from "@tanstack/react-table";
|
import type { Table as ReactTable } from "@tanstack/react-table";
|
||||||
import { Button } from "src/components";
|
import { Button } from "src/components";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
tableInstance: ReactTable<any>;
|
tableInstance: ReactTable<any>;
|
||||||
@@ -13,19 +13,13 @@ export default function Empty({ tableInstance, onNew, isFiltered }: Props) {
|
|||||||
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
||||||
<div className="text-center my-4">
|
<div className="text-center my-4">
|
||||||
{isFiltered ? (
|
{isFiltered ? (
|
||||||
<h2>
|
<h2>{intl.formatMessage({ id: "empty-search" })}</h2>
|
||||||
<T id="empty.search" />
|
|
||||||
</h2>
|
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<h2>
|
<h2>{intl.formatMessage({ id: "proxy-hosts.empty" })}</h2>
|
||||||
<T id="proxy-hosts.empty" />
|
<p className="text-muted">{intl.formatMessage({ id: "empty-subtitle" })}</p>
|
||||||
</h2>
|
|
||||||
<p className="text-muted">
|
|
||||||
<T id="empty-subtitle" />
|
|
||||||
</p>
|
|
||||||
<Button className="btn-lime my-3" onClick={onNew}>
|
<Button className="btn-lime my-3" onClick={onNew}>
|
||||||
<T id="proxy-hosts.add" />
|
{intl.formatMessage({ id: "proxy-hosts.add" })}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
@@ -4,7 +4,7 @@ import { useMemo } from "react";
|
|||||||
import type { ProxyHost } from "src/api/backend";
|
import type { ProxyHost } from "src/api/backend";
|
||||||
import { CertificateFormatter, DomainsFormatter, GravatarFormatter, StatusFormatter } from "src/components";
|
import { CertificateFormatter, DomainsFormatter, GravatarFormatter, StatusFormatter } from "src/components";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import Empty from "./Empty";
|
import Empty from "./Empty";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -83,7 +83,12 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
</button>
|
</button>
|
||||||
<div className="dropdown-menu dropdown-menu-end">
|
<div className="dropdown-menu dropdown-menu-end">
|
||||||
<span className="dropdown-header">
|
<span className="dropdown-header">
|
||||||
<T id="proxy-hosts.actions-title" data={{ id: info.row.original.id }} />
|
{intl.formatMessage(
|
||||||
|
{
|
||||||
|
id: "proxy-hosts.actions-title",
|
||||||
|
},
|
||||||
|
{ id: info.row.original.id },
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
<a
|
<a
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
@@ -94,7 +99,7 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconEdit size={16} />
|
<IconEdit size={16} />
|
||||||
<T id="action.edit" />
|
{intl.formatMessage({ id: "action.edit" })}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
@@ -105,7 +110,9 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconPower size={16} />
|
<IconPower size={16} />
|
||||||
<T id={info.row.original.enabled ? "action.disable" : "action.enable"} />
|
{intl.formatMessage({
|
||||||
|
id: info.row.original.enabled ? "action.disable" : "action.enable",
|
||||||
|
})}
|
||||||
</a>
|
</a>
|
||||||
<div className="dropdown-divider" />
|
<div className="dropdown-divider" />
|
||||||
<a
|
<a
|
||||||
@@ -117,7 +124,7 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconTrash size={16} />
|
<IconTrash size={16} />
|
||||||
<T id="action.delete" />
|
{intl.formatMessage({ id: "action.delete" })}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
@@ -5,7 +5,7 @@ import Alert from "react-bootstrap/Alert";
|
|||||||
import { deleteProxyHost, toggleProxyHost } from "src/api/backend";
|
import { deleteProxyHost, toggleProxyHost } from "src/api/backend";
|
||||||
import { Button, LoadingPage } from "src/components";
|
import { Button, LoadingPage } from "src/components";
|
||||||
import { useProxyHosts } from "src/hooks";
|
import { useProxyHosts } from "src/hooks";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { DeleteConfirmModal, ProxyHostModal } from "src/modals";
|
import { DeleteConfirmModal, ProxyHostModal } from "src/modals";
|
||||||
import { showSuccess } from "src/notifications";
|
import { showSuccess } from "src/notifications";
|
||||||
import Table from "./Table";
|
import Table from "./Table";
|
||||||
@@ -41,7 +41,6 @@ export default function TableWrapper() {
|
|||||||
if (search && data) {
|
if (search && data) {
|
||||||
filtered = data?.filter((_item) => {
|
filtered = data?.filter((_item) => {
|
||||||
return true;
|
return true;
|
||||||
// TODO
|
|
||||||
// item.domainNames.some((domain: string) => domain.toLowerCase().includes(search)) ||
|
// item.domainNames.some((domain: string) => domain.toLowerCase().includes(search)) ||
|
||||||
// item.forwardDomainName.toLowerCase().includes(search)
|
// item.forwardDomainName.toLowerCase().includes(search)
|
||||||
// );
|
// );
|
||||||
@@ -58,9 +57,7 @@ export default function TableWrapper() {
|
|||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
<div className="row w-full">
|
<div className="row w-full">
|
||||||
<div className="col">
|
<div className="col">
|
||||||
<h2 className="mt-1 mb-0">
|
<h2 className="mt-1 mb-0">{intl.formatMessage({ id: "proxy-hosts.title" })}</h2>
|
||||||
<T id="proxy-hosts.title" />
|
|
||||||
</h2>
|
|
||||||
</div>
|
</div>
|
||||||
{data?.length ? (
|
{data?.length ? (
|
||||||
<div className="col-md-auto col-sm-12">
|
<div className="col-md-auto col-sm-12">
|
||||||
@@ -77,7 +74,7 @@ export default function TableWrapper() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Button size="sm" className="btn-lime">
|
<Button size="sm" className="btn-lime">
|
||||||
<T id="proxy-hosts.add" />
|
{intl.formatMessage({ id: "proxy-hosts.add" })}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -96,12 +93,12 @@ export default function TableWrapper() {
|
|||||||
{editId ? <ProxyHostModal id={editId} onClose={() => setEditId(0)} /> : null}
|
{editId ? <ProxyHostModal id={editId} onClose={() => setEditId(0)} /> : null}
|
||||||
{deleteId ? (
|
{deleteId ? (
|
||||||
<DeleteConfirmModal
|
<DeleteConfirmModal
|
||||||
title="proxy-host.delete.title"
|
title={intl.formatMessage({ id: "proxy-host.delete.title" })}
|
||||||
onConfirm={handleDelete}
|
onConfirm={handleDelete}
|
||||||
onClose={() => setDeleteId(0)}
|
onClose={() => setDeleteId(0)}
|
||||||
invalidations={[["proxy-hosts"], ["proxy-host", deleteId]]}
|
invalidations={[["proxy-hosts"], ["proxy-host", deleteId]]}
|
||||||
>
|
>
|
||||||
<T id="proxy-host.delete.content" />
|
{intl.formatMessage({ id: "proxy-host.delete.content" })}
|
||||||
</DeleteConfirmModal>
|
</DeleteConfirmModal>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import type { Table as ReactTable } from "@tanstack/react-table";
|
import type { Table as ReactTable } from "@tanstack/react-table";
|
||||||
import { Button } from "src/components";
|
import { Button } from "src/components";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
tableInstance: ReactTable<any>;
|
tableInstance: ReactTable<any>;
|
||||||
@@ -13,19 +13,13 @@ export default function Empty({ tableInstance, onNew, isFiltered }: Props) {
|
|||||||
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
||||||
<div className="text-center my-4">
|
<div className="text-center my-4">
|
||||||
{isFiltered ? (
|
{isFiltered ? (
|
||||||
<h2>
|
<h2>{intl.formatMessage({ id: "empty-search" })}</h2>
|
||||||
<T id="empty.search" />
|
|
||||||
</h2>
|
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<h2>
|
<h2>{intl.formatMessage({ id: "redirection-hosts.empty" })}</h2>
|
||||||
<T id="redirection-hosts.empty" />
|
<p className="text-muted">{intl.formatMessage({ id: "empty-subtitle" })}</p>
|
||||||
</h2>
|
|
||||||
<p className="text-muted">
|
|
||||||
<T id="empty-subtitle" />
|
|
||||||
</p>
|
|
||||||
<Button className="btn-yellow my-3" onClick={onNew}>
|
<Button className="btn-yellow my-3" onClick={onNew}>
|
||||||
<T id="redirection-hosts.add" />
|
{intl.formatMessage({ id: "redirection-hosts.add" })}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
@@ -4,7 +4,7 @@ import { useMemo } from "react";
|
|||||||
import type { RedirectionHost } from "src/api/backend";
|
import type { RedirectionHost } from "src/api/backend";
|
||||||
import { CertificateFormatter, DomainsFormatter, GravatarFormatter, StatusFormatter } from "src/components";
|
import { CertificateFormatter, DomainsFormatter, GravatarFormatter, StatusFormatter } from "src/components";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import Empty from "./Empty";
|
import Empty from "./Empty";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -88,7 +88,12 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
</button>
|
</button>
|
||||||
<div className="dropdown-menu dropdown-menu-end">
|
<div className="dropdown-menu dropdown-menu-end">
|
||||||
<span className="dropdown-header">
|
<span className="dropdown-header">
|
||||||
<T id="redirection-hosts.actions-title" data={{ id: info.row.original.id }} />
|
{intl.formatMessage(
|
||||||
|
{
|
||||||
|
id: "redirection-hosts.actions-title",
|
||||||
|
},
|
||||||
|
{ id: info.row.original.id },
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
<a
|
<a
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
@@ -99,7 +104,7 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconEdit size={16} />
|
<IconEdit size={16} />
|
||||||
<T id="action.edit" />
|
{intl.formatMessage({ id: "action.edit" })}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
@@ -110,7 +115,9 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconPower size={16} />
|
<IconPower size={16} />
|
||||||
<T id={info.row.original.enabled ? "action.disable" : "action.enable"} />
|
{intl.formatMessage({
|
||||||
|
id: info.row.original.enabled ? "action.disable" : "action.enable",
|
||||||
|
})}
|
||||||
</a>
|
</a>
|
||||||
<div className="dropdown-divider" />
|
<div className="dropdown-divider" />
|
||||||
<a
|
<a
|
||||||
@@ -122,7 +129,7 @@ export default function Table({ data, isFetching, onEdit, onDelete, onDisableTog
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconTrash size={16} />
|
<IconTrash size={16} />
|
||||||
<T id="action.delete" />
|
{intl.formatMessage({ id: "action.delete" })}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
@@ -5,7 +5,7 @@ import Alert from "react-bootstrap/Alert";
|
|||||||
import { deleteRedirectionHost, toggleRedirectionHost } from "src/api/backend";
|
import { deleteRedirectionHost, toggleRedirectionHost } from "src/api/backend";
|
||||||
import { Button, LoadingPage } from "src/components";
|
import { Button, LoadingPage } from "src/components";
|
||||||
import { useRedirectionHosts } from "src/hooks";
|
import { useRedirectionHosts } from "src/hooks";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { DeleteConfirmModal, RedirectionHostModal } from "src/modals";
|
import { DeleteConfirmModal, RedirectionHostModal } from "src/modals";
|
||||||
import { showSuccess } from "src/notifications";
|
import { showSuccess } from "src/notifications";
|
||||||
import Table from "./Table";
|
import Table from "./Table";
|
||||||
@@ -57,9 +57,7 @@ export default function TableWrapper() {
|
|||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
<div className="row w-full">
|
<div className="row w-full">
|
||||||
<div className="col">
|
<div className="col">
|
||||||
<h2 className="mt-1 mb-0">
|
<h2 className="mt-1 mb-0">{intl.formatMessage({ id: "redirection-hosts.title" })}</h2>
|
||||||
<T id="redirection-hosts.title" />
|
|
||||||
</h2>
|
|
||||||
</div>
|
</div>
|
||||||
{data?.length ? (
|
{data?.length ? (
|
||||||
<div className="col-md-auto col-sm-12">
|
<div className="col-md-auto col-sm-12">
|
||||||
@@ -76,8 +74,9 @@ export default function TableWrapper() {
|
|||||||
onChange={(e: any) => setSearch(e.target.value.toLowerCase().trim())}
|
onChange={(e: any) => setSearch(e.target.value.toLowerCase().trim())}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button size="sm" className="btn-yellow" onClick={() => setEditId("new")}>
|
<Button size="sm" className="btn-yellow" onClick={() => setEditId("new")}>
|
||||||
<T id="redirection-hosts.add" />
|
{intl.formatMessage({ id: "redirection-hosts.add" })}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -96,12 +95,12 @@ export default function TableWrapper() {
|
|||||||
{editId ? <RedirectionHostModal id={editId} onClose={() => setEditId(0)} /> : null}
|
{editId ? <RedirectionHostModal id={editId} onClose={() => setEditId(0)} /> : null}
|
||||||
{deleteId ? (
|
{deleteId ? (
|
||||||
<DeleteConfirmModal
|
<DeleteConfirmModal
|
||||||
title="redirection-host.delete.title"
|
title={intl.formatMessage({ id: "redirection-host.delete.title" })}
|
||||||
onConfirm={handleDelete}
|
onConfirm={handleDelete}
|
||||||
onClose={() => setDeleteId(0)}
|
onClose={() => setDeleteId(0)}
|
||||||
invalidations={[["redirection-hosts"], ["redirection-host", deleteId]]}
|
invalidations={[["redirection-hosts"], ["redirection-host", deleteId]]}
|
||||||
>
|
>
|
||||||
<T id="redirection-host.delete.content" />
|
{intl.formatMessage({ id: "redirection-host.delete.content" })}
|
||||||
</DeleteConfirmModal>
|
</DeleteConfirmModal>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import type { Table as ReactTable } from "@tanstack/react-table";
|
import type { Table as ReactTable } from "@tanstack/react-table";
|
||||||
import { Button } from "src/components";
|
import { Button } from "src/components";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
tableInstance: ReactTable<any>;
|
tableInstance: ReactTable<any>;
|
||||||
@@ -13,19 +13,13 @@ export default function Empty({ tableInstance, onNew, isFiltered }: Props) {
|
|||||||
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
||||||
<div className="text-center my-4">
|
<div className="text-center my-4">
|
||||||
{isFiltered ? (
|
{isFiltered ? (
|
||||||
<h2>
|
<h2>{intl.formatMessage({ id: "empty-search" })}</h2>
|
||||||
<T id="empty.search" />
|
|
||||||
</h2>
|
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<h2>
|
<h2>{intl.formatMessage({ id: "streams.empty" })}</h2>
|
||||||
<T id="streams.empty" />
|
<p className="text-muted">{intl.formatMessage({ id: "empty-subtitle" })}</p>
|
||||||
</h2>
|
|
||||||
<p className="text-muted">
|
|
||||||
<T id="empty-subtitle" />
|
|
||||||
</p>
|
|
||||||
<Button className="btn-blue my-3" onClick={onNew}>
|
<Button className="btn-blue my-3" onClick={onNew}>
|
||||||
<T id="streams.add" />
|
{intl.formatMessage({ id: "streams.add" })}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
@@ -4,7 +4,7 @@ import { useMemo } from "react";
|
|||||||
import type { Stream } from "src/api/backend";
|
import type { Stream } from "src/api/backend";
|
||||||
import { CertificateFormatter, GravatarFormatter, StatusFormatter, ValueWithDateFormatter } from "src/components";
|
import { CertificateFormatter, GravatarFormatter, StatusFormatter, ValueWithDateFormatter } from "src/components";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import Empty from "./Empty";
|
import Empty from "./Empty";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -55,12 +55,12 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
|||||||
<>
|
<>
|
||||||
{value.tcpForwarding ? (
|
{value.tcpForwarding ? (
|
||||||
<span className="badge badge-lg domain-name">
|
<span className="badge badge-lg domain-name">
|
||||||
<T id="streams.tcp" />
|
{intl.formatMessage({ id: "streams.tcp" })}
|
||||||
</span>
|
</span>
|
||||||
) : null}
|
) : null}
|
||||||
{value.udpForwarding ? (
|
{value.udpForwarding ? (
|
||||||
<span className="badge badge-lg domain-name">
|
<span className="badge badge-lg domain-name">
|
||||||
<T id="streams.udp" />
|
{intl.formatMessage({ id: "streams.udp" })}
|
||||||
</span>
|
</span>
|
||||||
) : null}
|
) : null}
|
||||||
</>
|
</>
|
||||||
@@ -96,7 +96,12 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
|||||||
</button>
|
</button>
|
||||||
<div className="dropdown-menu dropdown-menu-end">
|
<div className="dropdown-menu dropdown-menu-end">
|
||||||
<span className="dropdown-header">
|
<span className="dropdown-header">
|
||||||
<T id="streams.actions-title" data={{ id: info.row.original.id }} />
|
{intl.formatMessage(
|
||||||
|
{
|
||||||
|
id: "streams.actions-title",
|
||||||
|
},
|
||||||
|
{ id: info.row.original.id },
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
<a
|
<a
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
@@ -107,7 +112,7 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconEdit size={16} />
|
<IconEdit size={16} />
|
||||||
<T id="action.edit" />
|
{intl.formatMessage({ id: "action.edit" })}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
@@ -118,7 +123,7 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconPower size={16} />
|
<IconPower size={16} />
|
||||||
<T id="action.disable" />
|
{intl.formatMessage({ id: "action.disable" })}
|
||||||
</a>
|
</a>
|
||||||
<div className="dropdown-divider" />
|
<div className="dropdown-divider" />
|
||||||
<a
|
<a
|
||||||
@@ -130,7 +135,7 @@ export default function Table({ data, isFetching, isFiltered, onEdit, onDelete,
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconTrash size={16} />
|
<IconTrash size={16} />
|
||||||
<T id="action.delete" />
|
{intl.formatMessage({ id: "action.delete" })}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
|
@@ -5,7 +5,7 @@ import Alert from "react-bootstrap/Alert";
|
|||||||
import { deleteStream, toggleStream } from "src/api/backend";
|
import { deleteStream, toggleStream } from "src/api/backend";
|
||||||
import { Button, LoadingPage } from "src/components";
|
import { Button, LoadingPage } from "src/components";
|
||||||
import { useStreams } from "src/hooks";
|
import { useStreams } from "src/hooks";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { DeleteConfirmModal, StreamModal } from "src/modals";
|
import { DeleteConfirmModal, StreamModal } from "src/modals";
|
||||||
import { showSuccess } from "src/notifications";
|
import { showSuccess } from "src/notifications";
|
||||||
import Table from "./Table";
|
import Table from "./Table";
|
||||||
@@ -60,9 +60,7 @@ export default function TableWrapper() {
|
|||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
<div className="row w-full">
|
<div className="row w-full">
|
||||||
<div className="col">
|
<div className="col">
|
||||||
<h2 className="mt-1 mb-0">
|
<h2 className="mt-1 mb-0">{intl.formatMessage({ id: "streams.title" })}</h2>
|
||||||
<T id="streams.title" />
|
|
||||||
</h2>
|
|
||||||
</div>
|
</div>
|
||||||
{data?.length ? (
|
{data?.length ? (
|
||||||
<div className="col-md-auto col-sm-12">
|
<div className="col-md-auto col-sm-12">
|
||||||
@@ -80,7 +78,7 @@ export default function TableWrapper() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Button size="sm" className="btn-blue" onClick={() => setEditId("new")}>
|
<Button size="sm" className="btn-blue" onClick={() => setEditId("new")}>
|
||||||
<T id="streams.add" />
|
{intl.formatMessage({ id: "streams.add" })}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -99,12 +97,12 @@ export default function TableWrapper() {
|
|||||||
{editId ? <StreamModal id={editId} onClose={() => setEditId(0)} /> : null}
|
{editId ? <StreamModal id={editId} onClose={() => setEditId(0)} /> : null}
|
||||||
{deleteId ? (
|
{deleteId ? (
|
||||||
<DeleteConfirmModal
|
<DeleteConfirmModal
|
||||||
title="stream.delete.title"
|
title={intl.formatMessage({ id: "stream.delete.title" })}
|
||||||
onConfirm={handleDelete}
|
onConfirm={handleDelete}
|
||||||
onClose={() => setDeleteId(0)}
|
onClose={() => setDeleteId(0)}
|
||||||
invalidations={[["streams"], ["stream", deleteId]]}
|
invalidations={[["streams"], ["stream", deleteId]]}
|
||||||
>
|
>
|
||||||
<T id="stream.delete.content" />
|
{intl.formatMessage({ id: "stream.delete.content" })}
|
||||||
</DeleteConfirmModal>
|
</DeleteConfirmModal>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { IconDotsVertical, IconEdit, IconPower, IconTrash } from "@tabler/icons-react";
|
import { IconDotsVertical, IconEdit, IconPower, IconTrash } from "@tabler/icons-react";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
export default function SettingTable() {
|
export default function SettingTable() {
|
||||||
return (
|
return (
|
||||||
@@ -8,9 +8,7 @@ export default function SettingTable() {
|
|||||||
<div className="card-table">
|
<div className="card-table">
|
||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
<div className="row w-full">
|
<div className="row w-full">
|
||||||
<h2 className="mt-1 mb-0">
|
<h2 className="mt-1 mb-0">{intl.formatMessage({ id: "settings.title" })}</h2>
|
||||||
<T id="settings.title" />
|
|
||||||
</h2>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="advanced-table">
|
<div id="advanced-table">
|
||||||
|
@@ -6,7 +6,7 @@ import { Alert } from "react-bootstrap";
|
|||||||
import { createUser } from "src/api/backend";
|
import { createUser } from "src/api/backend";
|
||||||
import { Button, LocalePicker, Page, ThemeSwitcher } from "src/components";
|
import { Button, LocalePicker, Page, ThemeSwitcher } from "src/components";
|
||||||
import { useAuthState } from "src/context";
|
import { useAuthState } from "src/context";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { validateEmail, validateString } from "src/modules/Validations";
|
import { validateEmail, validateString } from "src/modules/Validations";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
@@ -89,12 +89,8 @@ export default function Setup() {
|
|||||||
{({ isSubmitting }) => (
|
{({ isSubmitting }) => (
|
||||||
<Form>
|
<Form>
|
||||||
<div className="card-body text-center py-4 p-sm-5">
|
<div className="card-body text-center py-4 p-sm-5">
|
||||||
<h1 className="mt-5">
|
<h1 className="mt-5">{intl.formatMessage({ id: "setup.title" })}</h1>
|
||||||
<T id="setup.title" />
|
<p className="text-secondary">{intl.formatMessage({ id: "setup.preamble" })}</p>
|
||||||
</h1>
|
|
||||||
<p className="text-secondary">
|
|
||||||
<T id="setup.preamble" />
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
@@ -109,7 +105,7 @@ export default function Setup() {
|
|||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="name">
|
<label htmlFor="name">
|
||||||
<T id="user.full-name" />
|
{intl.formatMessage({ id: "user.full-name" })}
|
||||||
</label>
|
</label>
|
||||||
{form.errors.name ? (
|
{form.errors.name ? (
|
||||||
<div className="invalid-feedback">
|
<div className="invalid-feedback">
|
||||||
@@ -134,7 +130,7 @@ export default function Setup() {
|
|||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="email">
|
<label htmlFor="email">
|
||||||
<T id="email-address" />
|
{intl.formatMessage({ id: "email-address" })}
|
||||||
</label>
|
</label>
|
||||||
{form.errors.email ? (
|
{form.errors.email ? (
|
||||||
<div className="invalid-feedback">
|
<div className="invalid-feedback">
|
||||||
@@ -159,7 +155,7 @@ export default function Setup() {
|
|||||||
{...field}
|
{...field}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="password">
|
<label htmlFor="password">
|
||||||
<T id="user.new-password" />
|
{intl.formatMessage({ id: "user.new-password" })}
|
||||||
</label>
|
</label>
|
||||||
{form.errors.password ? (
|
{form.errors.password ? (
|
||||||
<div className="invalid-feedback">
|
<div className="invalid-feedback">
|
||||||
@@ -182,7 +178,7 @@ export default function Setup() {
|
|||||||
disabled={isSubmitting}
|
disabled={isSubmitting}
|
||||||
className="w-100"
|
className="w-100"
|
||||||
>
|
>
|
||||||
<T id="save" />
|
{intl.formatMessage({ id: "save" })}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import type { Table as ReactTable } from "@tanstack/react-table";
|
import type { Table as ReactTable } from "@tanstack/react-table";
|
||||||
import { Button } from "src/components";
|
import { Button } from "src/components";
|
||||||
import { T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
tableInstance: ReactTable<any>;
|
tableInstance: ReactTable<any>;
|
||||||
@@ -13,19 +13,13 @@ export default function Empty({ tableInstance, onNewUser, isFiltered }: Props) {
|
|||||||
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
<td colSpan={tableInstance.getVisibleFlatColumns().length}>
|
||||||
<div className="text-center my-4">
|
<div className="text-center my-4">
|
||||||
{isFiltered ? (
|
{isFiltered ? (
|
||||||
<h2>
|
<h2>{intl.formatMessage({ id: "empty-search" })}</h2>
|
||||||
<T id="empty-search" />
|
|
||||||
</h2>
|
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<h2>
|
<h2>{intl.formatMessage({ id: "users.empty" })}</h2>
|
||||||
<T id="users.empty" />
|
<p className="text-muted">{intl.formatMessage({ id: "empty-subtitle" })}</p>
|
||||||
</h2>
|
|
||||||
<p className="text-muted">
|
|
||||||
<T id="empty-subtitle" />
|
|
||||||
</p>
|
|
||||||
<Button className="btn-orange my-3" onClick={onNewUser}>
|
<Button className="btn-orange my-3" onClick={onNewUser}>
|
||||||
<T id="users.add" />
|
{intl.formatMessage({ id: "users.add" })}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
@@ -10,7 +10,7 @@ import {
|
|||||||
ValueWithDateFormatter,
|
ValueWithDateFormatter,
|
||||||
} from "src/components";
|
} from "src/components";
|
||||||
import { TableLayout } from "src/components/Table/TableLayout";
|
import { TableLayout } from "src/components/Table/TableLayout";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import Empty from "./Empty";
|
import Empty from "./Empty";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -101,7 +101,12 @@ export default function Table({
|
|||||||
</button>
|
</button>
|
||||||
<div className="dropdown-menu dropdown-menu-end">
|
<div className="dropdown-menu dropdown-menu-end">
|
||||||
<span className="dropdown-header">
|
<span className="dropdown-header">
|
||||||
<T id="users.actions-title" data={{ id: info.row.original.id }} />
|
{intl.formatMessage(
|
||||||
|
{
|
||||||
|
id: "users.actions-title",
|
||||||
|
},
|
||||||
|
{ id: info.row.original.id },
|
||||||
|
)}
|
||||||
</span>
|
</span>
|
||||||
<a
|
<a
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
@@ -112,7 +117,7 @@ export default function Table({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconEdit size={16} />
|
<IconEdit size={16} />
|
||||||
<T id="users.edit" />
|
{intl.formatMessage({ id: "user.edit" })}
|
||||||
</a>
|
</a>
|
||||||
{currentUserId !== info.row.original.id ? (
|
{currentUserId !== info.row.original.id ? (
|
||||||
<>
|
<>
|
||||||
@@ -125,7 +130,7 @@ export default function Table({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconShield size={16} />
|
<IconShield size={16} />
|
||||||
<T id="action.permissions" />
|
{intl.formatMessage({ id: "action.permissions" })}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
@@ -136,7 +141,7 @@ export default function Table({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconLock size={16} />
|
<IconLock size={16} />
|
||||||
<T id="user.set-password" />
|
{intl.formatMessage({ id: "user.set-password" })}
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
className="dropdown-item"
|
className="dropdown-item"
|
||||||
@@ -147,7 +152,9 @@ export default function Table({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconPower size={16} />
|
<IconPower size={16} />
|
||||||
<T id={info.row.original.isDisabled ? "action.enable" : "action.disable"} />
|
{intl.formatMessage({
|
||||||
|
id: info.row.original.isDisabled ? "action.enable" : "action.disable",
|
||||||
|
})}
|
||||||
</a>
|
</a>
|
||||||
<div className="dropdown-divider" />
|
<div className="dropdown-divider" />
|
||||||
<a
|
<a
|
||||||
@@ -159,7 +166,7 @@ export default function Table({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconTrash size={16} />
|
<IconTrash size={16} />
|
||||||
<T id="action.delete" />
|
{intl.formatMessage({ id: "action.delete" })}
|
||||||
</a>
|
</a>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
|
@@ -5,7 +5,7 @@ import Alert from "react-bootstrap/Alert";
|
|||||||
import { deleteUser, toggleUser } from "src/api/backend";
|
import { deleteUser, toggleUser } from "src/api/backend";
|
||||||
import { Button, LoadingPage } from "src/components";
|
import { Button, LoadingPage } from "src/components";
|
||||||
import { useUser, useUsers } from "src/hooks";
|
import { useUser, useUsers } from "src/hooks";
|
||||||
import { intl, T } from "src/locale";
|
import { intl } from "src/locale";
|
||||||
import { DeleteConfirmModal, PermissionsModal, SetPasswordModal, UserModal } from "src/modals";
|
import { DeleteConfirmModal, PermissionsModal, SetPasswordModal, UserModal } from "src/modals";
|
||||||
import { showSuccess } from "src/notifications";
|
import { showSuccess } from "src/notifications";
|
||||||
import Table from "./Table";
|
import Table from "./Table";
|
||||||
@@ -61,9 +61,7 @@ export default function TableWrapper() {
|
|||||||
<div className="card-header">
|
<div className="card-header">
|
||||||
<div className="row w-full">
|
<div className="row w-full">
|
||||||
<div className="col">
|
<div className="col">
|
||||||
<h2 className="mt-1 mb-0">
|
<h2 className="mt-1 mb-0">{intl.formatMessage({ id: "users.title" })}</h2>
|
||||||
<T id="users.title" />
|
|
||||||
</h2>
|
|
||||||
</div>
|
</div>
|
||||||
{data?.length ? (
|
{data?.length ? (
|
||||||
<div className="col-md-auto col-sm-12">
|
<div className="col-md-auto col-sm-12">
|
||||||
@@ -82,7 +80,7 @@ export default function TableWrapper() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button size="sm" className="btn-orange" onClick={() => setEditUserId("new")}>
|
<Button size="sm" className="btn-orange" onClick={() => setEditUserId("new")}>
|
||||||
<T id="users.add" />
|
{intl.formatMessage({ id: "users.add" })}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -107,12 +105,12 @@ export default function TableWrapper() {
|
|||||||
) : null}
|
) : null}
|
||||||
{deleteUserId ? (
|
{deleteUserId ? (
|
||||||
<DeleteConfirmModal
|
<DeleteConfirmModal
|
||||||
title="user.delete.title"
|
title={intl.formatMessage({ id: "user.delete.title" })}
|
||||||
onConfirm={handleDelete}
|
onConfirm={handleDelete}
|
||||||
onClose={() => setDeleteUserId(0)}
|
onClose={() => setDeleteUserId(0)}
|
||||||
invalidations={[["users"], ["user", deleteUserId]]}
|
invalidations={[["users"], ["user", deleteUserId]]}
|
||||||
>
|
>
|
||||||
<T id="user.delete.content" />
|
{intl.formatMessage({ id: "user.delete.content" })}
|
||||||
</DeleteConfirmModal>
|
</DeleteConfirmModal>
|
||||||
) : null}
|
) : null}
|
||||||
{editUserPasswordId ? (
|
{editUserPasswordId ? (
|
||||||
|
Reference in New Issue
Block a user