Fixed frontend issues, switched back to nginxproxymanager dockerhub space

This commit is contained in:
Jamie Curnow 2024-05-09 08:41:49 +10:00
parent ae9504584c
commit ecc3b2b5b7
No known key found for this signature in database
GPG Key ID: FFBB624C43388E9E
26 changed files with 304 additions and 1106 deletions

View File

@ -4,7 +4,7 @@
# This file assumes that these scripts have been run first: # This file assumes that these scripts have been run first:
# - ./scripts/ci/build-frontend # - ./scripts/ci/build-frontend
FROM jc21/testca as testca FROM nginxproxymanager/testca as testca
FROM letsencrypt/pebble as pebbleca FROM letsencrypt/pebble as pebbleca
FROM jc21/gotools:latest AS gobuild FROM jc21/gotools:latest AS gobuild
@ -32,7 +32,7 @@ RUN mkdir -p /dist \
# Final image # Final image
#=============== #===============
FROM jc21/nginx-full:acmesh AS final FROM nginxproxymanager/nginx-full:acmesh AS final
COPY --from=gobuild /dist/server /app/bin/server COPY --from=gobuild /dist/server /app/bin/server
COPY --from=gobuild /dist/ipranges /app/bin/ipranges COPY --from=gobuild /dist/ipranges /app/bin/ipranges

View File

@ -1,6 +1,6 @@
FROM jc21/testca as testca FROM nginxproxymanager/testca as testca
FROM letsencrypt/pebble as pebbleca FROM letsencrypt/pebble as pebbleca
FROM jc21/nginx-full:acmesh-golang FROM nginxproxymanager/nginx-full:acmesh-golang
LABEL maintainer="Jamie Curnow <jc@jc21.com>" LABEL maintainer="Jamie Curnow <jc@jc21.com>"
SHELL ["/bin/bash", "-o", "pipefail", "-c"] SHELL ["/bin/bash", "-o", "pipefail", "-c"]

View File

