+
+
+
+
+
+ {{ cellValue }}
+
@@ -26,6 +41,11 @@ export default {
},
data () {
return {
+ formats: [
+ { text: 'JSON', value: 'json' },
+ { text: 'TEXT', value: 'text' }
+ ],
+ currentFormat: 'text',
cmOptions: {
tabSize: 4,
mode: { name: 'javascript', json: true },
@@ -35,14 +55,65 @@ export default {
foldGutter: true,
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'],
readOnly: true
+ },
+ formattedJson: ''
+ }
+ },
+ watch: {
+ currentFormat () {
+ this.formattedJson = ''
+ if (this.currentFormat === 'json') {
+ this.formatJson(this.cellValue)
+ }
+ },
+ cellValue () {
+ if (this.currentFormat === 'json') {
+ this.formatJson(this.cellValue)
}
}
},
methods: {
-
+ formatJson (jsonStr) {
+ try {
+ this.formattedJson = JSON.stringify(
+ JSON.parse(jsonStr), null, 4
+ )
+ } catch {
+ this.formattedJson = ''
+ }
+ }
}
}
diff --git a/src/views/Main/Workspace/Tabs/Tab/RunResult/index.vue b/src/views/Main/Workspace/Tabs/Tab/RunResult/index.vue
index 79edb54..3519066 100644
--- a/src/views/Main/Workspace/Tabs/Tab/RunResult/index.vue
+++ b/src/views/Main/Workspace/Tabs/Tab/RunResult/index.vue
@@ -12,7 +12,9 @@
-
+
+
+
@@ -81,6 +83,7 @@
:time="time"
:pageSize="pageSize"
class="straight"
+ @updateSelectedCell="onUpdateSelectedCell"
/>
@@ -121,11 +124,8 @@ export default {
preparingCopy: false,
dataToCopy: null,
viewValuePanelVisible: false,
- testCell: JSON.stringify(
- JSON.parse('{"x": 1, "y": 2, "vector": [1,2,3]}'),
- null,
- 4
- )
+ selectedCell: null,
+ selectedCellValue: ''
}
},
components: {
@@ -227,6 +227,11 @@ export default {
toggleViewValuePanel () {
this.viewValuePanelVisible = !this.viewValuePanelVisible
+ },
+
+ onUpdateSelectedCell (e) {
+ this.selectedCell = e
+ this.selectedCellValue = this.selectedCell?.innerText
}
}
}
@@ -251,6 +256,11 @@ export default {
width: 100%;
box-sizing: border-box;
}
+.value-viewer-container {
+ height: 100%;
+ width: 100%;
+ background-color: var(--color-white);
+}
.table-preview {
position: absolute;