|
@@ -155,8 +155,29 @@ export default {
|
|
return
|
|
return
|
|
},
|
|
},
|
|
save(){
|
|
save(){
|
|
- this.$refs.form.validate((valid) => {
|
|
|
|
|
|
+ this.$refs.form.validate(async (valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
+ let testConnection = await this.$axios({
|
|
|
|
+ method: "POST",
|
|
|
|
+ url: this.$api.algorithmsLibrary.testConnection,
|
|
|
|
+ data:{
|
|
|
|
+ gitUrl: this.form.gitUrl,
|
|
|
|
+ gitUserName: this.form.gitUserName,
|
|
|
|
+ gitPassword: this.form.gitPassword,
|
|
|
|
+ }
|
|
|
|
+ }).then(res=>{
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
+ return true
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(res.message || "测试失败");
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ }).catch(e=>{
|
|
|
|
+ return false
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ if(!testConnection) return
|
|
|
|
+
|
|
this.$axios({
|
|
this.$axios({
|
|
method: "post",
|
|
method: "post",
|
|
url: this.$api.algorithmsLibrary.addOrUpdate,
|
|
url: this.$api.algorithmsLibrary.addOrUpdate,
|
|
@@ -175,8 +196,29 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
saveOther(){
|
|
saveOther(){
|
|
- this.$refs.form.validate((valid) => {
|
|
|
|
|
|
+ this.$refs.form.validate(async (valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
+ let testConnection = await this.$axios({
|
|
|
|
+ method: "POST",
|
|
|
|
+ url: this.$api.algorithmsLibrary.testConnection,
|
|
|
|
+ data:{
|
|
|
|
+ gitUrl: this.form.gitUrl,
|
|
|
|
+ gitUserName: this.form.gitUserName,
|
|
|
|
+ gitPassword: this.form.gitPassword,
|
|
|
|
+ }
|
|
|
|
+ }).then(res=>{
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
+ return true
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(res.message || "测试失败");
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ }).catch(e=>{
|
|
|
|
+ return false
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ if(!testConnection) return
|
|
|
|
+
|
|
let data = {...this.form}
|
|
let data = {...this.form}
|
|
data.id = ''
|
|
data.id = ''
|
|
this.$axios({
|
|
this.$axios({
|