diff --git a/api-test/frontend/src/business/commons/json-schema/JsonSchemaEditor.vue b/api-test/frontend/src/business/commons/json-schema/JsonSchemaEditor.vue index 4c43f854ae..b6f666ef55 100644 --- a/api-test/frontend/src/business/commons/json-schema/JsonSchemaEditor.vue +++ b/api-test/frontend/src/business/commons/json-schema/JsonSchemaEditor.vue @@ -13,6 +13,9 @@ {{ this.$t('commons.import') }}
+ + {{ expandTitle }} + diff --git a/api-test/frontend/src/business/commons/json-schema/schema/editor/main.vue b/api-test/frontend/src/business/commons/json-schema/schema/editor/main.vue index 66a8c6c19a..3c2e34f64c 100644 --- a/api-test/frontend/src/business/commons/json-schema/schema/editor/main.vue +++ b/api-test/frontend/src/business/commons/json-schema/schema/editor/main.vue @@ -33,7 +33,7 @@ - + - + - - + - + - + - + - +
- + - + - +
@@ -182,6 +189,7 @@ v-for="(item, key, index) in pickValue.properties" :value="{ [key]: item }" :parent="pickValue" + :expand-all-params="expandAllParams" :key="index" :deep="deep + 1" :root="false" @@ -202,6 +210,7 @@ v-for="(item, key, index) in pickValue.items" :value="{ [key]: item }" :parent="pickValue" + :expand-all-params="expandAllParams" :key="index" :deep="deep + 1" :root="false" @@ -289,6 +298,12 @@ export default { type: Object, required: true, }, + expandAllParams: { + type: Boolean, + default() { + return false; + }, + }, paramColumns: Array, showMockVars: { type: Boolean, @@ -393,16 +408,31 @@ export default { }; }, created() { - if (this.pickValue) { - if (this.pickValue.hidden === undefined) { - this.hidden = this.root ? false : true; - } else { - this.hidden = this.root ? false : this.pickValue.hidden; - } + if (this.expandAllParams) { + this.hidden = false; } else { - this.hidden = true; + if (this.pickValue) { + if (this.pickValue.hidden === undefined) { + this.hidden = this.root ? false : true; + } else { + this.hidden = this.root ? false : this.pickValue.hidden; + } + } else { + this.hidden = true; + } } }, + watch: { + expandAllParams() { + if (this.expandAllParams) { + this.hidden = false; + } else { + if (!this.root) { + this.hidden = true; + } + } + }, + }, methods: { showColumns(columns) { if (!this.paramColumns) { diff --git a/api-test/frontend/src/business/definition/components/ApiVariable.vue b/api-test/frontend/src/business/definition/components/ApiVariable.vue index 285ff94965..650da8d261 100644 --- a/api-test/frontend/src/business/definition/components/ApiVariable.vue +++ b/api-test/frontend/src/business/definition/components/ApiVariable.vue @@ -4,170 +4,157 @@ {{ description }} - - - - - -
- - - - - - - - - - - {{ keyText }} - - - + - - - - - - - {{ $t('api_test.definition.document.table_coloum.is_required') }} - - - - - - - - - {{ valueText }} - - - - - - - - - {{ valueText }} - - - - - - - {{ $t('api_test.request.content_type') }} - - - - - - - - {{ $t('schema.minLength') }} - - - - - - - {{ $t('schema.maxLength') }} - - - - - - - {{ $t('commons.encode') }} - - - - - - - - - {{ $t('commons.description') }} - - - - - - - - - - - - + + + +
{ + item.isEdit = false; + }); + }, + getTableMinWidth(col) { + if (col === 'name') { + return '200px'; + } else if (col === 'value') { + return '300px'; + } else if (col === 'description') { + return '200px'; + } else { + return '120px'; + } + }, + clickRow(row, column, event) { + this.closeAllTableDataEdit(); + if (!this.isReadOnly) { + this.$nextTick(() => { + this.$set(row, 'isEdit', true); + }); + } + }, + initTableColumn() { + this.tableColumnArr = []; + if (this.type === 'body') { + this.tableColumnArr.push({ + id: 0, + prop: 'type', + label: this.$t('api_test.definition.document.request_param') + this.$t('commons.type'), + }); + } + this.tableColumnArr.push({ id: 1, prop: 'name', label: this.$t('api_definition.document.name') }); + this.tableColumnArr.push({ id: 3, prop: 'required', label: this.$t('api_definition.document.is_required') }); + this.tableColumnArr.push({ id: 4, prop: 'value', label: this.$t('api_definition.document.value') }); + if (this.type === 'body') { + this.tableColumnArr.push({ id: 2, prop: 'contentType', label: this.$t('api_definition.document.type') }); + } + if (this.paramColumns) { + this.paramColumns.forEach((item) => { + let tableColumn = {}; + if (item === 'MIX_LENGTH') { + tableColumn.id = 5; + tableColumn.prop = 'min'; + tableColumn.label = this.$t('schema.minLength'); + } else if (item === 'MAX_LENGTH') { + tableColumn.id = 6; + tableColumn.prop = 'max'; + tableColumn.label = this.$t('schema.maxLength'); + } else if (item === 'ENCODE') { + tableColumn.id = 7; + tableColumn.prop = 'urlEncode'; + tableColumn.label = this.$t('commons.encode'); + } else if (item === 'DESCRIPTION') { + tableColumn.id = 8; + tableColumn.prop = 'description'; + tableColumn.label = this.$t('commons.description'); + } else { + tableColumn = null; + } + if (tableColumn) { + this.tableColumnArr.push(tableColumn); + } + }); + } + }, showColumns(columns) { return this.paramColumns.indexOf(columns) >= 0; }, @@ -359,6 +420,7 @@ export default { urlEncode: this.urlEncode, uuid: this.uuid(), required: false, + isEdit: false, contentType: 'text/plain', }) ); @@ -443,6 +505,9 @@ export default { }, }, created() { + if (this.paramType === 'response') { + this.storageKey = 'API_RESPONSE_PARAMS_SHOW_FIELD'; + } if (this.parameters.length === 0 || this.parameters[this.parameters.length - 1].name) { this.parameters.push( new KeyValue({ @@ -451,14 +516,25 @@ export default { required: false, urlEncode: this.urlEncode, uuid: this.uuid(), + isEdit: false, contentType: 'text/plain', }) ); } - let savedApiParamsShowFields = getShowFields('API_PARAMS_SHOW_FIELD'); + let savedApiParamsShowFields = getShowFields(this.storageKey); if (savedApiParamsShowFields) { this.paramColumns = savedApiParamsShowFields; } + this.parameters.forEach((item) => { + this.$set(item, 'isEdit', false); + }); + this.initTableColumn(); + }, + activated() { + this.initTableColumn(); + }, + mounted() { + this.initTableColumn(); }, }; @@ -515,4 +591,8 @@ export default { margin-bottom: 5px; font-weight: 600; } + +.param-div-show { + min-height: 16px; +} diff --git a/api-test/frontend/src/business/definition/components/body/ApiBody.vue b/api-test/frontend/src/business/definition/components/body/ApiBody.vue index 9f2bd070cc..516ad1c1d3 100644 --- a/api-test/frontend/src/business/definition/components/body/ApiBody.vue +++ b/api-test/frontend/src/business/definition/components/body/ApiBody.vue @@ -31,9 +31,11 @@ - +
- + +
- - - -
diff --git a/api-test/frontend/src/business/definition/components/document/components/ApiRequestInfo.vue b/api-test/frontend/src/business/definition/components/document/components/ApiRequestInfo.vue index 4091b0d5f8..f5c872c996 100644 --- a/api-test/frontend/src/business/definition/components/document/components/ApiRequestInfo.vue +++ b/api-test/frontend/src/business/definition/components/document/components/ApiRequestInfo.vue @@ -25,18 +25,6 @@ :prop="item.prop" :label="item.label" show-overflow-tooltip /> - - - -
diff --git a/api-test/frontend/src/business/definition/components/document/components/ApiResponseInfo.vue b/api-test/frontend/src/business/definition/components/document/components/ApiResponseInfo.vue index 8e892783fb..85eebb3283 100644 --- a/api-test/frontend/src/business/definition/components/document/components/ApiResponseInfo.vue +++ b/api-test/frontend/src/business/definition/components/document/components/ApiResponseInfo.vue @@ -2,36 +2,24 @@
+ +
+ +
+
- - - -
@@ -62,25 +50,111 @@