()
| 17 | import { useTranslation } from 'react-i18next'; |
| 18 | import { createApiKeys, getApiKeysList, getApiKeys, updateApiKeys, deleteApiKeys } from '../../axios/apiKeys.ts' |
| 19 | function ApiKeys() { |
| 20 | const { apiKeyLists } = useSelector((state: any) => state.apikey); |
| 21 | const dispatch = useDispatch() |
| 22 | const { t } = useTranslation(); |
| 23 | const { apikeysTableColumn } = CommonComponents(); |
| 24 | const { tooltipEditTitle, tooltipDeleteTitle, tooltipShowTitle, tooltipHideTitle } = tooltipTitle(); |
| 25 | |
| 26 | useEffect(() => { |
| 27 | if (apiKeyLists.data.length > 0) { |
| 28 | const data = apiKeyLists.data.map((item: any) => { |
| 29 | return { |
| 30 | ...item, |
| 31 | key: item.apikey_id |
| 32 | } |
| 33 | }) |
| 34 | setApiKeysList(data) |
| 35 | }else { |
| 36 | setApiKeysList([]) |
| 37 | } |
| 38 | }, [apiKeyLists]) |
| 39 | const [form] = Form.useForm(); |
| 40 | const [form1] = Form.useForm(); |
| 41 | const [deleteForm] = Form.useForm(); |
| 42 | const [openEditAPIKey, setOpenEditAPIKey] = useState(false) |
| 43 | const [openCreateAPIKey, setOpenCreateAPIKey] = useState(false) |
| 44 | const [createNameValue, setCreateNameValue] = useState('') |
| 45 | |
| 46 | const [openDeleteModal, setOpenDeleteModal] = useState(false) |
| 47 | const [apiKeysList, setApiKeysList] = useState<any[]>([]) |
| 48 | const [loading, setLoading] = useState(false); |
| 49 | const [confirmLoading, setConfirmLoading] = useState(false) |
| 50 | const [tableLoading, setTableLoading] = useState(false) |
| 51 | const [deleteLoading, setDeleteLoading] = useState(false); |
| 52 | const [record, setRecord] = useState<any>({}); |
| 53 | const [initialValues, setInitialValues] = useState({ |
| 54 | name: '', |
| 55 | }) |
| 56 | const [id, setId] = useState(''); |
| 57 | const [disabled, setDisabled] = useState(true); |
| 58 | const handleNewInstance = async () => { |
| 59 | await form.setFieldValue('name', '') |
| 60 | await setCreateNameValue('') |
| 61 | setId('') |
| 62 | setOpenCreateAPIKey(true) |
| 63 | await form.resetFields() |
| 64 | } |
| 65 | |
| 66 | const fetchData = async (params: Record<string, any>) => { |
| 67 | try { |
| 68 | setTableLoading(true) |
| 69 | const res = await getApiKeysList(params) |
| 70 | const data = res.data.map((item: any) => { |
| 71 | return { |
| 72 | ...item, |
| 73 | key: item.apikey_id |
| 74 | } |
| 75 | }) |
| 76 | setApiKeysList(data) |
nothing calls this directly
no test coverage detected