@ -22,7 +22,7 @@ function App() {
<Router /> <Router />
</AuthProvider> </AuthProvider>
</ChakraProvider> </ChakraProvider>
<ReactQueryDevtools position="bottom-right" panelPosition="right" /> <ReactQueryDevtools buttonPosition="bottom-right" position="right" />
</QueryClientProvider> </QueryClientProvider>
</LocaleProvider> </LocaleProvider>
</RawIntlProvider> </RawIntlProvider>

View File

@ -27,7 +27,7 @@ function SiteWrapper({ children }: Props) {
const j: SSEMessage = JSON.parse(e.data); const j: SSEMessage = JSON.parse(e.data);
if (j) { if (j) {
if (j.affects) { if (j.affects) {
queryClient.invalidateQueries([j.affects]); queryClient.invalidateQueries({ queryKey: [j.affects] });
} }
if (j.type) { if (j.type) {
toast({ toast({

View File

@ -31,7 +31,6 @@ const useAccessLists = (
return useQuery<AccessListsResponse, Error>({ return useQuery<AccessListsResponse, Error>({
queryKey: ["access-lists", { offset, limit, sortBy, filters }], queryKey: ["access-lists", { offset, limit, sortBy, filters }],
queryFn: () => fetchAccessLists(offset, limit, sortBy, filters), queryFn: () => fetchAccessLists(offset, limit, sortBy, filters),
keepPreviousData: true,
staleTime: 15 * 1000, // 15 seconds staleTime: 15 * 1000, // 15 seconds
...options, ...options,
}); });

View File

@ -22,14 +22,13 @@ const useCertificate = (id: number, options = {}) => {
const useSetCertificate = () => { const useSetCertificate = () => {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
return useMutation( return useMutation({
(values: Certificate) => { mutationFn: (values: Certificate) => {
return values.id return values.id
? setCertificate(values.id, values) ? setCertificate(values.id, values)
: createCertificate(values); : createCertificate(values);
}, },
{ onMutate: (values: Certificate) => {
onMutate: (values) => {
const previousObject = queryClient.getQueryData([ const previousObject = queryClient.getQueryData([
"certificate", "certificate",
values.id, values.id,
@ -45,11 +44,10 @@ const useSetCertificate = () => {
}, },
onError: (_, __, rollback: any) => rollback(), onError: (_, __, rollback: any) => rollback(),
onSuccess: async ({ id }: Certificate) => { onSuccess: async ({ id }: Certificate) => {
queryClient.invalidateQueries(["certificate", id]); queryClient.invalidateQueries({ queryKey: ["certificate", id] });
queryClient.invalidateQueries(["certificates"]); queryClient.invalidateQueries({ queryKey: ["certificates"] });
}, },
}, });
);
}; };
export { useCertificate, useSetCertificate }; export { useCertificate, useSetCertificate };

View File

@ -31,7 +31,6 @@ const useCertificateAuthorities = (
return useQuery<CertificateAuthoritiesResponse, Error>({ return useQuery<CertificateAuthoritiesResponse, Error>({
queryKey: ["certificate-authorities", { offset, limit, sortBy, filters }], queryKey: ["certificate-authorities", { offset, limit, sortBy, filters }],
queryFn: () => fetchCertificateAuthorities(offset, limit, sortBy, filters), queryFn: () => fetchCertificateAuthorities(offset, limit, sortBy, filters),
keepPreviousData: true,
staleTime: 15 * 1000, // 15 seconds staleTime: 15 * 1000, // 15 seconds
...options, ...options,
}); });

View File

@ -22,14 +22,13 @@ const useCertificateAuthority = (id: number, options = {}) => {
const useSetCertificateAuthority = () => { const useSetCertificateAuthority = () => {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
return useMutation( return useMutation({
(values: CertificateAuthority) => { mutationFn: (values: CertificateAuthority) => {
return values.id return values.id
? setCertificateAuthority(values.id, values) ? setCertificateAuthority(values.id, values)
: createCertificateAuthority(values); : createCertificateAuthority(values);
}, },
{ onMutate: (values: CertificateAuthority) => {
onMutate: (values) => {
const previousObject = queryClient.getQueryData([ const previousObject = queryClient.getQueryData([
"certificate-authority", "certificate-authority",
values.id, values.id,
@ -49,13 +48,16 @@ const useSetCertificateAuthority = () => {
previousObject, previousObject,
); );
}, },
onError: (_, __, rollback: any) => rollback(), onError: (_: any, __: any, rollback: any) => rollback(),
onSuccess: async ({ id }: CertificateAuthority) => { onSuccess: async ({ id }: CertificateAuthority) => {
queryClient.invalidateQueries(["certificate-authority", id]); queryClient.invalidateQueries({
queryClient.invalidateQueries(["certificate-authorities"]); queryKey: ["certificate-authority", id],
});
queryClient.invalidateQueries({
queryKey: ["certificate-authorities"],
});
}, },
}, });
);
}; };
export { useCertificateAuthority, useSetCertificateAuthority }; export { useCertificateAuthority, useSetCertificateAuthority };

View File

@ -31,7 +31,6 @@ const useCertificates = (
return useQuery<CertificatesResponse, Error>({ return useQuery<CertificatesResponse, Error>({
queryKey: ["certificates", { offset, limit, sortBy, filters }], queryKey: ["certificates", { offset, limit, sortBy, filters }],
queryFn: () => fetchCertificates(offset, limit, sortBy, filters), queryFn: () => fetchCertificates(offset, limit, sortBy, filters),
keepPreviousData: true,
staleTime: 15 * 1000, // 15 seconds staleTime: 15 * 1000, // 15 seconds
...options, ...options,
}); });

View File

@ -22,14 +22,13 @@ const useDNSProvider = (id: number, options = {}) => {
const useSetDNSProvider = () => { const useSetDNSProvider = () => {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
return useMutation( return useMutation({
(values: DNSProvider) => { mutationFn: (values: DNSProvider) => {
return values.id return values.id
? setDNSProvider(values.id, values) ? setDNSProvider(values.id, values)
: createDNSProvider(values); : createDNSProvider(values);
}, },
{ onMutate: (values: DNSProvider) => {
onMutate: (values) => {
const previousObject = queryClient.getQueryData([ const previousObject = queryClient.getQueryData([
"dns-provider", "dns-provider",
values.id, values.id,
@ -45,11 +44,10 @@ const useSetDNSProvider = () => {
}, },
onError: (_, __, rollback: any) => rollback(), onError: (_, __, rollback: any) => rollback(),
onSuccess: async ({ id }: DNSProvider) => { onSuccess: async ({ id }: DNSProvider) => {
queryClient.invalidateQueries(["dns-provider", id]); queryClient.invalidateQueries({ queryKey: ["dns-provider", id] });
queryClient.invalidateQueries(["dns-providers"]); queryClient.invalidateQueries({ queryKey: ["dns-providers"] });
}, },
}, });
);
}; };
export { useDNSProvider, useSetDNSProvider }; export { useDNSProvider, useSetDNSProvider };

View File

@ -31,7 +31,6 @@ const useDNSProviders = (
return useQuery<DNSProvidersResponse, Error>({ return useQuery<DNSProvidersResponse, Error>({
queryKey: ["dns-providers", { offset, limit, sortBy, filters }], queryKey: ["dns-providers", { offset, limit, sortBy, filters }],
queryFn: () => fetchDNSProviders(offset, limit, sortBy, filters), queryFn: () => fetchDNSProviders(offset, limit, sortBy, filters),
keepPreviousData: true,
staleTime: 15 * 1000, // 15 seconds staleTime: 15 * 1000, // 15 seconds
...options, ...options,
}); });

View File

@ -6,7 +6,6 @@ const useDNSProvidersAcmesh = (options = {}) => {
return useQuery<DNSProvidersAcmesh[], Error>({ return useQuery<DNSProvidersAcmesh[], Error>({
queryKey: ["dns-providers-acmesh"], queryKey: ["dns-providers-acmesh"],
queryFn: () => getDNSProvidersAcmesh(), queryFn: () => getDNSProvidersAcmesh(),
keepPreviousData: true,
staleTime: 60 * 60 * 1000, // 1 hour staleTime: 60 * 60 * 1000, // 1 hour
...options, ...options,
}); });

View File

@ -26,7 +26,6 @@ const useHosts = (
return useQuery<HostsResponse, Error>({ return useQuery<HostsResponse, Error>({
queryKey: ["hosts", { offset, limit, sortBy, filters }], queryKey: ["hosts", { offset, limit, sortBy, filters }],
queryFn: () => fetchHosts(offset, limit, sortBy, filters), queryFn: () => fetchHosts(offset, limit, sortBy, filters),
keepPreviousData: true,
staleTime: 15 * 1000, // 15 seconds staleTime: 15 * 1000, // 15 seconds
...options, ...options,
}); });

View File

@ -31,7 +31,6 @@ const useNginxTemplates = (
return useQuery<NginxTemplatesResponse, Error>({ return useQuery<NginxTemplatesResponse, Error>({
queryKey: ["nginx-templates", { offset, limit, sortBy, filters }], queryKey: ["nginx-templates", { offset, limit, sortBy, filters }],
queryFn: () => fetchNginxTemplates(offset, limit, sortBy, filters), queryFn: () => fetchNginxTemplates(offset, limit, sortBy, filters),
keepPreviousData: true,
staleTime: 15 * 1000, // 15 seconds staleTime: 15 * 1000, // 15 seconds
...options, ...options,
}); });

View File

@ -26,7 +26,6 @@ const useSettings = (
return useQuery<SettingsResponse, Error>({ return useQuery<SettingsResponse, Error>({
queryKey: ["settings", { offset, limit, sortBy, filters }], queryKey: ["settings", { offset, limit, sortBy, filters }],
queryFn: () => fetchSettings(offset, limit, sortBy, filters), queryFn: () => fetchSettings(offset, limit, sortBy, filters),
keepPreviousData: true,
staleTime: 15 * 1000, // 15 seconds staleTime: 15 * 1000, // 15 seconds
...options, ...options,
}); });

View File

@ -31,7 +31,6 @@ const useUpstreams = (
return useQuery<HostsResponse, Error>({ return useQuery<HostsResponse, Error>({
queryKey: ["upstreams", { offset, limit, sortBy, filters }], queryKey: ["upstreams", { offset, limit, sortBy, filters }],
queryFn: () => fetchUpstreams(offset, limit, sortBy, filters), queryFn: () => fetchUpstreams(offset, limit, sortBy, filters),
keepPreviousData: true,
staleTime: 15 * 1000, // 15 seconds staleTime: 15 * 1000, // 15 seconds
...options, ...options,
}); });

View File

@ -17,7 +17,8 @@ const useUser = (id: string | number, options = {}) => {
const useSetUser = () => { const useSetUser = () => {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
return useMutation((values: User) => setUser(values.id, values), { return useMutation({
mutationFn: (values: User) => setUser(values.id, values),
onMutate: (values) => { onMutate: (values) => {
const previousObject = queryClient.getQueryData(["user", values.id]); const previousObject = queryClient.getQueryData(["user", values.id]);
@ -31,8 +32,8 @@ const useSetUser = () => {
}, },
onError: (_, __, rollback: any) => rollback(), onError: (_, __, rollback: any) => rollback(),
onSuccess: async ({ id }: User) => { onSuccess: async ({ id }: User) => {
queryClient.invalidateQueries(["user", id]); queryClient.invalidateQueries({ queryKey: ["user", id] });
queryClient.invalidateQueries(["users"]); queryClient.invalidateQueries({ queryKey: ["users"] });
}, },
}); });
}; };

View File

@ -26,7 +26,6 @@ const useUsers = (
return useQuery<UsersResponse, Error>({ return useQuery<UsersResponse, Error>({
queryKey: ["users", { offset, limit, sortBy, filters }], queryKey: ["users", { offset, limit, sortBy, filters }],
queryFn: () => fetchUsers(offset, limit, sortBy, filters), queryFn: () => fetchUsers(offset, limit, sortBy, filters),
keepPreviousData: true,
staleTime: 15 * 1000, // 15 seconds staleTime: 15 * 1000, // 15 seconds
...options, ...options,
}); });

View File

@ -79,7 +79,7 @@ function CertificateAuthorityEditModal({
closeOnOverlayClick={false}> closeOnOverlayClick={false}>
<ModalOverlay /> <ModalOverlay />
<ModalContent> <ModalContent>
{status === "loading" ? ( {status === "pending" ? (
// todo nicer // todo nicer
<p>loading</p> <p>loading</p>
) : ( ) : (

View File

@ -79,7 +79,7 @@ function CertificateEditModal({
closeOnOverlayClick={false}> closeOnOverlayClick={false}>
<ModalOverlay /> <ModalOverlay />
<ModalContent> <ModalContent>
{status === "loading" ? ( {status === "pending" ? (
// todo nicer // todo nicer
<p>loading</p> <p>loading</p>
) : ( ) : (

View File

@ -80,7 +80,7 @@ function UpstreamEditModal({
closeOnOverlayClick={false}> closeOnOverlayClick={false}>
<ModalOverlay /> <ModalOverlay />
<ModalContent> <ModalContent>
{status === "loading" ? ( {status === "pending" ? (
// todo nicer // todo nicer
<p>loading</p> <p>loading</p>
) : ( ) : (

View File

@ -79,7 +79,7 @@ function UserCreateModal({ isOpen, onClose }: UserCreateModalProps) {
const response = await createUser(payload); const response = await createUser(payload);
if (response && typeof response.id !== "undefined" && response.id) { if (response && typeof response.id !== "undefined" && response.id) {
// ok // ok
queryClient.invalidateQueries(["users"]); queryClient.invalidateQueries({ queryKey: ["users"] });
onClose(); onClose();
resetForm(); resetForm();
} else { } else {

View File

@ -98,7 +98,7 @@ function UserEditModal({ userId, isOpen, onClose }: UserEditModalProps) {
closeOnOverlayClick={false}> closeOnOverlayClick={false}>
<ModalOverlay /> <ModalOverlay />
<ModalContent> <ModalContent>
{status === "loading" ? ( {status === "pending" ? (
// todo nicer // todo nicer
<p>loading</p> <p>loading</p>
) : ( ) : (

View File

@ -55,7 +55,7 @@ function TableWrapper() {
isClosable: true, isClosable: true,
}); });
setTimeout(() => { setTimeout(() => {
queryClient.invalidateQueries(["certificates"]); queryClient.invalidateQueries({ queryKey: ["certificates"] });
}, 500); }, 500);
} catch (err: any) { } catch (err: any) {
toast({ toast({

View File

@ -67,7 +67,7 @@ function Setup() {
try { try {
await login(response.email, password); await login(response.email, password);
// Trigger a Health change // Trigger a Health change
await queryClient.refetchQueries(["health"]); await queryClient.refetchQueries({ queryKey: ["health"] });
// window.location.reload(); // window.location.reload();
} catch (err: any) { } catch (err: any) {
showErr(err.message); showErr(err.message);

File diff suppressed because it is too large Load Diff