mirror of
https://github.com/fosrl/pangolin.git
synced 2026-04-01 15:36:38 +00:00
Filter only newt sites on private resources
This commit is contained in:
@@ -614,6 +614,7 @@ export function InternalResourceForm({
|
|||||||
<SitesSelector
|
<SitesSelector
|
||||||
orgId={orgId}
|
orgId={orgId}
|
||||||
selectedSite={selectedSite}
|
selectedSite={selectedSite}
|
||||||
|
filterTypes={["newt"]}
|
||||||
onSelectSite={(site) => {
|
onSelectSite={(site) => {
|
||||||
setSelectedSite(site);
|
setSelectedSite(site);
|
||||||
field.onChange(site.siteId);
|
field.onChange(site.siteId);
|
||||||
|
|||||||
@@ -24,12 +24,14 @@ export type SitesSelectorProps = {
|
|||||||
orgId: string;
|
orgId: string;
|
||||||
selectedSite?: Selectedsite | null;
|
selectedSite?: Selectedsite | null;
|
||||||
onSelectSite: (selected: Selectedsite) => void;
|
onSelectSite: (selected: Selectedsite) => void;
|
||||||
|
filterTypes?: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export function SitesSelector({
|
export function SitesSelector({
|
||||||
orgId,
|
orgId,
|
||||||
selectedSite,
|
selectedSite,
|
||||||
onSelectSite
|
onSelectSite,
|
||||||
|
filterTypes
|
||||||
}: SitesSelectorProps) {
|
}: SitesSelectorProps) {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const [siteSearchQuery, setSiteSearchQuery] = useState("");
|
const [siteSearchQuery, setSiteSearchQuery] = useState("");
|
||||||
@@ -45,7 +47,9 @@ export function SitesSelector({
|
|||||||
|
|
||||||
// always include the selected site in the list of sites shown
|
// always include the selected site in the list of sites shown
|
||||||
const sitesShown = useMemo(() => {
|
const sitesShown = useMemo(() => {
|
||||||
const allSites: Array<Selectedsite> = [...sites];
|
const allSites: Array<Selectedsite> = filterTypes
|
||||||
|
? sites.filter((s) => filterTypes.includes(s.type))
|
||||||
|
: [...sites];
|
||||||
if (
|
if (
|
||||||
debouncedQuery.trim().length === 0 &&
|
debouncedQuery.trim().length === 0 &&
|
||||||
selectedSite &&
|
selectedSite &&
|
||||||
@@ -54,7 +58,7 @@ export function SitesSelector({
|
|||||||
allSites.unshift(selectedSite);
|
allSites.unshift(selectedSite);
|
||||||
}
|
}
|
||||||
return allSites;
|
return allSites;
|
||||||
}, [debouncedQuery, sites, selectedSite]);
|
}, [debouncedQuery, sites, selectedSite, filterTypes]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Command shouldFilter={false}>
|
<Command shouldFilter={false}>
|
||||||
|
|||||||
Reference in New Issue
Block a user