Skip to content

Commit c494a23

Browse files
committed
Processed immediate activity in Query Library.
1 parent 43eb5b7 commit c494a23

File tree

3 files changed

+30
-13
lines changed

3 files changed

+30
-13
lines changed

client/packages/lowcoder/src/comps/comps/queryLibrary/queryLibraryComp.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ const children = {
4747
const QueryLibraryCompBase = simpleMultiComp(children);
4848

4949
export const QueryLibraryComp = class extends QueryLibraryCompBase {
50-
propertyView(params: { onPublish: () => void; onHistoryShow: () => void }) {
50+
propertyView(params: { onPublish: () => void; onHistoryShow: () => void; setModify: any; modify: boolean }) {
5151
return (
52-
<PropertyView comp={this} onPublish={params.onPublish} onHistoryShow={params.onHistoryShow} />
52+
<PropertyView comp={this} onPublish={params.onPublish} onHistoryShow={params.onHistoryShow} setModify={params.setModify} modify={params.modify} />
5353
);
5454
}
5555

@@ -99,11 +99,13 @@ function getMetaData(
9999
}
100100

101101
const PropertyView = (props: {
102-
comp: QueryLibraryCompType;
103-
onPublish: () => void;
104-
onHistoryShow: () => void;
102+
comp: QueryLibraryCompType,
103+
onPublish: () => void,
104+
onHistoryShow: () => void,
105+
setModify?: any
106+
modify?: boolean
105107
}) => {
106-
const { comp, onPublish, onHistoryShow } = props;
108+
const { comp, onPublish, onHistoryShow, setModify, modify } = props;
107109

108110
const reduxDispatch = useDispatch();
109111

@@ -157,12 +159,16 @@ const PropertyView = (props: {
157159
CustomModal.confirm({
158160
title: trans("queryLibrary.deleteQueryLabel"),
159161
content: trans("queryLibrary.deleteQueryContent"),
160-
onConfirm: () =>
162+
onConfirm: () =>{
161163
reduxDispatch(
162164
deleteQueryLibrary({
163165
queryLibraryId: comp.children.query.children.id.getView(),
164166
})
165-
),
167+
)
168+
setTimeout(() => {
169+
setModify(!modify);
170+
}, 500);
171+
},
166172
confirmBtnType: "delete",
167173
okText: trans("delete"),
168174
})

client/packages/lowcoder/src/pages/queryLibrary/LeftNav.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,10 @@ export const LeftNav = (props: {
166166
total: number;
167167
setSearchValues: any;
168168
searchValues: string;
169+
setModify?: any;
170+
modify?: boolean;
169171
}) => {
170-
const {currentPage, setCurrentPage, pageSize, setPageSize, total , setSearchValues, searchValues} = props
172+
const {currentPage, setCurrentPage, pageSize, setPageSize, total , setSearchValues, searchValues, modify, setModify} = props
171173
const dispatch = useDispatch();
172174
const [searchValue, setSearchValue] = useState("");
173175
const datasourceTypes = useSelector(getDataSourceTypesMap);
@@ -244,8 +246,12 @@ export const LeftNav = (props: {
244246
CustomModal.confirm({
245247
title: trans("queryLibrary.deleteQueryTitle"),
246248
content: trans("queryLibrary.deleteQueryContent"),
247-
onConfirm: () =>
248-
dispatch(deleteQueryLibrary({ queryLibraryId: q.id })),
249+
onConfirm: () => {
250+
dispatch(deleteQueryLibrary({ queryLibraryId: q.id }))
251+
setTimeout(() => {
252+
setModify(!modify);
253+
}, 200);
254+
},
249255
confirmBtnType: "delete",
250256
okText: trans("delete"),
251257
}),

client/packages/lowcoder/src/pages/queryLibrary/QueryLibraryEditor.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ export const QueryLibraryEditor = () => {
9191
const [queryLibrary, setQueryLibrary] = useState<any>({});
9292
const [currentPage, setCurrentPage] = useState(1);
9393
const [pageSize, setPageSize] = useState(10);
94-
const [searchValues, setSearchValues] = useState("")
94+
const [searchValues, setSearchValues] = useState("");
95+
const [modify, setModify] = useState(false);
9596

9697
const selectedRecords = queryLibraryRecords[selectedQuery] ?? {};
9798
const libraryQuery = queryLibrary[selectedQuery];
@@ -133,7 +134,7 @@ export const QueryLibraryEditor = () => {
133134
} catch (error) {
134135
console.error(error)
135136
}
136-
}, [currentPage, pageSize, searchValues, setSearchValues])
137+
}, [currentPage, pageSize, searchValues, modify])
137138

138139
useEffect(() => {
139140
if (orgId) {
@@ -234,6 +235,8 @@ export const QueryLibraryEditor = () => {
234235
total={elements.total}
235236
setSearchValues={setSearchValues}
236237
searchValues={searchValues}
238+
setModify={setModify}
239+
modify={modify}
237240
/>
238241
<RightContent>
239242
{!selectedQuery || !comp?.children.query.children.id.getView() ? (
@@ -247,6 +250,8 @@ export const QueryLibraryEditor = () => {
247250
comp.propertyView({
248251
onPublish: () => setPublishModalVisible(true),
249252
onHistoryShow: () => setShowHistory(true),
253+
setModify: setModify,
254+
modify: modify
250255
})
251256
)}
252257

0 commit comments

Comments
 (0)