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..aecca9c2a 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) @@ -274,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, @@ -287,7 +291,6 @@ export default function IntegrationList({ } else{ body = { - force_full: true, integration_info: [ { integration_type: integration_type, @@ -298,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 @@ -308,6 +319,7 @@ export default function IntegrationList({ ...actionLoading, discovery: false, }) + setRunOpen(false) setNotification({ text: `Discovery started`, type: 'success', @@ -326,6 +338,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 +457,10 @@ export default function IntegrationList({ + + + + } + > + { + return { + label: item?.name, + value: item?.name, + params: item?.params, + } + })} + selectedOptions={selectedResourceType} + onChange={({ detail }) => { + setSelectedResourceType(detail.selectedOptions) + }} + tokenLimit={2} + placeholder="Select resource type" + /> + ) : (