mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 05:17:28 -08:00
feat(editor): Add "Download" button if JSON data is to large (#6850)
* feat(editor): Add "Download" button if JSON data is to large
* ⚡ Some code improvements + change button style
---------
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
parent
6499f42481
commit
efe08cced3
|
@ -284,6 +284,12 @@
|
|||
:label="$locale.baseText('ndv.output.tooMuchData.showDataAnyway')"
|
||||
@click="showTooMuchData"
|
||||
/>
|
||||
|
||||
<n8n-button
|
||||
size="small"
|
||||
:label="$locale.baseText('runData.downloadBinaryData')"
|
||||
@click="downloadJsonData()"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
|
@ -1290,6 +1296,14 @@ export default defineComponent({
|
|||
saveAs(blob, fileName);
|
||||
}
|
||||
},
|
||||
async downloadJsonData() {
|
||||
const inputData = this.getNodeInputData(this.node, this.runIndex, this.currentOutputIndex);
|
||||
|
||||
const fileName = this.node!.name.replace(/[^\w\d]/g, '_');
|
||||
const blob = new Blob([JSON.stringify(inputData, null, 2)], { type: 'application/json' });
|
||||
|
||||
saveAs(blob, `${fileName}.json`);
|
||||
},
|
||||
displayBinaryData(index: number, key: string) {
|
||||
this.binaryDataDisplayVisible = true;
|
||||
|
||||
|
|
Loading…
Reference in a new issue