|
|
@@ -58,7 +58,7 @@
|
|
|
>
|
|
|
<el-form :model="addForm" label-width="80px">
|
|
|
<el-form-item label="名字">
|
|
|
- <el-input v-model="addForm.name" style="width: 70%; padding-right: 2px" readonly />
|
|
|
+ <el-input v-model="addForm.name" style="width: 70%; padding-right: 2px" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="URL">
|
|
|
<el-input v-model="addForm.url" style="width: 70%; padding-right: 2px" />
|
|
|
@@ -75,7 +75,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getWebhookList } from '@/api/devops'
|
|
|
+import { addWebhook, deleteUser, deleteWebhook, getWebhookList, testWebhook } from '@/api/devops'
|
|
|
|
|
|
export default {
|
|
|
name: 'Webhook',
|
|
|
@@ -112,20 +112,48 @@ export default {
|
|
|
this.showAddDialog = true
|
|
|
},
|
|
|
onAdd() {
|
|
|
- this.showAddDialog = false
|
|
|
const formData = new FormData()
|
|
|
formData.append('name', this.addForm.name)
|
|
|
- this.$message.info('add -> ' + this.addForm.name)
|
|
|
+ formData.append('url', this.addForm.url)
|
|
|
+ formData.append('sign', this.addForm.sign)
|
|
|
+ addWebhook(formData).then(resp => {
|
|
|
+ this.$message.info(resp.msg)
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message.error(error.message)
|
|
|
+ }).finally(() => {
|
|
|
+ this.showAddDialog = false
|
|
|
+ })
|
|
|
},
|
|
|
handleTest(index, row) {
|
|
|
const formData = new FormData()
|
|
|
- formData.append('name', this.addForm.name)
|
|
|
- this.$message.info('test -> ' + row.name)
|
|
|
+ formData.append('id', row.id)
|
|
|
+ testWebhook(formData).then(resp => {
|
|
|
+ this.showAddDialog = false
|
|
|
+ this.$message.info(resp.msg)
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message.error(error.message)
|
|
|
+ })
|
|
|
},
|
|
|
handleDelete(index, row) {
|
|
|
- const formData = new FormData()
|
|
|
- formData.append('name', this.addForm.name)
|
|
|
- this.$message.info('delete -> ' + row.name)
|
|
|
+ this.$confirm('确定要删除 ' + row.name + '?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ const formData = new FormData()
|
|
|
+ formData.append('id', row.id)
|
|
|
+ deleteWebhook(formData).then(resp => {
|
|
|
+ this.getData()
|
|
|
+ this.$message.info(resp.msg)
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message.error(error.message)
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消'
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|