diff --git a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/controller/service/ShedlockController.kt b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/controller/service/ShedlockController.kt index 023d181e13..424d0fe91f 100644 --- a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/controller/service/ShedlockController.kt +++ b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/controller/service/ShedlockController.kt @@ -34,7 +34,9 @@ import com.tencent.bkrepo.common.security.permission.PrincipalType import com.tencent.bkrepo.common.service.util.ResponseBuilder import com.tencent.bkrepo.job.pojo.ShedlockInfo import com.tencent.bkrepo.job.service.ShedlockService +import org.springframework.web.bind.annotation.DeleteMapping import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RestController @@ -48,4 +50,10 @@ class ShedlockController(val shelockService: ShedlockService) { fun listShelock(): Response> { return ResponseBuilder.success(shelockService.listShelock()) } + + @DeleteMapping("/delete/{id}") + fun deleteShelock(@PathVariable id: String): Response{ + shelockService.deleteShelock(id) + return ResponseBuilder.success() + } } diff --git a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/service/ShedlockService.kt b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/service/ShedlockService.kt index 2bd9ea641e..32af369595 100644 --- a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/service/ShedlockService.kt +++ b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/service/ShedlockService.kt @@ -31,4 +31,6 @@ import com.tencent.bkrepo.job.pojo.ShedlockInfo interface ShedlockService { fun listShelock(): List + + fun deleteShelock(id: String) } diff --git a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/service/impl/ShedlockServiceImp.kt b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/service/impl/ShedlockServiceImp.kt index 328a1d5b5b..2905e75d7d 100644 --- a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/service/impl/ShedlockServiceImp.kt +++ b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/service/impl/ShedlockServiceImp.kt @@ -39,4 +39,8 @@ class ShedlockServiceImp constructor( override fun listShelock(): List { return shelockRepository.findAllBy() } + + override fun deleteShelock(id: String) { + shelockRepository.deleteById(id) + } } diff --git a/src/frontend/devops-op/src/api/shed-lock.js b/src/frontend/devops-op/src/api/shed-lock.js index ab90ee0c4a..a37a520158 100644 --- a/src/frontend/devops-op/src/api/shed-lock.js +++ b/src/frontend/devops-op/src/api/shed-lock.js @@ -8,3 +8,10 @@ export function listShedlock() { method: 'get' }) } + +export function deleteShelock(id) { + return request({ + url: `${PREFIX_SERVICES}/delete/${id}`, + method: 'delete' + }) +} diff --git a/src/frontend/devops-op/src/views/shed-lock/index.vue b/src/frontend/devops-op/src/views/shed-lock/index.vue index 46daada22a..4a8fd46b20 100644 --- a/src/frontend/devops-op/src/views/shed-lock/index.vue +++ b/src/frontend/devops-op/src/views/shed-lock/index.vue @@ -30,13 +30,24 @@ prop="lockedBy" label="锁定者" /> + + +