mirror of
https://github.com/fosrl/pangolin.git
synced 2026-04-14 13:56:36 +00:00
Filter only approved sites
This commit is contained in:
@@ -14,7 +14,6 @@ import { Button } from "@app/components/ui/button";
|
|||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
import { toast } from "@app/hooks/useToast";
|
import { toast } from "@app/hooks/useToast";
|
||||||
import { createApiClient, formatAxiosError } from "@app/lib/api";
|
import { createApiClient, formatAxiosError } from "@app/lib/api";
|
||||||
import { ListSitesResponse } from "@server/routers/site";
|
|
||||||
import { AxiosResponse } from "axios";
|
import { AxiosResponse } from "axios";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -25,8 +24,6 @@ import {
|
|||||||
type InternalResourceFormValues
|
type InternalResourceFormValues
|
||||||
} from "./InternalResourceForm";
|
} from "./InternalResourceForm";
|
||||||
|
|
||||||
type Site = ListSitesResponse["sites"][0];
|
|
||||||
|
|
||||||
type CreateInternalResourceDialogProps = {
|
type CreateInternalResourceDialogProps = {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
setOpen: (val: boolean) => void;
|
setOpen: (val: boolean) => void;
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import { getUserDisplayName } from "@app/lib/getUserDisplayName";
|
|||||||
import { orgQueries, resourceQueries } from "@app/lib/queries";
|
import { orgQueries, resourceQueries } from "@app/lib/queries";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { tierMatrix } from "@server/lib/billing/tierMatrix";
|
import { tierMatrix } from "@server/lib/billing/tierMatrix";
|
||||||
import { ListSitesResponse } from "@server/routers/site";
|
|
||||||
import { UserType } from "@server/types/UserTypes";
|
import { UserType } from "@server/types/UserTypes";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { ChevronsUpDown, ExternalLink } from "lucide-react";
|
import { ChevronsUpDown, ExternalLink } from "lucide-react";
|
||||||
@@ -128,8 +127,6 @@ export const cleanForFQDN = (name: string): string =>
|
|||||||
|
|
||||||
// --- Types ---
|
// --- Types ---
|
||||||
|
|
||||||
type Site = ListSitesResponse["sites"][0];
|
|
||||||
|
|
||||||
export type InternalResourceMode = "host" | "cidr" | "http";
|
export type InternalResourceMode = "host" | "cidr" | "http";
|
||||||
|
|
||||||
export type InternalResourceData = {
|
export type InternalResourceData = {
|
||||||
|
|||||||
@@ -12,14 +12,6 @@ import { useTranslations } from "next-intl";
|
|||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import { ContainersSelector } from "./ContainersSelector";
|
import { ContainersSelector } from "./ContainersSelector";
|
||||||
import { Button } from "./ui/button";
|
import { Button } from "./ui/button";
|
||||||
import {
|
|
||||||
Command,
|
|
||||||
CommandEmpty,
|
|
||||||
CommandGroup,
|
|
||||||
CommandInput,
|
|
||||||
CommandItem,
|
|
||||||
CommandList
|
|
||||||
} from "./ui/command";
|
|
||||||
import { Input } from "./ui/input";
|
import { Input } from "./ui/input";
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
|
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger } from "./ui/select";
|
import { Select, SelectContent, SelectItem, SelectTrigger } from "./ui/select";
|
||||||
@@ -212,6 +204,12 @@ export function ResourceTargetAddressItem({
|
|||||||
proxyTarget.port === 0 ? "" : proxyTarget.port
|
proxyTarget.port === 0 ? "" : proxyTarget.port
|
||||||
}
|
}
|
||||||
className="w-18.75 px-2 border-none placeholder-gray-400 rounded-l-xs"
|
className="w-18.75 px-2 border-none placeholder-gray-400 rounded-l-xs"
|
||||||
|
type="number"
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (["e", "E", "+", "-", "."].includes(e.key)) {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
}}
|
||||||
onBlur={(e) => {
|
onBlur={(e) => {
|
||||||
const value = parseInt(e.target.value, 10);
|
const value = parseInt(e.target.value, 10);
|
||||||
if (!isNaN(value) && value > 0) {
|
if (!isNaN(value) && value > 0) {
|
||||||
@@ -227,6 +225,7 @@ export function ResourceTargetAddressItem({
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -155,7 +155,8 @@ export const orgQueries = {
|
|||||||
queryKey: ["ORG", orgId, "SITES", { query, perPage }] as const,
|
queryKey: ["ORG", orgId, "SITES", { query, perPage }] as const,
|
||||||
queryFn: async ({ signal, meta }) => {
|
queryFn: async ({ signal, meta }) => {
|
||||||
const sp = new URLSearchParams({
|
const sp = new URLSearchParams({
|
||||||
pageSize: perPage.toString()
|
pageSize: perPage.toString(),
|
||||||
|
status: "approved"
|
||||||
});
|
});
|
||||||
|
|
||||||
if (query?.trim()) {
|
if (query?.trim()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user