Improve hiding of large data

This commit is contained in:
Jan Oberhauser
2019-10-04 13:27:50 +02:00
parent 1ab8896c37
commit 199e7a7a2c

View File

@@ -68,7 +68,9 @@
<div class="text"> <div class="text">
The node contains {{parseInt(dataSize/1024).toLocaleString()}} KB of data.<br /> The node contains {{parseInt(dataSize/1024).toLocaleString()}} KB of data.<br />
Displaying it could cause problems! Displaying it could cause problems!<br />
<br />
If you decide to display it anyway avoid the JSON view!
</div> </div>
<el-button size="small" @click="displayMode = 'Table';showData = true;"> <el-button size="small" @click="displayMode = 'Table';showData = true;">
@@ -441,20 +443,16 @@ export default mixins(
key, key,
}; };
}, },
}, refreshDataSize () {
watch: {
node (newNode, oldNode) {
// Reset the selected output index every time another node gets selected
this.outputIndex = 0;
// Hide by default the data from being displayed // Hide by default the data from being displayed
this.showData = false; this.showData = false;
// Check how much data there is to display // Check how much data there is to display
const inputData = this.getNodeInputData(this.node, this.runIndex, this.outputIndex); const inputData = this.getNodeInputData(this.node, this.runIndex, this.outputIndex);
this.dataSize = JSON.stringify(inputData).length; this.dataSize = JSON.stringify(inputData).length;
if (this.dataSize < 102400) {
// Data is reasonable small (< 100kb) so display it directly if (this.dataSize < 204800) {
// Data is reasonable small (< 200kb) so display it directly
this.showData = true; this.showData = true;
} }
@@ -462,6 +460,16 @@ export default mixins(
this.displayMode = 'Table'; this.displayMode = 'Table';
} }
}, },
},
watch: {
node (newNode, oldNode) {
// Reset the selected output index every time another node gets selected
this.outputIndex = 0;
this.refreshDataSize();
},
jsonData () {
this.refreshDataSize();
},
displayMode () { displayMode () {
this.closeBinaryDataDisplay(); this.closeBinaryDataDisplay();
}, },