diff --git a/src/dashboard-front/src/components/ag-editor.vue b/src/dashboard-front/src/components/ag-editor.vue index 696499274..05ff62781 100644 --- a/src/dashboard-front/src/components/ag-editor.vue +++ b/src/dashboard-front/src/components/ag-editor.vue @@ -285,6 +285,7 @@ defineExpose({ switchFontSize, setTheme, updateOptions, + handleFormat, }); diff --git a/src/dashboard-front/src/views/online-debug/components/edit-table.vue b/src/dashboard-front/src/views/online-debug/components/edit-table.vue index bb231d614..5af6aabf7 100644 --- a/src/dashboard-front/src/views/online-debug/components/edit-table.vue +++ b/src/dashboard-front/src/views/online-debug/components/edit-table.vue @@ -4,91 +4,90 @@ ref="bkTableRef" row-hover="auto" :data="tableData" - show-overflow-tooltip @cell-click="handleCellClick" :cell-class="getCellClass" border="outer"> + + + + + + @@ -451,11 +450,15 @@ defineExpose({ :deep(.bk-input) { border: none; height: 100%; + border-radius: 0px; .angle-up { display: none !important; } &:hover { border: 1px solid #A3C5FD; + .angle-up { + display: inline-flex !important; + } } } &.is-focus { @@ -484,6 +487,7 @@ defineExpose({ } .bk-form { line-height: 42px; + margin-bottom: -1px; .table-form-item { margin-bottom: 0; .bk-form-content { @@ -497,6 +501,7 @@ defineExpose({ } } .edit-input.bk-input { + border-radius: 0px; &:hover { border: 1px solid #A3C5FD; } @@ -506,10 +511,14 @@ defineExpose({ } .bk-select { &:hover { - border: 1px solid #A3C5FD; + .bk-input { + border: 1px solid #A3C5FD; + } } &.is-focus { - border: 1px solid #3A84FF; + .bk-input { + border: 1px solid #3A84FF; + } } } } diff --git a/src/dashboard-front/src/views/online-debug/components/response-content.vue b/src/dashboard-front/src/views/online-debug/components/response-content.vue index 4d90b23a9..032a84364 100644 --- a/src/dashboard-front/src/views/online-debug/components/response-content.vue +++ b/src/dashboard-front/src/views/online-debug/components/response-content.vue @@ -40,11 +40,17 @@
-
+
Pretty
-
+
Raw
@@ -95,6 +101,7 @@ v-model="editorText" theme="Visual Studio" ref="resourceEditorRef" + language="json" :minimap="false" :show-copy="true" :show-full-screen="true" @@ -146,6 +153,7 @@ const bodyTypeList = ref([ label: 'TEXT', }, ]); +const bodyType = ref('pretty'); const detailsType = ref('cURL'); const detailsTypeList = ref([ { @@ -161,6 +169,29 @@ const stopPropa = (e: Event) => { e?.stopPropagation(); }; +const formatBody = () => { + resourceEditorRef.value?.updateOptions({ + readOnly: false, + }); + setTimeout(() => { + resourceEditorRef.value?.handleFormat(); + }); + setTimeout(() => { + resourceEditorRef.value?.updateOptions({ + readOnly: true, + }); + }, 200); +}; + +const handleBodyTypeChange = (type: string) => { + bodyType.value = type; + if (type === 'pretty') { + formatBody(); + } else { + setEditorValue(); + } +}; + const setEditorValue = () => { if (tabActive.value === 'body') { editorText.value = data.value?.body || ''; @@ -168,6 +199,9 @@ const setEditorValue = () => { editorText.value = data.value?.curl || ''; } resourceEditorRef.value?.setValue(editorText.value); + if (tabActive.value === 'body' && bodyType.value === 'pretty') { + formatBody(); + } activeIndex.value = [1]; };