diff --git a/src/frontend/devops-manage/src/components/dialectPopoverTable.vue b/src/frontend/devops-manage/src/components/dialectPopoverTable.vue index b1c198fe6eb1..11bb05a72ece 100644 --- a/src/frontend/devops-manage/src/components/dialectPopoverTable.vue +++ b/src/frontend/devops-manage/src/components/dialectPopoverTable.vue @@ -75,11 +75,6 @@ const namingConventionData = [ constrainedMode: t('流程控制选项、插件入参、Job设置等流水线配置中均可使用函数'), constrainedExample: t('如变量a值为Json字符串,则bash脚本中,可以使用fromJSON读取echo “a.node is ${{fromJSON(a).node}}”') }, - { - difference: t('变量值超长'), - classic: t('仅警告未报错'), - constrainedMode: t('将报错,运行失败'), - }, { difference: t('变量 ID 规范'), classic: t('未限制'), diff --git a/src/frontend/devops-pipeline/src/components/PipelineLabelSelector/index.vue b/src/frontend/devops-pipeline/src/components/PipelineLabelSelector/index.vue new file mode 100644 index 000000000000..13fad8c5d272 --- /dev/null +++ b/src/frontend/devops-pipeline/src/components/PipelineLabelSelector/index.vue @@ -0,0 +1,301 @@ + + + + + diff --git a/src/frontend/devops-pipeline/src/components/PipelineTemplatePreview.vue b/src/frontend/devops-pipeline/src/components/PipelineTemplatePreview.vue index 65fdbb9b1e44..a447fafebf2a 100644 --- a/src/frontend/devops-pipeline/src/components/PipelineTemplatePreview.vue +++ b/src/frontend/devops-pipeline/src/components/PipelineTemplatePreview.vue @@ -35,6 +35,7 @@ :name="panel.name" > @@ -108,7 +108,7 @@ import VuexInput from '@/components/atomFormField/VuexInput/index.vue' import VuexTextarea from '@/components/atomFormField/VuexTextarea/index.vue' import SyntaxStyleConfiguration from '@/components/syntaxStyleConfiguration' - import { mapGetters, mapActions, mapState } from 'vuex' + import { mapGetters } from 'vuex' export default { name: 'bkdevops-base-info-setting-tab', @@ -134,9 +134,6 @@ ...mapGetters({ tagGroupList: 'pipelines/getTagGroupList' }), - ...mapState('pipelines', [ - 'currentPipelineDialect' - ]), projectId () { return this.$route.params.projectId }, @@ -154,6 +151,12 @@ }) return value }) + }, + curProject () { + return this.$store.state.curProject + }, + defaultPipelineDialect () { + return this.curProject?.properties?.pipelineDialect } }, watch: { @@ -174,9 +177,6 @@ this.requestGrouptLists() }, methods: { - ...mapActions('pipelines', [ - 'getPipelineDialect' - ]), /** * * 获取标签及其分组 */ @@ -188,7 +188,6 @@ this.$store.commit('pipelines/updateGroupLists', res) // 获取当前项目语法风格 - await this.getPipelineDialect(this.projectId) } catch (err) { this.$showTips({ message: err.message || err, @@ -212,7 +211,7 @@ this.settings = { ...this.settings, inheritedDialect: value, - ...value && { pipelineDialect: this.currentPipelineDialect } + ...value && { pipelineDialect: this.defaultPipelineDialect } } this.handleBaseInfoChange('pipelineAsCodeSettings', this.settings) }, diff --git a/src/frontend/devops-pipeline/src/components/pipelineSetting/settingBase/index.vue b/src/frontend/devops-pipeline/src/components/pipelineSetting/settingBase/index.vue index 4f4f315d33bf..854be0c0f8e6 100755 --- a/src/frontend/devops-pipeline/src/components/pipelineSetting/settingBase/index.vue +++ b/src/frontend/devops-pipeline/src/components/pipelineSetting/settingBase/index.vue @@ -72,7 +72,7 @@ @@ -165,8 +165,7 @@ }, computed: { ...mapState('pipelines', [ - 'templateSetting', - 'currentPipelineDialect' + 'templateSetting' ]), ...mapGetters({ tagGroupList: 'pipelines/getTagGroupList' @@ -246,6 +245,12 @@ }, TEMPLATE_RESOURCE_ACTION () { return TEMPLATE_RESOURCE_ACTION + }, + curProject () { + return this.$store.state.curProject + }, + defaultPipelineDialect () { + return this.curProject?.properties?.pipelineDialect } }, watch: { @@ -260,8 +265,7 @@ methods: { ...mapActions('pipelines', [ 'requestTemplateSetting', - 'updateTemplateSetting', - 'getPipelineDialect' + 'updateTemplateSetting' ]), ...mapActions('atom', [ 'updatePipelineSetting' @@ -300,8 +304,6 @@ }) $store.commit('pipelines/updateGroupLists', res) this.dataList = this.tagGroupList - // 获取当前项目语法风格 - await this.getPipelineDialect(this.projectId) } catch (err) { this.$showTips({ message: err.message || err, @@ -356,7 +358,7 @@ settings.inheritedDialect = value if (value) { - settings.pipelineDialect = this.currentPipelineDialect + settings.pipelineDialect = this.defaultPipelineDialect } }, pipelineDialectChange (value) { diff --git a/src/frontend/devops-pipeline/src/components/syntaxStyleConfiguration.vue b/src/frontend/devops-pipeline/src/components/syntaxStyleConfiguration.vue index 3cc979b789e2..9f13e0f45637 100644 --- a/src/frontend/devops-pipeline/src/components/syntaxStyleConfiguration.vue +++ b/src/frontend/devops-pipeline/src/components/syntaxStyleConfiguration.vue @@ -14,6 +14,7 @@ {{ $t('inheritedProject') }} @@ -26,14 +27,14 @@ {{ $t('CLASSIC') }} {{ $t('CONSTRAINED') }} @@ -54,41 +55,15 @@ isShowPopover: { type: Boolean, default: true + }, + disabled: { + type: Boolean, + default: false } }, computed: { - namingConventionData () { - return [ - { - difference: this.$t('expressionFormat'), - classic: this.$t('traditionalFormat'), - classicExample: this.$t('traditionalFormatExample'), - constrainedMode: this.$t('constraintFormat'), - constrainedExample: this.$t('constraintFormatExample') - }, - { - difference: this.$t('variableValueTooLong'), - classic: this.$t('traditionalValueTooLongMode'), - constrainedMode: this.$t('constraintReadOnlyMode') - }, - { - difference: this.$t('variableNotFound'), - classic: this.$t('traditionalNotFoundMode'), - constrainedMode: this.$t('constraintReadOnlyMode') - }, - { - difference: this.$t('variableStandard'), - classic: this.$t('traditionalStandardMode'), - constrainedMode: this.$t('constraintStandardMode') - } - ] - }, isDialectDisabled () { - if (this.inheritedDialect) { - return true - } else { - return false - } + return !!this.inheritedDialect } }, methods: { diff --git a/src/frontend/devops-pipeline/src/store/modules/pipelines/pipelinesTemplate.js b/src/frontend/devops-pipeline/src/store/modules/pipelines/pipelinesTemplate.js index e331d345502b..97a2b5aca3a0 100755 --- a/src/frontend/devops-pipeline/src/store/modules/pipelines/pipelinesTemplate.js +++ b/src/frontend/devops-pipeline/src/store/modules/pipelines/pipelinesTemplate.js @@ -19,15 +19,14 @@ import { PROCESS_API_URL_PREFIX, - STORE_API_URL_PREFIX, - PROJECT_API_URL_PREFIX + STORE_API_URL_PREFIX } from '@/store/constants' import ajax from '@/utils/request' const prefix = `/${PROCESS_API_URL_PREFIX}/user` const state = { - currentPipelineDialect: false + } const getters = { @@ -35,16 +34,10 @@ const getters = { } const mutations = { - getCurrentPipelineDialect (state, params) { - state.currentPipelineDialect = params.data - } + } const actions = { - async getPipelineDialect ({ commit }, projectId) { - const res = await ajax.get(`${PROJECT_API_URL_PREFIX}/user/projects/${projectId}/pipelineDialect`) - commit('getCurrentPipelineDialect', res) - }, installPipelineTemplate (_, params) { return ajax.post(`${STORE_API_URL_PREFIX}/user/market/template/install`, params).then(response => { }) diff --git a/src/frontend/devops-pipeline/src/views/CreatePipeline.vue b/src/frontend/devops-pipeline/src/views/CreatePipeline.vue index 4a14943ad838..bbc93f9e9106 100644 --- a/src/frontend/devops-pipeline/src/views/CreatePipeline.vue +++ b/src/frontend/devops-pipeline/src/views/CreatePipeline.vue @@ -88,7 +88,7 @@ >

{{ item.label }} @@ -110,8 +110,15 @@ + + + item.name.toLowerCase().indexOf(this.searchName.toLowerCase()) > -1) ?? [] } + }, + isConstrainMode () { + return this.templateType === templateTypeEnum.CONSTRAIN } }, watch: { @@ -397,23 +416,26 @@ } return acc }, []) - console.log(this.applySettings) } }, searchName (val) { if (this.activePanel === 'store') { this.requestMarkTemplates(true) } + }, + defaultPipelineDialect (val) { + this.pipelineDialect = val } }, - created () { + async created () { + await this.$store.dispatch('requestProjectDetail', { + projectId: this.$route.params.projectId + }) this.requestPipelineTemplate({ projectId: this.$route.params.projectId }) - this.requestPipelineDialect() }, mounted () { - console.log(this.$refs.pipelineName) this.$nextTick(() => { this.$refs.pipelineName.focus() }) @@ -426,7 +448,7 @@ ...mapActions('pipelines', [ 'installPipelineTemplate', 'createPipelineWithTemplate', - 'getPipelineDialect' + 'requestTemplateSetting' ]), goList () { this.$router.push(this.pipelineListRoute) @@ -497,9 +519,17 @@ this.isLoading = false } }, - selectTemp (index) { - console.log(index) + async selectTemp (index) { const target = this.tempList.length && this.tempList[index] + if (target?.templateType !== 'PUBLIC') { + await this.requestTemplateSetting({ + projectId: this.$route.params.projectId, + templateId: target.templateId + }) + this.labelValues = this.templateSetting.labels + } else { + this.labelValues = [] + } if (index !== this.activeTempIndex && target.installed) { this.activeTempIndex = index } @@ -517,7 +547,6 @@ this.previewSettingType = '' }, previewSetting (setting) { - console.log(setting) this.isShowPreview = true this.previewSettingType = setting }, @@ -545,7 +574,8 @@ }, {}), instanceType: this.templateType, inheritedDialect: this.inheritedDialect, - pipelineDialect: this.pipelineDialect + pipelineDialect: this.pipelineDialect, + labels: this.labelValues } if (this.templateType === templateTypeEnum.CONSTRAIN) { @@ -555,6 +585,10 @@ templateId: this.activeTemp.templateId, curVersionId: this.activeTemp.version, pipelineName: this.newPipelineName + + }, + query: { + useTemplateSettings: true } }) return @@ -589,19 +623,10 @@ this.isDisabled = false } }, - async requestPipelineDialect () { - try { - const projectId = this.$route.params.projectId - await this.getPipelineDialect(projectId) - this.pipelineDialect = this.currentPipelineDialect - } catch (err) { - console.log(err) - } - }, inheritedChange (value) { this.inheritedDialect = value if (value) { - this.pipelineDialect = this.currentPipelineDialect + this.pipelineDialect = this.defaultPipelineDialect } }, pipelineDialectChange (value) { diff --git a/src/frontend/devops-pipeline/src/views/subpages/ExecDetail.vue b/src/frontend/devops-pipeline/src/views/subpages/ExecDetail.vue index 23d92c12e864..42664c2294d2 100755 --- a/src/frontend/devops-pipeline/src/views/subpages/ExecDetail.vue +++ b/src/frontend/devops-pipeline/src/views/subpages/ExecDetail.vue @@ -61,10 +61,10 @@ name="default-user" size="24" /> - + {{ $t("details.executorInfo", [ - execDetail.triggerUser, + startUser, execDetail.trigger, execFormatStartTime ]) @@ -394,6 +394,21 @@ }, pipelineModel () { return this.execDetail?.model || {} + }, + executeCount () { + return this.execDetail?.executeCount ?? 1 + }, + recordList () { + const list = [...this.execDetail?.recordList] + return ( + list.reverse().map((record, index) => ({ + id: index + 1, + user: record.startUser + })) ?? [] + ) + }, + startUser () { + return this.recordList.find(i => i.id === this.executeCount)?.user || '' } }, diff --git a/src/frontend/devops-pipeline/src/views/template/instance_create.vue b/src/frontend/devops-pipeline/src/views/template/instance_create.vue index 598166cf17ac..9d32ae55b177 100755 --- a/src/frontend/devops-pipeline/src/views/template/instance_create.vue +++ b/src/frontend/devops-pipeline/src/views/template/instance_create.vue @@ -350,7 +350,7 @@ }, async mounted () { this.requestTemplateDatail(this.curVersionId) - if (this.$route.query.useTemplateSettings === 'true') { + if (this.$route.query.useTemplateSettings) { this.isTemplateSetting = true } if (this.curVersionId) { diff --git a/src/frontend/locale/pipeline/en-US.json b/src/frontend/locale/pipeline/en-US.json index bd31044d2ae2..82fb623c0bc6 100644 --- a/src/frontend/locale/pipeline/en-US.json +++ b/src/frontend/locale/pipeline/en-US.json @@ -1663,5 +1663,6 @@ "deleteDraft": "Delete Draft", "sureDeleteDraft": "Are you sure you want to delete this draft?", "deleteDraftPipeline": "The current pipeline has not been published yet. Deleting the draft is equivalent to deleting the pipeline. Are you sure you want to proceed?", - "noDraft": "No drafts available for deletion" + "noDraft": "No drafts available for deletion", + "addLabels": "Add Label" } \ No newline at end of file diff --git a/src/frontend/locale/pipeline/zh-CN.json b/src/frontend/locale/pipeline/zh-CN.json index fbf69f43401e..f1433017811b 100644 --- a/src/frontend/locale/pipeline/zh-CN.json +++ b/src/frontend/locale/pipeline/zh-CN.json @@ -1665,5 +1665,6 @@ "deleteDraft": "删除草稿", "sureDeleteDraft": "确认删除该草稿?", "deleteDraftPipeline": "当前流水线尚未发布,删除草稿等同于删除流水线,确认删除吗?", - "noDraft": "暂无可删除的草稿" + "noDraft": "暂无可删除的草稿", + "addLabels": "添加标签" } \ No newline at end of file