mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-31 07:43:33 +00:00 
			
		
		
		
	Various tweaks and backend improvements
This commit is contained in:
		| @@ -1,6 +1,6 @@ | ||||
| export type AccessListExpansion = "owner" | "items" | "clients"; | ||||
| export type AuditLogExpansion = "user"; | ||||
| export type CertificateExpansion = "owner" | "proxy_hosts" | "redirection_hosts" | "dead_hosts"; | ||||
| export type CertificateExpansion = "owner" | "proxy_hosts" | "redirection_hosts" | "dead_hosts" | "streams"; | ||||
| export type HostExpansion = "owner" | "certificate"; | ||||
| export type ProxyHostExpansion = "owner" | "access_list" | "certificate"; | ||||
| export type UserExpansion = "permissions"; | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import OverlayTrigger from "react-bootstrap/OverlayTrigger"; | ||||
| import Popover from "react-bootstrap/Popover"; | ||||
| import type { DeadHost, ProxyHost, RedirectionHost } from "src/api/backend"; | ||||
| import type { DeadHost, ProxyHost, RedirectionHost, Stream } from "src/api/backend"; | ||||
| import { T } from "src/locale"; | ||||
|  | ||||
| const getSection = (title: string, items: ProxyHost[] | RedirectionHost[] | DeadHost[]) => { | ||||
| @@ -23,13 +23,34 @@ const getSection = (title: string, items: ProxyHost[] | RedirectionHost[] | Dead | ||||
| 	); | ||||
| }; | ||||
|  | ||||
| const getSectionStream = (items: Stream[]) => { | ||||
| 	if (items.length === 0) { | ||||
| 		return null; | ||||
| 	} | ||||
| 	return ( | ||||
| 		<> | ||||
| 			<div> | ||||
| 				<strong> | ||||
| 					<T id="streams" /> | ||||
| 				</strong> | ||||
| 			</div> | ||||
| 			{items.map((stream) => ( | ||||
| 				<div key={stream.id} className="ms-1"> | ||||
| 					{stream.forwardingHost}:{stream.forwardingPort} | ||||
| 				</div> | ||||
| 			))} | ||||
| 		</> | ||||
| 	); | ||||
| }; | ||||
|  | ||||
| interface Props { | ||||
| 	proxyHosts: ProxyHost[]; | ||||
| 	redirectionHosts: RedirectionHost[]; | ||||
| 	deadHosts: DeadHost[]; | ||||
| 	streams: Stream[]; | ||||
| } | ||||
| export function CertificateInUseFormatter({ proxyHosts, redirectionHosts, deadHosts }: Props) { | ||||
| 	const totalCount = proxyHosts?.length + redirectionHosts?.length + deadHosts?.length; | ||||
| export function CertificateInUseFormatter({ proxyHosts, redirectionHosts, deadHosts, streams }: Props) { | ||||
| 	const totalCount = proxyHosts?.length + redirectionHosts?.length + deadHosts?.length + streams?.length; | ||||
| 	if (totalCount === 0) { | ||||
| 		return ( | ||||
| 			<span className="badge bg-red-lt"> | ||||
| @@ -41,6 +62,7 @@ export function CertificateInUseFormatter({ proxyHosts, redirectionHosts, deadHo | ||||
| 	proxyHosts.sort(); | ||||
| 	redirectionHosts.sort(); | ||||
| 	deadHosts.sort(); | ||||
| 	streams.sort(); | ||||
|  | ||||
| 	const popover = ( | ||||
| 		<Popover id="popover-basic"> | ||||
| @@ -48,6 +70,7 @@ export function CertificateInUseFormatter({ proxyHosts, redirectionHosts, deadHo | ||||
| 				{getSection("proxy-hosts", proxyHosts)} | ||||
| 				{getSection("redirection-hosts", redirectionHosts)} | ||||
| 				{getSection("dead-hosts", deadHosts)} | ||||
| 				{getSectionStream(streams)} | ||||
| 			</Popover.Body> | ||||
| 		</Popover> | ||||
| 	); | ||||
|   | ||||
| @@ -1,4 +1,5 @@ | ||||
| import { IconArrowsCross, IconBolt, IconBoltOff, IconDisc, IconLock, IconShield, IconUser } from "@tabler/icons-react"; | ||||
| import cn from "classnames"; | ||||
| import type { AuditLog } from "src/api/backend"; | ||||
| import { DateTimeFormat, T } from "src/locale"; | ||||
|  | ||||
| @@ -32,7 +33,7 @@ const getColorForAction = (action: string) => { | ||||
| }; | ||||
|  | ||||
| const getIcon = (row: AuditLog) => { | ||||
| 	const c = getColorForAction(row.action); | ||||
| 	const c = cn(getColorForAction(row.action), "me-1"); | ||||
| 	let ico = null; | ||||
| 	switch (row.objectType) { | ||||
| 		case "user": | ||||
|   | ||||
| @@ -52,6 +52,7 @@ const useSetDeadHost = () => { | ||||
| 			queryClient.invalidateQueries({ queryKey: ["dead-hosts"] }); | ||||
| 			queryClient.invalidateQueries({ queryKey: ["audit-logs"] }); | ||||
| 			queryClient.invalidateQueries({ queryKey: ["host-report"] }); | ||||
| 			queryClient.invalidateQueries({ queryKey: ["certificates"] }); | ||||
| 		}, | ||||
| 	}); | ||||
| }; | ||||
|   | ||||
| @@ -59,6 +59,7 @@ const useSetProxyHost = () => { | ||||
| 			queryClient.invalidateQueries({ queryKey: ["proxy-hosts"] }); | ||||
| 			queryClient.invalidateQueries({ queryKey: ["audit-logs"] }); | ||||
| 			queryClient.invalidateQueries({ queryKey: ["host-report"] }); | ||||
| 			queryClient.invalidateQueries({ queryKey: ["certificates"] }); | ||||
| 		}, | ||||
| 	}); | ||||
| }; | ||||
|   | ||||
| @@ -63,6 +63,7 @@ const useSetRedirectionHost = () => { | ||||
| 			queryClient.invalidateQueries({ queryKey: ["redirection-hosts"] }); | ||||
| 			queryClient.invalidateQueries({ queryKey: ["audit-logs"] }); | ||||
| 			queryClient.invalidateQueries({ queryKey: ["host-report"] }); | ||||
| 			queryClient.invalidateQueries({ queryKey: ["certificates"] }); | ||||
| 		}, | ||||
| 	}); | ||||
| }; | ||||
|   | ||||
| @@ -48,6 +48,7 @@ const useSetStream = () => { | ||||
| 			queryClient.invalidateQueries({ queryKey: ["streams"] }); | ||||
| 			queryClient.invalidateQueries({ queryKey: ["audit-logs"] }); | ||||
| 			queryClient.invalidateQueries({ queryKey: ["host-report"] }); | ||||
| 			queryClient.invalidateQueries({ queryKey: ["certificates"] }); | ||||
| 		}, | ||||
| 	}); | ||||
| }; | ||||
|   | ||||
| @@ -79,6 +79,7 @@ export default function Table({ data, isFetching, onDelete, onRenew, onDownload, | ||||
| 							proxyHosts={r.proxyHosts} | ||||
| 							redirectionHosts={r.redirectionHosts} | ||||
| 							deadHosts={r.deadHosts} | ||||
| 							streams={r.streams} | ||||
| 						/> | ||||
| 					); | ||||
| 				}, | ||||
|   | ||||
| @@ -22,6 +22,7 @@ export default function TableWrapper() { | ||||
| 		"dead_hosts", | ||||
| 		"proxy_hosts", | ||||
| 		"redirection_hosts", | ||||
| 		"streams", | ||||
| 	]); | ||||
|  | ||||
| 	if (isLoading) { | ||||
|   | ||||
| @@ -124,7 +124,6 @@ const Dashboard = () => { | ||||
| - check permissions in all places | ||||
|  | ||||
| More for api, then implement here: | ||||
| - Properly implement refresh tokens | ||||
| - Add error message_18n for all backend errors | ||||
| - minor: certificates expand with hosts needs to omit 'is_deleted' | ||||
| - properly wrap all logger.debug called in isDebug check | ||||
|   | ||||
		Reference in New Issue
	
	Block a user