feat: fix getApps and create for cloudflare pages integration

This commit is contained in:
Stijn-Kuijper
2023-06-19 13:58:38 +02:00
parent 6ca010e2ba
commit 1a54bf34ef
2 changed files with 24 additions and 24 deletions
+3 -4
View File
@@ -134,7 +134,7 @@ const getApps = async ({
case INTEGRATION_CLOUDFLARE_PAGES: case INTEGRATION_CLOUDFLARE_PAGES:
apps = await getAppsCloudflarePages({ apps = await getAppsCloudflarePages({
accessToken, accessToken,
accountId: '' accountId: accessId
}) })
break; break;
} }
@@ -670,13 +670,12 @@ const getAppsCloudflarePages = async ({
} }
); );
const apps = data.map((a: any) => { const apps = data.result.map((a: any) => {
return { return {
name: a["project_name"], name: a.name,
appId: a.id, appId: a.id,
}; };
}); });
return apps; return apps;
} }
@@ -57,7 +57,8 @@ export default function CloudflarePagesIntegrationPage() {
targetServiceId: null, targetServiceId: null,
owner: null, owner: null,
path: null, path: null,
region: null region: null,
secretPath: '/',
}); });
setIsLoading(false); setIsLoading(false);
@@ -82,14 +83,14 @@ export default function CloudflarePagesIntegrationPage() {
onValueChange={(val) => setSelectedSourceEnvironment(val)} onValueChange={(val) => setSelectedSourceEnvironment(val)}
className="w-full border border-mineshaft-500" className="w-full border border-mineshaft-500"
> >
{workspace?.environments.map((sourceEnvironment) => { {workspace?.environments.map((sourceEnvironment) => (
<SelectItem <SelectItem
value={sourceEnvironment.slug} value={sourceEnvironment.slug}
key={`sourcce-environment-${sourceEnvironment.slug}`} key={`source-environment-${sourceEnvironment.slug}`}
> >
{sourceEnvironment.name} {sourceEnvironment.name}
</SelectItem> </SelectItem>
})} ))}
</Select> </Select>
</FormControl> </FormControl>
<FormControl label="Cloudflare Pages Project" className="mt-4 px-6"> <FormControl label="Cloudflare Pages Project" className="mt-4 px-6">
@@ -100,18 +101,18 @@ export default function CloudflarePagesIntegrationPage() {
isDisabled={integrationAuthApps.length === 0} isDisabled={integrationAuthApps.length === 0}
> >
{integrationAuthApps.length > 0 ? ( {integrationAuthApps.length > 0 ? (
integrationAuthApps.map((integrationAuthApp) => { integrationAuthApps.map((integrationAuthApp) => (
<SelectItem <SelectItem
value={integrationAuthApp.name} value={integrationAuthApp.name}
key={`target-app-${integrationAuthApp.name}`} key={`target-app-${integrationAuthApp.name}`}
> >
{integrationAuthApp.name} {integrationAuthApp.name}
</SelectItem>
})
) : (
<SelectItem value="none" key="target-app-none">
No projects found
</SelectItem> </SelectItem>
))
) : (
<SelectItem value="none" key="target-app-none">
No apps found
</SelectItem>
)} )}
</Select> </Select>
</FormControl> </FormControl>