2019-06-23 03:35:23 -07:00
|
|
|
<template>
|
|
|
|
<div class="run-data-view" v-loading="workflowRunning">
|
|
|
|
<BinaryDataDisplay :windowVisible="binaryDataDisplayVisible" :displayData="binaryDataDisplayData" @close="closeBinaryDataDisplay"/>
|
|
|
|
|
2021-08-29 04:36:17 -07:00
|
|
|
<div
|
2019-06-23 03:35:23 -07:00
|
|
|
v-if="node && !isReadOnly"
|
|
|
|
class="execute-node-button"
|
|
|
|
>
|
2021-08-29 04:36:17 -07:00
|
|
|
<n8n-button
|
2021-12-15 04:16:53 -08:00
|
|
|
:title="$locale.baseText('runData.executesThisNodeAfterExecuting', { interpolate: { nodeName: node.name } })"
|
2021-08-29 04:36:17 -07:00
|
|
|
:loading="workflowRunning"
|
|
|
|
icon="play-circle"
|
2021-12-15 04:16:53 -08:00
|
|
|
:label="$locale.baseText('runData.executeNode')"
|
2021-08-29 04:36:17 -07:00
|
|
|
@click.stop="runWorkflow(node.name, 'RunData.ExecuteNodeButton')"
|
|
|
|
/>
|
|
|
|
</div>
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
<div class="header">
|
|
|
|
<div class="title-text">
|
2021-10-27 12:55:37 -07:00
|
|
|
<n8n-text :bold="true" v-if="dataCount < maxDisplayItems">
|
2021-12-15 04:16:53 -08:00
|
|
|
{{ $locale.baseText('runData.items') }}: {{ dataCount }}
|
2021-10-27 12:55:37 -07:00
|
|
|
</n8n-text>
|
2021-08-29 04:36:17 -07:00
|
|
|
<div v-else class="title-text">
|
2021-12-15 04:16:53 -08:00
|
|
|
<n8n-text :bold="true">{{ $locale.baseText('runData.items') }}:</n8n-text>
|
2021-08-29 04:36:17 -07:00
|
|
|
<span class="opts">
|
|
|
|
<n8n-select size="mini" v-model="maxDisplayItems" @click.stop>
|
|
|
|
<n8n-option v-for="option in maxDisplayItemsOptions" :label="option" :value="option" :key="option" />
|
|
|
|
</n8n-select>
|
2021-09-11 04:19:32 -07:00
|
|
|
</span>/
|
2021-10-27 12:55:37 -07:00
|
|
|
<n8n-text :bold="true">{{ dataCount }}</n8n-text>
|
2021-08-29 04:36:17 -07:00
|
|
|
</div>
|
|
|
|
<n8n-tooltip
|
2019-06-23 03:35:23 -07:00
|
|
|
v-if="runMetadata"
|
|
|
|
placement="right"
|
|
|
|
>
|
2021-08-29 04:36:17 -07:00
|
|
|
<div slot="content">
|
2021-12-15 04:16:53 -08:00
|
|
|
<n8n-text :bold="true" size="small">{{ $locale.baseText('runData.startTime') + ':' }}</n8n-text> {{runMetadata.startTime}}<br/>
|
|
|
|
<n8n-text :bold="true" size="small">{{ $locale.baseText('runData.executionTime') + ':' }}</n8n-text> {{runMetadata.executionTime}} {{ $locale.baseText('runData.ms') }}
|
2021-08-29 04:36:17 -07:00
|
|
|
</div>
|
|
|
|
<font-awesome-icon icon="info-circle" class="primary-color" />
|
|
|
|
</n8n-tooltip>
|
2021-10-27 12:55:37 -07:00
|
|
|
<n8n-text :bold="true" v-if="maxOutputIndex > 0">
|
2021-12-15 04:16:53 -08:00
|
|
|
| {{ $locale.baseText('runData.output') }}:
|
2021-10-27 12:55:37 -07:00
|
|
|
</n8n-text>
|
2021-08-29 04:36:17 -07:00
|
|
|
<span class="opts" v-if="maxOutputIndex > 0" >
|
|
|
|
<n8n-select size="mini" v-model="outputIndex" @click.stop>
|
|
|
|
<n8n-option v-for="option in (maxOutputIndex + 1)" :label="getOutputName(option-1)" :value="option -1" :key="option">
|
|
|
|
</n8n-option>
|
|
|
|
</n8n-select>
|
2019-06-23 03:35:23 -07:00
|
|
|
</span>
|
2019-06-27 05:07:45 -07:00
|
|
|
|
2021-10-27 12:55:37 -07:00
|
|
|
<n8n-text :bold="true" v-if="maxRunIndex > 0">
|
2021-12-15 04:16:53 -08:00
|
|
|
| {{ $locale.baseText('runData.dataOfExecution') }}:
|
2021-10-27 12:55:37 -07:00
|
|
|
</n8n-text>
|
2021-08-29 04:36:17 -07:00
|
|
|
<span class="opts">
|
|
|
|
<n8n-select v-if="maxRunIndex > 0" size="mini" v-model="runIndex" @click.stop>
|
|
|
|
<n8n-option v-for="option in (maxRunIndex + 1)" :label="option + '/' + (maxRunIndex+1)" :value="option-1" :key="option">
|
|
|
|
</n8n-option>
|
|
|
|
</n8n-select>
|
|
|
|
</span>
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
</div>
|
2021-08-29 04:36:17 -07:00
|
|
|
<div v-if="hasNodeRun && !hasRunError" class="title-data-display-selector" @click.stop>
|
2019-06-23 03:35:23 -07:00
|
|
|
<el-radio-group v-model="displayMode" size="mini">
|
2021-12-15 04:16:53 -08:00
|
|
|
<el-radio-button :label="$locale.baseText('runData.json')" :disabled="showData === false"></el-radio-button>
|
|
|
|
<el-radio-button :label="$locale.baseText('runData.table')"></el-radio-button>
|
|
|
|
<el-radio-button :label="$locale.baseText('runData.binary')" v-if="binaryData.length !== 0"></el-radio-button>
|
2019-06-23 03:35:23 -07:00
|
|
|
</el-radio-group>
|
|
|
|
</div>
|
2022-01-07 13:02:21 -08:00
|
|
|
<div v-if="hasNodeRun && !hasRunError && displayMode === $locale.baseText('runData.json') && state.path !== deselectedPlaceholder" class="select-button">
|
2020-12-18 09:55:53 -08:00
|
|
|
<el-dropdown trigger="click" @command="handleCopyClick">
|
|
|
|
<span class="el-dropdown-link">
|
2021-12-15 04:16:53 -08:00
|
|
|
<n8n-icon-button :title="$locale.baseText('runData.copyToClipboard')" icon="copy" />
|
2020-12-18 09:55:53 -08:00
|
|
|
</span>
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
2021-11-10 10:41:40 -08:00
|
|
|
<el-dropdown-item :command="{command: 'itemPath'}">
|
2021-12-15 04:16:53 -08:00
|
|
|
{{ $locale.baseText('runData.copyItemPath') }}
|
2021-11-10 10:41:40 -08:00
|
|
|
</el-dropdown-item>
|
|
|
|
<el-dropdown-item :command="{command: 'parameterPath'}">
|
2021-12-15 04:16:53 -08:00
|
|
|
{{ $locale.baseText('runData.copyParameterPath') }}
|
2021-11-10 10:41:40 -08:00
|
|
|
</el-dropdown-item>
|
|
|
|
<el-dropdown-item :command="{command: 'value'}">
|
2021-12-15 04:16:53 -08:00
|
|
|
{{ $locale.baseText('runData.copyValue') }}
|
2021-11-10 10:41:40 -08:00
|
|
|
</el-dropdown-item>
|
2020-12-18 09:55:53 -08:00
|
|
|
</el-dropdown-menu>
|
|
|
|
</el-dropdown>
|
|
|
|
</div>
|
2019-06-23 03:35:23 -07:00
|
|
|
</div>
|
|
|
|
<div class="data-display-content">
|
|
|
|
<span v-if="node && workflowRunData !== null && workflowRunData.hasOwnProperty(node.name)">
|
|
|
|
<div v-if="workflowRunData[node.name][runIndex].error" class="error-display">
|
2021-04-16 09:33:36 -07:00
|
|
|
<NodeErrorView :error="workflowRunData[node.name][runIndex].error" />
|
2019-06-23 03:35:23 -07:00
|
|
|
</div>
|
|
|
|
<span v-else>
|
2021-08-29 04:36:17 -07:00
|
|
|
<div v-if="showData === false" class="too-much-data">
|
2019-10-02 06:30:51 -07:00
|
|
|
<h3>
|
2021-12-15 04:16:53 -08:00
|
|
|
{{ $locale.baseText('runData.nodeReturnedALargeAmountOfData') }}
|
2019-10-02 06:30:51 -07:00
|
|
|
</h3>
|
|
|
|
|
|
|
|
<div class="text">
|
2022-03-05 11:11:34 -08:00
|
|
|
<span v-html="$locale.baseText(
|
2021-11-10 10:41:40 -08:00
|
|
|
'runData.theNodeContains',
|
|
|
|
{
|
|
|
|
interpolate: {
|
|
|
|
numberOfKb: parseInt(dataSize/1024).toLocaleString()
|
|
|
|
}
|
|
|
|
}
|
2022-03-05 11:11:34 -08:00
|
|
|
)"></span>
|
2019-10-02 06:30:51 -07:00
|
|
|
</div>
|
|
|
|
|
2021-08-29 04:36:17 -07:00
|
|
|
<n8n-button
|
|
|
|
icon="eye"
|
2021-12-15 04:16:53 -08:00
|
|
|
:label="$locale.baseText('runData.displayDataAnyway')"
|
2022-01-07 13:02:21 -08:00
|
|
|
@click="displayMode = $locale.baseText('runData.table');showData = true;"
|
2021-08-29 04:36:17 -07:00
|
|
|
/>
|
2019-10-02 06:30:51 -07:00
|
|
|
</div>
|
2022-01-07 13:02:21 -08:00
|
|
|
<div v-else-if="[$locale.baseText('runData.json'), $locale.baseText('runData.table')].includes(displayMode)">
|
2019-06-23 03:35:23 -07:00
|
|
|
<div v-if="jsonData.length === 0" class="no-data">
|
2021-12-15 04:16:53 -08:00
|
|
|
{{ $locale.baseText('runData.noTextDataFound') }}
|
2019-06-23 03:35:23 -07:00
|
|
|
</div>
|
2022-01-07 13:02:21 -08:00
|
|
|
<div v-else-if="displayMode === $locale.baseText('runData.table')">
|
2019-06-23 03:35:23 -07:00
|
|
|
<div v-if="tableData !== null && tableData.columns.length === 0" class="no-data">
|
2021-12-15 04:16:53 -08:00
|
|
|
{{ $locale.baseText('runData.entriesExistButThey') }}
|
2019-06-23 03:35:23 -07:00
|
|
|
</div>
|
|
|
|
<table v-else-if="tableData !== null">
|
|
|
|
<tr>
|
|
|
|
<th v-for="column in tableData.columns" :key="column">{{column}}</th>
|
|
|
|
</tr>
|
|
|
|
<tr v-for="(row, index1) in tableData.data" :key="index1">
|
|
|
|
<td v-for="(data, index2) in row" :key="index2">{{ [null, undefined].includes(data) ? ' ' : data }}</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
2020-12-18 09:55:53 -08:00
|
|
|
<vue-json-pretty
|
2022-01-07 13:02:21 -08:00
|
|
|
v-else-if="displayMode === $locale.baseText('runData.json')"
|
2019-11-23 01:23:26 -08:00
|
|
|
:data="jsonData"
|
2020-12-18 09:55:53 -08:00
|
|
|
:deep="10"
|
|
|
|
v-model="state.path"
|
|
|
|
:showLine="true"
|
|
|
|
:showLength="true"
|
|
|
|
selectableType="single"
|
|
|
|
path=""
|
|
|
|
:highlightSelectedNode="true"
|
|
|
|
:selectOnClickNode="true"
|
|
|
|
@click="dataItemClicked"
|
2019-10-02 06:30:51 -07:00
|
|
|
class="json-data"
|
2019-11-23 01:23:26 -08:00
|
|
|
/>
|
2019-06-23 03:35:23 -07:00
|
|
|
</div>
|
2022-01-07 13:02:21 -08:00
|
|
|
<div v-else-if="displayMode === $locale.baseText('runData.binary')">
|
2019-06-23 03:35:23 -07:00
|
|
|
<div v-if="binaryData.length === 0" class="no-data">
|
2021-12-15 04:16:53 -08:00
|
|
|
{{ $locale.baseText('runData.noBinaryDataFound') }}
|
2019-06-23 03:35:23 -07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div v-else>
|
|
|
|
<div v-for="(binaryDataEntry, index) in binaryData" :key="index">
|
|
|
|
<div class="binary-data-row-index">
|
|
|
|
<div class="binary-data-cell-index">
|
|
|
|
{{index + 1}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="binary-data-row">
|
|
|
|
<div class="binary-data-cell" v-for="(binaryData, key) in binaryDataEntry" :key="index + '_' + key">
|
|
|
|
<div class="binary-data-information">
|
|
|
|
<div class="binary-data-cell-name">
|
|
|
|
{{key}}
|
|
|
|
</div>
|
|
|
|
<div v-if="binaryData.fileName">
|
2021-12-15 04:16:53 -08:00
|
|
|
<div class="label">{{ $locale.baseText('runData.fileName') }}: </div>
|
2019-06-23 03:35:23 -07:00
|
|
|
<div class="value">{{binaryData.fileName}}</div>
|
|
|
|
</div>
|
2021-03-18 10:13:24 -07:00
|
|
|
<div v-if="binaryData.directory">
|
2021-12-15 04:16:53 -08:00
|
|
|
<div class="label">{{ $locale.baseText('runData.directory') }}: </div>
|
2021-03-18 10:13:24 -07:00
|
|
|
<div class="value">{{binaryData.directory}}</div>
|
2021-02-15 04:25:30 -08:00
|
|
|
</div>
|
2019-06-23 03:35:23 -07:00
|
|
|
<div v-if="binaryData.fileExtension">
|
2021-12-15 04:16:53 -08:00
|
|
|
<div class="label">{{ $locale.baseText('runData.fileExtension') }}:</div>
|
2019-06-23 03:35:23 -07:00
|
|
|
<div class="value">{{binaryData.fileExtension}}</div>
|
|
|
|
</div>
|
|
|
|
<div v-if="binaryData.mimeType">
|
2021-12-15 04:16:53 -08:00
|
|
|
<div class="label">{{ $locale.baseText('runData.mimeType') }}: </div>
|
2019-06-23 03:35:23 -07:00
|
|
|
<div class="value">{{binaryData.mimeType}}</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="binary-data-show-data-button-wrapper">
|
2021-12-15 04:16:53 -08:00
|
|
|
<n8n-button size="small" :label="$locale.baseText('runData.showBinaryData')" class="binary-data-show-data-button" @click="displayBinaryData(index, key)" />
|
2019-06-23 03:35:23 -07:00
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
<div v-else class="message">
|
|
|
|
<div>
|
2021-12-15 04:16:53 -08:00
|
|
|
<n8n-text :bold="true">{{ $locale.baseText('runData.noData') }}</n8n-text ><br />
|
2019-06-23 03:35:23 -07:00
|
|
|
<br />
|
2021-12-15 04:16:53 -08:00
|
|
|
{{ $locale.baseText('runData.dataReturnedByThisNodeWillDisplayHere') }}<br />
|
2019-06-23 03:35:23 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-12-18 09:55:53 -08:00
|
|
|
//@ts-ignore
|
|
|
|
import VueJsonPretty from 'vue-json-pretty';
|
2019-06-23 03:35:23 -07:00
|
|
|
import {
|
|
|
|
GenericValue,
|
|
|
|
IBinaryKeyData,
|
|
|
|
IDataObject,
|
|
|
|
INodeExecutionData,
|
2021-11-19 01:17:13 -08:00
|
|
|
INodeTypeDescription,
|
2019-06-23 03:35:23 -07:00
|
|
|
IRunData,
|
|
|
|
IRunExecutionData,
|
|
|
|
ITaskData,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
|
|
|
import {
|
|
|
|
IBinaryDisplayData,
|
|
|
|
IExecutionResponse,
|
|
|
|
INodeUi,
|
|
|
|
ITableData,
|
|
|
|
} from '@/Interface';
|
|
|
|
|
2020-05-23 15:53:06 -07:00
|
|
|
import {
|
|
|
|
MAX_DISPLAY_DATA_SIZE,
|
|
|
|
MAX_DISPLAY_ITEMS_AUTO_ALL,
|
|
|
|
} from '@/constants';
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
import BinaryDataDisplay from '@/components/BinaryDataDisplay.vue';
|
2021-11-10 10:41:40 -08:00
|
|
|
import NodeErrorView from '@/components/Error/NodeErrorView.vue';
|
2019-06-23 03:35:23 -07:00
|
|
|
|
2020-12-18 09:55:53 -08:00
|
|
|
import { copyPaste } from '@/components/mixins/copyPaste';
|
2021-05-05 17:46:33 -07:00
|
|
|
import { externalHooks } from "@/components/mixins/externalHooks";
|
2019-06-23 03:35:23 -07:00
|
|
|
import { genericHelpers } from '@/components/mixins/genericHelpers';
|
|
|
|
import { nodeHelpers } from '@/components/mixins/nodeHelpers';
|
|
|
|
import { workflowRun } from '@/components/mixins/workflowRun';
|
|
|
|
|
|
|
|
import mixins from 'vue-typed-mixins';
|
|
|
|
|
2020-12-18 09:55:53 -08:00
|
|
|
// A path that does not exist so that nothing is selected by default
|
|
|
|
const deselectedPlaceholder = '_!^&*';
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
export default mixins(
|
2020-12-18 09:55:53 -08:00
|
|
|
copyPaste,
|
2021-05-05 17:46:33 -07:00
|
|
|
externalHooks,
|
2019-06-23 03:35:23 -07:00
|
|
|
genericHelpers,
|
|
|
|
nodeHelpers,
|
|
|
|
workflowRun,
|
|
|
|
)
|
|
|
|
.extend({
|
|
|
|
name: 'RunData',
|
|
|
|
components: {
|
|
|
|
BinaryDataDisplay,
|
2021-04-16 09:33:36 -07:00
|
|
|
NodeErrorView,
|
2020-12-18 09:55:53 -08:00
|
|
|
VueJsonPretty,
|
2019-06-23 03:35:23 -07:00
|
|
|
},
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
binaryDataPreviewActive: false,
|
2019-10-02 06:30:51 -07:00
|
|
|
dataSize: 0,
|
2020-12-18 09:55:53 -08:00
|
|
|
deselectedPlaceholder,
|
2022-01-07 13:02:21 -08:00
|
|
|
displayMode: this.$locale.baseText('runData.table'),
|
2020-12-18 09:55:53 -08:00
|
|
|
state: {
|
|
|
|
value: '' as object | number | string,
|
|
|
|
path: deselectedPlaceholder,
|
|
|
|
},
|
2019-06-23 03:35:23 -07:00
|
|
|
runIndex: 0,
|
2019-10-02 06:30:51 -07:00
|
|
|
showData: false,
|
2019-06-23 03:35:23 -07:00
|
|
|
outputIndex: 0,
|
2020-05-23 15:53:06 -07:00
|
|
|
maxDisplayItems: 25 as number | null,
|
2019-06-23 03:35:23 -07:00
|
|
|
binaryDataDisplayVisible: false,
|
|
|
|
binaryDataDisplayData: null as IBinaryDisplayData | null,
|
2020-05-23 15:53:06 -07:00
|
|
|
|
|
|
|
MAX_DISPLAY_DATA_SIZE,
|
|
|
|
MAX_DISPLAY_ITEMS_AUTO_ALL,
|
2019-06-23 03:35:23 -07:00
|
|
|
};
|
|
|
|
},
|
2021-09-15 01:11:59 -07:00
|
|
|
mounted() {
|
|
|
|
this.init();
|
|
|
|
},
|
2019-06-23 03:35:23 -07:00
|
|
|
computed: {
|
2021-08-29 04:36:17 -07:00
|
|
|
hasNodeRun(): boolean {
|
|
|
|
return Boolean(this.node && this.workflowRunData && this.workflowRunData.hasOwnProperty(this.node.name));
|
|
|
|
},
|
|
|
|
hasRunError(): boolean {
|
|
|
|
return Boolean(this.node && this.workflowRunData && this.workflowRunData[this.node.name] && this.workflowRunData[this.node.name][this.runIndex] && this.workflowRunData[this.node.name][this.runIndex].error);
|
|
|
|
},
|
2019-06-23 03:35:23 -07:00
|
|
|
workflowRunning (): boolean {
|
|
|
|
return this.$store.getters.isActionActive('workflowRunning');
|
|
|
|
},
|
|
|
|
workflowExecution (): IExecutionResponse | null {
|
|
|
|
return this.$store.getters.getWorkflowExecution;
|
|
|
|
},
|
|
|
|
workflowRunData (): IRunData | null {
|
|
|
|
if (this.workflowExecution === null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
const executionData: IRunExecutionData = this.workflowExecution.data;
|
|
|
|
return executionData.resultData.runData;
|
|
|
|
},
|
2020-05-23 15:53:06 -07:00
|
|
|
maxDisplayItemsOptions (): number[] {
|
2020-07-10 01:12:30 -07:00
|
|
|
const options = [25, 50, 100, 250, 500, 1000].filter(option => option <= this.dataCount);
|
|
|
|
if (!options.includes(this.dataCount)) {
|
|
|
|
options.push(this.dataCount);
|
|
|
|
}
|
|
|
|
return options;
|
2020-05-23 15:53:06 -07:00
|
|
|
},
|
2019-06-23 03:35:23 -07:00
|
|
|
node (): INodeUi | null {
|
|
|
|
return this.$store.getters.activeNode;
|
|
|
|
},
|
|
|
|
runMetadata () {
|
|
|
|
if (!this.node || this.workflowExecution === null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const runData = this.workflowRunData;
|
|
|
|
|
|
|
|
if (runData === null || !runData.hasOwnProperty(this.node.name)) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (runData[this.node.name].length <= this.runIndex) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const taskData: ITaskData = runData[this.node.name][this.runIndex];
|
|
|
|
return {
|
|
|
|
executionTime: taskData.executionTime,
|
|
|
|
startTime: new Date(taskData.startTime).toLocaleString(),
|
|
|
|
};
|
|
|
|
},
|
|
|
|
dataCount (): number {
|
|
|
|
if (this.node === null) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const runData: IRunData | null = this.workflowRunData;
|
|
|
|
|
|
|
|
if (runData === null || !runData.hasOwnProperty(this.node.name)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (runData[this.node.name].length <= this.runIndex) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (runData[this.node.name][this.runIndex].hasOwnProperty('error')) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!runData[this.node.name][this.runIndex].hasOwnProperty('data') ||
|
|
|
|
runData[this.node.name][this.runIndex].data === undefined
|
|
|
|
) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const inputData = this.getMainInputData(runData[this.node.name][this.runIndex].data!, this.outputIndex);
|
|
|
|
|
|
|
|
return inputData.length;
|
|
|
|
},
|
|
|
|
maxOutputIndex (): number {
|
|
|
|
if (this.node === null) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const runData: IRunData | null = this.workflowRunData;
|
|
|
|
|
|
|
|
if (runData === null || !runData.hasOwnProperty(this.node.name)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (runData[this.node.name].length < this.runIndex) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (runData[this.node.name][this.runIndex].data === undefined ||
|
|
|
|
runData[this.node.name][this.runIndex].data!.main === undefined
|
|
|
|
) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return runData[this.node.name][this.runIndex].data!.main.length - 1;
|
|
|
|
},
|
|
|
|
maxRunIndex (): number {
|
|
|
|
if (this.node === null) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const runData: IRunData | null = this.workflowRunData;
|
|
|
|
|
|
|
|
if (runData === null || !runData.hasOwnProperty(this.node.name)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (runData[this.node.name].length) {
|
|
|
|
return runData[this.node.name].length - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
},
|
|
|
|
jsonData (): IDataObject[] {
|
2020-05-23 15:53:06 -07:00
|
|
|
let inputData = this.getNodeInputData(this.node, this.runIndex, this.outputIndex);
|
2019-12-23 12:54:27 -08:00
|
|
|
if (inputData.length === 0 || !Array.isArray(inputData)) {
|
2019-06-23 03:35:23 -07:00
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
2020-05-23 15:53:06 -07:00
|
|
|
if (this.maxDisplayItems !== null) {
|
|
|
|
inputData = inputData.slice(0, this.maxDisplayItems);
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
return this.convertToJson(inputData);
|
|
|
|
},
|
|
|
|
tableData (): ITableData | undefined {
|
2020-05-23 15:53:06 -07:00
|
|
|
let inputData = this.getNodeInputData(this.node, this.runIndex, this.outputIndex);
|
2019-06-23 03:35:23 -07:00
|
|
|
if (inputData.length === 0) {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
2020-05-23 15:53:06 -07:00
|
|
|
if (this.maxDisplayItems !== null) {
|
|
|
|
inputData = inputData.slice(0,this.maxDisplayItems);
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
return this.convertToTable(inputData);
|
|
|
|
},
|
|
|
|
binaryData (): IBinaryKeyData[] {
|
|
|
|
if (this.node === null) {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.getBinaryData(this.workflowRunData, this.node.name, this.runIndex, this.outputIndex);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
2021-09-15 01:11:59 -07:00
|
|
|
init() {
|
|
|
|
// Reset the selected output index every time another node gets selected
|
|
|
|
this.outputIndex = 0;
|
|
|
|
this.maxDisplayItems = 25;
|
|
|
|
this.refreshDataSize();
|
2022-01-07 13:02:21 -08:00
|
|
|
if (this.displayMode === this.$locale.baseText('runData.binary')) {
|
2021-09-15 01:11:59 -07:00
|
|
|
this.closeBinaryDataDisplay();
|
|
|
|
if (this.binaryData.length === 0) {
|
2022-01-07 13:02:21 -08:00
|
|
|
this.displayMode = this.$locale.baseText('runData.table');
|
2021-09-15 01:11:59 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-06-23 03:35:23 -07:00
|
|
|
closeBinaryDataDisplay () {
|
|
|
|
this.binaryDataDisplayVisible = false;
|
|
|
|
this.binaryDataDisplayData = null;
|
|
|
|
},
|
|
|
|
convertToJson (inputData: INodeExecutionData[]): IDataObject[] {
|
|
|
|
const returnData: IDataObject[] = [];
|
|
|
|
inputData.forEach((data) => {
|
|
|
|
if (!data.hasOwnProperty('json')) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
returnData.push(data.json);
|
|
|
|
});
|
|
|
|
|
|
|
|
return returnData;
|
|
|
|
},
|
|
|
|
convertToTable (inputData: INodeExecutionData[]): ITableData | undefined {
|
|
|
|
const tableData: GenericValue[][] = [];
|
|
|
|
const tableColumns: string[] = [];
|
|
|
|
let leftEntryColumns: string[], entryRows: GenericValue[];
|
|
|
|
// Go over all entries
|
|
|
|
let entry: IDataObject;
|
|
|
|
inputData.forEach((data) => {
|
|
|
|
if (!data.hasOwnProperty('json')) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
entry = data.json;
|
|
|
|
|
|
|
|
// Go over all keys of entry
|
|
|
|
entryRows = [];
|
|
|
|
leftEntryColumns = Object.keys(entry);
|
|
|
|
|
|
|
|
// Go over all the already existing column-keys
|
|
|
|
tableColumns.forEach((key) => {
|
|
|
|
if (entry.hasOwnProperty(key)) {
|
|
|
|
// Entry does have key so add its value
|
|
|
|
entryRows.push(entry[key]);
|
|
|
|
// Remove key so that we know that it got added
|
|
|
|
leftEntryColumns.splice(leftEntryColumns.indexOf(key), 1);
|
|
|
|
} else {
|
|
|
|
// Entry does not have key so add null
|
|
|
|
entryRows.push(null);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Go over all the columns the entry has but did not exist yet
|
|
|
|
leftEntryColumns.forEach((key) => {
|
|
|
|
// Add the key for all runs in the future
|
|
|
|
tableColumns.push(key);
|
|
|
|
// Add the value
|
|
|
|
entryRows.push(entry[key]);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Add the data of the entry
|
|
|
|
tableData.push(entryRows);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Make sure that all entry-rows have the same length
|
|
|
|
tableData.forEach((entryRows) => {
|
|
|
|
if (tableColumns.length > entryRows.length) {
|
|
|
|
// Has to less entries so add the missing ones
|
|
|
|
entryRows.push.apply(entryRows, new Array(tableColumns.length - entryRows.length));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
|
|
|
columns: tableColumns,
|
|
|
|
data: tableData,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
clearExecutionData () {
|
|
|
|
this.$store.commit('setWorkflowExecutionData', null);
|
|
|
|
this.updateNodesExecutionIssues();
|
|
|
|
},
|
2020-12-18 09:55:53 -08:00
|
|
|
dataItemClicked (path: string, data: object | number | string) {
|
|
|
|
this.state.value = data;
|
|
|
|
},
|
2019-06-23 03:35:23 -07:00
|
|
|
displayBinaryData (index: number, key: string) {
|
|
|
|
this.binaryDataDisplayVisible = true;
|
|
|
|
|
|
|
|
this.binaryDataDisplayData = {
|
|
|
|
node: this.node!.name,
|
|
|
|
runIndex: this.runIndex,
|
|
|
|
outputIndex: this.outputIndex,
|
|
|
|
index,
|
|
|
|
key,
|
|
|
|
};
|
|
|
|
},
|
2020-12-18 09:55:53 -08:00
|
|
|
getOutputName (outputIndex: number) {
|
|
|
|
if (this.node === null) {
|
|
|
|
return outputIndex + 1;
|
|
|
|
}
|
|
|
|
|
2022-02-05 03:57:48 -08:00
|
|
|
const nodeType = this.$store.getters.nodeType(this.node.type, this.node.typeVersion) as INodeTypeDescription | null;
|
2021-11-19 01:17:13 -08:00
|
|
|
if (!nodeType || !nodeType.outputNames || nodeType.outputNames.length <= outputIndex) {
|
2020-12-18 09:55:53 -08:00
|
|
|
return outputIndex + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nodeType.outputNames[outputIndex];
|
|
|
|
},
|
|
|
|
convertPath (path: string): string {
|
|
|
|
// TODO: That can for sure be done fancier but for now it works
|
|
|
|
const placeholder = '*___~#^#~___*';
|
|
|
|
let inBrackets = path.match(/\[(.*?)\]/g);
|
|
|
|
|
|
|
|
if (inBrackets === null) {
|
|
|
|
inBrackets = [];
|
|
|
|
} else {
|
|
|
|
inBrackets = inBrackets.map(item => item.slice(1, -1)).map(item => {
|
|
|
|
if (item.startsWith('"') && item.endsWith('"')) {
|
|
|
|
return item.slice(1, -1);
|
|
|
|
}
|
|
|
|
return item;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
const withoutBrackets = path.replace(/\[(.*?)\]/g, placeholder);
|
|
|
|
const pathParts = withoutBrackets.split('.');
|
|
|
|
const allParts = [] as string[];
|
|
|
|
pathParts.forEach(part => {
|
|
|
|
let index = part.indexOf(placeholder);
|
|
|
|
while(index !== -1) {
|
|
|
|
if (index === 0) {
|
|
|
|
allParts.push(inBrackets!.shift() as string);
|
|
|
|
part = part.substr(placeholder.length);
|
|
|
|
} else {
|
|
|
|
allParts.push(part.substr(0, index));
|
|
|
|
part = part.substr(index);
|
|
|
|
}
|
|
|
|
index = part.indexOf(placeholder);
|
|
|
|
}
|
|
|
|
if (part !== '') {
|
|
|
|
allParts.push(part);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return '["' + allParts.join('"]["') + '"]';
|
|
|
|
},
|
|
|
|
handleCopyClick (commandData: { command: string }) {
|
|
|
|
const newPath = this.convertPath(this.state.path);
|
|
|
|
|
|
|
|
let value: string;
|
|
|
|
if (commandData.command === 'value') {
|
|
|
|
if (typeof this.state.value === 'object') {
|
|
|
|
value = JSON.stringify(this.state.value, null, 2);
|
|
|
|
} else {
|
|
|
|
value = this.state.value.toString();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
let startPath = '';
|
|
|
|
let path = '';
|
|
|
|
if (commandData.command === 'itemPath') {
|
|
|
|
const pathParts = newPath.split(']');
|
|
|
|
const index = pathParts[0].slice(1);
|
|
|
|
path = pathParts.slice(1).join(']');
|
|
|
|
startPath = `$item(${index}).$node["${this.node!.name}"].json`;
|
|
|
|
} else if (commandData.command === 'parameterPath') {
|
|
|
|
path = newPath.split(']').slice(1).join(']');
|
|
|
|
startPath = `$node["${this.node!.name}"].json`;
|
|
|
|
}
|
|
|
|
if (!path.startsWith('[') && !path.startsWith('.') && path) {
|
|
|
|
path += '.';
|
|
|
|
}
|
|
|
|
value = `{{ ${startPath + path} }}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.copyToClipboard(value);
|
|
|
|
},
|
2019-10-04 04:27:50 -07:00
|
|
|
refreshDataSize () {
|
2019-10-02 06:30:51 -07:00
|
|
|
// Hide by default the data from being displayed
|
|
|
|
this.showData = false;
|
|
|
|
|
|
|
|
// Check how much data there is to display
|
|
|
|
const inputData = this.getNodeInputData(this.node, this.runIndex, this.outputIndex);
|
2020-05-23 14:54:56 -07:00
|
|
|
|
2020-05-23 15:53:06 -07:00
|
|
|
const jsonItems = inputData.slice(0, this.maxDisplayItems || inputData.length).map(item => item.json);
|
2020-05-23 14:54:56 -07:00
|
|
|
|
|
|
|
this.dataSize = JSON.stringify(jsonItems).length;
|
2019-10-04 04:27:50 -07:00
|
|
|
|
2020-05-23 15:53:06 -07:00
|
|
|
if (this.dataSize < this.MAX_DISPLAY_DATA_SIZE) {
|
2019-10-04 04:27:50 -07:00
|
|
|
// Data is reasonable small (< 200kb) so display it directly
|
2019-10-02 06:30:51 -07:00
|
|
|
this.showData = true;
|
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
},
|
2019-10-04 04:27:50 -07:00
|
|
|
},
|
|
|
|
watch: {
|
2021-09-15 01:11:59 -07:00
|
|
|
node() {
|
|
|
|
this.init();
|
2019-10-04 04:27:50 -07:00
|
|
|
},
|
|
|
|
jsonData () {
|
|
|
|
this.refreshDataSize();
|
|
|
|
},
|
2021-05-05 17:46:33 -07:00
|
|
|
displayMode (newValue, oldValue) {
|
2019-06-23 03:35:23 -07:00
|
|
|
this.closeBinaryDataDisplay();
|
2021-05-05 17:46:33 -07:00
|
|
|
this.$externalHooks().run('runData.displayModeChanged', { newValue, oldValue });
|
2021-10-18 20:57:49 -07:00
|
|
|
if(this.node) {
|
|
|
|
const nodeType = this.node ? this.node.type : '';
|
|
|
|
this.$telemetry.track('User changed node output view mode', { old_mode: oldValue, new_mode: newValue, node_type: nodeType, workflow_id: this.$store.getters.workflowId });
|
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
},
|
|
|
|
maxRunIndex () {
|
|
|
|
this.runIndex = Math.min(this.runIndex, this.maxRunIndex);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
|
|
.run-data-view {
|
|
|
|
position: relative;
|
2021-09-11 01:15:36 -07:00
|
|
|
width: 100%;
|
2019-06-23 03:35:23 -07:00
|
|
|
height: 100%;
|
|
|
|
background-color: #f9f9f9;
|
|
|
|
|
|
|
|
.data-display-content {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
top: 50px;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
overflow-y: auto;
|
2021-08-29 04:36:17 -07:00
|
|
|
line-height: 1.5;
|
2021-09-11 01:15:36 -07:00
|
|
|
word-break: normal;
|
2021-10-27 12:55:37 -07:00
|
|
|
font-size: var(--font-size-s);
|
2019-06-23 03:35:23 -07:00
|
|
|
|
|
|
|
.binary-data-row {
|
|
|
|
display: inline-flex;
|
|
|
|
padding: 0.5em 1em;
|
|
|
|
|
|
|
|
.binary-data-cell {
|
|
|
|
display: inline-block;
|
|
|
|
width: 300px;
|
|
|
|
overflow: hidden;
|
|
|
|
background-color: #fff;
|
|
|
|
margin-right: 1em;
|
|
|
|
border-radius: 3px;
|
|
|
|
-webkit-box-shadow: 0px 0px 12px 0px rgba(0,0,0,0.05);
|
|
|
|
-moz-box-shadow: 0px 0px 12px 0px rgba(0,0,0,0.05);
|
|
|
|
box-shadow: 0px 0px 12px 0px rgba(0,0,0,0.05);
|
|
|
|
|
|
|
|
.binary-data-information {
|
|
|
|
margin: 1em;
|
|
|
|
|
|
|
|
.binary-data-cell-name {
|
|
|
|
color: $--color-primary;
|
|
|
|
font-weight: 600;
|
|
|
|
font-size: 1.2em;
|
|
|
|
padding-bottom: 0.5em;
|
|
|
|
margin-bottom: 0.5em;
|
|
|
|
border-bottom: 1px solid #ccc;
|
|
|
|
}
|
|
|
|
|
|
|
|
.binary-data-show-data-button-wrapper {
|
|
|
|
margin-top: 1.5em;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.label {
|
|
|
|
padding-top: 0.5em;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
.value {
|
|
|
|
white-space: initial;
|
|
|
|
word-wrap: break-word;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.binary-data-row-index {
|
|
|
|
display: block;
|
|
|
|
padding: 1em 1em 0.25em 1em;
|
|
|
|
|
|
|
|
.binary-data-cell-index {
|
|
|
|
display: inline-block;
|
|
|
|
width: 30px;
|
|
|
|
height: 30px;
|
|
|
|
line-height: 30px;
|
|
|
|
border-radius: 5px;
|
|
|
|
text-align: center;
|
|
|
|
padding: 0 0.1em;
|
|
|
|
background-color: $--custom-header-background;
|
|
|
|
font-weight: 600;
|
|
|
|
color: #fff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.json-data {
|
2021-08-29 04:36:17 -07:00
|
|
|
line-height: 1.5;
|
|
|
|
|
2020-12-18 09:55:53 -08:00
|
|
|
&.vjs-tree {
|
2019-11-23 01:23:26 -08:00
|
|
|
color: $--custom-input-font;
|
2019-11-16 14:36:50 -08:00
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
.error-display,
|
|
|
|
.json-data,
|
|
|
|
.message,
|
|
|
|
.no-data {
|
2019-10-02 06:30:51 -07:00
|
|
|
margin: 1em;
|
|
|
|
}
|
|
|
|
|
2021-08-29 04:36:17 -07:00
|
|
|
.too-much-data {
|
2019-10-02 06:30:51 -07:00
|
|
|
margin: 1em;
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
.text {
|
|
|
|
margin-bottom: 1em;
|
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
table {
|
|
|
|
border-collapse: collapse;
|
|
|
|
text-align: left;
|
|
|
|
width: calc(100% - 1px);
|
|
|
|
border-left: 25px solid #00000000;
|
|
|
|
border-right: 25px solid #00000000;
|
|
|
|
|
|
|
|
th {
|
|
|
|
background-color: $--custom-table-background-main;
|
|
|
|
color: #fff;
|
|
|
|
padding: 12px;
|
|
|
|
}
|
|
|
|
td {
|
|
|
|
padding: 12px;
|
|
|
|
}
|
|
|
|
tr:nth-child(even) {
|
|
|
|
background: #fff;;
|
|
|
|
}
|
|
|
|
tr:nth-child(odd) {
|
2021-05-29 11:31:21 -07:00
|
|
|
background: $--custom-table-background-stripe-color;
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.execute-node-button {
|
|
|
|
position: absolute;
|
|
|
|
top: 10px;
|
|
|
|
right: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.header {
|
|
|
|
padding-top: 10px;
|
|
|
|
padding-left: 10px;
|
|
|
|
|
2021-08-29 04:36:17 -07:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
height: 40px;
|
|
|
|
|
2020-12-18 09:55:53 -08:00
|
|
|
.select-button {
|
|
|
|
height: 30px;
|
|
|
|
top: 50px;
|
|
|
|
right: 30px;
|
|
|
|
position: absolute;
|
|
|
|
text-align: right;
|
|
|
|
width: 200px;
|
|
|
|
z-index: 10;
|
|
|
|
}
|
|
|
|
|
2019-06-23 03:35:23 -07:00
|
|
|
.title-text {
|
2021-08-29 04:36:17 -07:00
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
2021-09-11 04:19:32 -07:00
|
|
|
|
|
|
|
> * {
|
|
|
|
margin-right: 2px;
|
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
.title-data-display-selector {
|
|
|
|
position: absolute;
|
|
|
|
left: calc(50% - 105px);
|
|
|
|
width: 210px;
|
|
|
|
display: inline-block;
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
.entry.active {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
}
|
2019-06-27 05:07:45 -07:00
|
|
|
|
2021-08-29 04:36:17 -07:00
|
|
|
.opts {
|
2019-06-27 05:07:45 -07:00
|
|
|
width: 80px;
|
|
|
|
z-index: 1;
|
|
|
|
}
|
2019-06-23 03:35:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|