diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/CollectionComponent.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/CollectionComponent.jsx index 8a76a9e200..43ce23584b 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/CollectionComponent.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/CollectionComponent.jsx @@ -34,7 +34,8 @@ function CollectionComponent(props) { }, [condition]) const allCollections = PersistStore(state => state.allCollections); - const allCollectionsOptions = allCollections.filter(x => x.type !== "API_GROUP") + const activatedCollections = allCollections.filter(collection => collection.deactivated === false) + const allCollectionsOptions = activatedCollections.filter(x => x.type !== "API_GROUP") .map(collection => { return { label: collection.displayName, diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/ConditionComponent.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/ConditionComponent.jsx index e4f04456ab..820334b2c2 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/ConditionComponent.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/ConditionComponent.jsx @@ -16,12 +16,11 @@ function ConditionComponent(props) { } },[condition]) const allCollections = PersistStore(state => state.allCollections); - const allCollectionsOptions = allCollections.map(collection => { - return { - label: collection.displayName, - value: collection.id - } - }) + const activatedCollections = allCollections.filter(collection => collection.deactivated === false) + const allCollectionsOptions = activatedCollections.map(collection => ({ + label: collection.displayName, + value: collection.id + })) const getApiEndpointsOptions = (data) => { return data.map(apiEndpoint => { let str = func.toMethodUrlString(apiEndpoint); diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/shared/DropdownSearch.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/shared/DropdownSearch.jsx index 2882edb20e..37bbc3c538 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/shared/DropdownSearch.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/components/shared/DropdownSearch.jsx @@ -65,9 +65,19 @@ function DropdownSearch(props) { setLoading(true); } + const defaultSliceValue = sliceMaxVal || 20 + setTimeout(() => { if (value === '' && selectedOptions.length === 0) { - setOptions(deselectedOptions); + const options = deselectedOptions.slice(0, defaultSliceValue); + const title = options.length > defaultSliceValue + ? `Showing ${options.length} result${func.addPlurality(options.length)} only. (type more to refine results)` + : "Showing all results"; + const nestedOptions = [{ + title: title, + options: options + }] + setOptions(nestedOptions); setLoading(false); return; } @@ -87,8 +97,17 @@ function DropdownSearch(props) { }); }else{ resultOptions = deselectedOptions.filter((option) => - option[searchKey].match(filterRegex) - ); + option[searchKey].match(filterRegex) + ).slice(0, defaultSliceValue); + + const title = resultOptions.length >= defaultSliceValue + ? `Showing ${resultOptions.length} result${func.addPlurality(resultOptions.length)} only. (type more to refine results)` + : "Showing all results"; + + resultOptions = [{ + title: title, + options: resultOptions + }] } setOptions(resultOptions); setLoading(false); diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/ApiGroupModal.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/ApiGroupModal.jsx index fb7443e108..d809345cb4 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/ApiGroupModal.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/observe/api_collections/ApiGroupModal.jsx @@ -19,6 +19,7 @@ function ApiGroupModal(props){ const setCollectionsMap = PersistStore(state => state.setCollectionsMap) const allCollections = PersistStore(state => state.allCollections); const setAllCollections = PersistStore(state => state.setAllCollections) + const activatedGroupCollections = allCollections.filter((x) => { return (x.type === 'API_GROUP' && x.deactivated === false) }) const [apiGroupName, setApiGroupName] = useState(currentApiGroupName) @@ -65,12 +66,13 @@ function ApiGroupModal(props){ id={"select-api-group"} label="Select API group" placeholder="Select API group" - optionsList={allCollections.filter((x) => { return x.type === 'API_GROUP' }).map((x) => { - return { - label: x.displayName, - value: x.displayName - } - }) + optionsList={ + activatedGroupCollections.map((x) => { + return { + label: x.displayName, + value: x.displayName + } + }) } setSelected={setApiGroupName} /> diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx index 887c9c319c..6c61d73653 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/test_editor/components/SampleApi.jsx @@ -154,7 +154,8 @@ const SampleApi = () => { } - const allCollectionsOptions = allCollections.map(collection => { + const activatedCollections = allCollections.filter(collection => collection.deactivated === false) + const allCollectionsOptions = activatedCollections.map(collection => { return { label: collection.displayName, value: collection.id diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/TestRunsPage/TestrunsBannerComponent.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/TestRunsPage/TestrunsBannerComponent.jsx index 23adac845d..af7a4d767d 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/TestRunsPage/TestrunsBannerComponent.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/testing/TestRunsPage/TestrunsBannerComponent.jsx @@ -12,7 +12,7 @@ function SelectCollectionComponent() { const allCollections = PersistStore(state => state.allCollections); const navigate = useNavigate() let urlsCount = 0 - const allCollectionsOptions = allCollections.filter(x => x.type !== "API_GROUP") + const allCollectionsOptions = allCollections.filter(x => (x.type !== "API_GROUP" && x.deactivated === false)) .map(collection => { urlsCount += collection.urlsCount return { diff --git a/apps/dashboard/web/polaris_web/web/src/util/func.js b/apps/dashboard/web/polaris_web/web/src/util/func.js index c473eb6a85..652b884201 100644 --- a/apps/dashboard/web/polaris_web/web/src/util/func.js +++ b/apps/dashboard/web/polaris_web/web/src/util/func.js @@ -1246,9 +1246,11 @@ getDeprecatedEndpoints(apiInfoList, unusedEndpoints, apiCollectionId) { getSearchItemsArr(allRoutes,allCollections){ let combinedArr = [] + const activatedColections = allCollections.filter((item) => item.deactivated === false) + let initialStr = "/dashboard/observe/inventory/" - allCollections.forEach((item)=> { + activatedColections.forEach((item)=> { combinedArr.push({content: item.displayName, url: initialStr + item.id, type:'collection'}) })