Переглянути джерело

更新构建配置相关页面

reghao 4 днів тому
батько
коміт
4486792546

+ 2 - 1
src/components/card/PackerAddCard.vue

@@ -160,7 +160,7 @@ export default {
         type: '',
         name: '',
         artifactPath: '',
-        dockerRegistry: '',
+        dockerRegistryId: '',
         ossEndpoint: '',
         targetPath: ''
       },
@@ -254,6 +254,7 @@ export default {
       this.showAddOssDialog = true
     },
     onAddSuccess() {
+      this.showAddRegistryDialog = false
       getPackTypes().then(resp => {
         if (resp.code === 0) {
           this.packTypes = resp.data.packTypes

+ 3 - 6
src/views/devops/app/AppConfig.vue

@@ -434,7 +434,7 @@
             <div class="footer-btns" style="text-align: center; margin-top: 20px">
               <el-button v-if="active > 0" @click="prev">上一步</el-button>
               <el-button v-if="active < 2" type="primary" @click="next">下一步</el-button>
-              <el-button v-if="active === 2" type="success" @click="submit">提交配置</el-button>
+              <el-button v-if="active === 2" type="success" @click="onAdd">提交配置</el-button>
             </div>
           </el-form>
         </div>
@@ -943,17 +943,14 @@ export default {
     prev() {
       if (this.active > 0) this.active--;
     },
-    submit() {
+    onAdd() {
       this.$refs.appFormRef.validate((valid) => {
         if (valid) {
           addAppConfig(this.appForm).then(resp => {
-            console.log('提交数据:', this.form);
-            this.$message.success('配置已保存');
             if (resp.code === 0) {
               this.active = 0;
               this.$refs.appFormRef.resetFields();
-              this.appForm.repoAuthConfig = { id: null };
-              this.appForm.compilerConfig = { id: null };
+              this.showAddDialog = false
               this.getData()
             } else {
               this.$message.info(resp.msg)

+ 15 - 84
src/views/devops/docker/DockerRegistry.vue

@@ -74,64 +74,26 @@
       :visible.sync="showAddDialog"
       center
     >
-      <template>
-        <el-form ref="form" :model="form" label-width="100px">
-          <el-form-item label="仓库认证" prop="repoAuthName">
-            <el-row :gutter="10">
-              <el-col :span="14">
-                <el-select
-                    v-model="form.repoAuthName"
-                    placeholder="请选择仓库认证"
-                    style="width: 100%"
-                    :disabled="repoAuthNames.length === 0"
-                >
-                  <el-option
-                      v-for="(item, index) in repoAuthNames"
-                      :key="index"
-                      :label="item.label"
-                      :value="item.value"
-                  />
-                </el-select>
-              </el-col>
-              <el-col :span="6">
-                <el-button
-                    type="text"
-                    icon="el-icon-plus"
-                    @click="handleAddRepoAuth"
-                >
-                  {{ repoAuthNames.length === 0 ? '暂无数据,去添加' : '新增认证' }}
-                </el-button>
-              </el-col>
-            </el-row>
-          </el-form-item>
-          <el-form-item label="仓库地址">
-            <el-input v-model="form.registryUrl" style="width: 70%" placeholder="e.g. registry.cn-hangzhou.aliyuncs.com" />
-          </el-form-item>
-          <el-form-item label="命名空间">
-            <el-input v-model="form.registryNamespace" style="width: 70%" placeholder="e.g. reghao/" />
-          </el-form-item>
-          <el-form-item>
-            <el-button type="primary" @click="onAddDockerRegistry">确定</el-button>
-          </el-form-item>
-        </el-form>
-      </template>
-    </el-dialog>
-    <el-dialog
-        title="添加仓库认证"
-        append-to-body
-        :visible.sync="showAddRepoAuthDialog"
-        center
-    >
-
+      <registry-add-card
+          @close="showAddDialog = false"
+          @success="onAddSuccess"
+      />
     </el-dialog>
   </el-container>
 </template>
 
 <script>
-import { addDockerRegistry, deleteDockerRegistry, getDockerRegistryList, getRepoAuthNames } from '@/api/devops'
+import RegistryAddCard from '@/components/card/RegistryAddCard.vue'
+import {
+  deleteDockerRegistry,
+  getDockerRegistryList,
+} from '@/api/devops'
 
 export default {
   name: 'DockerRegistry',
+  components: {
+    RegistryAddCard
+  },
   data() {
     return {
       queryInfo: {
@@ -145,17 +107,7 @@ export default {
       totalSize: 0,
       dataList: [],
       // **********************************************************************
-      showAddDialog: false,
-      repoAuthNames: [],
-      form: {
-        repoAuthName: '',
-        registryUrl: '',
-        registryNamespace: ''
-      },
-      // **********************************************************************
-      showAddRepoAuthDialog: false,
-      repoAuthForm: {
-      }
+      showAddDialog: false
     }
   },
   created() {
@@ -185,27 +137,9 @@ export default {
     },
     handleShowAdd() {
       this.showAddDialog = true
-      getRepoAuthNames().then(resp => {
-        if (resp.code === 0) {
-          this.repoAuthNames = resp.data
-        } else {
-          this.showAddDialog = false
-          this.$message.info(resp.msg)
-        }
-      }).catch(error => {
-        this.showAddDialog = false
-        this.$message.error(error.message)
-      })
     },
-    onAddDockerRegistry() {
-      addDockerRegistry(this.form).then(resp => {
-        this.$message.info(resp.msg)
-        this.getData()
-      }).catch(error => {
-        this.$message.error(error.message)
-      }).finally(() => {
-        this.showAddDialog = false
-      })
+    onAddSuccess() {
+      this.showAddDialog = false
     },
     handleEdit(index, row) {
       this.$confirm('确定要删除 ' + row.registryUrl + '?', '提示', {
@@ -228,9 +162,6 @@ export default {
         })
       })
     },
-    handleAddRepoAuth() {
-      this.showAddRepoAuthDialog = true
-    },
     handleUsage(row) {
       this.$message.info('handleUsage')
     }