n8n-editor-ui
Version:
Workflow Editor UI for n8n
3 lines (2 loc) • 5.1 kB
JavaScript
import{m as w}from"./pinia-6bf9956f.js";import{j as g}from"./jsonpath-af75f2ea.js";import{_ as T,$ as b,a0 as v,a1 as $,n as u,a2 as J,d as j,f as k,a3 as C,j as S,a4 as y,G as x}from"./index-906713a6.js";import"./axios-92f151e4.js";import{_ as D}from"./n8n-02caf295.js";import{d as I,b as p,o as l,f as N,c as P,w as i,e as r,l as c,t as d,g as V,n as G}from"./vendor-18a4b4e1.js";import"./flatted-8b14da7d.js";import"./@fortawesome/vue-fontawesome-f597912a.js";import"./@fortawesome/fontawesome-svg-core-984d6dde.js";import"./vue-i18n-c3b0f366.js";import"./uuid-cf522c50.js";import"./dateformat-8c1d9796.js";import"./lodash-es-876af2e5.js";import"./luxon-19e1de07.js";import"./@jsplumb/browser-ui-70b0a0d6.js";import"./@jsplumb/core-0a463c13.js";import"./@jsplumb/util-98a92a84.js";import"./@jsplumb/common-fe415eb9.js";import"./@jsplumb/connector-bezier-53998944.js";import"./@n8n/codemirror-lang-sql-9a304659.js";import"./codemirror-lang-n8n-expression-47e67c3a.js";import"./codemirror-lang-html-n8n-4223f8c7.js";import"./fast-json-stable-stringify-57a373c2.js";import"./prettier-51497383.js";import"./esprima-next-8c7e8ff9.js";import"./@vueuse/core-60457efe.js";import"./timeago.js-a9e71aec.js";import"./qrcode.vue-338130ab.js";import"./file-saver-0526b42c.js";import"./vue-json-pretty-95ec0e1b.js";import"./humanize-duration-6da291e3.js";import"./v3-infinite-loading-8fbfd594.js";import"./vue-agile-44d1a063.js";import"./copy-to-clipboard-4e2822ec.js";import"./vue3-touch-events-ee55ce04.js";import"./@fortawesome/free-solid-svg-icons-d79f1537.js";import"./@fortawesome/free-regular-svg-icons-74cb85f8.js";const O=I({name:"run-data-json-actions",mixins:[T,b,v,$],props:{node:{type:Object},paneType:{type:String},sessionId:{type:String},currentOutputIndex:{type:Number},runIndex:{type:Number},displayMode:{type:String},distanceFromActive:{type:Number},selectedJsonPath:{type:String,default:u},jsonData:{type:Array,required:!0}},setup(){return{i18n:x(),...J()}},computed:{...w(k,j),activeNode(){return this.ndvStore.activeNode},noSelection(){return this.selectedJsonPath===u},normalisedJsonPath(){return this.noSelection?'[""]':this.selectedJsonPath}},methods:{getJsonValue(){let t=g.query(this.jsonData,`$${this.normalisedJsonPath}`)[0];this.noSelection&&(this.hasPinData?t=C(this.pinData):t=S(this.getNodeInputData(this.node,this.runIndex,this.currentOutputIndex)));let e="";return typeof t=="object"?e=JSON.stringify(t,null,2):e=t.toString(),e},getJsonItemPath(){const t=y(this.normalisedJsonPath);let e="",s="";const a=t.split("]"),o=a[0].slice(1);return s=a.slice(1).join("]"),e=`$item(${o}).$node["${this.node.name}"].json`,{path:s,startPath:e}},getJsonParameterPath(){const e=y(this.normalisedJsonPath).split("]").slice(1).join("]");let s=`$node["${this.node.name}"].json`;return this.distanceFromActive===1&&(s="$json"),{path:e,startPath:s}},handleCopyClick(t){let e;if(t.command==="value")e=this.getJsonValue(),this.showToast({title:this.i18n.baseText("runData.copyValue.toast"),message:"",type:"success",duration:2e3});else{let a="",o="";if(t.command==="itemPath"){const n=this.getJsonItemPath();a=n.startPath,o=n.path,this.showToast({title:this.i18n.baseText("runData.copyItemPath.toast"),message:"",type:"success",duration:2e3})}else if(t.command==="parameterPath"){const n=this.getJsonParameterPath();a=n.startPath,o=n.path,this.showToast({title:this.i18n.baseText("runData.copyParameterPath.toast"),message:"",type:"success",duration:2e3})}!o.startsWith("[")&&!o.startsWith(".")&&o&&(o+="."),e=`{{ ${a+o} }}`}const s={value:"selection",itemPath:"item_path",parameterPath:"parameter_path"}[t.command];this.$telemetry.track("User copied ndv data",{node_type:this.activeNode.type,session_id:this.sessionId,run_index:this.runIndex,view:"json",copy_type:s,workflow_id:this.workflowsStore.workflowId,pane:this.paneType,in_execution_log:this.isReadOnlyRoute}),this.copyToClipboard(e)}}}),A="_actionsGroup_1ai92_5",B={actionsGroup:A},M={class:"el-dropdown-link"};function R(t,e,s,a,o,n){const h=p("n8n-icon-button"),m=p("el-dropdown-item"),f=p("el-dropdown-menu"),_=p("el-dropdown");return l(),N("div",{class:G(t.$style.actionsGroup)},[t.noSelection?(l(),P(h,{key:0,title:t.i18n.baseText("runData.copyToClipboard"),icon:"copy",type:"tertiary",circle:!1,onClick:e[0]||(e[0]=q=>t.handleCopyClick({command:"value"}))},null,8,["title"])):(l(),P(_,{key:1,trigger:"click",onCommand:t.handleCopyClick},{dropdown:i(()=>[r(f,null,{default:i(()=>[r(m,{command:{command:"value"}},{default:i(()=>[c(d(t.i18n.baseText("runData.copyValue")),1)]),_:1}),r(m,{command:{command:"itemPath"},divided:""},{default:i(()=>[c(d(t.i18n.baseText("runData.copyItemPath")),1)]),_:1}),r(m,{command:{command:"parameterPath"}},{default:i(()=>[c(d(t.i18n.baseText("runData.copyParameterPath")),1)]),_:1})]),_:1})]),default:i(()=>[V("span",M,[r(h,{title:t.i18n.baseText("runData.copyToClipboard"),icon:"copy",type:"tertiary",circle:!1},null,8,["title"])])]),_:1},8,["onCommand"]))],2)}const W={$style:B},jt=D(O,[["render",R],["__cssModules",W]]);export{jt as default};
//# sourceMappingURL=RunDataJsonActions-80c5e3f3.js.map