diff --git a/Source/SelfService/Web/apis/integrations/CacheKeys.ts b/Source/SelfService/Web/apis/integrations/CacheKeys.ts index e32b3bd41..b7d8eb749 100644 --- a/Source/SelfService/Web/apis/integrations/CacheKeys.ts +++ b/Source/SelfService/Web/apis/integrations/CacheKeys.ts @@ -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', diff --git a/Source/SelfService/Web/apis/integrations/commandMappingApi.hooks.ts b/Source/SelfService/Web/apis/integrations/commandMappingApi.hooks.ts index 5089bbb54..b773dfbf7 100644 --- a/Source/SelfService/Web/apis/integrations/commandMappingApi.hooks.ts +++ b/Source/SelfService/Web/apis/integrations/commandMappingApi.hooks.ts @@ -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; @@ -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({ diff --git a/Source/SelfService/Web/apis/integrations/generated/.openapi-generator/FILES b/Source/SelfService/Web/apis/integrations/generated/.openapi-generator/FILES index 4746860bc..64aaa5507 100644 --- a/Source/SelfService/Web/apis/integrations/generated/.openapi-generator/FILES +++ b/Source/SelfService/Web/apis/integrations/generated/.openapi-generator/FILES @@ -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 diff --git a/Source/SelfService/Web/apis/integrations/generated/apis/ConnectionsController2Api.ts b/Source/SelfService/Web/apis/integrations/generated/apis/ConnectionsController2Api.ts new file mode 100644 index 000000000..650ed3b3a --- /dev/null +++ b/Source/SelfService/Web/apis/integrations/generated/apis/ConnectionsController2Api.ts @@ -0,0 +1,363 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Aigonix.Bridge.M3 + * Bridge API - made for Aigonix Studio + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + ConnectionModelArrayResult, + ConnectionModelResult, + ProblemDetails, + StringResult, +} from '../models/index'; +import { + ConnectionModelArrayResultFromJSON, + ConnectionModelArrayResultToJSON, + ConnectionModelResultFromJSON, + ConnectionModelResultToJSON, + ProblemDetailsFromJSON, + ProblemDetailsToJSON, + StringResultFromJSON, + StringResultToJSON, +} from '../models/index'; + +export interface Connections2IdConnectorDeploymentGetRequest { + id: string; +} + +export interface Connections2IdDeleteRequest { + id: string; +} + +export interface Connections2IdGetRequest { + id: string; +} + +export interface Connections2IdNameGetRequest { + id: string; +} + +export interface Connections2IdNamePostRequest { + id: string; + body: string; +} + +export interface Connections2IdPostRequest { + id: string; + body?: string; +} + +/** + * + */ +export class ConnectionsController2Api extends runtime.BaseAPI { + + /** + * GET all the connections the Bridge API knows about for the current user/tenant/customer + */ + async connections2GetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections2`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => ConnectionModelArrayResultFromJSON(jsonValue)); + } + + /** + * GET all the connections the Bridge API knows about for the current user/tenant/customer + */ + async connections2Get(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.connections2GetRaw(initOverrides); + return await response.value(); + } + + /** + * Get connector bundle for an on-premises deployment + */ + async connections2IdConnectorDeploymentGetRaw(requestParameters: Connections2IdConnectorDeploymentGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connections2IdConnectorDeploymentGet.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections2/{id}/connector-deployment`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * Get connector bundle for an on-premises deployment + */ + async connections2IdConnectorDeploymentGet(requestParameters: Connections2IdConnectorDeploymentGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.connections2IdConnectorDeploymentGetRaw(requestParameters, initOverrides); + } + + /** + * DELETE to this resource to delete the connection + */ + async connections2IdDeleteRaw(requestParameters: Connections2IdDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connections2IdDelete.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections2/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.VoidApiResponse(response); + } + + /** + * DELETE to this resource to delete the connection + */ + async connections2IdDelete(requestParameters: Connections2IdDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + await this.connections2IdDeleteRaw(requestParameters, initOverrides); + } + + /** + * GET one specific connection + */ + async connections2IdGetRaw(requestParameters: Connections2IdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connections2IdGet.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections2/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => ConnectionModelResultFromJSON(jsonValue)); + } + + /** + * GET one specific connection + */ + async connections2IdGet(requestParameters: Connections2IdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.connections2IdGetRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * GET the name of the connection + */ + async connections2IdNameGetRaw(requestParameters: Connections2IdNameGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connections2IdNameGet.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections2/{id}/name`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => StringResultFromJSON(jsonValue)); + } + + /** + * GET the name of the connection + */ + async connections2IdNameGet(requestParameters: Connections2IdNameGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.connections2IdNameGetRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * POST to this resource to set the name of a connection + */ + async connections2IdNamePostRaw(requestParameters: Connections2IdNamePostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connections2IdNamePost.'); + } + + if (requestParameters.body === null || requestParameters.body === undefined) { + throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling connections2IdNamePost.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections2/{id}/name`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: requestParameters.body as any, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => StringResultFromJSON(jsonValue)); + } + + /** + * POST to this resource to set the name of a connection + */ + async connections2IdNamePost(requestParameters: Connections2IdNamePostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.connections2IdNamePostRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * POST to this resources to register a connection. This connection can then be configured, deployed and will hold mappings. + */ + async connections2IdPostRaw(requestParameters: Connections2IdPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters.id === null || requestParameters.id === undefined) { + throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling connections2IdPost.'); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters["X-Organization-Id"] = this.configuration.apiKey("X-Organization-Id"); // X-Organization-Id authentication + } + + if (this.configuration && this.configuration.accessToken) { + const token = this.configuration.accessToken; + const tokenString = await token("Bearer", []); + + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + const response = await this.request({ + path: `/connections2/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: requestParameters.body as any, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => ConnectionModelResultFromJSON(jsonValue)); + } + + /** + * POST to this resources to register a connection. This connection can then be configured, deployed and will hold mappings. + */ + async connections2IdPost(requestParameters: Connections2IdPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.connections2IdPostRaw(requestParameters, initOverrides); + return await response.value(); + } + +} diff --git a/Source/SelfService/Web/apis/integrations/generated/apis/index.ts b/Source/SelfService/Web/apis/integrations/generated/apis/index.ts index a00c2a604..30ce383ef 100644 --- a/Source/SelfService/Web/apis/integrations/generated/apis/index.ts +++ b/Source/SelfService/Web/apis/integrations/generated/apis/index.ts @@ -8,6 +8,7 @@ export * from './ConnectionConfigurationApi'; export * from './ConnectionRestApiApi'; export * from './ConnectionWebhookApi'; export * from './ConnectionsApi'; +export * from './ConnectionsController2Api'; export * from './DeploymentApi'; export * from './EnvironmentApi'; export * from './JqAssistantApi'; diff --git a/Source/SelfService/Web/apis/integrations/generated/models/CommandMappingModel.ts b/Source/SelfService/Web/apis/integrations/generated/models/CommandMappingModel.ts index 50ada68ec..dd6b45a5d 100644 --- a/Source/SelfService/Web/apis/integrations/generated/models/CommandMappingModel.ts +++ b/Source/SelfService/Web/apis/integrations/generated/models/CommandMappingModel.ts @@ -79,7 +79,7 @@ export interface CommandMappingModel { * @type {Array} * @memberof CommandMappingModel */ - parameterMappings: Array; + parameters: Array; /** * The last time (if any) the command mapping was deployed. May be null if * it has never been deployed @@ -112,7 +112,7 @@ export function instanceOfCommandMappingModel(value: object): boolean { isInstance = isInstance && "id" in value; isInstance = isInstance && "createdAt" in value; isInstance = isInstance && "name" in value; - isInstance = isInstance && "parameterMappings" in value; + isInstance = isInstance && "parameters" in value; return isInstance; } @@ -135,7 +135,7 @@ export function CommandMappingModelFromJSONTyped(json: any, ignoreDiscriminator: 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], 'm3Program': !exists(json, 'm3Program') ? undefined : json['m3Program'], 'm3Transaction': !exists(json, 'm3Transaction') ? undefined : json['m3Transaction'], - 'parameterMappings': ((json['parameterMappings'] as Array).map(MappedParameterFromJSON)), + 'parameters': ((json['parameters'] as Array).map(MappedParameterFromJSON)), 'deployedAt': !exists(json, 'deployedAt') ? undefined : (json['deployedAt'] === null ? null : new Date(json['deployedAt'])), 'deployedVersion': !exists(json, 'deployedVersion') ? undefined : json['deployedVersion'], 'confirmedDeployedVersion': !exists(json, 'confirmedDeployedVersion') ? undefined : json['confirmedDeployedVersion'], @@ -159,7 +159,7 @@ export function CommandMappingModelToJSON(value?: CommandMappingModel | null): a 'namespace': value.namespace, 'm3Program': value.m3Program, 'm3Transaction': value.m3Transaction, - 'parameterMappings': ((value.parameterMappings as Array).map(MappedParameterToJSON)), + 'parameters': ((value.parameters as Array).map(MappedParameterToJSON)), 'deployedAt': value.deployedAt === undefined ? undefined : (value.deployedAt === null ? null : value.deployedAt.toISOString()), 'deployedVersion': value.deployedVersion, 'confirmedDeployedVersion': value.confirmedDeployedVersion, diff --git a/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/CommandDetailSection.tsx b/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/CommandDetailSection.tsx index aaf5c71ce..8b8e12dbd 100644 --- a/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/CommandDetailSection.tsx +++ b/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/CommandDetailSection.tsx @@ -7,11 +7,15 @@ import { ContentWithSubtitle, InlineWrapper, Input } from '@dolittle/design-syst import { alphaNumericCharsRegex } from '../../../../../utils/helpers/regex'; -export const CommandDetailSection = () => +export type CommandDetailSectionProps = { + isDisabled?: boolean; +}; + +export const CommandDetailSection = ({ isDisabled }: CommandDetailSectionProps) => - + - + ; diff --git a/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/commandsListDetailPanel/index.tsx b/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/commandsListDetailPanel/index.tsx deleted file mode 100644 index 16e830bc9..000000000 --- a/Source/SelfService/Web/integrations/connection/connectionDetails/commands/command/commandsListDetailPanel/index.tsx +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Aigonix. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -import React, { useState } from 'react'; - -import { DataGridPro, GRID_CHECKBOX_SELECTION_FIELD, GridFilterModel, GridSelectionModel } from '@mui/x-data-grid-pro'; - -import { Button, ContentDivider, ContentWithSubtitle, DataGridCustomToolbar, dataGridDefaultProps, DataGridWrapper, Form, NewSwitch } from '@dolittle/design-system'; - -import { commandsListDetailPanelColumns } from './DetailPanelColumns'; - -const styles = { - // Hack for select cell active state. Otherwise size is going to be different. - '& .MuiOutlinedInput-root': { - '& .MuiSelect-select': { p: '5px 15px' }, - '& fieldset': { border: 'none' }, - }, - // Hide the filter icon in the column header. - '& .MuiDataGrid-columnHeader--filtered .MuiDataGrid-iconButtonContainer': { - display: 'none', - }, -}; - -const commandsListDetailPanelRows = [ - { - name: 'ABSK', - description: 'ABCclass-supplier', - type: 'StringType', - length: 1, - required: false - }, - { - name: 'ABSM', - description: 'ABCmethod-supplier', - type: 'StringType', - length: 1, - required: false - }, - { - name: 'ACRF', - description: 'User-definedaccountingcontrolobject', - type: 'StringType', - length: 8, - required: false - }, - { - name: 'AGNT', - description: 'Agent', - type: 'StringType', - length: 10, - required: false - }, - { - name: 'ALSU', - description: 'Searchkey', - type: 'StringType', - length: 10, - required: false - }, - { - name: 'ATPR', - description: 'Attributepricingrule', - type: 'StringType', - length: 1, - required: false - }, - { - name: 'AVCD', - description: 'Activitycode', - type: 'StringType', - length: 3, - required: false - }, - { - name: 'BUYE', - description: 'Buyer', - type: 'StringType', - length: 10, - required: false - }, - { - name: 'CF10', - description: 'User-definedfield5-purchase/financial', - type: 'StringType', - length: 1, - required: false - }, -]; - -type CommandEditParametersProps = { - namespace: string; - description: string; -}; - -export const EditCommandSection = ({ row }: any) => { - const [selectedRowIds, setSelectedRowIds] = useState([]); - const [hideUnselectedRows, setHideUnselectedRows] = useState(false); - - const gridFilters: GridFilterModel = { - // Hide unselected rows. - items: hideUnselectedRows ? [ - { - columnField: GRID_CHECKBOX_SELECTION_FIELD, - operatorValue: 'is', - value: 'true', - }, - ] : [], - }; - - return ( - UpdSupplier'}`}> - - initialValues={{ - namespace: '', - description: '', - }} - onSubmit={() => { }} - > - - row.name} - autoHeight={false} - checkboxSelection - keepNonExistentRowsSelected - selectionModel={selectedRowIds} - onSelectionModelChange={newSelectionModel => setSelectedRowIds(newSelectionModel)} - filterModel={gridFilters} - components={{ - Toolbar: () => ( - - setHideUnselectedRows(!hideUnselectedRows)} - /> - - ) - }} - experimentalFeatures={{ newEditingApi: true }} - sx={styles} - /> - - - - -