From ec0a007de07f7d8f1bec38aa05e18395ce5f636c Mon Sep 17 00:00:00 2001 From: Marco <51787428+MarcoMruz@users.noreply.github.com> Date: Fri, 10 May 2024 09:48:55 +0200 Subject: [PATCH] Fd 674 wm (#1540) * add additional properties into workflow import and refactor workflow input from grid into vstack * remove bad URLs used when redirecting * create new function in shared to omit deeply nested objects * add info comment about test framework limitations * handle sent json in inputParams * support multiple properties to be omitted in omitDeep function * add possibility to export workflow definition * generate graphql types --- .../src/__generated__/graphql.ts | 99 ++++++++++++++++++- .../components/modals/definition-modal.tsx | 24 ++++- .../src/components/workflow-diagram.tsx | 4 +- .../src/components/workflow-list-header.tsx | 21 +++- .../input-output-tab.tsx | 23 +---- .../workflow-json-tab.tsx | 13 +-- .../executed-workflow-detail.tsx | 5 +- .../workflow-definitions-modals.tsx | 61 +++++++++++- .../workflow-form-input.tsx | 7 +- .../workflow-inputs-form.tsx | 21 ++-- .../shared/src/helpers/utils.helpers.spec.ts | 72 ++++++++++++++ packages/shared/src/helpers/utils.helpers.ts | 52 ++++++++++ packages/shared/src/index.ts | 1 + 13 files changed, 350 insertions(+), 53 deletions(-) create mode 100644 packages/shared/src/helpers/utils.helpers.spec.ts create mode 100644 packages/shared/src/helpers/utils.helpers.ts diff --git a/packages/frinx-workflow-ui/src/__generated__/graphql.ts b/packages/frinx-workflow-ui/src/__generated__/graphql.ts index a3b55b4ec..9ecd8e777 100644 --- a/packages/frinx-workflow-ui/src/__generated__/graphql.ts +++ b/packages/frinx-workflow-ui/src/__generated__/graphql.ts @@ -97,6 +97,16 @@ export type AddSnapshotPayload = { snapshot: Maybe; }; +export type AddStreamInput = { + deviceName: Scalars['String']['input']; + streamName: Scalars['String']['input']; +}; + +export type AddStreamPayload = { + __typename?: 'AddStreamPayload'; + stream: Stream; +}; + export type AddZoneInput = { name: Scalars['String']['input']; }; @@ -833,6 +843,10 @@ export type FilterLabelsInput = { name: Scalars['String']['input']; }; +export type FilterStreamsInput = { + streamName?: InputMaybe; +}; + export type FilterTaskDefinitionsInput = { keyword?: InputMaybe; }; @@ -1031,6 +1045,12 @@ export type NetTopology = { nodes: Array; }; +export type NetTopologyVersionData = { + __typename?: 'NetTopologyVersionData'; + edges: Array; + nodes: Array; +}; + export type Node = { id: Scalars['ID']['output']; }; @@ -1389,6 +1409,10 @@ export type SortResourcePoolsInput = { field?: InputMaybe; }; +export type SortStreamBy = + | 'createdAt' + | 'streamName'; + export type SortTasksBy = { _fake?: InputMaybe; }; @@ -1433,6 +1457,33 @@ export type Status = | 'TIMED_OUT' | 'UNKNOWN'; +export type Stream = Node & { + __typename?: 'Stream'; + createdAt: Scalars['String']['output']; + deviceName: Scalars['String']['output']; + id: Scalars['ID']['output']; + streamName: Scalars['String']['output']; + updatedAt: Scalars['String']['output']; +}; + +export type StreamConnection = { + __typename?: 'StreamConnection'; + edges: Array; + pageInfo: PageInfo; + totalCount: Scalars['Int']['output']; +}; + +export type StreamEdge = { + __typename?: 'StreamEdge'; + cursor: Scalars['String']['output']; + node: Stream; +}; + +export type StreamOrderByInput = { + direction: SortDirection; + sortKey: SortStreamBy; +}; + export type SubWorkflowParams = { __typename?: 'SubWorkflowParams'; name: Scalars['String']['output']; @@ -2248,6 +2299,7 @@ export type ConductorMutation = { deleteWorkflowDefinition: DeleteWorkflowDefinitionPayload; editEventHandler: EditEventHandlerPayload; executeWorkflowByName: Maybe; + exportWorkflowDefinition: Maybe; /** Lists workflows for the given correlation id list */ getWorkflows: Maybe; /** Log Task Execution Details */ @@ -2373,6 +2425,12 @@ export type ConductorMutationExecuteWorkflowByNameArgs = { }; +export type ConductorMutationExportWorkflowDefinitionArgs = { + name: Scalars['String']['input']; + version?: InputMaybe; +}; + + export type ConductorMutationGetWorkflowsArgs = { includeClosed?: InputMaybe; includeTasks?: InputMaybe; @@ -2919,6 +2977,7 @@ export type DeviceInventoryMutation = { addDevice: AddDevicePayload; addLocation: AddLocationPayload; addSnapshot: Maybe; + addStream: AddStreamPayload; addZone: AddZonePayload; applySnapshot: ApplySnapshotPayload; bulkInstallDevices: BulkInstallDevicePayload; @@ -2933,6 +2992,7 @@ export type DeviceInventoryMutation = { deleteSnapshot: Maybe; importCSV: Maybe; installDevice: InstallDevicePayload; + reconnectKafka: Maybe; resetConfig: ResetConfigPayload; revertChanges: RevertChangesPayload; syncFromNetwork: SyncFromNetworkPayload; @@ -2965,6 +3025,11 @@ export type DeviceInventoryMutationAddSnapshotArgs = { }; +export type DeviceInventoryMutationAddStreamArgs = { + input: AddStreamInput; +}; + + export type DeviceInventoryMutationAddZoneArgs = { input: AddZoneInput; }; @@ -3090,9 +3155,11 @@ export type DeviceInventoryQuery = { countries: CountryConnection; dataStore: Maybe; devices: DeviceConnection; + kafkaHealthCheck: Maybe; labels: LabelConnection; locations: LocationConnection; netTopology: Maybe; + netTopologyVersionData: NetTopologyVersionData; node: Maybe; phyTopologyVersionData: PhyTopologyVersionData; ptpDiffSynce: PtpDiffSynce; @@ -3100,6 +3167,7 @@ export type DeviceInventoryQuery = { ptpTopology: Maybe; ptpTopologyVersionData: PtpTopologyVersionData; shortestPath: Array; + streams: StreamConnection; syncePathToGrandMaster: Maybe>; synceTopology: Maybe; synceTopologyVersionData: SynceTopologyVersionData; @@ -3167,6 +3235,11 @@ export type DeviceInventoryQueryLocationsArgs = { }; +export type DeviceInventoryQueryNetTopologyVersionDataArgs = { + version: Scalars['String']['input']; +}; + + export type DeviceInventoryQueryNodeArgs = { id: Scalars['ID']['input']; }; @@ -3193,6 +3266,16 @@ export type DeviceInventoryQueryShortestPathArgs = { }; +export type DeviceInventoryQueryStreamsArgs = { + after?: InputMaybe; + before?: InputMaybe; + filter?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + orderBy?: InputMaybe; +}; + + export type DeviceInventoryQuerySyncePathToGrandMasterArgs = { deviceFrom: Scalars['String']['input']; }; @@ -3702,7 +3785,7 @@ export type GetEventHandlerDetailQueryVariables = Exact<{ }>; -export type GetEventHandlerDetailQuery = { __typename?: 'Query', conductor: { __typename?: 'conductorQuery', node: { __typename?: 'AllocationStrategy' } | { __typename?: 'Blueprint' } | { __typename?: 'Country' } | { __typename?: 'Device' } | { __typename?: 'EventHandler', name: string, event: string, condition: string | null, isActive: boolean | null, evaluatorType: string | null, actions: Array<{ __typename?: 'EventHandlerAction', action: MutationInput_UpdateEventHandler_Input_Actions_Items_Action | null, expandInlineJSON: any | null, startWorkflow: { __typename?: 'StartWorkflow', name: string | null, version: number | null, input: any | null, correlationId: string | null, taskToDomain: any | null } | null, completeTask: { __typename?: 'TaskDetails', workflowId: string | null, taskId: string | null, output: any | null, taskRefName: string | null } | null, failTask: { __typename?: 'TaskDetails', workflowId: string | null, taskId: string | null, output: any | null, taskRefName: string | null } | null } | null> } | { __typename?: 'Label' } | { __typename?: 'Location' } | { __typename?: 'PropertyType' } | { __typename?: 'Resource' } | { __typename?: 'ResourcePool' } | { __typename?: 'ResourceType' } | { __typename?: 'Tag' } | { __typename?: 'TaskDefinition' } | { __typename?: 'Workflow' } | { __typename?: 'WorkflowDefinition' } | { __typename?: 'WorkflowTask' } | { __typename?: 'Zone' } | null } }; +export type GetEventHandlerDetailQuery = { __typename?: 'Query', conductor: { __typename?: 'conductorQuery', node: { __typename?: 'AllocationStrategy' } | { __typename?: 'Blueprint' } | { __typename?: 'Country' } | { __typename?: 'Device' } | { __typename?: 'EventHandler', name: string, event: string, condition: string | null, isActive: boolean | null, evaluatorType: string | null, actions: Array<{ __typename?: 'EventHandlerAction', action: MutationInput_UpdateEventHandler_Input_Actions_Items_Action | null, expandInlineJSON: any | null, startWorkflow: { __typename?: 'StartWorkflow', name: string | null, version: number | null, input: any | null, correlationId: string | null, taskToDomain: any | null } | null, completeTask: { __typename?: 'TaskDetails', workflowId: string | null, taskId: string | null, output: any | null, taskRefName: string | null } | null, failTask: { __typename?: 'TaskDetails', workflowId: string | null, taskId: string | null, output: any | null, taskRefName: string | null } | null } | null> } | { __typename?: 'Label' } | { __typename?: 'Location' } | { __typename?: 'PropertyType' } | { __typename?: 'Resource' } | { __typename?: 'ResourcePool' } | { __typename?: 'ResourceType' } | { __typename?: 'Stream' } | { __typename?: 'Tag' } | { __typename?: 'TaskDefinition' } | { __typename?: 'Workflow' } | { __typename?: 'WorkflowDefinition' } | { __typename?: 'WorkflowTask' } | { __typename?: 'Zone' } | null } }; export type EditEventHandlerMutationVariables = Exact<{ input: EditEventHandlerInput; @@ -3716,7 +3799,7 @@ export type EventHandlerDetailQueryVariables = Exact<{ }>; -export type EventHandlerDetailQuery = { __typename?: 'Query', conductor: { __typename?: 'conductorQuery', node: { __typename?: 'AllocationStrategy' } | { __typename?: 'Blueprint' } | { __typename?: 'Country' } | { __typename?: 'Device' } | { __typename?: 'EventHandler', id: string, name: string, event: string, condition: string | null, evaluatorType: string | null, isActive: boolean | null, actions: Array<{ __typename?: 'EventHandlerAction', action: MutationInput_UpdateEventHandler_Input_Actions_Items_Action | null, expandInlineJSON: any | null, completeTask: { __typename?: 'TaskDetails', workflowId: string | null, taskId: string | null, output: any | null, taskRefName: string | null } | null, failTask: { __typename?: 'TaskDetails', workflowId: string | null, taskId: string | null, output: any | null, taskRefName: string | null } | null, startWorkflow: { __typename?: 'StartWorkflow', name: string | null, version: number | null, input: any | null, correlationId: string | null, taskToDomain: any | null } | null } | null> } | { __typename?: 'Label' } | { __typename?: 'Location' } | { __typename?: 'PropertyType' } | { __typename?: 'Resource' } | { __typename?: 'ResourcePool' } | { __typename?: 'ResourceType' } | { __typename?: 'Tag' } | { __typename?: 'TaskDefinition' } | { __typename?: 'Workflow' } | { __typename?: 'WorkflowDefinition' } | { __typename?: 'WorkflowTask' } | { __typename?: 'Zone' } | null } }; +export type EventHandlerDetailQuery = { __typename?: 'Query', conductor: { __typename?: 'conductorQuery', node: { __typename?: 'AllocationStrategy' } | { __typename?: 'Blueprint' } | { __typename?: 'Country' } | { __typename?: 'Device' } | { __typename?: 'EventHandler', id: string, name: string, event: string, condition: string | null, evaluatorType: string | null, isActive: boolean | null, actions: Array<{ __typename?: 'EventHandlerAction', action: MutationInput_UpdateEventHandler_Input_Actions_Items_Action | null, expandInlineJSON: any | null, completeTask: { __typename?: 'TaskDetails', workflowId: string | null, taskId: string | null, output: any | null, taskRefName: string | null } | null, failTask: { __typename?: 'TaskDetails', workflowId: string | null, taskId: string | null, output: any | null, taskRefName: string | null } | null, startWorkflow: { __typename?: 'StartWorkflow', name: string | null, version: number | null, input: any | null, correlationId: string | null, taskToDomain: any | null } | null } | null> } | { __typename?: 'Label' } | { __typename?: 'Location' } | { __typename?: 'PropertyType' } | { __typename?: 'Resource' } | { __typename?: 'ResourcePool' } | { __typename?: 'ResourceType' } | { __typename?: 'Stream' } | { __typename?: 'Tag' } | { __typename?: 'TaskDefinition' } | { __typename?: 'Workflow' } | { __typename?: 'WorkflowDefinition' } | { __typename?: 'WorkflowTask' } | { __typename?: 'Zone' } | null } }; export type DeleteEventHandlerDetailMutationVariables = Exact<{ deleteEventHandlerId: Scalars['ID']['input']; @@ -3777,14 +3860,14 @@ export type ExecutedWorkflowDetailQueryVariables = Exact<{ }>; -export type ExecutedWorkflowDetailQuery = { __typename?: 'Query', conductor: { __typename?: 'conductorQuery', node: { __typename?: 'AllocationStrategy' } | { __typename?: 'Blueprint' } | { __typename?: 'Country' } | { __typename?: 'Device' } | { __typename?: 'EventHandler' } | { __typename?: 'Label' } | { __typename?: 'Location' } | { __typename?: 'PropertyType' } | { __typename?: 'Resource' } | { __typename?: 'ResourcePool' } | { __typename?: 'ResourceType' } | { __typename?: 'Tag' } | { __typename?: 'TaskDefinition' } | { __typename?: 'Workflow', id: string, createdBy: string | null, updatedBy: string | null, createdAt: string | null, updatedAt: string | null, status: WorkflowStatus | null, parentId: string | null, ownerApp: string | null, input: string | null, output: string | null, reasonForIncompletion: string | null, failedReferenceTaskNames: Array | null, originalId: string | null, variables: string | null, lastRetriedTime: string | null, startTime: string | null, endTime: string | null, externalOutputPayloadStoragePath: string | null, externalInputPayloadStoragePath: string | null, correlationId: string | null, workflowDefinition: { __typename?: 'WorkflowDefinition', id: string, version: number, name: string, ownerEmail: string | null, restartable: boolean, tasksJson: any | null, hasSchedule: boolean, createdAt: string | null, updatedAt: string | null, createdBy: string | null, updatedBy: string | null, inputParameters: Array | null, timeoutPolicy: TimeoutPolicy | null, timeoutSeconds: number | null, description: { __typename?: 'WorkflowDefinitionDescription', description: string | null, labels: Array | null } | null, outputParameters: Array<{ __typename?: 'OutputParameters', key: string, value: string }> | null } | null, tasks: Array<{ __typename?: 'WorkflowTask', id: string, taskType: string | null, referenceTaskName: string | null, status: WorkflowTaskStatus | null, retryCount: number | null, startTime: string | null, endTime: string | null, updatedAt: string | null, scheduledTime: string | null, taskDefName: string | null, workflowType: string | null, retried: boolean | null, executed: boolean | null, taskId: string | null, reasonForIncompletion: string | null, taskDefinition: string | null, subWorkflowId: string | null, inputData: string | null, outputData: string | null, externalOutputPayloadStoragePath: string | null, externalInputPayloadStoragePath: string | null, callbackAfterSeconds: number | null, seq: number | null, pollCount: number | null, logs: Array<{ __typename?: 'WorkflowTaskLog', createdAt: string | null, message: string | null }> | null }> | null } | { __typename?: 'WorkflowDefinition' } | { __typename?: 'WorkflowTask' } | { __typename?: 'Zone' } | null } }; +export type ExecutedWorkflowDetailQuery = { __typename?: 'Query', conductor: { __typename?: 'conductorQuery', node: { __typename?: 'AllocationStrategy' } | { __typename?: 'Blueprint' } | { __typename?: 'Country' } | { __typename?: 'Device' } | { __typename?: 'EventHandler' } | { __typename?: 'Label' } | { __typename?: 'Location' } | { __typename?: 'PropertyType' } | { __typename?: 'Resource' } | { __typename?: 'ResourcePool' } | { __typename?: 'ResourceType' } | { __typename?: 'Stream' } | { __typename?: 'Tag' } | { __typename?: 'TaskDefinition' } | { __typename?: 'Workflow', id: string, createdBy: string | null, updatedBy: string | null, createdAt: string | null, updatedAt: string | null, status: WorkflowStatus | null, parentId: string | null, ownerApp: string | null, input: string | null, output: string | null, reasonForIncompletion: string | null, failedReferenceTaskNames: Array | null, originalId: string | null, variables: string | null, lastRetriedTime: string | null, startTime: string | null, endTime: string | null, externalOutputPayloadStoragePath: string | null, externalInputPayloadStoragePath: string | null, correlationId: string | null, workflowDefinition: { __typename?: 'WorkflowDefinition', id: string, version: number, name: string, ownerEmail: string | null, restartable: boolean, tasksJson: any | null, hasSchedule: boolean, createdAt: string | null, updatedAt: string | null, createdBy: string | null, updatedBy: string | null, inputParameters: Array | null, timeoutPolicy: TimeoutPolicy | null, timeoutSeconds: number | null, description: { __typename?: 'WorkflowDefinitionDescription', description: string | null, labels: Array | null } | null, outputParameters: Array<{ __typename?: 'OutputParameters', key: string, value: string }> | null } | null, tasks: Array<{ __typename?: 'WorkflowTask', id: string, taskType: string | null, referenceTaskName: string | null, status: WorkflowTaskStatus | null, retryCount: number | null, startTime: string | null, endTime: string | null, updatedAt: string | null, scheduledTime: string | null, taskDefName: string | null, workflowType: string | null, retried: boolean | null, executed: boolean | null, taskId: string | null, reasonForIncompletion: string | null, taskDefinition: string | null, subWorkflowId: string | null, inputData: string | null, outputData: string | null, externalOutputPayloadStoragePath: string | null, externalInputPayloadStoragePath: string | null, callbackAfterSeconds: number | null, seq: number | null, pollCount: number | null, logs: Array<{ __typename?: 'WorkflowTaskLog', createdAt: string | null, message: string | null }> | null }> | null } | { __typename?: 'WorkflowDefinition' } | { __typename?: 'WorkflowTask' } | { __typename?: 'Zone' } | null } }; export type ControlExecutedWorkflowSubscriptionVariables = Exact<{ workflowId: Scalars['String']['input']; }>; -export type ControlExecutedWorkflowSubscription = { __typename?: 'Subscription', conductor: { __typename?: 'ConductorSubscription', controlExecutedWorkflow: { __typename?: 'Workflow', endTime: string | null, startTime: string | null, status: WorkflowStatus | null, tasks: Array<{ __typename?: 'WorkflowTask', id: string, endTime: string | null, startTime: string | null, updatedAt: string | null, status: WorkflowTaskStatus | null, taskType: string | null, subWorkflowId: string | null }> | null } } }; +export type ControlExecutedWorkflowSubscription = { __typename?: 'Subscription', conductor: { __typename?: 'ConductorSubscription', controlExecutedWorkflow: { __typename?: 'Workflow', endTime: string | null, startTime: string | null, status: WorkflowStatus | null, tasks: Array<{ __typename?: 'WorkflowTask', id: string, endTime: string | null, startTime: string | null, updatedAt: string | null, status: WorkflowTaskStatus | null, taskType: string | null, subWorkflowId: string | null, referenceTaskName: string | null }> | null } } }; export type RerunEditedWorkflowMutationVariables = Exact<{ input: ExecuteWorkflowByNameInput; @@ -3949,6 +4032,14 @@ export type ExecuteWorkflowByNameMutationVariables = Exact<{ export type ExecuteWorkflowByNameMutation = { __typename?: 'Mutation', conductor: { __typename?: 'conductorMutation', executeWorkflowByName: string | null } }; +export type ExportWorkflowDefinitionMutationVariables = Exact<{ + name: Scalars['String']['input']; + version?: InputMaybe; +}>; + + +export type ExportWorkflowDefinitionMutation = { __typename?: 'Mutation', conductor: { __typename?: 'conductorMutation', exportWorkflowDefinition: any | null } }; + export type WorkflowsQueryVariables = Exact<{ filter?: InputMaybe; orderBy?: InputMaybe; diff --git a/packages/frinx-workflow-ui/src/components/modals/definition-modal.tsx b/packages/frinx-workflow-ui/src/components/modals/definition-modal.tsx index 4df4fbb12..f3f6352fb 100644 --- a/packages/frinx-workflow-ui/src/components/modals/definition-modal.tsx +++ b/packages/frinx-workflow-ui/src/components/modals/definition-modal.tsx @@ -1,6 +1,7 @@ import React, { VoidFunctionComponent } from 'react'; import { Button, + ButtonGroup, Modal, ModalBody, ModalCloseButton, @@ -14,10 +15,11 @@ import { ClientWorkflowWithTasks, Editor, removeGraphqlSpecsFromWorkflow } from type ModalProps = { isOpen: boolean; onClose: () => void; + onExportClick: () => void; workflow?: ClientWorkflowWithTasks; }; -const DefinitionModal: VoidFunctionComponent = ({ isOpen, onClose, workflow }) => { +const DefinitionModal: VoidFunctionComponent = ({ isOpen, onClose, workflow, onExportClick }) => { return ( @@ -25,12 +27,24 @@ const DefinitionModal: VoidFunctionComponent = ({ isOpen, onClose, w {workflow?.name} - + - + + + + diff --git a/packages/frinx-workflow-ui/src/components/workflow-diagram.tsx b/packages/frinx-workflow-ui/src/components/workflow-diagram.tsx index 9a7d3aa86..38535fae4 100644 --- a/packages/frinx-workflow-ui/src/components/workflow-diagram.tsx +++ b/packages/frinx-workflow-ui/src/components/workflow-diagram.tsx @@ -58,7 +58,7 @@ const WorkflowDiagram = ({ meta, result }: Props) => { } const tasks = jsonParse(meta.tasksJson) || []; - const taskMap = new Map(unwrap(result.tasks).map((t) => [t.id, t])); + const taskMap = new Map(unwrap(result.tasks).map((t) => [t.referenceTaskName, t])); const elements: { nodes: Node[]; edges: Edge[] } = getLayoutedElements( getElementsFromWorkflow(tasks.map(convertWorkflowTaskToExtendedTask), true), 'TB', @@ -96,7 +96,7 @@ const WorkflowDiagram = ({ meta, result }: Props) => { fitView onNodeClick={(_e, node) => { if (node.data?.isSubWorkflow) { - navigate(`../executed/${node.data?.subWorkflowId}`); + navigate(`../${node.data?.subWorkflowId}`); } }} /> diff --git a/packages/frinx-workflow-ui/src/components/workflow-list-header.tsx b/packages/frinx-workflow-ui/src/components/workflow-list-header.tsx index e48e6203c..9bf97d1a9 100644 --- a/packages/frinx-workflow-ui/src/components/workflow-list-header.tsx +++ b/packages/frinx-workflow-ui/src/components/workflow-list-header.tsx @@ -81,15 +81,34 @@ const WorkflowListHeader: VoidFunctionComponent = ({ onImportSuccess }) = const json = readFiles .map((data) => JSON.parse(data)) .map((data) => { - const { tasks, name, description, labels, outputParameters, restartable, timeoutSeconds, version } = data; + const { + tasks, + labels, + name, + description, + outputParameters, + restartable, + timeoutSeconds, + version, + inputParameters, + ownerApp, + createdBy, + updatedBy, + } = data; return { tasks: JSON.stringify(tasks), name, description: { description, labels: labels || [] }, outputParameters, + inputParameters: inputParameters || [], restartable, timeoutSeconds, version, + ownerApp: ownerApp || '', + createTime: Date.now(), + updateTime: Date.now(), + createdBy: createdBy || '', + updatedBy: updatedBy || '', }; }); const response = await Promise.all( diff --git a/packages/frinx-workflow-ui/src/pages/executed-workflow-detail/executed-workflow-detail-tabs/input-output-tab.tsx b/packages/frinx-workflow-ui/src/pages/executed-workflow-detail/executed-workflow-detail-tabs/input-output-tab.tsx index 2ea345d0a..68d5cf811 100644 --- a/packages/frinx-workflow-ui/src/pages/executed-workflow-detail/executed-workflow-detail-tabs/input-output-tab.tsx +++ b/packages/frinx-workflow-ui/src/pages/executed-workflow-detail/executed-workflow-detail-tabs/input-output-tab.tsx @@ -1,7 +1,7 @@ import React, { VoidFunctionComponent, useState, useEffect } from 'react'; -import { IconButton, Button, SimpleGrid, Box, Stack, Textarea, Text, Icon, useDisclosure } from '@chakra-ui/react'; +import { IconButton, Button, SimpleGrid, Box, Stack, Text, Icon, useDisclosure } from '@chakra-ui/react'; import FeatherIcon from 'feather-icons-react'; -import unescapeJs from 'unescape-js'; +import { Editor } from '@frinx/shared'; import ExternalStorageModal from './external-storage-modal'; type Props = { @@ -14,20 +14,6 @@ type Props = { externalOutputPayloadStoragePath?: string | null; }; -const getJSON = (data: Record | unknown, isEscaped: boolean) => { - return isEscaped - ? JSON.stringify(data, null, 2) - .replace(/\\n/g, '\\n') - .replace(/\\'/g, "\\'") - .replace(/\\"/g, '\\"') - .replace(/\\&/g, '\\&') - .replace(/\\r/g, '\\r') - .replace(/\\t/g, '\\t') - .replace(/\\b/g, '\\b') - .replace(/\\f/g, '\\f') - : unescapeJs(JSON.stringify(data, null, 2)); -}; - const InputOutputTab: VoidFunctionComponent = ({ isEscaped, input, @@ -74,6 +60,7 @@ const InputOutputTab: VoidFunctionComponent = ({ onClick={() => copyToClipBoard(input)} /> {externalInputPayloadStoragePath && ( @@ -87,7 +74,7 @@ const InputOutputTab: VoidFunctionComponent = ({ )} -