From f1949db51c49f8a019883234793554e658b3b2f0 Mon Sep 17 00:00:00 2001 From: Mohamad Choupan Date: Fri, 20 Dec 2024 21:35:40 +0330 Subject: [PATCH 1/2] feat: add resource types list --- .../TypeDetailNew/Integration/index.tsx | 98 ++++++++++++++++++- 1 file changed, 96 insertions(+), 2 deletions(-) diff --git a/services/web-ui/src/pages/Integrations/TypeDetailNew/Integration/index.tsx b/services/web-ui/src/pages/Integrations/TypeDetailNew/Integration/index.tsx index 67dd7a949..27817f329 100644 --- a/services/web-ui/src/pages/Integrations/TypeDetailNew/Integration/index.tsx +++ b/services/web-ui/src/pages/Integrations/TypeDetailNew/Integration/index.tsx @@ -20,6 +20,7 @@ import { Header, KeyValuePairs, Modal, + Multiselect, Pagination, SpaceBetween, Spinner, @@ -71,6 +72,10 @@ export default function IntegrationList({ const [confirmModal, setConfirmModal] = useState(false) const [action, setAction] = useState() const setNotification = useSetAtom(notificationAtom) + const [resourceTypes, setResourceTypes] = useState([]) + const [selectedResourceType, setSelectedResourceType] = useState() + const [runOpen, setRunOpen] = useState(false) + const [runAll, setRunAll] = useState(false) const GetIntegrations = () => { setLoading(true) @@ -326,6 +331,41 @@ export default function IntegrationList({ }) }) } + const GetResourceTypes = () => { + let url = '' + if (window.location.origin === 'http://localhost:3000') { + url = window.__RUNTIME_CONFIG__.REACT_APP_BASE_URL + } else { + url = window.location.origin + } + // @ts-ignore + const token = JSON.parse(localStorage.getItem('openg_auth')).token + + const config = { + headers: { + Authorization: `Bearer ${token}`, + }, + } + + // const body = { + // integration_type: [integration_type], + // } + axios + .get( + `${url}/main/integration/api/v1/integrations/types/${integration_type}/resource_types`, + + config + ) + .then((res) => { + const data = res.data + console.log(data?.integration_types) + setResourceTypes(data?.integration_types) + }) + .catch((err) => { + console.log(err) + }) + } + useEffect(() => { @@ -410,7 +450,10 @@ export default function IntegrationList({ + + + + } + > + { + return { + label: item?.name, + value: item?.name, + params: item?.params, + } + })} + selectedOptions={selectedResourceType} + onChange={({ detail }) =>{ + setSelectedResourceType(detail.selectedOptions) + }} + placeholder="Select resource type" + /> + ) : ( From 15e74144c6e949ffc8463af11a21f1902dd7b1e7 Mon Sep 17 00:00:00 2001 From: Mohamad Choupan Date: Fri, 20 Dec 2024 23:58:37 +0330 Subject: [PATCH 2/2] feat: add describe by single resource --- .../TypeDetailNew/Integration/index.tsx | 58 +++++++++++++------ 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/services/web-ui/src/pages/Integrations/TypeDetailNew/Integration/index.tsx b/services/web-ui/src/pages/Integrations/TypeDetailNew/Integration/index.tsx index 27817f329..aecca9c2a 100644 --- a/services/web-ui/src/pages/Integrations/TypeDetailNew/Integration/index.tsx +++ b/services/web-ui/src/pages/Integrations/TypeDetailNew/Integration/index.tsx @@ -279,7 +279,6 @@ export default function IntegrationList({ let body ={} if(flag){ body = { - force_full: true, integration_info:row?.map((item)=>{ return { integration_type: integration_type, @@ -292,7 +291,6 @@ export default function IntegrationList({ } else{ body = { - force_full: true, integration_info: [ { integration_type: integration_type, @@ -303,6 +301,14 @@ export default function IntegrationList({ ], } } + if(selectedResourceType?.length > 0 && selectedResourceType?.length < resourceTypes?.length){ + // @ts-ignore + body['resource_types'] = selectedResourceType?.map((item:any)=>{ + return { + resource_type: item.value, + } + }) + } axios @@ -313,6 +319,7 @@ export default function IntegrationList({ ...actionLoading, discovery: false, }) + setRunOpen(false) setNotification({ text: `Discovery started`, type: 'success', @@ -687,21 +694,35 @@ export default function IntegrationList({ // @ts-ignore header={'Run Discovery'} footer={ - <> - - - + + } > { + onChange={({ detail }) => { setSelectedResourceType(detail.selectedOptions) }} + tokenLimit={2} placeholder="Select resource type" />