diff --git a/modules/server/src/main/java/io/jpom/controller/build/RepositoryController.java b/modules/server/src/main/java/io/jpom/controller/build/RepositoryController.java index 68999c80f..8151d9fd3 100644 --- a/modules/server/src/main/java/io/jpom/controller/build/RepositoryController.java +++ b/modules/server/src/main/java/io/jpom/controller/build/RepositoryController.java @@ -65,8 +65,9 @@ import java.util.Map; import java.util.stream.Collectors; /** - * @author Hotstrip * Repository controller + * + * @author Hotstrip */ @RestController @Feature(cls = ClassFeature.BUILD_REPOSITORY) @@ -84,6 +85,10 @@ public class RepositoryController extends BaseServerController { /** * load repository list * + *
+	 *     此请求会分页列出数据,如需要不分页列出所有数据使用{@link #loadRepositoryListAll()}
+	 * 
+ * * @return json */ @PostMapping(value = "/build/repository/list") @@ -96,6 +101,10 @@ public class RepositoryController extends BaseServerController { /** * load repository list * + *
+	 *     此请求不进行分页列出所有数据,如需要分页使用{@link #loadRepositoryList()}
+	 * 
+ * * @return json */ @GetMapping(value = "/build/repository/list_all") @@ -353,10 +362,10 @@ public class RepositoryController extends BaseServerController { * @param repositoryModelReq 仓库信息 */ private void checkInfo(RepositoryModel repositoryModelReq) { - Assert.notNull(repositoryModelReq, "请传人正确的信息"); + Assert.notNull(repositoryModelReq, "请输入正确的信息"); Assert.hasText(repositoryModelReq.getName(), "请填写仓库名称"); Integer repoType = repositoryModelReq.getRepoType(); - Assert.state(repoType != null && (repoType == 1 || repoType == 0), "请选择仓库类型"); + Assert.state(repoType != null && (repoType == RepositoryModel.RepoType.Git.getCode() || repoType == RepositoryModel.RepoType.Svn.getCode()), "请选择仓库类型"); Assert.hasText(repositoryModelReq.getGitUrl(), "请填写仓库地址"); // Integer protocol = repositoryModelReq.getProtocol(); diff --git a/modules/server/src/main/java/io/jpom/model/enums/GitProtocolEnum.java b/modules/server/src/main/java/io/jpom/model/enums/GitProtocolEnum.java index 25f478124..e559caa3b 100644 --- a/modules/server/src/main/java/io/jpom/model/enums/GitProtocolEnum.java +++ b/modules/server/src/main/java/io/jpom/model/enums/GitProtocolEnum.java @@ -34,7 +34,7 @@ public enum GitProtocolEnum implements BaseEnum { /** * http */ - HTTP(0, "HTTP(s)"), + HTTP(0, "HTTP(S)"), SSH(1, "SSH"), ; diff --git a/modules/server/src/main/java/io/jpom/service/h2db/BaseDbService.java b/modules/server/src/main/java/io/jpom/service/h2db/BaseDbService.java index 6c99b10ef..ac35f1ae0 100644 --- a/modules/server/src/main/java/io/jpom/service/h2db/BaseDbService.java +++ b/modules/server/src/main/java/io/jpom/service/h2db/BaseDbService.java @@ -198,7 +198,7 @@ public abstract class BaseDbService extends BaseDbCommonS } /** - * 通用的分页查询, 使用该方法查询,数据库表字段不能保护 "page", "limit", "order_field", "order", "total" + * 通用的分页查询, 使用该方法查询,数据库表字段不能包含 "page", "limit", "order_field", "order", "total" *

* page=1&limit=10&order=ascend&order_field=name * diff --git a/web-vue/src/api/repository.js b/web-vue/src/api/repository.js index b207058ca..e54d8ae5b 100644 --- a/web-vue/src/api/repository.js +++ b/web-vue/src/api/repository.js @@ -1,10 +1,18 @@ import axios from "./config"; /** - * 仓库列表 - * @param { - * name: 仓库名称 - * } params + * 分页获取仓库列表 + * + * @param {Object} params 分页和查询参数 + * @param {Number} params.limit 每页显示条数,默认 10 条 + * @param {Number} params.page 获取第几页的数据,默认第 1 页 + * @param {Number} params.total 总条数,默认 0 + * @param {String} params.order 排序方式[ascend(升序,从小到大), descend(降序,从大到小)] + * @param {String} params.order_field 需要排序的字段名称 + * @param {Number} params.repoType 查询的仓库类型[0(GIT), 1(SVN)] + * @param {String} params.name 仓库名称 + * @param {String} params.gitUrl 仓库地址 + * @return {axios} 请求结果 axios 对象 */ export function getRepositoryList(params) { return axios({ @@ -15,8 +23,9 @@ export function getRepositoryList(params) { } /** - * 仓库列表 all + * 不分页获取所有仓库列表 * + * @return {axios} 请求结果 axios 对象 */ export function getRepositoryListAll() { return axios({ @@ -26,18 +35,18 @@ export function getRepositoryListAll() { } /** - * 编辑仓库信息,新增或者删除 - * @param { - * id: id - * name: 仓库名称 - * gitUrl: 仓库地址 - * repoType: 仓库类型 {0: GIT, 1: SVN} - * protocol: 协议 {0: HTTP(S), 1: SSH} - * userName: 用户名 - * password: 密码 - * rsaPub: 公钥信息 - * } params - * @returns + * 编辑仓库信息,新增或者更新 + * + * @param {Object} params 请求参数 + * @param {String} params.id 仓库id + * @param {String} params.name 仓库名称 + * @param {String} params.gitUrl 仓库地址 + * @param {Number} params.repoType 仓库类型[0(GIT), 1(SVN)] + * @param {Number} params.protocol 协议[0(HTTP(S)), 1(SSH)] + * @param {String} params.userName 用户名 + * @param {String} params.password 密码 + * @param {String} params.rsaPub 公钥信息 + * @return {axios} 请求结果 axios 对象 */ export function editRepository(params) { return axios({ @@ -48,12 +57,12 @@ export function editRepository(params) { } /** - * delete by id -@param { - * id: id - * isRealDel: 是否真删 - * } params - * @returns + * 根据 仓库id 删除仓库 + * + * @param {Object} params 请求参数 + * @param {String} params.id 仓库id + * @param {Boolean} params.isRealDel 是否真正删除 + * @return {axios} 请求结果 axios 对象 */ export function deleteRepository(params) { return axios({ @@ -62,19 +71,6 @@ export function deleteRepository(params) { data: params, }); } -/** - * delete by id - * @param {String} id - * @returns - */ -export function recoveryRepository(id) { - return axios({ - url: "/build/repository/recovery", - method: "post", - data: { id }, - }); -} - /** * restHideField by id * @param {String} id diff --git a/web-vue/src/pages/repository/list.vue b/web-vue/src/pages/repository/list.vue index 1f48eefb5..a0e7944ce 100644 --- a/web-vue/src/pages/repository/list.vue +++ b/web-vue/src/pages/repository/list.vue @@ -459,6 +459,7 @@ export default { } this.loadData(); }, + // 在导入仓库时,选择不同的 git 平台显示不同的提示语 importTypeChange(val) { if (val === "gitee") { this.importTypePlaceholder = "在 设置-->安全设置-->私人令牌 中获取";