|
|
@@ -242,9 +242,9 @@
|
|
|
>
|
|
|
<template #title>
|
|
|
<span>创建流水线</span>
|
|
|
- <span class="button-group">
|
|
|
- <ElButton type="text">模板详解</ElButton>
|
|
|
- </span>
|
|
|
+<!-- <span class="button-group">-->
|
|
|
+<!-- <ElButton type="text">模板详解</ElButton>-->
|
|
|
+<!-- </span>-->
|
|
|
</template>
|
|
|
<ElForm
|
|
|
:model="createPipelineForm"
|
|
|
@@ -355,6 +355,7 @@ import { APITestAPI, PipelineAPI } from '@/api';
|
|
|
|
|
|
import { formatter } from '@/utils/time';
|
|
|
import { copy } from '@/utils/clipboard';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
@@ -518,21 +519,28 @@ export default {
|
|
|
this.loading = false;
|
|
|
},
|
|
|
async handlePipelineCreateConfirm() {
|
|
|
- this.confirmLoading = true;
|
|
|
- this.$refs.createPipelineForm.validate(async (valid) => {
|
|
|
- if (valid) {
|
|
|
- await PipelineAPI.createPipeline({
|
|
|
- projectId: this.$store.state.workspace.currentProjectId,
|
|
|
- name: this.createPipelineForm.name,
|
|
|
- templateName: this.createPipelineForm.template,
|
|
|
- });
|
|
|
- this.showPipelineCreateModal = false;
|
|
|
- this.confirmLoading = false;
|
|
|
- this.loading = true;
|
|
|
- this.pipelines = await PipelineAPI.getPipelinesByProjectId(this.$store.state.workspace.currentProjectId);
|
|
|
- this.loading = false;
|
|
|
- }
|
|
|
- });
|
|
|
+ const regExp = /^[a-z]([a-z]|-){2,29}/;
|
|
|
+ if (this.createPipelineForm.name.length < 3 || this.createPipelineForm.name.length > 30) {
|
|
|
+ ElMessage.warning('流水线名称长度必须在3-30之间!');
|
|
|
+ } else if (!regExp.test(this.createPipelineForm.name)) {
|
|
|
+ ElMessage.warning('流水线名称必须是以小写字母开头且由小写字母和-组成的字符串!');
|
|
|
+ } else if (this.createPipelineForm.template.length === 0) {
|
|
|
+ ElMessage.warning('还未选择模板!');
|
|
|
+ } else {
|
|
|
+ this.$refs.createPipelineForm.validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ await PipelineAPI.createPipeline({
|
|
|
+ projectId: this.$store.state.workspace.currentProjectId,
|
|
|
+ name: this.createPipelineForm.name,
|
|
|
+ templateName: this.createPipelineForm.template,
|
|
|
+ });
|
|
|
+ this.showPipelineCreateModal = false;
|
|
|
+ this.loading = true;
|
|
|
+ this.pipelines = await PipelineAPI.getPipelinesByProjectId(this.$store.state.workspace.currentProjectId);
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
open(url, target) {
|
|
|
window.open(url, target);
|