mirror of
https://github.com/SigNoz/signoz.git
synced 2026-11-21 07:41:25 +00:00
Compare commits
3 Commits
refactor/s
...
fix/antd-l
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb201f504a | ||
|
|
3a0e31c4d5 | ||
|
|
343510f0bc |
@@ -338,6 +338,11 @@
|
||||
"importNames": ["patchDashboardV2", "usePatchDashboardV2"],
|
||||
"message": "[dashboard-v2] Don't call patchDashboardV2/usePatchDashboardV2 directly — use useOptimisticPatch().patchAsync so spec edits update the react-query cache optimistically and reconcile on settle."
|
||||
},
|
||||
{
|
||||
"name": "antd/lib",
|
||||
"allowTypeImports": true,
|
||||
"message": "[bundle] antd/lib is the CommonJS root and bundles every antd component. Import from 'antd' instead."
|
||||
},
|
||||
{
|
||||
"name": "motion/react-client",
|
||||
"message": "[motion] motion/react-client is for React Server Components only. Use 'motion/react' instead — it provides the same exports and works correctly in client-side SPAs."
|
||||
|
||||
@@ -2,8 +2,7 @@ import { Dispatch, SetStateAction, useEffect, useMemo, useState } from 'react';
|
||||
import { useAppNavigate } from 'lib/router/useAppNavigate';
|
||||
import { Color } from '@signozhq/design-tokens';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { Select, Skeleton } from 'antd';
|
||||
import { SelectProps } from 'antd/lib';
|
||||
import { Select, SelectProps, Skeleton } from 'antd';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import { useListAccounts } from 'api/generated/services/cloudintegration';
|
||||
import cx from 'classnames';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import { Button } from '@signozhq/ui/button';
|
||||
import { Modal } from 'antd/lib';
|
||||
import { Modal } from 'antd';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import { useDisconnectAccount } from 'api/generated/services/cloudintegration';
|
||||
import { CloudintegrationtypesGCPConnectionMethodDTO } from 'api/generated/services/sigNoz.schemas';
|
||||
|
||||
@@ -7,8 +7,7 @@ import {
|
||||
useState,
|
||||
} from 'react';
|
||||
import { toast } from '@signozhq/ui/toast';
|
||||
import { Form } from 'antd';
|
||||
import { FormInstance } from 'antd/lib';
|
||||
import { Form, FormInstance } from 'antd';
|
||||
import { useUpdateAccount } from 'api/generated/services/cloudintegration';
|
||||
import { CloudAccount } from 'container/Integrations/CloudIntegration/AmazonWebServices/types';
|
||||
import { INTEGRATION_TYPES } from 'container/Integrations/constants';
|
||||
|
||||
@@ -7,8 +7,7 @@ import {
|
||||
useState,
|
||||
} from 'react';
|
||||
import { toast } from '@signozhq/ui/toast';
|
||||
import { Form } from 'antd';
|
||||
import { FormInstance } from 'antd/lib';
|
||||
import { Form, FormInstance } from 'antd';
|
||||
import { useUpdateAccount } from 'api/generated/services/cloudintegration';
|
||||
import { INTEGRATION_TYPES } from 'container/Integrations/constants';
|
||||
import { CloudAccount } from 'container/Integrations/types';
|
||||
|
||||
@@ -7,8 +7,7 @@ import {
|
||||
useState,
|
||||
} from 'react';
|
||||
import { toast } from '@signozhq/ui/toast';
|
||||
import { Form } from 'antd';
|
||||
import { FormInstance } from 'antd/lib';
|
||||
import { Form, FormInstance } from 'antd';
|
||||
import { useUpdateAccount } from 'api/generated/services/cloudintegration';
|
||||
import { INTEGRATION_TYPES } from 'container/Integrations/constants';
|
||||
import { CloudAccount } from 'container/Integrations/types';
|
||||
|
||||
@@ -23,7 +23,10 @@ import {
|
||||
updateTaggedAccount,
|
||||
} from './CloudIntegration.stories.mocks';
|
||||
import {
|
||||
openAccountSelect,
|
||||
openAccountSettings,
|
||||
openConnectDialog,
|
||||
openDisconnectConfirm,
|
||||
openGcpRegionDropdown,
|
||||
} from './__story_mockdata__/cloudIntegration.play';
|
||||
|
||||
@@ -86,6 +89,17 @@ export const GoogleCloudPlatform: Story = {
|
||||
args: { provider: 'gcp' },
|
||||
};
|
||||
|
||||
/** The page while the account list is loading, the account picker a skeleton. */
|
||||
export const Loading: Story = {
|
||||
args: { dataState: 'loading' },
|
||||
};
|
||||
|
||||
/** The account picker open over two connected accounts. */
|
||||
export const AccountSelectOpen: Story = {
|
||||
args: { accounts: 2 },
|
||||
play: openAccountSelect,
|
||||
};
|
||||
|
||||
/** Every log attribute and metric a service collects, as the agent names them. */
|
||||
export const DataCollected: Story = {
|
||||
play: async ({ canvasElement }): Promise<void> => {
|
||||
@@ -129,16 +143,27 @@ export const AzureConnectAccount: Story = {
|
||||
|
||||
/** The regions an already-connected account collects from. */
|
||||
export const EditAccount: Story = {
|
||||
play: async ({ canvasElement }): Promise<void> => {
|
||||
await userEvent.click(
|
||||
await within(canvasElement).findByText(
|
||||
/edit account/i,
|
||||
undefined,
|
||||
untilLoaded,
|
||||
),
|
||||
);
|
||||
await screen.findByRole('dialog', undefined, untilLoaded);
|
||||
},
|
||||
play: openAccountSettings,
|
||||
};
|
||||
|
||||
/** The resource groups an already-connected Azure subscription collects from. */
|
||||
export const AzureEditAccount: Story = {
|
||||
args: { provider: 'azure' },
|
||||
play: openAccountSettings,
|
||||
};
|
||||
|
||||
/** The projects an already-connected GCP account collects from. */
|
||||
export const GcpEditAccount: Story = {
|
||||
args: { provider: 'gcp' },
|
||||
play: openAccountSettings,
|
||||
};
|
||||
|
||||
/**
|
||||
* Disconnecting an account, which asks first and names what is removed from the
|
||||
* cloud account and what is left to delete by hand.
|
||||
*/
|
||||
export const DisconnectConfirm: Story = {
|
||||
play: openDisconnectConfirm,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
type CloudIntegrationArgs,
|
||||
offersIntegrateNow,
|
||||
openConnectFlow,
|
||||
openEditAccount,
|
||||
untilLoaded,
|
||||
} from '../CloudIntegration.stories.mocks';
|
||||
|
||||
@@ -17,6 +18,16 @@ interface PlayContext {
|
||||
args: CloudIntegrationArgs;
|
||||
}
|
||||
|
||||
/** The hero shows the account picker and Edit Account only once accounts have answered. */
|
||||
const offersAccountActions = (args: CloudIntegrationArgs): boolean =>
|
||||
args.dataState === 'loaded' && args.accounts > 0;
|
||||
|
||||
const blurActiveElement = (): void => {
|
||||
if (document.activeElement instanceof HTMLElement) {
|
||||
document.activeElement.blur();
|
||||
}
|
||||
};
|
||||
|
||||
export const openConnectDialog = async ({
|
||||
canvasElement,
|
||||
args,
|
||||
@@ -48,3 +59,49 @@ export const openGcpRegionDropdown = async ({
|
||||
);
|
||||
await screen.findByRole('listbox');
|
||||
};
|
||||
|
||||
export const openAccountSelect = async ({
|
||||
args,
|
||||
}: PlayContext): Promise<void> => {
|
||||
if (!offersAccountActions(args)) {
|
||||
return;
|
||||
}
|
||||
await userEvent.click(
|
||||
await screen.findByRole('combobox', { name: 'Cloud account' }, untilLoaded),
|
||||
);
|
||||
await screen.findByRole('listbox');
|
||||
};
|
||||
|
||||
export const openAccountSettings = async ({
|
||||
canvasElement,
|
||||
args,
|
||||
}: PlayContext): Promise<void> => {
|
||||
if (!offersAccountActions(args)) {
|
||||
return;
|
||||
}
|
||||
await openEditAccount(canvasElement);
|
||||
blurActiveElement();
|
||||
};
|
||||
|
||||
export const openDisconnectConfirm = async ({
|
||||
canvasElement,
|
||||
args,
|
||||
}: PlayContext): Promise<void> => {
|
||||
if (!offersAccountActions(args)) {
|
||||
return;
|
||||
}
|
||||
await openEditAccount(canvasElement);
|
||||
await userEvent.click(
|
||||
await screen.findByTestId(
|
||||
'cloud-disconnect-account-btn',
|
||||
undefined,
|
||||
untilLoaded,
|
||||
),
|
||||
);
|
||||
await screen.findByTestId(
|
||||
'cloud-remove-account-confirm',
|
||||
undefined,
|
||||
untilLoaded,
|
||||
);
|
||||
blurActiveElement();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user