From 5f365c4ac9bc82e578265e29417b43add9c35192 Mon Sep 17 00:00:00 2001 From: lannoy0523 <46735290+lannoy0523@users.noreply.github.com> Date: Wed, 6 Nov 2024 10:56:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=88=B6=E5=93=81?= =?UTF-8?q?=E9=A2=84=E5=8A=A0=E8=BD=BD=E5=8A=9F=E8=83=BD=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=20#2683?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 增加制品预加载功能管理页面 #2683 * feat: 修改文件名称 #2683 * feat: 修改文件名称 #2683 --- .../user/UserArtifactPreloadController.kt | 9 +- src/frontend/devops-op/package.json | 2 +- src/frontend/devops-op/src/api/preload.js | 66 ++++ .../src/icons/svg/service-config.svg | 1 + src/frontend/devops-op/src/router/index.js | 13 + .../components/EditPlanConfigDialog.vue | 165 +++++++++ .../components/EditStrategyConfigDialog.vue | 208 +++++++++++ .../devops-op/src/views/preload/index.vue | 345 ++++++++++++++++++ ...figDialog.vue => EditRepoConfigDialog.vue} | 0 .../devops-op/src/views/repoConfig/index.vue | 2 +- 10 files changed, 806 insertions(+), 5 deletions(-) create mode 100644 src/frontend/devops-op/src/api/preload.js create mode 100644 src/frontend/devops-op/src/icons/svg/service-config.svg create mode 100644 src/frontend/devops-op/src/views/preload/components/EditPlanConfigDialog.vue create mode 100644 src/frontend/devops-op/src/views/preload/components/EditStrategyConfigDialog.vue create mode 100644 src/frontend/devops-op/src/views/preload/index.vue rename src/frontend/devops-op/src/views/repoConfig/components/{editRepoConfigDialog.vue => EditRepoConfigDialog.vue} (100%) diff --git a/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/controller/user/UserArtifactPreloadController.kt b/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/controller/user/UserArtifactPreloadController.kt index 2b1edab60b..b4be322fa6 100644 --- a/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/controller/user/UserArtifactPreloadController.kt +++ b/src/backend/repository/biz-repository/src/main/kotlin/com/tencent/bkrepo/repository/controller/user/UserArtifactPreloadController.kt @@ -98,9 +98,10 @@ class UserArtifactPreloadController( @PathVariable projectId: String, @PathVariable repoName: String, @PathVariable id: String, - ) { + ): Response { checkPreloadEnabled(preloadPlanService, preloadStrategyService) preloadStrategyService.delete(projectId, repoName, id) + return ResponseBuilder.success() } @ApiOperation("获取所有预加载策略") @@ -143,9 +144,10 @@ class UserArtifactPreloadController( @PathVariable projectId: String, @PathVariable repoName: String, @PathVariable id: String, - ) { + ): Response { checkPreloadEnabled(preloadPlanService, preloadStrategyService) preloadPlanService.deletePlan(projectId, repoName, id) + return ResponseBuilder.success() } @ApiOperation("删除仓库的所有预加载计划") @@ -154,9 +156,10 @@ class UserArtifactPreloadController( fun deleteAllPlans( @PathVariable projectId: String, @PathVariable repoName: String, - ) { + ): Response { checkPreloadEnabled(preloadPlanService, preloadStrategyService) preloadPlanService.deletePlan(projectId, repoName) + return ResponseBuilder.success() } private fun checkPreloadEnabled( diff --git a/src/frontend/devops-op/package.json b/src/frontend/devops-op/package.json index 158d2b470d..cc31b012aa 100644 --- a/src/frontend/devops-op/package.json +++ b/src/frontend/devops-op/package.json @@ -33,7 +33,7 @@ "devDependencies": { "@vue/cli-plugin-babel": "~5.0.8", "@vue/cli-plugin-eslint": "~5.0.8", - "@vue/cli-service": "~5.0.1", + "@vue/cli-service": "~5.0.8", "autoprefixer": "9.5.1", "babel-plugin-dynamic-import-node": "2.3.3", "chalk": "2.4.2", diff --git a/src/frontend/devops-op/src/api/preload.js b/src/frontend/devops-op/src/api/preload.js new file mode 100644 index 0000000000..54f7969a0c --- /dev/null +++ b/src/frontend/devops-op/src/api/preload.js @@ -0,0 +1,66 @@ +import request from '@/utils/request' + +const PREFIX_SERVICES = '/repository/api/preload' + +export function queryStrategies(projectId, repoName) { + return request({ + url: `${PREFIX_SERVICES}/strategy/${projectId}/${repoName}`, + method: 'get' + }) +} + +export function deleteStrategy(projectId, repoName, id) { + return request({ + url: `${PREFIX_SERVICES}/strategy/${projectId}/${repoName}/${id}`, + method: 'delete' + }) +} + +export function createStrategy(data) { + return request({ + url: `${PREFIX_SERVICES}/strategy/`, + method: 'post', + data: data + }) +} + +export function updateStrategy(data) { + return request({ + url: `${PREFIX_SERVICES}/strategy/`, + method: 'put', + data: data + }) +} + +export function createPlan(data) { + return request({ + url: `${PREFIX_SERVICES}/plan/`, + method: 'post', + data: data + }) +} + +export function queryPlans(body) { + return request({ + url: `${PREFIX_SERVICES}/plan/${body.projectId}/${body.repoName}`, + method: 'get', + params: { + pageNumber: body.pageNumber, + pageSize: body.pageSize + } + }) +} + +export function deletePlan(projectId, repoName, id) { + return request({ + url: `${PREFIX_SERVICES}/plan/${projectId}/${repoName}/${id}`, + method: 'delete' + }) +} + +export function deletePlans(projectId, repoName) { + return request({ + url: `${PREFIX_SERVICES}/plan/${projectId}/${repoName}`, + method: 'delete' + }) +} diff --git a/src/frontend/devops-op/src/icons/svg/service-config.svg b/src/frontend/devops-op/src/icons/svg/service-config.svg new file mode 100644 index 0000000000..b154d98e0b --- /dev/null +++ b/src/frontend/devops-op/src/icons/svg/service-config.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/frontend/devops-op/src/router/index.js b/src/frontend/devops-op/src/router/index.js index 06600c068c..e5e859f09c 100644 --- a/src/frontend/devops-op/src/router/index.js +++ b/src/frontend/devops-op/src/router/index.js @@ -25,6 +25,7 @@ export const ROUTER_NAME_FILE_CACHE = 'FileCache' export const ROUTER_NAME_FILE_SYSTEM_RECORD = 'FileSystemRecord' export const ROUTER_NAME_REPO_CONFIG = 'RepoConfig' export const ROUTER_NAME_RATE_LIMITER_CONFIG = 'RateLimiterConfig' +export const ROUTER_NAME_PRELOAD_CONFIG = 'PreloadConfig' Vue.use(Router) @@ -326,6 +327,18 @@ export const asyncRoutes = [ } ] }, + { + path: '/preload-config', + component: Layout, + children: [ + { + path: '/', + name: ROUTER_NAME_PRELOAD_CONFIG, + meta: { title: '制品预加载配置', icon: 'service-config' }, + component: () => import('@/views/preload/index') + } + ] + }, // 404 page must be placed at the end !!! { path: '*', redirect: '/404', hidden: true } ] diff --git a/src/frontend/devops-op/src/views/preload/components/EditPlanConfigDialog.vue b/src/frontend/devops-op/src/views/preload/components/EditPlanConfigDialog.vue new file mode 100644 index 0000000000..32151f6a4d --- /dev/null +++ b/src/frontend/devops-op/src/views/preload/components/EditPlanConfigDialog.vue @@ -0,0 +1,165 @@ + + + + diff --git a/src/frontend/devops-op/src/views/preload/components/EditStrategyConfigDialog.vue b/src/frontend/devops-op/src/views/preload/components/EditStrategyConfigDialog.vue new file mode 100644 index 0000000000..94dff6c904 --- /dev/null +++ b/src/frontend/devops-op/src/views/preload/components/EditStrategyConfigDialog.vue @@ -0,0 +1,208 @@ + + + + diff --git a/src/frontend/devops-op/src/views/preload/index.vue b/src/frontend/devops-op/src/views/preload/index.vue new file mode 100644 index 0000000000..9e69e0b072 --- /dev/null +++ b/src/frontend/devops-op/src/views/preload/index.vue @@ -0,0 +1,345 @@ + + + + + + diff --git a/src/frontend/devops-op/src/views/repoConfig/components/editRepoConfigDialog.vue b/src/frontend/devops-op/src/views/repoConfig/components/EditRepoConfigDialog.vue similarity index 100% rename from src/frontend/devops-op/src/views/repoConfig/components/editRepoConfigDialog.vue rename to src/frontend/devops-op/src/views/repoConfig/components/EditRepoConfigDialog.vue diff --git a/src/frontend/devops-op/src/views/repoConfig/index.vue b/src/frontend/devops-op/src/views/repoConfig/index.vue index cf0622ec6d..a4ee1f6b6c 100644 --- a/src/frontend/devops-op/src/views/repoConfig/index.vue +++ b/src/frontend/devops-op/src/views/repoConfig/index.vue @@ -161,7 +161,7 @@ import { searchProjects } from '@/api/project' import { listRepositories, pageRepositories } from '@/api/repository' import { formatNormalDate } from '@/utils/date' import { convertFileSize } from '@/utils/file' -import EditRepoConfigDialog from '@/views/repoConfig/components/editRepoConfigDialog' +import EditRepoConfigDialog from '@/views/repoConfig/components/EditRepoConfigDialog' export default { name: 'RepoConfig',