Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix/issue 2777 2" #511

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ exports[`sqle/components/RuleDetail click return button 1`] = `
</div>
</div>
<div
class="rule-list-wrapper css-rhwzhg"
class="rule-list-wrapper css-8rro2x"
>
<div
class="css-1br6ibb"
Expand Down Expand Up @@ -543,7 +543,7 @@ exports[`sqle/components/RuleDetail render error snap 1`] = `
</div>
</div>
<div
class="rule-list-wrapper css-rhwzhg"
class="rule-list-wrapper css-8rro2x"
>
<div
class="css-1br6ibb"
Expand Down Expand Up @@ -861,7 +861,7 @@ exports[`sqle/components/RuleDetail render snap 1`] = `
</div>
</div>
<div
class="rule-list-wrapper css-rhwzhg"
class="rule-list-wrapper css-8rro2x"
>
<div
class="css-1br6ibb"
Expand Down Expand Up @@ -1155,7 +1155,7 @@ exports[`sqle/components/RuleDetail render snap 2`] = `
</div>
</div>
<div
class="rule-list-wrapper css-rhwzhg"
class="rule-list-wrapper css-8rro2x"
>
<div
class="css-1br6ibb"
Expand Down Expand Up @@ -1475,7 +1475,7 @@ exports[`sqle/components/RuleDetail render snap when has params 1`] = `
</div>
</div>
<div
class="rule-list-wrapper css-rhwzhg"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -1799,7 +1799,7 @@ exports[`sqle/components/RuleDetail render snap when input fuzzy test 1`] = `
</div>
</div>
<div
class="rule-list-wrapper css-rhwzhg"
class="rule-list-wrapper css-8rro2x"
>
<div
class="css-1br6ibb"
Expand Down Expand Up @@ -2118,7 +2118,7 @@ exports[`sqle/components/RuleDetail send global request when not select project
</div>
</div>
<div
class="rule-list-wrapper css-rhwzhg"
class="rule-list-wrapper css-8rro2x"
>
<div
class="css-1br6ibb"
Expand Down
20 changes: 7 additions & 13 deletions packages/sqle/src/components/RuleList/RuleList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ import usePermission from '@actiontech/shared/lib/global/usePermission/usePermis

const scrollStepRange = 30;

export const pageRemainingHeight = (
pageHeaderHeight: RuleListProps['pageHeaderHeight']
) => {
let headerHeight = pageHeaderHeight;
// #if [demo || ce]
headerHeight += 184;
// #else
headerHeight += 128;
// #endif
return headerHeight;
};

const RuleList: React.FC<RuleListProps> = ({
rules = [],
pageHeaderHeight,
Expand Down Expand Up @@ -270,10 +258,16 @@ const RuleList: React.FC<RuleListProps> = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [rules]);

const pageRemainingHeight = useMemo(() => {
// #if [demo || ce]
return pageHeaderHeight + 184;
// #endif
}, [pageHeaderHeight]);

return (
<>
<RulesStyleWrapper
pageHeaderHeight={pageRemainingHeight(pageHeaderHeight)}
pageHeaderHeight={pageRemainingHeight}
className="rule-list-wrapper"
// #if [demo || ce]
paddingBottomNone={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @test_version ce
*/

import RuleList, { pageRemainingHeight } from '../RuleList';
import RuleList from '../RuleList';
import { act, cleanup } from '@testing-library/react';
import { renderWithTheme } from '../../../testUtils/customRender';
import { RuleListProps, RuleStatusEnum } from '../index.type';
Expand Down Expand Up @@ -45,8 +45,4 @@ describe('sqle/components/RuleList CE', () => {
await act(async () => jest.advanceTimersByTime(3000));
expect(baseElement).toMatchSnapshot();
});

it('page remaining height should increase 184', () => {
expect(pageRemainingHeight(100)).toBe(284);
});
});
6 changes: 1 addition & 5 deletions packages/sqle/src/components/RuleList/test/RuleList.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import RuleList, { pageRemainingHeight } from '../RuleList';
import RuleList from '../RuleList';
import { act, cleanup, fireEvent, screen } from '@testing-library/react';
import { renderWithTheme } from '../../../testUtils/customRender';
import { getBySelector } from '@actiontech/shared/lib/testUtil/customQuery';
Expand Down Expand Up @@ -182,8 +182,4 @@ describe('sqle/components/RuleList', () => {
await act(async () => jest.advanceTimersByTime(300));
expect(baseElement).toMatchSnapshot();
});

it('page remaining height should increase 128', () => {
expect(pageRemainingHeight(100)).toBe(228);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`sqle/components/RuleList scroll infinite list 1`] = `
<body>
<div>
<div
class="rule-list-wrapper css-1r6bun"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -813,7 +813,7 @@ exports[`sqle/components/RuleList should match snap shot when actionType is disa
<body>
<div>
<div
class="rule-list-wrapper css-1bhqk71"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -1269,7 +1269,7 @@ exports[`sqle/components/RuleList should match snap shot when actionType is enab
<body>
<div>
<div
class="rule-list-wrapper css-1bhqk71"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -1849,7 +1849,7 @@ exports[`sqle/components/RuleList should match snap shot when enableCheckDetail
<body>
<div>
<div
class="rule-list-wrapper css-1bhqk71"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -2305,7 +2305,7 @@ exports[`sqle/components/RuleList should match snap shot when enableCheckDetail
<body>
<div>
<div
class="rule-list-wrapper css-1bhqk71"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -3153,7 +3153,7 @@ exports[`sqle/components/RuleList should match snap shot when has props 1`] = `
<body>
<div>
<div
class="rule-list-wrapper css-1bhqk71"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -3433,7 +3433,7 @@ exports[`sqle/components/RuleList should match snap shot when has renderDisableN
<body>
<div>
<div
class="rule-list-wrapper css-1bhqk71"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -3909,7 +3909,7 @@ exports[`sqle/components/RuleList should match snap shot when isAction is true 1
<body>
<div>
<div
class="rule-list-wrapper css-1bhqk71"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -4353,7 +4353,7 @@ exports[`sqle/components/RuleList should match snap shot when no rule data 1`] =
<body>
<div>
<div
class="rule-list-wrapper css-5u6w7h"
class="rule-list-wrapper css-8rro2x"
>
<div
class="css-1br6ibb"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ exports[`sqle/CustomRuleList click rule item 1`] = `
class="ant-space-item"
>
<div
class="rule-list-wrapper css-1bhqk71"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -779,7 +779,7 @@ exports[`sqle/CustomRuleList should match snap shot 1`] = `
class="ant-space-item"
>
<div
class="rule-list-wrapper css-1bhqk71"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -1177,7 +1177,7 @@ exports[`sqle/CustomRuleList should render empty tips when request return null 1
class="ant-space-item"
>
<div
class="rule-list-wrapper css-1bhqk71"
class="rule-list-wrapper css-8rro2x"
>
<div
class="css-1br6ibb"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ exports[`sqle/GlobalRuleTemplate/CreateRuleTemplate create global rule template
</div>
</div>
<div
class="rule-list-wrapper css-ghg9ee"
class="rule-list-wrapper css-8rro2x"
>
<div
class="css-1br6ibb"
Expand Down Expand Up @@ -1508,7 +1508,7 @@ exports[`sqle/GlobalRuleTemplate/CreateRuleTemplate rule list action 1`] = `
</div>
</div>
<div
class="rule-list-wrapper css-ghg9ee"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -3044,7 +3044,7 @@ exports[`sqle/GlobalRuleTemplate/CreateRuleTemplate should match snap shot 1`] =
class="ant-spin-container"
>
<div
class="rule-list-wrapper css-ghg9ee"
class="rule-list-wrapper css-8rro2x"
>
<div
class="css-1br6ibb"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ exports[`sqle/GlobalRuleTemplate/ImportRuleTemplate import global rule template
</div>
</div>
<div
class="rule-list-wrapper css-ghg9ee"
class="rule-list-wrapper css-8rro2x"
>
<div
class="css-1br6ibb"
Expand Down Expand Up @@ -2891,7 +2891,7 @@ exports[`sqle/GlobalRuleTemplate/ImportRuleTemplate rule list action 1`] = `
</div>
</div>
<div
class="rule-list-wrapper css-ghg9ee"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ exports[`sqle/GlobalRuleTemplate/RuleTemplateDetail should match snap shot 1`] =
</div>
</div>
<div
class="rule-list-wrapper css-rhwzhg"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ exports[`sqle/GlobalRuleTemplate/UpdateRuleTemplate rule list action 1`] = `
</div>
</div>
<div
class="rule-list-wrapper css-ghg9ee"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -1932,7 +1932,7 @@ exports[`sqle/GlobalRuleTemplate/UpdateRuleTemplate should match snap shot 1`] =
class="ant-spin-container"
>
<div
class="rule-list-wrapper css-ghg9ee"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -2969,7 +2969,7 @@ exports[`sqle/GlobalRuleTemplate/UpdateRuleTemplate update global rule template
</div>
</div>
<div
class="rule-list-wrapper css-ghg9ee"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down
6 changes: 3 additions & 3 deletions packages/sqle/src/page/Rule/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ exports[`sqle/Rule filter list based on project name 1`] = `
</div>
</div>
<div
class="rule-list-wrapper css-1vzpr2e"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -1342,7 +1342,7 @@ exports[`sqle/Rule request return no data 1`] = `
</div>
</div>
<div
class="rule-list-wrapper css-1vzpr2e"
class="rule-list-wrapper css-8rro2x"
>
<div
class="css-1br6ibb"
Expand Down Expand Up @@ -2162,7 +2162,7 @@ exports[`sqle/Rule should match snap shot 1`] = `
</div>
</div>
<div
class="rule-list-wrapper css-1vzpr2e"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ exports[`sqle/RuleManager should render custom rule list 1`] = `
class="ant-space-item"
>
<div
class="rule-list-wrapper css-1bhqk71"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ exports[`sqle/RuleTemplate/CreateRuleTemplate create rule template 1`] = `
</div>
</div>
<div
class="rule-list-wrapper css-ghg9ee"
class="rule-list-wrapper css-8rro2x"
>
<div
class="css-1br6ibb"
Expand Down Expand Up @@ -1508,7 +1508,7 @@ exports[`sqle/RuleTemplate/CreateRuleTemplate rule list action 1`] = `
</div>
</div>
<div
class="rule-list-wrapper css-ghg9ee"
class="rule-list-wrapper css-8rro2x"
>
<div
id="rule-list-wrapper-id"
Expand Down Expand Up @@ -3044,7 +3044,7 @@ exports[`sqle/RuleTemplate/CreateRuleTemplate should match snap shot 1`] = `
class="ant-spin-container"
>
<div
class="rule-list-wrapper css-ghg9ee"
class="rule-list-wrapper css-8rro2x"
>
<div
class="css-1br6ibb"
Expand Down
Loading
Loading