Skip to content

Commit 3a187e6

Browse files
committed
Processed immediate activity in TrashView.
1 parent 2e5879e commit 3a187e6

File tree

6 files changed

+32
-19
lines changed

6 files changed

+32
-19
lines changed

client/packages/lowcoder/src/pages/ApplicationV2/HomeLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ export function HomeLayout(props: HomeLayoutProps) {
586586
{resList.length > 0 ? (
587587
<>
588588
{mode === "trash" ? (
589-
<TrashTableView resources={resList} />
589+
<TrashTableView resources={resList} setModify={setModify} modify={modify!}/>
590590
) : (
591591
<>
592592
<LayoutSwitcher onClick={() => setLayout(layout === "list" ? "card" : "list")}>

client/packages/lowcoder/src/pages/ApplicationV2/HomeView.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ export function HomeView() {
2727
pageNum:currentPage,
2828
pageSize:pageSize,
2929
applicationType: ApplicationPaginationType[typeFilter],
30-
name: searchValue,
30+
name: searchValues,
3131
}).then(
32-
data => {
32+
(data: any) => {
3333
if (data.success) {
3434
setElements({elements: data.data || [], total: data.total || 1})
3535
}
@@ -48,7 +48,7 @@ export function HomeView() {
4848
if (searchValue.length > 2 || searchValue === "")
4949
setSearchValues(searchValue)
5050
}, 500);
51-
})
51+
}, [searchValue])
5252

5353
const user = useSelector(getUser);
5454

client/packages/lowcoder/src/pages/ApplicationV2/TrashTableView.tsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ const EditBtn = styled(TacoButton)`
3232
height: 24px;
3333
`;
3434

35-
export const TrashTableView = (props: { resources: HomeRes[] }) => {
35+
export const TrashTableView = (props: { resources: HomeRes[] , setModify: any, modify: boolean }) => {
36+
const {resources, setModify, modify} = props;
3637
const dispatch = useDispatch();
3738

3839
return (
@@ -119,13 +120,17 @@ export const TrashTableView = (props: { resources: HomeRes[] }) => {
119120
style={{ padding: "0 8px", width: "fit-content", minWidth: "52px" }}
120121
buttonType={"blue"}
121122
className={"home-datasource-edit-button"}
122-
onClick={() =>
123-
dispatch(
124-
restoreApplication({ applicationId: item.id }, () => {
125-
messageInstance.success(trans("home.recoverSuccessMsg"));
126-
})
127-
)
123+
onClick={() =>{
124+
dispatch(
125+
restoreApplication({ applicationId: item.id }, () => {
126+
messageInstance.success(trans("home.recoverSuccessMsg"));
127+
})
128+
)
129+
setTimeout(() => {
130+
setModify(!modify);
131+
}, 200);
128132
}
133+
}
129134
>
130135
{trans("recover")}
131136
</EditBtn>
@@ -140,7 +145,7 @@ export const TrashTableView = (props: { resources: HomeRes[] }) => {
140145
type: HomeResInfo[item.type].name.toLowerCase(),
141146
name: <b>{item.name}</b>,
142147
}),
143-
onConfirm: () =>
148+
onConfirm: () =>{
144149
new Promise((resolve, reject) => {
145150
dispatch(
146151
deleteApplication(
@@ -152,10 +157,15 @@ export const TrashTableView = (props: { resources: HomeRes[] }) => {
152157
() => reject()
153158
)
154159
);
155-
}),
160+
})
161+
setTimeout(() => {
162+
setModify(!modify);
163+
}, 200);
164+
},
156165
confirmBtnType: "delete",
157166
okText: trans("delete"),
158167
})
168+
159169
}
160170
style={{ marginLeft: "12px", width: "76px" }}
161171
>
@@ -166,7 +176,7 @@ export const TrashTableView = (props: { resources: HomeRes[] }) => {
166176
},
167177
},
168178
]}
169-
dataSource={props.resources}
179+
dataSource={resources}
170180
/>
171181
);
172182
};

client/packages/lowcoder/src/pages/ApplicationV2/TrashView.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export function TrashView() {
1717
const [searchValues, setSearchValues] = useState("");
1818
const [searchValue, setSearchValue] = useState("");
1919
const [typeFilter, setTypeFilter] = useState<number>(0);
20+
const [modify, setModify] = useState(false);
2021

2122
useEffect( () => {
2223
if (typeFilter === 7) // Application of Navigation is 3 in API.
@@ -39,15 +40,15 @@ export function TrashView() {
3940
} catch (error) {
4041
console.error('Failed to fetch data:', error);
4142
}
42-
}, [currentPage, pageSize, searchValues, typeFilter]
43+
}, [currentPage, pageSize, searchValues, typeFilter, modify]
4344
);
4445

4546
useEffect(()=> {
4647
setTimeout(() => {
4748
if (searchValue.length > 2 || searchValue === "")
4849
setSearchValues(searchValue)
4950
}, 500);
50-
})
51+
}, [searchValue])
5152

5253
return (
5354
<>
@@ -64,6 +65,8 @@ export function TrashView() {
6465
setSearchValue={setSearchValue}
6566
searchValue={searchValue}
6667
setTypeFilterPagination={setTypeFilter}
68+
setModify={setModify}
69+
modify={modify}
6770
/>
6871
</>
6972
);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export const DatasourceList = () => {
129129
if (searchValue.length > 2 || searchValue === "")
130130
setSearchValues(searchValue)
131131
}, 500);
132-
})
132+
}, [searchValue])
133133

134134
useEffect( () => {
135135
fetchDatasourcePagination(
@@ -139,7 +139,7 @@ export const DatasourceList = () => {
139139
pageSize: pageSize,
140140
name: searchValues
141141
}
142-
).then(result => {
142+
).then((result: any) => {
143143
if (result.success){
144144
setElements({elements: result.data || [], total: result.total || 1})
145145
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export const LeftNav = (props: {
177177
if (searchValue.length > 2 || searchValue === "")
178178
setSearchValues(searchValue)
179179
}, 500);
180-
})
180+
}, [searchValue])
181181

182182
return (
183183
<ReadOnlyMask readOnly={!!props.readOnly}>

0 commit comments

Comments
 (0)