Skip to content

Commit 336a9d6

Browse files
committed
feat:开启了 PAC 的流水线支持UI编辑分支版本以及手动执行分支版本 issue #11506
# Reviewed, transaction id: 34081
1 parent 98f752a commit 336a9d6

File tree

4 files changed

+31
-52
lines changed

4 files changed

+31
-52
lines changed

src/frontend/devops-pipeline/src/components/PipelineDetailTabs/VersionHistorySideSlider.vue

+1-3
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,7 @@
331331
theme: 'success'
332332
})
333333
334-
if (row.isDraft) { // 删除草稿时需要更新pipelineInfo
335-
this.requestPipelineSummary(this.$route.params)
336-
}
334+
this.requestPipelineSummary(this.$route.params)
337335
} catch (err) {
338336
this.$showTips({
339337
message: err.message || err,

src/frontend/devops-pipeline/src/components/PipelineDetailTabs/VersionSelector.vue

+24-30
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@
132132
</template>
133133
<script>
134134
import Logo from '@/components/Logo'
135-
import { UPDATE_PIPELINE_INFO } from '@/store/modules/atom/constants'
136135
import { bus, SHOW_VERSION_HISTORY_SIDESLIDER } from '@/utils/bus'
137136
import { VERSION_STATUS_ENUM } from '@/utils/pipelineConst'
138137
import { convertTime } from '@/utils/util'
@@ -250,9 +249,10 @@
250249
},
251250
methods: {
252251
convertTime,
253-
...mapActions('pipelines', [
254-
'requestPipelineVersionList'
255-
]),
252+
...mapActions({
253+
requestPipelineVersionList: 'pipelines/requestPipelineVersionList',
254+
requestPipelineSummary: 'atom/requestPipelineSummary'
255+
}),
256256
257257
async loadMore (page) {
258258
try {
@@ -275,36 +275,30 @@
275275
})
276276
this.pagination.page = res.page
277277
this.hasNext = res.count > res.page * pagination.limit
278-
if (res.records.length > 0) {
279-
const versions = res.records.map(item => {
280-
const isDraft = item.status === VERSION_STATUS_ENUM.COMMITTING
281-
const isBranchVersion = item.status === VERSION_STATUS_ENUM.BRANCH
278+
const versions = res.records.map(item => {
279+
const isDraft = item.status === VERSION_STATUS_ENUM.COMMITTING
280+
const isBranchVersion = item.status === VERSION_STATUS_ENUM.BRANCH
282281
283-
return {
284-
...item,
285-
displayName: isDraft ? this.$t('draft') : item.versionName,
286-
description: isDraft ? this.$t('baseOn', [item.baseVersionName]) : (item.description || '--'),
287-
isBranchVersion,
288-
isDraft,
289-
isRelease: item.status === VERSION_STATUS_ENUM.RELEASED
282+
return {
283+
...item,
284+
displayName: isDraft ? this.$t('draft') : item.versionName,
285+
description: isDraft ? this.$t('baseOn', [item.baseVersionName]) : (item.description || '--'),
286+
isBranchVersion,
287+
isDraft,
288+
isRelease: item.status === VERSION_STATUS_ENUM.RELEASED
290289
291-
}
292-
})
293-
if (page === 1) {
294-
this.versionList = versions
295-
const releaseVersion = versions.find(item => item.status === VERSION_STATUS_ENUM.RELEASED)
296-
if (releaseVersion?.version > this.pipelineInfo.releaseVersion) {
297-
// HACK: 最新版本变更时,更新当前流水线信息
298-
this.$store.commit(`atom/${UPDATE_PIPELINE_INFO}`, {
299-
releaseVersion: releaseVersion.version,
300-
releaseVersionName: releaseVersion.versionName
301-
})
302-
}
303-
} else {
304-
this.versionList.push(...versions)
305290
}
306-
this.switchVersion(this.value)
291+
})
292+
if (page === 1) {
293+
this.versionList = versions
294+
const releaseVersion = versions.find(item => item.status === VERSION_STATUS_ENUM.RELEASED)
295+
if (releaseVersion?.version > this.pipelineInfo.releaseVersion) {
296+
this.requestPipelineSummary(this.$route.params)
297+
}
298+
} else {
299+
this.versionList.push(...versions)
307300
}
301+
this.switchVersion(this.value)
308302
} catch (error) {
309303
console.log(error)
310304
} finally {

src/frontend/devops-pipeline/src/components/PipelineHeader/EditHeader.vue

+4-17
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@
117117
<script>
118118
import ModeSwitch from '@/components/ModeSwitch'
119119
import VersionDiffEntry from '@/components/PipelineDetailTabs/VersionDiffEntry.vue'
120-
import { UPDATE_PIPELINE_INFO } from '@/store/modules/atom/constants'
121120
import {
122121
RESOURCE_ACTION
123122
} from '@/utils/permission'
@@ -262,6 +261,7 @@
262261
'setPipelineEditing',
263262
'saveDraftPipeline',
264263
'setSaveStatus',
264+
'requestPipelineSummary',
265265
'updateContainer'
266266
]),
267267
...mapActions('pipelines', [
@@ -320,7 +320,7 @@
320320
this.formatParams(pipeline)
321321
322322
// 请求执行构建
323-
const { data: { version, versionName } } = await this.saveDraftPipeline({
323+
await this.saveDraftPipeline({
324324
projectId,
325325
pipelineId,
326326
baseVersion: this.pipelineInfo?.baseVersion,
@@ -340,15 +340,7 @@
340340
})
341341
this.setPipelineEditing(false)
342342
343-
this.$store.commit(`atom/${UPDATE_PIPELINE_INFO}`, {
344-
canDebug: true,
345-
canRelease: true,
346-
baseVersion: this.pipelineInfo?.baseVersion ?? this.pipelineInfo?.releaseVersion ?? this.pipelineInfo?.version,
347-
baseVersionName: this.pipelineInfo?.baseVersionName ?? this.pipelineInfo?.releaseVersionName ?? this.pipelineInfo?.versionName,
348-
baseVersionStatus: this.pipelineInfo?.baseVersionStatus ?? this.pipelineInfo?.latestVersionStatus,
349-
version,
350-
versionName
351-
})
343+
await this.requestPipelineSummary(this.$route.params)
352344
353345
this.$bkMessage({
354346
theme: 'success',
@@ -403,12 +395,7 @@
403395
})
404396
405397
// 删除草稿时需要更新pipelineInfo
406-
this.$store.commit(`atom/${UPDATE_PIPELINE_INFO}`, {
407-
version: this.pipelineInfo?.releaseVersion,
408-
versionName: this.pipelineInfo?.releaseVersionName,
409-
canDebug: false,
410-
canRelease: false
411-
})
398+
await this.requestPipelineSummary(this.$route.params)
412399
this.$showTips({
413400
message: this.$t('delete') + this.$t('version') + this.$t('success'),
414401
theme: 'success'

src/frontend/devops-pipeline/src/components/PipelineHeader/HistoryHeader.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
{{ $t("diff") }}
4949
</VersionDiffEntry>
5050
<RollbackEntry
51-
v-if="showRollback && isReleasePipeline"
51+
v-if="showRollback && (isReleasePipeline || onlyBranchPipeline)"
5252
:text="false"
5353
:has-permission="canEdit"
5454
:version="currentVersion"
@@ -197,7 +197,7 @@
197197
return this.pipelineInfo?.permissions?.canExecute ?? true
198198
},
199199
executable () {
200-
return (!this.isCurPipelineLocked && this.canManualStartup && this.isReleasePipeline) || this.isActiveDraftVersion
200+
return (!this.isCurPipelineLocked && this.canManualStartup && this.editAndExecutable) || this.isActiveDraftVersion
201201
},
202202
canManualStartup () {
203203
return this.pipelineInfo?.canManualStartup ?? true

0 commit comments

Comments
 (0)