This is an automated email from the ASF dual-hosted git repository. xxyu pushed a commit to branch kylin5 in repository https://gitbox.apache.org/repos/asf/kylin.git
commit bb348f3f19c6b6413dd6277c4cedc8f9fb9cfb78 Author: Qian Xia <lauraxiaq...@gmail.com> AuthorDate: Fri Mar 24 18:36:17 2023 +0800 KYLIN-5487 refine sync comment name issue --- kystudio/package.json | 24 +++++++++++----------- .../studio/StudioModel/BatchMeasureModal/index.vue | 11 +++++----- .../studio/StudioModel/ModelEdit/index.vue | 2 +- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/kystudio/package.json b/kystudio/package.json index 7cedf37632..e48263d1f1 100644 --- a/kystudio/package.json +++ b/kystudio/package.json @@ -46,23 +46,23 @@ "vuex": "2.5.0" }, "devDependencies": { - "@babel/core": "^7.15.8", - "@babel/helper-module-imports": "^7.15.4", - "@babel/plugin-proposal-decorators": "^7.15.8", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-jsx": "^7.14.5", - "@babel/plugin-transform-runtime": "^7.15.8", - "@babel/preset-env": "^7.15.8", - "@babel/register": "^7.15.3", - "@vue/babel-helper-vue-jsx-merge-props": "^1.2.1", - "@vue/babel-preset-jsx": "^1.2.4", + "@babel/core": "7.15.8", + "@babel/helper-module-imports": "7.15.4", + "@babel/plugin-proposal-decorators": "7.15.8", + "@babel/plugin-syntax-dynamic-import": "7.8.3", + "@babel/plugin-syntax-jsx": "7.14.5", + "@babel/plugin-transform-runtime": "7.15.8", + "@babel/preset-env": "7.15.8", + "@babel/register": "7.15.3", + "@vue/babel-helper-vue-jsx-merge-props": "1.2.1", + "@vue/babel-preset-jsx": "1.2.4", "@vue/test-utils": "1.1.3", "autoprefixer": "^6.7.2", "babel-core": "7.0.0-bridge.0", "babel-eslint": "^8.2.6", "babel-jest": "24.9.0", - "babel-loader": "^8.0.6", - "babel-plugin-istanbul": "^3.1.2", + "babel-loader": "8.0.6", + "babel-plugin-istanbul": "3.1.2", "chai": "^3.5.0", "chalk": "^1.1.3", "connect-history-api-fallback": "^1.3.0", diff --git a/kystudio/src/components/studio/StudioModel/BatchMeasureModal/index.vue b/kystudio/src/components/studio/StudioModel/BatchMeasureModal/index.vue index b1ac218c7d..452c3020bf 100644 --- a/kystudio/src/components/studio/StudioModel/BatchMeasureModal/index.vue +++ b/kystudio/src/components/studio/StudioModel/BatchMeasureModal/index.vue @@ -264,7 +264,7 @@ export default class BatchMeasureModal extends Vue { const lastIndex = uniqueName.lastIndexOf('_') let sameCount = +uniqueName.substring(lastIndex + 1) const sameNameMes = getObjectBySomeKeys(arrrReverse, 'name' ,uniqueName) - if ((sameNameMes.table_guid || sameNameMes.guid) !== column.table_guid) { + if (sameNameMes.parameter_value.length && sameNameMes.parameter_value[0].table_guid !== column.table_guid) { uniqueName = uniqueName + '_' + column.table_alias } else if (!isNaN(parseFloat(sameCount))) { // 是数字 sameCount++ @@ -288,7 +288,7 @@ export default class BatchMeasureModal extends Vue { if (this.syncComment) { allMeasureArr.forEach(item => { if (item.parameter_value.length > 0) { - const column = columns.filter(it => it.full_colname === item.parameter_value[0].value) + const column = columns.filter(it => (it.full_colname || `${it.table_alias}.${it.column}`) === item.parameter_value[0].value) column.length > 0 && column[0].comment && (item.comment = column[0].comment) } }) @@ -542,12 +542,11 @@ export default class BatchMeasureModal extends Vue { this.$set(col, 'table_guid', table.guid) this.$set(col, 'table_alias', table.alias) const len = this.usedColumns.length - const selectedColumns = this.usedColumns.filter(it => this.expressions.indexOf(it.expression) !== -1).map(item => item.parameter_value[0].value) - let others = this.otherColumns.length ? this.otherColumns : this.modelDesc.all_named_columns.filter(item => !selectedColumns.includes(item.column)) + let others = this.otherColumns.length ? [...this.otherColumns, ...this.modelDesc.dimensions] : this.modelDesc.all_named_columns for (let i = 0; i < len; i++) { let d = this.usedColumns[i] if (this.expressions.indexOf(d.expression) !== -1 && d.parameter_value[0].value === table.alias + '.' + col.column) { - let regxt = new RegExp(`\\_${d.expression}$`) + let regxt = new RegExp(`\\_${d.expression}(\\_\\d+)?$`) let name = d.name.trim() ? d.name.replace(regxt, '') : col.name col[d.expression].value = true col[d.expression].isShouldDisable = true @@ -557,7 +556,7 @@ export default class BatchMeasureModal extends Vue { } } for (let it of others) { - if (`${col.table_alias}.${col.column}` === it.column && !selectedColumns.includes(it.column)) { + if (`${col.table_alias}.${col.column}` === it.column) { this.$set(col, 'name', it.name.trim() ? it.name : col.column) break } diff --git a/kystudio/src/components/studio/StudioModel/ModelEdit/index.vue b/kystudio/src/components/studio/StudioModel/ModelEdit/index.vue index af21fb6ecb..689de2c4d8 100644 --- a/kystudio/src/components/studio/StudioModel/ModelEdit/index.vue +++ b/kystudio/src/components/studio/StudioModel/ModelEdit/index.vue @@ -1283,6 +1283,7 @@ export default class ModelEdit extends Vue { }) } async initModelDesc (cb) { + this.resetOtherColumns() if (this.extraoption.modelName && this.extraoption.action === 'edit') { this.getModelByModelName({model_name: this.extraoption.modelName, project: this.extraoption.project}).then((response) => { handleSuccess(response, (data) => { @@ -1290,7 +1291,6 @@ export default class ModelEdit extends Vue { this.modelData = data.value[0] this.modelData.project = this.currentSelectedProject this.modelData.anti_flatten_lookups = [] - this.resetOtherColumns() cb(this.modelData) } else { kylinMessage(this.$t('modelDataNullTip'), {type: 'warning'})