mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-28 22:39:57 +00:00
Compare commits
1 Commits
main
...
feat/globa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d5cd7091c |
7
frontend/src/api/globalConfig/globalConfig.ts
Normal file
7
frontend/src/api/globalConfig/globalConfig.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import axios from 'api';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { GlobalConfigDataProps } from 'types/api/globalConfig/types';
|
||||
|
||||
export const getGlobalConfig = (): Promise<
|
||||
AxiosResponse<GlobalConfigDataProps>
|
||||
> => axios.get(`/global/config`);
|
||||
@@ -996,6 +996,7 @@
|
||||
gap: 8px;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
|
||||
.ingestion-key-url-label {
|
||||
font-size: 13px;
|
||||
|
||||
@@ -40,7 +40,7 @@ import { initialQueryMeterWithType } from 'constants/queryBuilder';
|
||||
import ROUTES from 'constants/routes';
|
||||
import { INITIAL_ALERT_THRESHOLD_STATE } from 'container/CreateAlertV2/context/constants';
|
||||
import dayjs from 'dayjs';
|
||||
import { useGetDeploymentsData } from 'hooks/CustomDomain/useGetDeploymentsData';
|
||||
import { useGetGlobalConfig } from 'hooks/globalConfig/useGetGlobalConfig';
|
||||
import { useGetAllIngestionsKeys } from 'hooks/IngestionKeys/useGetAllIngestionKeys';
|
||||
import useDebouncedFn from 'hooks/useDebouncedFunction';
|
||||
import { useGetTenantLicense } from 'hooks/useGetTenantLicense';
|
||||
@@ -302,11 +302,11 @@ function MultiIngestionSettings(): JSX.Element {
|
||||
};
|
||||
|
||||
const {
|
||||
data: deploymentsData,
|
||||
isLoading: isLoadingDeploymentsData,
|
||||
isFetching: isFetchingDeploymentsData,
|
||||
isError: isErrorDeploymentsData,
|
||||
} = useGetDeploymentsData(!isEnterpriseSelfHostedUser);
|
||||
data: globalConfig,
|
||||
isLoading: isLoadingGlobalConfig,
|
||||
isFetching: isFetchingGlobalConfig,
|
||||
isError: isErrorGlobalConfig,
|
||||
} = useGetGlobalConfig(!isEnterpriseSelfHostedUser);
|
||||
|
||||
const {
|
||||
mutate: createIngestionKey,
|
||||
@@ -1409,10 +1409,10 @@ function MultiIngestionSettings(): JSX.Element {
|
||||
</Typography.Text>
|
||||
</header>
|
||||
|
||||
{!isErrorDeploymentsData &&
|
||||
!isLoadingDeploymentsData &&
|
||||
!isFetchingDeploymentsData &&
|
||||
deploymentsData && (
|
||||
{!isErrorGlobalConfig &&
|
||||
!isLoadingGlobalConfig &&
|
||||
!isFetchingGlobalConfig &&
|
||||
globalConfig && (
|
||||
<div className="ingestion-setup-details-links">
|
||||
<div className="ingestion-key-url-container">
|
||||
<div className="ingestion-key-url-label">Ingestion URL</div>
|
||||
@@ -1421,29 +1421,10 @@ function MultiIngestionSettings(): JSX.Element {
|
||||
onClick={(e): void => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleCopyKey(
|
||||
`ingest.${deploymentsData?.data.data.cluster.region.dns}`,
|
||||
);
|
||||
handleCopyKey(`${globalConfig?.data.data.ingestion_url}`);
|
||||
}}
|
||||
>
|
||||
ingest.{deploymentsData?.data.data.cluster.region.dns}
|
||||
<Copy className="copy-key-btn" size={12} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="ingestion-data-region-container">
|
||||
<div className="ingestion-data-region-label">Region</div>
|
||||
<div
|
||||
className="ingestion-data-region-value"
|
||||
onClick={(e): void => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
handleCopyKey(deploymentsData?.data.data.cluster.region.name || '');
|
||||
}}
|
||||
>
|
||||
<Typography.Text className="ingestion-data-region-value-text">
|
||||
{deploymentsData?.data.data.cluster.region.name}
|
||||
</Typography.Text>
|
||||
{globalConfig?.data.data.ingestion_url}
|
||||
<Copy className="copy-key-btn" size={12} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
import { Skeleton, Typography } from 'antd';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import { AxiosError } from 'axios';
|
||||
import { useGetDeploymentsData } from 'hooks/CustomDomain/useGetDeploymentsData';
|
||||
import { useGetGlobalConfig } from 'hooks/globalConfig/useGetGlobalConfig';
|
||||
import { useGetAllIngestionsKeys } from 'hooks/IngestionKeys/useGetAllIngestionKeys';
|
||||
import { useNotifications } from 'hooks/useNotifications';
|
||||
import {
|
||||
ArrowUpRight,
|
||||
Copy,
|
||||
Info,
|
||||
Key,
|
||||
MapPin,
|
||||
TriangleAlert,
|
||||
} from 'lucide-react';
|
||||
import { ArrowUpRight, Copy, Info, Key, TriangleAlert } from 'lucide-react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useCopyToClipboard } from 'react-use';
|
||||
import { IngestionKeyProps } from 'types/api/ingestionKeys/types';
|
||||
@@ -59,11 +52,11 @@ export default function OnboardingIngestionDetails(): JSX.Element {
|
||||
});
|
||||
|
||||
const {
|
||||
data: deploymentsData,
|
||||
isLoading: isLoadingDeploymentsData,
|
||||
isFetching: isFetchingDeploymentsData,
|
||||
isError: isDeploymentsDataError,
|
||||
} = useGetDeploymentsData(true);
|
||||
data: globalConfig,
|
||||
isLoading: isLoadingGlobalConfig,
|
||||
isFetching: isFetchingGlobalConfig,
|
||||
isError: isErrorGlobalConfig,
|
||||
} = useGetGlobalConfig(true);
|
||||
|
||||
const handleCopyKey = (text: string): void => {
|
||||
handleCopyToClipboard(text);
|
||||
@@ -114,8 +107,8 @@ export default function OnboardingIngestionDetails(): JSX.Element {
|
||||
|
||||
<div className="ingestion-key-details-section-key">
|
||||
{isIngestionKeysLoading ||
|
||||
isLoadingDeploymentsData ||
|
||||
isFetchingDeploymentsData ? (
|
||||
isLoadingGlobalConfig ||
|
||||
isFetchingGlobalConfig ? (
|
||||
<div className="skeleton-container">
|
||||
<Skeleton.Input active className="skeleton-input" />
|
||||
<Skeleton.Input active className="skeleton-input" />
|
||||
@@ -124,16 +117,16 @@ export default function OnboardingIngestionDetails(): JSX.Element {
|
||||
</div>
|
||||
) : (
|
||||
<div className="ingestion-key-region-details-section">
|
||||
{!isDeploymentsDataError &&
|
||||
!isLoadingDeploymentsData &&
|
||||
!isFetchingDeploymentsData && (
|
||||
{!isErrorGlobalConfig &&
|
||||
!isLoadingGlobalConfig &&
|
||||
!isFetchingGlobalConfig && (
|
||||
<div className="ingestion-region-container">
|
||||
<Typography.Text className="ingestion-region-label">
|
||||
<MapPin size={14} /> Region
|
||||
Ingestion URL
|
||||
</Typography.Text>
|
||||
|
||||
<Typography.Text className="ingestion-region-value-copy">
|
||||
{deploymentsData?.data?.data?.cluster.region.name}
|
||||
{globalConfig?.data?.data?.ingestion_url}
|
||||
|
||||
<Copy
|
||||
size={14}
|
||||
@@ -144,9 +137,7 @@ export default function OnboardingIngestionDetails(): JSX.Element {
|
||||
{},
|
||||
);
|
||||
|
||||
handleCopyKey(
|
||||
deploymentsData?.data?.data?.cluster.region.name || '',
|
||||
);
|
||||
handleCopyKey(`${globalConfig?.data?.data?.ingestion_url}`);
|
||||
}}
|
||||
/>
|
||||
</Typography.Text>
|
||||
|
||||
13
frontend/src/hooks/globalConfig/useGetGlobalConfig.ts
Normal file
13
frontend/src/hooks/globalConfig/useGetGlobalConfig.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { getGlobalConfig } from 'api/globalConfig/globalConfig';
|
||||
import { AxiosError, AxiosResponse } from 'axios';
|
||||
import { useQuery, UseQueryResult } from 'react-query';
|
||||
import { GlobalConfigDataProps } from 'types/api/globalConfig/types';
|
||||
|
||||
export const useGetGlobalConfig = (
|
||||
isEnabled: boolean,
|
||||
): UseQueryResult<AxiosResponse<GlobalConfigDataProps>, AxiosError> =>
|
||||
useQuery<AxiosResponse<GlobalConfigDataProps>, AxiosError>({
|
||||
queryKey: ['getGlobalConfig'],
|
||||
queryFn: () => getGlobalConfig(),
|
||||
enabled: isEnabled,
|
||||
});
|
||||
9
frontend/src/types/api/globalConfig/types.ts
Normal file
9
frontend/src/types/api/globalConfig/types.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export interface GlobalConfigData {
|
||||
external_url: string;
|
||||
ingestion_url: string;
|
||||
}
|
||||
|
||||
export interface GlobalConfigDataProps {
|
||||
status: string;
|
||||
data: GlobalConfigData;
|
||||
}
|
||||
Reference in New Issue
Block a user