(params: object)
| 45 | getBundleList: getBundleList |
| 46 | })); |
| 47 | const getBundleList = async (params: object) => { |
| 48 | const res: any = await bundleList(params) |
| 49 | const selectedItem: any = res.data.find((item: any) => item.registered === false) || [] |
| 50 | setBundleId(selectedItem.bundle_id) |
| 51 | setBundleName(selectedItem.name) |
| 52 | setDescription(selectedItem.description) |
| 53 | |
| 54 | setBundlesList(res.data) |
| 55 | const imagesData: any = {}; |
| 56 | res.data.forEach((image: any) => { |
| 57 | fetch(image.icon_url) |
| 58 | .then(response => response.blob()) |
| 59 | .then(blob => { |
| 60 | const reader = new FileReader(); |
| 61 | reader.onload = function () { |
| 62 | imagesData[image.bundle_id] = reader.result; |
| 63 | setCachedImages(imagesData); |
| 64 | }; |
| 65 | reader.readAsDataURL(blob); |
| 66 | }); |
| 67 | }); |
| 68 | setCredentialsSchema(selectedItem.credentials_schema) |
| 69 | const res1 = await getPluginDetail(res.data[0].bundle_id) |
| 70 | setPluginListData(res1.data) |
| 71 | setPluginId(res1.data[0].plugin_id) |
| 72 | setPluginName(res1.data[0].name) |
| 73 | setPluginDesc(res1.data[0].description) |
| 74 | const inputSchematemp = res1.data[0].input_schema |
| 75 | const arr: any[] = [] |
| 76 | Object.values(inputSchematemp).forEach((item: any) => { |
| 77 | arr.push(item) |
| 78 | }) |
| 79 | setInputSchema(arr) |
| 80 | } |
| 81 | |
| 82 | const handleNext1 = async () => { |
| 83 | if (JSON.stringify(credentialsSchema) === '{}') { |
no test coverage detected