Skip to content

Commit

Permalink
Merge pull request #507 from dolittle/commands-page
Browse files Browse the repository at this point in the history
Commands page
  • Loading branch information
N00bG1rl authored Feb 29, 2024
2 parents 0f5a7f0 + 24a6e14 commit 4ac406e
Show file tree
Hide file tree
Showing 24 changed files with 1,732 additions and 63 deletions.
3 changes: 3 additions & 0 deletions Source/SelfService/Web/apis/integrations/CacheKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

export enum CACHE_KEYS {
//CommandMappingApi
ConnectionCommandMappings_GET = 'connection_command_get',

//ConnectionsApi
Connections_GET = 'connections_get',
ConnectionsConnectorDeployment_GET = 'connections_connector_deployment_get',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Aigonix. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

import { useQuery, useMutation } from '@tanstack/react-query';

import { API_CONFIGURATION } from './api';
import { CACHE_KEYS } from './CacheKeys';
import { ConnectionsIdCommandsGetRequest, ConnectionsIdCommandsCommandIdCreatePostRequest, CommandMappingApi } from './generated';

let apiInstance: CommandMappingApi | undefined;

const getOrCreateApi = () => {
if (!apiInstance) {
apiInstance = new CommandMappingApi(API_CONFIGURATION);
}
return apiInstance;
};

export const useConnectionsIdCommandsGet = (params: ConnectionsIdCommandsGetRequest) => {
const api = getOrCreateApi();
return useQuery({
queryKey: [CACHE_KEYS.ConnectionCommandMappings_GET, params.id],
queryFn: api.connectionsIdCommandsGet.bind(api, params),
staleTime: 60000,
});
};

export const useConnectionsIdCommandsCommandIdCreatePostRequest = () => {
const api = getOrCreateApi();
return useMutation({
mutationFn: (params: ConnectionsIdCommandsCommandIdCreatePostRequest) =>
api.connectionsIdCommandsCommandIdCreatePost(params),
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
apis/AsyncApiApi.ts
apis/BaseMetadataApi.ts
apis/CommandApi.ts
apis/CommandMappingApi.ts
apis/ConnectionConfigurationApi.ts
apis/ConnectionRestApiApi.ts
apis/ConnectionWebhookApi.ts
Expand All @@ -23,16 +24,21 @@ apis/TableMetadataAssistantApi.ts
apis/index.ts
index.ts
models/AccountAccess.ts
models/ApiParameter.ts
models/ColumnMetadata.ts
models/ColumnRecommendation.ts
models/ColumnRecommendations.ts
models/CommandHeader.ts
models/CommandMappingModel.ts
models/CommandMappingModelIEnumerableResult.ts
models/ConnectionConfiguration.ts
models/ConnectionConfigurationResult.ts
models/ConnectionModel.ts
models/ConnectionModelArrayResult.ts
models/ConnectionModelResult.ts
models/ConnectionPrograms.ts
models/ConnectionStatus.ts
models/CreateCommand.ts
models/CredentialStatus.ts
models/DescribedJqDto.ts
models/DescribedLinqDto.ts
Expand All @@ -58,6 +64,7 @@ models/MappableTable.ts
models/MappableTableColumn.ts
models/MappableTableResult.ts
models/MappedField.ts
models/MappedParameter.ts
models/MappingReference.ts
models/MdpConfiguration.ts
models/MdpConfigurationResult.ts
Expand All @@ -69,6 +76,7 @@ models/ModelIndex.ts
models/NoSuchReadModelResult.ts
models/NotFoundResult.ts
models/Parameter.ts
models/ParameterMode.ts
models/ProblemDetails.ts
models/ProgramDetails.ts
models/ProgramMetadataHeader.ts
Expand All @@ -95,6 +103,8 @@ models/TableListingEntryIEnumerableResult.ts
models/TableSummaryDto.ts
models/TopicAccess.ts
models/TopicAccessDto.ts
models/UpdateCommandNames.ts
models/UpdateCommandParameters.ts
models/WebhookServiceStatus.ts
models/WebhookStatusDto.ts
models/WebhookTargetStatus.ts
Expand Down
Loading

0 comments on commit 4ac406e

Please sign in to comment.