()
| 74 | // ==============================|| Credentials ||============================== // |
| 75 | |
| 76 | const Credentials = () => { |
| 77 | const theme = useTheme() |
| 78 | const customization = useSelector((state) => state.customization) |
| 79 | const dispatch = useDispatch() |
| 80 | useNotifier() |
| 81 | const { error, setError } = useError() |
| 82 | |
| 83 | const enqueueSnackbar = (...args) => dispatch(enqueueSnackbarAction(...args)) |
| 84 | const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args)) |
| 85 | |
| 86 | const [isLoading, setLoading] = useState(true) |
| 87 | const [showCredentialListDialog, setShowCredentialListDialog] = useState(false) |
| 88 | const [credentialListDialogProps, setCredentialListDialogProps] = useState({}) |
| 89 | const [showSpecificCredentialDialog, setShowSpecificCredentialDialog] = useState(false) |
| 90 | const [specificCredentialDialogProps, setSpecificCredentialDialogProps] = useState({}) |
| 91 | const [credentials, setCredentials] = useState([]) |
| 92 | const [componentsCredentials, setComponentsCredentials] = useState([]) |
| 93 | |
| 94 | const [showShareCredentialDialog, setShowShareCredentialDialog] = useState(false) |
| 95 | const [shareCredentialDialogProps, setShareCredentialDialogProps] = useState({}) |
| 96 | |
| 97 | const { confirm } = useConfirm() |
| 98 | |
| 99 | const getAllCredentialsApi = useApi(credentialsApi.getAllCredentials) |
| 100 | const getAllComponentsCredentialsApi = useApi(credentialsApi.getAllComponentsCredentials) |
| 101 | |
| 102 | const [search, setSearch] = useState('') |
| 103 | const onSearchChange = (event) => { |
| 104 | setSearch(event.target.value) |
| 105 | } |
| 106 | function filterCredentials(data) { |
| 107 | return data.name.toLowerCase().indexOf(search.toLowerCase()) > -1 |
| 108 | } |
| 109 | |
| 110 | const listCredential = () => { |
| 111 | const dialogProp = { |
| 112 | title: 'Add New Credential', |
| 113 | componentsCredentials |
| 114 | } |
| 115 | setCredentialListDialogProps(dialogProp) |
| 116 | setShowCredentialListDialog(true) |
| 117 | } |
| 118 | |
| 119 | const addNew = (credentialComponent) => { |
| 120 | const dialogProp = { |
| 121 | type: 'ADD', |
| 122 | cancelButtonName: 'Cancel', |
| 123 | confirmButtonName: 'Add', |
| 124 | credentialComponent |
| 125 | } |
| 126 | setSpecificCredentialDialogProps(dialogProp) |
| 127 | setShowSpecificCredentialDialog(true) |
| 128 | } |
| 129 | |
| 130 | const edit = (credential) => { |
| 131 | const dialogProp = { |
| 132 | type: 'EDIT', |
| 133 | cancelButtonName: 'Cancel', |
nothing calls this directly
no test coverage detected