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',