mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-06-04 11:25:52 +08:00
Chore: aws integrations UI improvements (#7068)
* chore: handle race between initial setting of ?cloudAccountId and ?service * chore: invalidate accounts query after successful account connection * chore: show service status only when enabled and disable save btn only if no change in svc config * chore: re-trigger CI
This commit is contained in:
parent
169bd3f65b
commit
ef635b6b60
@ -159,8 +159,9 @@ function AccountActions(): JSX.Element {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (initialAccount !== null) {
|
if (initialAccount !== null) {
|
||||||
setActiveAccount(initialAccount);
|
setActiveAccount(initialAccount);
|
||||||
urlQuery.set('cloudAccountId', initialAccount.cloud_account_id);
|
const latestUrlQuery = new URLSearchParams(window.location.search);
|
||||||
navigate({ search: urlQuery.toString() });
|
latestUrlQuery.set('cloudAccountId', initialAccount.cloud_account_id);
|
||||||
|
navigate({ search: latestUrlQuery.toString() });
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [initialAccount]);
|
}, [initialAccount]);
|
||||||
|
@ -2,9 +2,11 @@ import './CloudAccountSetupModal.style.scss';
|
|||||||
|
|
||||||
import { Color } from '@signozhq/design-tokens';
|
import { Color } from '@signozhq/design-tokens';
|
||||||
import SignozModal from 'components/SignozModal/SignozModal';
|
import SignozModal from 'components/SignozModal/SignozModal';
|
||||||
|
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
|
||||||
import { useIntegrationModal } from 'hooks/integrations/aws/useIntegrationModal';
|
import { useIntegrationModal } from 'hooks/integrations/aws/useIntegrationModal';
|
||||||
import { SquareArrowOutUpRight } from 'lucide-react';
|
import { SquareArrowOutUpRight } from 'lucide-react';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
import { useQueryClient } from 'react-query';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ActiveViewEnum,
|
ActiveViewEnum,
|
||||||
@ -18,6 +20,7 @@ import { SuccessView } from './SuccessView';
|
|||||||
function CloudAccountSetupModal({
|
function CloudAccountSetupModal({
|
||||||
onClose,
|
onClose,
|
||||||
}: IntegrationModalProps): JSX.Element {
|
}: IntegrationModalProps): JSX.Element {
|
||||||
|
const queryClient = useQueryClient();
|
||||||
const {
|
const {
|
||||||
form,
|
form,
|
||||||
modalState,
|
modalState,
|
||||||
@ -110,7 +113,10 @@ function CloudAccountSetupModal({
|
|||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
block: true,
|
block: true,
|
||||||
onOk: handleClose,
|
onOk: (): void => {
|
||||||
|
queryClient.invalidateQueries([REACT_QUERY_KEY.AWS_ACCOUNTS]);
|
||||||
|
handleClose();
|
||||||
|
},
|
||||||
cancelButtonProps: { style: { display: 'none' } },
|
cancelButtonProps: { style: { display: 'none' } },
|
||||||
disabled: false,
|
disabled: false,
|
||||||
};
|
};
|
||||||
@ -151,6 +157,7 @@ function CloudAccountSetupModal({
|
|||||||
activeView,
|
activeView,
|
||||||
handleClose,
|
handleClose,
|
||||||
setActiveView,
|
setActiveView,
|
||||||
|
queryClient,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const modalConfig = getModalConfig();
|
const modalConfig = getModalConfig();
|
||||||
|
@ -34,10 +34,19 @@ function ConfigureServiceModal({
|
|||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
// Track current form values
|
// Track current form values
|
||||||
const [currentValues, setCurrentValues] = useState({
|
const initialValues = {
|
||||||
metrics: initialConfig?.metrics?.enabled || false,
|
metrics: initialConfig?.metrics?.enabled || false,
|
||||||
logs: initialConfig?.logs?.enabled || false,
|
logs: initialConfig?.logs?.enabled || false,
|
||||||
});
|
};
|
||||||
|
const [currentValues, setCurrentValues] = useState(initialValues);
|
||||||
|
|
||||||
|
const isSaveDisabled = useMemo(
|
||||||
|
() =>
|
||||||
|
// disable only if current values are same as the initial config
|
||||||
|
currentValues.metrics === initialValues.metrics &&
|
||||||
|
currentValues.logs === initialValues.logs,
|
||||||
|
[currentValues, initialValues.metrics, initialValues.logs],
|
||||||
|
);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
mutate: updateServiceConfig,
|
mutate: updateServiceConfig,
|
||||||
@ -93,11 +102,6 @@ function ConfigureServiceModal({
|
|||||||
onClose,
|
onClose,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const isSaveDisabled = useMemo(
|
|
||||||
() => currentValues.metrics === false && currentValues.logs === false,
|
|
||||||
[currentValues],
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleClose = useCallback(() => {
|
const handleClose = useCallback(() => {
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
onClose();
|
onClose();
|
||||||
|
@ -111,7 +111,9 @@ function ServiceDetails(): JSX.Element | null {
|
|||||||
<div className="service-details__title-bar">
|
<div className="service-details__title-bar">
|
||||||
<div className="service-details__details-title">Details</div>
|
<div className="service-details__details-title">Details</div>
|
||||||
<div className="service-details__right-actions">
|
<div className="service-details__right-actions">
|
||||||
<ServiceStatus serviceStatus={serviceDetailsData.status} />
|
{isAnySignalConfigured && (
|
||||||
|
<ServiceStatus serviceStatus={serviceDetailsData.status} />
|
||||||
|
)}
|
||||||
|
|
||||||
{!!cloudAccountId && isAnySignalConfigured ? (
|
{!!cloudAccountId && isAnySignalConfigured ? (
|
||||||
<Button
|
<Button
|
||||||
|
@ -24,10 +24,11 @@ function ServicesList({
|
|||||||
|
|
||||||
const handleActiveService = useCallback(
|
const handleActiveService = useCallback(
|
||||||
(serviceId: string): void => {
|
(serviceId: string): void => {
|
||||||
urlQuery.set('service', serviceId);
|
const latestUrlQuery = new URLSearchParams(window.location.search);
|
||||||
navigate({ search: urlQuery.toString() });
|
latestUrlQuery.set('service', serviceId);
|
||||||
|
navigate({ search: latestUrlQuery.toString() });
|
||||||
},
|
},
|
||||||
[navigate, urlQuery],
|
[navigate],
|
||||||
);
|
);
|
||||||
|
|
||||||
const filteredServices = useMemo(() => {
|
const filteredServices = useMemo(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user