From 84aac7d8490b09f4cb9f051ccd1b3f3219a47ed4 Mon Sep 17 00:00:00 2001 From: lannoy0523 <935275025@qq.com> Date: Fri, 1 Nov 2024 15:27:39 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=88=B6?= =?UTF-8?q?=E5=93=81=E9=A2=84=E5=8A=A0=E8=BD=BD=E5=8A=9F=E8=83=BD=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=20#2683?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../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 ++++++++++++++++++ 8 files changed, 805 insertions(+), 4 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 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 5ced5d2e76..166d8b4ea3 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 24eaa9159d..e84ed35e23 100644 --- a/src/frontend/devops-op/src/router/index.js +++ b/src/frontend/devops-op/src/router/index.js @@ -24,6 +24,7 @@ export const ROUTER_NAME_FILE_SYSTEM = 'FileSystem' 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_PRELOAD_CONFIG = 'PreloadConfig' Vue.use(Router) @@ -313,6 +314,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..78a7bc8b16 --- /dev/null +++ b/src/frontend/devops-op/src/views/preload/index.vue @@ -0,0 +1,345 @@ + + + + + + From f9f786b24dbdffbe7ca2f82b372bd4cce837aad8 Mon Sep 17 00:00:00 2001 From: lannoy0523 <935275025@qq.com> Date: Wed, 6 Nov 2024 10:24:07 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=90=8D=E7=A7=B0=20#2683?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{editPlanConfigDialog.vue => EditPlanConfigDialog.vue} | 0 ...{editStrategyConfigDialog.vue => EditStrategyConfigDialog.vue} | 0 .../{editRepoConfigDialog.vue => EditRepoConfigDialog.vue} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src/frontend/devops-op/src/views/preload/components/{editPlanConfigDialog.vue => EditPlanConfigDialog.vue} (100%) rename src/frontend/devops-op/src/views/preload/components/{editStrategyConfigDialog.vue => EditStrategyConfigDialog.vue} (100%) rename src/frontend/devops-op/src/views/repoConfig/components/{editRepoConfigDialog.vue => EditRepoConfigDialog.vue} (100%) diff --git a/src/frontend/devops-op/src/views/preload/components/editPlanConfigDialog.vue b/src/frontend/devops-op/src/views/preload/components/EditPlanConfigDialog.vue similarity index 100% rename from src/frontend/devops-op/src/views/preload/components/editPlanConfigDialog.vue rename to src/frontend/devops-op/src/views/preload/components/EditPlanConfigDialog.vue diff --git a/src/frontend/devops-op/src/views/preload/components/editStrategyConfigDialog.vue b/src/frontend/devops-op/src/views/preload/components/EditStrategyConfigDialog.vue similarity index 100% rename from src/frontend/devops-op/src/views/preload/components/editStrategyConfigDialog.vue rename to src/frontend/devops-op/src/views/preload/components/EditStrategyConfigDialog.vue 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 From 8a13d0fb17ce6d43adffae60bd46d311ac63f912 Mon Sep 17 00:00:00 2001 From: lannoy0523 <935275025@qq.com> Date: Wed, 6 Nov 2024 10:29:09 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=90=8D=E7=A7=B0=20#2683?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/devops-op/src/views/preload/index.vue | 4 ++-- src/frontend/devops-op/src/views/repoConfig/index.vue | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontend/devops-op/src/views/preload/index.vue b/src/frontend/devops-op/src/views/preload/index.vue index 78a7bc8b16..9e69e0b072 100644 --- a/src/frontend/devops-op/src/views/preload/index.vue +++ b/src/frontend/devops-op/src/views/preload/index.vue @@ -137,8 +137,8 @@ import { searchProjects } from '@/api/project' import { listRepositories } from '@/api/repository' import { formatNormalDate } from '@/utils/date' import { convertFileSize } from '@/utils/file' -import editPlanConfigDialog from '@/views/preload/components/editPlanConfigDialog' -import editStrategyConfigDialog from '@/views/preload/components/editStrategyConfigDialog' +import editPlanConfigDialog from '@/views/preload/components/EditPlanConfigDialog' +import editStrategyConfigDialog from '@/views/preload/components/EditStrategyConfigDialog' import { deletePlan, deletePlans, deleteStrategy, queryPlans, queryStrategies } from '@/api/preload' export default { 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',