2
2
* cloud functions list sidebar
3
3
***************************/
4
4
import { useTranslation } from "react-i18next" ;
5
- import { AddIcon } from "@chakra-ui/icons" ;
6
5
import { useColorMode } from "@chakra-ui/react" ;
7
6
import clsx from "clsx" ;
8
7
@@ -11,47 +10,31 @@ import ConfirmButton from "@/components/ConfirmButton";
11
10
import EmptyBox from "@/components/EmptyBox" ;
12
11
import FileTypeIcon from "@/components/FileTypeIcon" ;
13
12
import IconText from "@/components/IconText" ;
14
- import IconWrap from "@/components/IconWrap" ;
15
13
import MoreButton from "@/components/MoreButton" ;
16
14
import Panel from "@/components/Panel" ;
17
15
import SectionList from "@/components/SectionList" ;
18
16
19
- import AddPolicyModal from "../mods/AddPolicyModal" ;
20
- import { useDeletePolicyMutation , usePolicyListQuery } from "../service" ;
17
+ import { useDeletePolicyMutation } from "../service" ;
21
18
import useDBMStore from "../store" ;
22
- export default function PolicyListPanel ( ) {
19
+ export default function PolicyListPanel ( props : { policyList : any } ) {
20
+ const { policyList } = props ;
23
21
const { t } = useTranslation ( ) ;
24
22
const deletePolicyMutation = useDeletePolicyMutation ( ) ;
25
23
const store = useDBMStore ( ( state ) => state ) ;
26
24
const darkMode = useColorMode ( ) . colorMode === "dark" ;
27
- const policyQuery = usePolicyListQuery ( ( data ) => {
28
- if ( data . data . length === 0 ) {
29
- store . setCurrentPolicy ( undefined ) ;
30
- } else if ( store . currentPolicy === undefined ) {
31
- store . setCurrentPolicy ( data ?. data [ 0 ] ) ;
32
- }
33
- } ) ;
25
+
34
26
return (
35
27
< Panel
36
28
className = "min-w-[200px]"
37
29
onClick = { ( ) => {
38
30
store . setCurrentShow ( "Policy" ) ;
39
31
} }
40
32
>
41
- < Panel . Header
42
- title = { t ( "CollectionPanel.Policy" ) . toString ( ) }
43
- actions = { [
44
- < AddPolicyModal key = "AddPolicyModal" >
45
- < IconWrap tooltip = { t ( "CollectionPanel.AddPolicy" ) . toString ( ) } size = { 20 } >
46
- < AddIcon fontSize = { 10 } />
47
- </ IconWrap >
48
- </ AddPolicyModal > ,
49
- ] }
50
- />
33
+ < Panel . Header title = { t ( "CollectionPanel.Policy" ) . toString ( ) } actions = { [ < > </ > ] } />
51
34
< div style = { { flexGrow : 1 , overflowY : "auto" , overflowX : "hidden" } } >
52
- { policyQuery ?. data ?. data ?. length ? (
35
+ { policyList ?. data ?. length ? (
53
36
< SectionList >
54
- { policyQuery ?. data ?. data . map ( ( item : any ) => {
37
+ { policyList ?. data . map ( ( item : any ) => {
55
38
return (
56
39
< SectionList . Item
57
40
isActive = {
0 commit comments