Skip to content

Commit ba9b6c1

Browse files
fix search for support tickets
1 parent 5e7395e commit ba9b6c1

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

client/packages/lowcoder/src/pages/datasource/datasourceList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export const DatasourceList = () => {
148148
<StyledTable
149149
loading={{
150150
spinning: !datasource.length,
151-
indicator: <LoadingOutlined spin />
151+
indicator: <LoadingOutlined spin style={{ fontSize: 30 }} />
152152
}}
153153
rowClassName={(record: any) => (!record.edit ? "datasource-can-not-edit" : "")}
154154
tableLayout={"auto"}

client/packages/lowcoder/src/pages/support/supportOverview.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styled from "styled-components";
22
import { trans } from "i18n";
33
import { searchCustomerTickets, createTicket } from "@lowcoder-ee/api/supportApi";
4-
import { useState, useEffect } from 'react';
4+
import { useState, useEffect, useMemo } from 'react';
55
import { Helmet } from "react-helmet";
66
import { useUserDetails } from "./useUserDetails";
77
import StepModal from "components/StepModal";
@@ -14,6 +14,7 @@ import { Input } from "antd";
1414
import ReactQuill from "react-quill";
1515
import 'react-quill/dist/quill.snow.css';
1616
import { Spin } from "antd";
17+
import LoadingOutlined from "@ant-design/icons/LoadingOutlined";
1718

1819

1920
const SupportWrapper = styled.div`
@@ -190,15 +191,16 @@ export function SupportOverview() {
190191
}
191192
};
192193

193-
const filteredTickets = supportTickets.filter((ticket: any) => {
194-
if (searchValue) {
194+
const filteredTickets = useMemo(() => {
195+
if (!Boolean(searchValue)) return supportTickets;
196+
197+
return supportTickets.filter((ticket: any) => {
195198
return (
196-
ticket.title.toLowerCase().includes(searchValue.trim().toLowerCase()) ||
197-
ticket.description.toLowerCase().includes(searchValue.trim().toLowerCase())
198-
);
199-
}
200-
return true;
201-
});
199+
ticket.title?.toLowerCase().includes(searchValue.trim().toLowerCase()) ||
200+
ticket.description?.toLowerCase().includes(searchValue.trim().toLowerCase())
201+
)
202+
});
203+
}, [searchValue, supportTickets]);
202204

203205
const handleCreateTicket = async () => {
204206
if (summary.length > 150) {
@@ -273,8 +275,9 @@ export function SupportOverview() {
273275
buttonType={summary ? "primary" : "normal"}
274276
onClick={handleCreateTicket}
275277
disabled={isSubmitting || !summary}
278+
loading={isSubmitting}
276279
>
277-
{isSubmitting ? <Spin /> : trans("support.createTicketSubmit")}
280+
{trans("support.createTicketSubmit")}
278281
</TacoButton>
279282
<div>
280283
<div style={{ margin: "20px 0 0 0" }}>{trans("support.createTicketInfoText")}</div>
@@ -304,7 +307,10 @@ export function SupportOverview() {
304307
</HeaderWrapper>
305308
<BodyWrapper>
306309
<StyledTable
307-
loading={loading}
310+
loading={{
311+
spinning: loading,
312+
indicator: <LoadingOutlined spin style={{ fontSize: 30 }} />
313+
}}
308314
rowClassName="datasource-can-not-edit"
309315
tableLayout={"auto"}
310316
scroll={{ x: "100%" }}

0 commit comments

Comments
 (0)