Skip to content

Commit

Permalink
Merge pull request #510 from dolittle/edit-command
Browse files Browse the repository at this point in the history
Edit command
  • Loading branch information
N00bG1rl authored Mar 15, 2024
2 parents d8d1326 + cf9ea01 commit 11e99b8
Show file tree
Hide file tree
Showing 19 changed files with 580 additions and 230 deletions.
7 changes: 5 additions & 2 deletions Source/SelfService/Web/apis/integrations/CacheKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
// 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',
//CommandsApi
ConnectionCommands_GET = 'connection_command_get',

//CommandApi
ConnectionCommand_GET = 'connection_command_get',

//ConnectionsApi
Connections_GET = 'connections_get',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import { useQuery, useMutation } from '@tanstack/react-query';

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

let apiInstance: CommandMappingApi | undefined;

Expand All @@ -19,12 +24,22 @@ const getOrCreateApi = () => {
export const useConnectionsIdCommandsGet = (params: ConnectionsIdCommandsGetRequest) => {
const api = getOrCreateApi();
return useQuery({
queryKey: [CACHE_KEYS.ConnectionCommandMappings_GET, params.id],
queryKey: [CACHE_KEYS.ConnectionCommands_GET, params.id],
queryFn: api.connectionsIdCommandsGet.bind(api, params),
staleTime: 60000,
});
};

export const useConnectionsIdCommandsCommandIdGet = (params: ConnectionsIdCommandsCommandIdGetRequest) => {
const api = getOrCreateApi();
return useQuery({
queryKey: [CACHE_KEYS.ConnectionCommand_GET, params.id, params.commandId],
queryFn: api.connectionsIdCommandsCommandIdGet.bind(api, params),
staleTime: 60000,
enabled: !!params.id && !!params.commandId,
});
};

export const useConnectionsIdCommandsCommandIdCreatePostRequest = () => {
const api = getOrCreateApi();
return useMutation({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apis/ConnectionConfigurationApi.ts
apis/ConnectionRestApiApi.ts
apis/ConnectionWebhookApi.ts
apis/ConnectionsApi.ts
apis/ConnectionsController2Api.ts
apis/DeploymentApi.ts
apis/EnvironmentApi.ts
apis/JqAssistantApi.ts
Expand Down
Loading

0 comments on commit 11e99b8

Please sign in to comment.