diff --git a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/controller/user/UserSeparationController.kt b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/controller/user/UserSeparationController.kt index 4355ae3cca..e0611f78c8 100644 --- a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/controller/user/UserSeparationController.kt +++ b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/controller/user/UserSeparationController.kt @@ -75,10 +75,12 @@ class UserSeparationController( @GetMapping("/tasks") fun tasks( @RequestParam(required = false) state: String? = null, + @RequestParam(required = false) projectId: String? = null, + @RequestParam(required = false) repoName: String? = null, @RequestParam(required = false, defaultValue = "$DEFAULT_PAGE_NUMBER") pageNumber: Int = DEFAULT_PAGE_NUMBER, @RequestParam(required = false, defaultValue = "$DEFAULT_PAGE_SIZE") pageSize: Int = DEFAULT_PAGE_SIZE, ): Response> { - val page = separationTaskService.findTasks(state, Pages.ofRequest(pageNumber, pageSize)) + val page = separationTaskService.findTasks(state, projectId, repoName, Pages.ofRequest(pageNumber, pageSize)) return ResponseBuilder.success(page) } diff --git a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/dao/SeparationTaskDao.kt b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/dao/SeparationTaskDao.kt index b9ae3c0b5a..36d66c16dc 100644 --- a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/dao/SeparationTaskDao.kt +++ b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/dao/SeparationTaskDao.kt @@ -102,16 +102,20 @@ class SeparationTaskDao : SimpleMongoDao() { return exists(Query(criteria)) } - fun find(state: String?, pageRequest: PageRequest): List { - val criteria = Criteria() - state?.let { criteria.and(TSeparationTask::state.name).isEqualTo(it) } - return find(Query(criteria).with(pageRequest)) + fun find(state: String?, projectId: String?, repoName: String?, pageRequest: PageRequest): List { + return find(buildQuery(state, projectId, repoName).with(pageRequest)) + } + + fun count(state: String?, projectId: String?, repoName: String?): Long { + return count(buildQuery(state, projectId, repoName)) } - fun count(state: String?): Long { + private fun buildQuery(state: String?, projectId: String?, repoName: String?): Query { val criteria = Criteria() state?.let { criteria.and(TSeparationTask::state.name).isEqualTo(it) } - return count(Query(criteria)) + projectId?.let { criteria.and(TSeparationTask::projectId.name).isEqualTo(projectId) } + repoName?.let { criteria.and(TSeparationTask::repoName.name).isEqualTo(repoName) } + return Query(criteria) } fun updateState( diff --git a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/service/SeparationTaskService.kt b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/service/SeparationTaskService.kt index c64378d4c6..e4c38039bf 100644 --- a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/service/SeparationTaskService.kt +++ b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/service/SeparationTaskService.kt @@ -41,7 +41,12 @@ interface SeparationTaskService { projectId: String? = null, repoName: String? = null ): Set - fun findTasks(state: String? = null, pageRequest: PageRequest): Page + fun findTasks( + state: String? = null, + projectId: String? = null, + repoName: String? = null, + pageRequest: PageRequest + ): Page fun reInitTaskState(taskId: String) diff --git a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/service/impl/SeparationTaskServiceImpl.kt b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/service/impl/SeparationTaskServiceImpl.kt index 1a2cb4cf93..371093084c 100644 --- a/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/service/impl/SeparationTaskServiceImpl.kt +++ b/src/backend/job/biz-job/src/main/kotlin/com/tencent/bkrepo/job/separation/service/impl/SeparationTaskServiceImpl.kt @@ -107,9 +107,14 @@ class SeparationTaskServiceImpl( return result } - override fun findTasks(state: String?, pageRequest: PageRequest): Page { - val count = separationTaskDao.count(state) - val records = separationTaskDao.find(state, pageRequest).map { it.toDto() } + override fun findTasks( + state: String?, + projectId: String?, + repoName: String?, + pageRequest: PageRequest + ): Page { + val count = separationTaskDao.count(state, projectId, repoName) + val records = separationTaskDao.find(state, projectId, repoName, pageRequest).map { it.toDto() } return Pages.ofResponse(pageRequest, count, records) } diff --git a/src/frontend/devops-op/src/api/separate.js b/src/frontend/devops-op/src/api/separate.js new file mode 100644 index 0000000000..b07f0c4de1 --- /dev/null +++ b/src/frontend/devops-op/src/api/separate.js @@ -0,0 +1,85 @@ +import request from '@/utils/request' + +const PREFIX_SERVICES = '/job/api/job/separation' + +export function querySeparateTask(data) { + return request({ + url: `${PREFIX_SERVICES}/tasks`, + method: 'get', + params: data + }) +} + +export function createSeparateTask(data) { + return request({ + url: `${PREFIX_SERVICES}/`, + method: 'post', + data: data + }) +} + +export function updateSeparateTask(taskId) { + return request({ + url: `${PREFIX_SERVICES}/update/${taskId}/state`, + method: 'post' + }) +} + +// 查询冷表中节点信息 +export function queryColdNodeData(body) { + return request({ + url: `${PREFIX_SERVICES}/node/${body.projectId}/${body.repoName}`, + method: 'get', + params: { + fullPath: body.fullPath + } + }) +} + +// 查询冷表中版本信息 +export function queryColdVersionData(body) { + return request({ + url: `${PREFIX_SERVICES}/version/${body.projectId}/${body.repoName}`, + method: 'get', + params: { + packageKey: body.packageKey, + version: body.version + } + }) +} + +// 分页查询包 +export function queryPackageData(body) { + return request({ + url: `${PREFIX_SERVICES}/package/page/${body.projectId}/${body.repoName}`, + method: 'get', + params: body.packageOption + }) +} + +// 分页查询版本 +export function queryVersionData(body) { + return request({ + url: `${PREFIX_SERVICES}/version/page/${body.projectId}/${body.repoName}`, + method: 'get', + params: { + packageKey: body.packageKey, + separationDate: body.separationDate, + option: body.versionOption + } + }) +} + +// 分页查询节点 +export function queryNodeData(body) { + return request({ + url: `${PREFIX_SERVICES}/node/page/${body.projectId}/${body.repoName}`, + method: 'get', + params: { + fullPath: body.fullPath, + separationDate: body.separationDate, + option: body.nodeOption + } + }) +} + diff --git a/src/frontend/devops-op/src/icons/svg/separate.svg b/src/frontend/devops-op/src/icons/svg/separate.svg new file mode 100644 index 0000000000..3a63e0663c --- /dev/null +++ b/src/frontend/devops-op/src/icons/svg/separate.svg @@ -0,0 +1 @@ + diff --git a/src/frontend/devops-op/src/router/index.js b/src/frontend/devops-op/src/router/index.js index fab87ed73c..860fbc7807 100644 --- a/src/frontend/devops-op/src/router/index.js +++ b/src/frontend/devops-op/src/router/index.js @@ -27,6 +27,8 @@ export const ROUTER_NAME_REPO_CONFIG = 'RepoConfig' export const ROUTER_NAME_RATE_LIMITER_CONFIG = 'RateLimiterConfig' export const ROUTER_NAME_PRELOAD_CONFIG = 'PreloadConfig' export const ROUTER_NAME_EXECUTION_CLUSTERS_CONFIG = 'ExecutionClustersConfig' +export const ROUTER_NAME_SEPARATION_CONFIG = 'SeparationConfig' +export const ROUTER_NAME_SEPARATION_RECORD = 'SeparationRecord' Vue.use(Router) @@ -340,6 +342,26 @@ export const asyncRoutes = [ } ] }, + { + path: '/separation-config', + component: Layout, + meta: { title: '降冷任务配置', icon: 'separate' }, + redirect: '/separation-config/task', + children: [ + { + path: 'task', + name: ROUTER_NAME_SEPARATION_CONFIG, + meta: { title: '降冷任务', icon: 'separate' }, + component: () => import('@/views/separation/index') + }, + { + path: 'infos', + name: ROUTER_NAME_SEPARATION_RECORD, + meta: { title: '数据查询', icon: 'separate' }, + component: () => import('@/views/separation/ShowData') + } + ] + }, // 404 page must be placed at the end !!! { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/frontend/devops-op/src/views/separation/ShowData.vue b/src/frontend/devops-op/src/views/separation/ShowData.vue new file mode 100644 index 0000000000..8dc5d4207e --- /dev/null +++ b/src/frontend/devops-op/src/views/separation/ShowData.vue @@ -0,0 +1,419 @@ + + + + + + diff --git a/src/frontend/devops-op/src/views/separation/components/CreateOrUpdateSeparationTaskDialog.vue b/src/frontend/devops-op/src/views/separation/components/CreateOrUpdateSeparationTaskDialog.vue new file mode 100644 index 0000000000..731e271041 --- /dev/null +++ b/src/frontend/devops-op/src/views/separation/components/CreateOrUpdateSeparationTaskDialog.vue @@ -0,0 +1,388 @@ + + + + diff --git a/src/frontend/devops-op/src/views/separation/index.vue b/src/frontend/devops-op/src/views/separation/index.vue new file mode 100644 index 0000000000..e47f97b913 --- /dev/null +++ b/src/frontend/devops-op/src/views/separation/index.vue @@ -0,0 +1,348 @@ + + + + + +