()
| 21 | import { toast } from 'react-toastify'; |
| 22 | import { useTranslation } from "react-i18next"; |
| 23 | function Actions() { |
| 24 | const { t } = useTranslation(); |
| 25 | const { actionLists } = useSelector((state: any) => state.action); |
| 26 | const dispatch = useDispatch() |
| 27 | const actionDrawerRef = useRef(null) |
| 28 | const { actionsTableColumn } = CommonComponents(); |
| 29 | const { tooltipEditTitle, tooltipDeleteTitle } = tooltipTitle(); |
| 30 | const [loading, setLoading] = useState(false); |
| 31 | const [pluginFunList, setPluginFunList] = useState([]) |
| 32 | const [deleteValue, setDeleteValue] = useState('') |
| 33 | const [updatePrevButton, setUpdatePrevButton] = useState(false) |
| 34 | const [OpenDrawer, setOpenDrawer] = useState(false) |
| 35 | const [drawerTitle, setDrawerTitle] = useState('') |
| 36 | const [OpenDeleteModal, setOpenDeleteModal] = useState(false) |
| 37 | const [radioValue, setRadioValue] = useState('none') |
| 38 | const [Authentication, setAuthentication] = useState<string>('') |
| 39 | const [schema, setSchema] = useState('') |
| 40 | const [custom, setCustom] = useState('') |
| 41 | const [limit, setLimit] = useState(20) |
| 42 | const [hasMore, setHasMore] = useState(false) |
| 43 | const [actionId, setActionId] = useState('') |
| 44 | const [tipSchema, setTipSchema] = useState(false) |
| 45 | useEffect(() => { |
| 46 | if (actionLists.data.length > 0) { |
| 47 | const data = actionLists.data.map((item: any) => { |
| 48 | return { |
| 49 | ...item, |
| 50 | key: item.action_id, |
| 51 | method: getFirstMethodAndEndpoint(item.openapi_schema)?.method, |
| 52 | endpoint: getFirstMethodAndEndpoint(item.openapi_schema)?.endpoint |
| 53 | } |
| 54 | }) |
| 55 | setPluginFunList(data) |
| 56 | setHasMore(actionLists.has_more) |
| 57 | } else { |
| 58 | setPluginFunList([]) |
| 59 | } |
| 60 | }, [actionLists]) |
| 61 | const onhandleTipError = (value: boolean) => { |
| 62 | setTipSchema(value) |
| 63 | } |
| 64 | const fetchData = async (params: any) => { |
| 65 | setLoading(true); |
| 66 | try { |
| 67 | const res: any = await getActionsList(params) |
| 68 | const data = res.data.map((item: any) => { |
| 69 | return { |
| 70 | ...item, |
| 71 | key: item.action_id, |
| 72 | method: getFirstMethodAndEndpoint(item.openapi_schema)?.method, |
| 73 | endpoint: getFirstMethodAndEndpoint(item.openapi_schema)?.endpoint |
| 74 | } |
| 75 | }) |
| 76 | |
| 77 | setPluginFunList(data) |
| 78 | setHasMore(res.has_more) |
| 79 | } catch (error) { |
| 80 | console.log(error) |
nothing calls this directly
no test coverage detected