-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [SIG-526]: UI Integrations V0 (#4595)
* feat: integrations v0 base setup routes and components * chore: typecheck fix * feat: integrations landing page changes * feat: initial header setup * feat: integrations list page setup * feat: integrations details content root setup * feat: integration detail content setup * feat: added overview tab * feat: added data tab * feat: handle configuration tab * feat: add min height for the container * feat: generate apis and hooks for usage * feat: added remove integration modal * feat: added remove integration modal * feat: added remove integration modal * feat: added test connection bars * chore: add bottom margins * feat: added test connection modal * feat: add all types of test connection * feat: add all types of test connection * fix: address review comments * fix: address review comments * feat: added get all integrations API and search bar implemnetation * feat: navigate to overview section in case of row click and configure in btn * feat: integrate get integration details api * feat: handle integration details page gracefully * feat: integrate uninstall API and the connection states * feat: add install integration API call * feat: added api error handling * feat: handle error states for list and details api * feat: handle the logs and metrics columns * feat: add TODOs for pending tasks * feat: comment from side nav * feat: added support for custom tags in react markdown * chore: revert the temporary change for merge * feat: integrate the status api calls and polling logic * chore: add markdown components and correct the polling issue * chore: handle light mode * chore: remove integrations from sideNav * fix: address review comments * fix: address review comments
- Loading branch information
1 parent
7136ecc
commit 0c41492
Showing
43 changed files
with
2,814 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import axios from 'api'; | ||
import { AxiosResponse } from 'axios'; | ||
import { AllIntegrationsProps } from 'types/api/integrations/types'; | ||
|
||
export const getAllIntegrations = (): Promise< | ||
AxiosResponse<AllIntegrationsProps> | ||
> => axios.get(`/integrations`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import axios from 'api'; | ||
import { AxiosResponse } from 'axios'; | ||
import { | ||
GetIntegrationPayloadProps, | ||
GetIntegrationProps, | ||
} from 'types/api/integrations/types'; | ||
|
||
export const getIntegration = ( | ||
props: GetIntegrationPayloadProps, | ||
): Promise<AxiosResponse<GetIntegrationProps>> => | ||
axios.get(`/integrations/${props.integrationId}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import axios from 'api'; | ||
import { AxiosResponse } from 'axios'; | ||
import { | ||
GetIntegrationPayloadProps, | ||
GetIntegrationStatusProps, | ||
} from 'types/api/integrations/types'; | ||
|
||
export const getIntegrationStatus = ( | ||
props: GetIntegrationPayloadProps, | ||
): Promise<AxiosResponse<GetIntegrationStatusProps>> => | ||
axios.get(`/integrations/${props.integrationId}/connection_status`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import axios from 'api'; | ||
import { ErrorResponseHandler } from 'api/ErrorResponseHandler'; | ||
import { AxiosError } from 'axios'; | ||
import { ErrorResponse, SuccessResponse } from 'types/api'; | ||
import { | ||
InstalledIntegrationsSuccessResponse, | ||
InstallIntegrationKeyProps, | ||
} from 'types/api/integrations/types'; | ||
|
||
const installIntegration = async ( | ||
props: InstallIntegrationKeyProps, | ||
): Promise< | ||
SuccessResponse<InstalledIntegrationsSuccessResponse> | ErrorResponse | ||
> => { | ||
try { | ||
const response = await axios.post('/integrations/install', { | ||
...props, | ||
}); | ||
|
||
return { | ||
statusCode: 200, | ||
error: null, | ||
message: response.data.status, | ||
payload: response.data.data, | ||
}; | ||
} catch (error) { | ||
return ErrorResponseHandler(error as AxiosError); | ||
} | ||
}; | ||
|
||
export default installIntegration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import axios from 'api'; | ||
import { ErrorResponseHandler } from 'api/ErrorResponseHandler'; | ||
import { AxiosError } from 'axios'; | ||
import { ErrorResponse, SuccessResponse } from 'types/api'; | ||
import { | ||
UninstallIntegrationProps, | ||
UninstallIntegrationSuccessResponse, | ||
} from 'types/api/integrations/types'; | ||
|
||
const unInstallIntegration = async ( | ||
props: UninstallIntegrationProps, | ||
): Promise< | ||
SuccessResponse<UninstallIntegrationSuccessResponse> | ErrorResponse | ||
> => { | ||
try { | ||
const response = await axios.post('/integrations/uninstall', { | ||
...props, | ||
}); | ||
|
||
return { | ||
statusCode: 200, | ||
error: null, | ||
message: response.data.status, | ||
payload: response.data.data, | ||
}; | ||
} catch (error) { | ||
return ErrorResponseHandler(error as AxiosError); | ||
} | ||
}; | ||
|
||
export default unInstallIntegration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { getAllIntegrations } from 'api/Integrations/getAllIntegrations'; | ||
import { AxiosError, AxiosResponse } from 'axios'; | ||
import { useQuery, UseQueryResult } from 'react-query'; | ||
import { AllIntegrationsProps } from 'types/api/integrations/types'; | ||
|
||
export const useGetAllIntegrations = (): UseQueryResult< | ||
AxiosResponse<AllIntegrationsProps>, | ||
AxiosError | ||
> => | ||
useQuery<AxiosResponse<AllIntegrationsProps>, AxiosError>({ | ||
queryKey: ['Integrations'], | ||
queryFn: () => getAllIntegrations(), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { getIntegration } from 'api/Integrations/getIntegration'; | ||
import { AxiosError, AxiosResponse } from 'axios'; | ||
import { useQuery, UseQueryResult } from 'react-query'; | ||
import { | ||
GetIntegrationPayloadProps, | ||
GetIntegrationProps, | ||
} from 'types/api/integrations/types'; | ||
|
||
export const useGetIntegration = ({ | ||
integrationId, | ||
}: GetIntegrationPayloadProps): UseQueryResult< | ||
AxiosResponse<GetIntegrationProps>, | ||
AxiosError | ||
> => | ||
useQuery<AxiosResponse<GetIntegrationProps>, AxiosError>({ | ||
queryKey: ['Integration', integrationId], | ||
queryFn: () => getIntegration({ integrationId }), | ||
}); |
20 changes: 20 additions & 0 deletions
20
frontend/src/hooks/Integrations/useGetIntegrationStatus.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { getIntegrationStatus } from 'api/Integrations/getIntegrationStatus'; | ||
import { AxiosError, AxiosResponse } from 'axios'; | ||
import { useQuery, UseQueryResult } from 'react-query'; | ||
import { | ||
GetIntegrationPayloadProps, | ||
GetIntegrationStatusProps, | ||
} from 'types/api/integrations/types'; | ||
|
||
export const useGetIntegrationStatus = ({ | ||
integrationId, | ||
enabled, | ||
}: GetIntegrationPayloadProps): UseQueryResult< | ||
AxiosResponse<GetIntegrationStatusProps>, | ||
AxiosError | ||
> => | ||
useQuery<AxiosResponse<GetIntegrationStatusProps>, AxiosError>({ | ||
queryKey: ['Integration', integrationId, Date.now()], | ||
queryFn: () => getIntegrationStatus({ integrationId }), | ||
enabled, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import './Integrations.styles.scss'; | ||
|
||
import { Color } from '@signozhq/design-tokens'; | ||
import { Input, Typography } from 'antd'; | ||
import { Search } from 'lucide-react'; | ||
import { Dispatch, SetStateAction } from 'react'; | ||
|
||
interface HeaderProps { | ||
searchTerm: string; | ||
setSearchTerm: Dispatch<SetStateAction<string>>; | ||
} | ||
|
||
function Header(props: HeaderProps): JSX.Element { | ||
const { searchTerm, setSearchTerm } = props; | ||
|
||
const handleSearch = (e: React.ChangeEvent<HTMLInputElement>): void => { | ||
setSearchTerm(e.target.value); | ||
}; | ||
return ( | ||
<div className="integrations-header"> | ||
<Typography.Title className="title">Integrations</Typography.Title> | ||
<Typography.Text className="subtitle"> | ||
Manage Integrations for this workspace | ||
</Typography.Text> | ||
|
||
<Input | ||
placeholder="Search for an integration..." | ||
prefix={<Search size={12} color={Color.BG_VANILLA_400} />} | ||
value={searchTerm} | ||
onChange={handleSearch} | ||
className="integrations-search-input" | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
export default Header; |
Oops, something went wrong.