Skip to content

Commit

Permalink
🪟🔧 Connector builder: Load project list on cloud (#5965)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Reuter committed Apr 18, 2023
1 parent 8b836ed commit a4b4a5a
Showing 1 changed file with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { useSuspenseQuery } from "services/connector/useSuspenseQuery";
import { useDefaultRequestMiddlewares } from "services/useDefaultRequestMiddlewares";
import { useInitService } from "services/useInitService";
import { useCurrentWorkspaceId } from "services/workspaces/WorkspacesService";
import { isCloudApp } from "utils/app";

import { SCOPE_WORKSPACE } from "../Scope";

Expand Down Expand Up @@ -48,21 +47,18 @@ export const useListProjects = () => {
const workspaceId = useCurrentWorkspaceId();

return useSuspenseQuery(connectorBuilderProjectsKeys.list(workspaceId), async () =>
// FIXME this is a temporary solution to avoid calling an API that's not forwarded in cloud environments yet
isCloudApp()
? []
: (await service.list(workspaceId)).projects.map(
(projectDetails): BuilderProject => ({
name: projectDetails.name,
version:
typeof projectDetails.activeDeclarativeManifestVersion !== "undefined"
? projectDetails.activeDeclarativeManifestVersion
: "draft",
sourceDefinitionId: projectDetails.sourceDefinitionId,
id: projectDetails.builderProjectId,
hasDraft: projectDetails.hasDraft,
})
)
(await service.list(workspaceId)).projects.map(
(projectDetails): BuilderProject => ({
name: projectDetails.name,
version:
typeof projectDetails.activeDeclarativeManifestVersion !== "undefined"
? projectDetails.activeDeclarativeManifestVersion
: "draft",
sourceDefinitionId: projectDetails.sourceDefinitionId,
id: projectDetails.builderProjectId,
hasDraft: projectDetails.hasDraft,
})
)
);
};

Expand Down

0 comments on commit a4b4a5a

Please sign in to comment.