Skip to content

Commit

Permalink
use /list instead of /list_for_workspace (#13341)
Browse files Browse the repository at this point in the history
/list_for_workspace is still wip,
part of #9652
  • Loading branch information
git-phu authored May 31, 2022
1 parent 64ad8c6 commit 5fce52b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
DestinationDefinitionCreate,
DestinationDefinitionUpdate,
getDestinationDefinition,
listDestinationDefinitionsForWorkspace,
listDestinationDefinitions,
listLatestDestinationDefinitions,
updateDestinationDefinition,
} from "../../request/AirbyteClient";
Expand All @@ -15,8 +15,8 @@ export class DestinationDefinitionService extends AirbyteRequestService {
return getDestinationDefinition({ destinationDefinitionId }, this.requestOptions);
}

public list(workspaceId: string) {
return listDestinationDefinitionsForWorkspace({ workspaceId }, this.requestOptions);
public list() {
return listDestinationDefinitions(this.requestOptions);
}

public listLatest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
createSourceDefinition,
getSourceDefinition,
listLatestSourceDefinitions,
listSourceDefinitionsForWorkspace,
listSourceDefinitions,
SourceDefinitionCreate,
SourceDefinitionUpdate,
updateSourceDefinition,
Expand All @@ -15,8 +15,8 @@ export class SourceDefinitionService extends AirbyteRequestService {
return getSourceDefinition({ sourceDefinitionId }, this.requestOptions);
}

public list(workspaceId: string) {
return listSourceDefinitionsForWorkspace({ workspaceId }, this.requestOptions);
public list() {
return listSourceDefinitions(this.requestOptions);
}

public listLatest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useConfig } from "config";
import { DestinationDefinitionService } from "core/domain/connector/DestinationDefinitionService";
import { useDefaultRequestMiddlewares } from "services/useDefaultRequestMiddlewares";
import { useInitService } from "services/useInitService";
import { useCurrentWorkspace } from "services/workspaces/WorkspacesService";
import { isDefined } from "utils/common";

import { DestinationDefinitionCreate, DestinationDefinitionRead } from "../../core/request/AirbyteClient";
Expand Down Expand Up @@ -36,13 +35,9 @@ const useDestinationDefinitionList = (): {
destinationDefinitions: DestinationDefinitionReadWithLatestTag[];
} => {
const service = useGetDestinationDefinitionService();
const workspace = useCurrentWorkspace();

return useSuspenseQuery(destinationDefinitionKeys.lists(), async () => {
const [definition, latestDefinition] = await Promise.all([
service.list(workspace.workspaceId),
service.listLatest(),
]);
const [definition, latestDefinition] = await Promise.all([service.list(), service.listLatest()]);

const destinationDefinitions: DestinationDefinitionRead[] = definition.destinationDefinitions.map(
(destination: DestinationDefinitionRead) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useConfig } from "config";
import { SourceDefinitionService } from "core/domain/connector/SourceDefinitionService";
import { useDefaultRequestMiddlewares } from "services/useDefaultRequestMiddlewares";
import { useInitService } from "services/useInitService";
import { useCurrentWorkspace } from "services/workspaces/WorkspacesService";
import { isDefined } from "utils/common";

import { SourceDefinitionCreate, SourceDefinitionRead } from "../../core/request/AirbyteClient";
Expand Down Expand Up @@ -36,13 +35,9 @@ const useSourceDefinitionList = (): {
sourceDefinitions: SourceDefinitionReadWithLatestTag[];
} => {
const service = useGetSourceDefinitionService();
const workspace = useCurrentWorkspace();

return useSuspenseQuery(sourceDefinitionKeys.lists(), async () => {
const [definition, latestDefinition] = await Promise.all([
service.list(workspace.workspaceId),
service.listLatest(),
]);
const [definition, latestDefinition] = await Promise.all([service.list(), service.listLatest()]);

const sourceDefinitions = definition.sourceDefinitions.map((source) => {
const withLatest = latestDefinition.sourceDefinitions.find(
Expand Down

0 comments on commit 5fce52b

Please sign in to comment.