Compare commits

..

32 Commits

Author SHA1 Message Date
xiaojunnuo 6c546b5290 chore: project finished 2026-03-03 23:31:42 +08:00
xiaojunnuo a853fc2026 chore: vip tip 2026-03-03 18:25:55 +08:00
xiaojunnuo 92c9ac3826 fix(cert-plugin): 优化又拍云客户端错误处理逻辑,当域名已绑定证书时不再抛出异常。 2026-03-03 14:35:50 +08:00
xiaojunnuo 78c2ced43b fix: 修复dcdn多个域名同时部署时 可能会出现证书名称重复的bug 2026-03-03 11:31:52 +08:00
xiaojunnuo 72f850f675 fix: 优化dcdn部署上传多次证书 偶尔报 The CertName already exists的问题 2026-03-03 11:29:50 +08:00
xiaojunnuo bc326489ab fix: 修复复制流水线保存后丢失分组和排序号的问题 2026-02-28 19:29:13 +08:00
xiaojunnuo ea5e7d9563 chore: project setting 2026-02-28 18:49:46 +08:00
xiaojunnuo 5b5b48fc06 chore: admin mode setting 2026-02-28 18:30:04 +08:00
xiaojunnuo 1548ba0b8d chore: project manager 2026-02-28 18:17:53 +08:00
xiaojunnuo 26b1c4244f chore: project approve 2026-02-28 12:14:38 +08:00
xiaojunnuo 8a4e981931 chore: project detail join approve 2026-02-28 12:13:31 +08:00
xiaojunnuo 6163c3f08e chore: join project 2026-02-28 00:49:02 +08:00
xiaojunnuo e17f381b1f chore: project blank 2026-02-27 23:09:50 +08:00
xiaojunnuo 316537eb4d fix: 修复偶尔下载证书报未授权的错误 2026-02-27 00:37:24 +08:00
xiaojunnuo b2c421600c chore: 首页数据统计项目显示 2026-02-27 00:14:53 +08:00
xiaojunnuo 787f6ef528 perf: 任务步骤页面增加串行执行提示说明 2026-02-27 00:06:44 +08:00
xiaojunnuo 8578547467 chore: project permission 2026-02-26 23:50:15 +08:00
xiaojunnuo 51ab6d6da1 perf: 【破坏性更新】错误返回信息msg字段名统一改成message,与成功的返回结构一致 2026-02-26 23:50:01 +08:00
xiaojunnuo 3a8b5de8f7 chore: project permission 2026-02-26 00:12:59 +08:00
xiaojunnuo faf08f6513 chore: project 2026-02-21 23:20:26 +08:00
xiaojunnuo 06c69d23be chore: 1 2026-02-19 00:18:29 +08:00
xiaojunnuo 1bcadd5f8e chore: 1 2026-02-19 00:17:02 +08:00
xiaojunnuo 524195d729 Merge branch 'v2-dev' into v2_admin_mode 2026-02-19 00:15:15 +08:00
xiaojunnuo 0c25d277ef build: release 2026-02-19 00:12:31 +08:00
xiaojunnuo 27b0348e1d fix: 修复发件邮箱无法输入的bug 2026-02-19 00:12:08 +08:00
xiaojunnuo ea5aa68769 build: publish 2026-02-18 23:22:03 +08:00
xiaojunnuo 99fefb168a build: trigger build image 2026-02-18 23:21:52 +08:00
xiaojunnuo 49457505cd v1.38.12 2026-02-18 23:20:43 +08:00
xiaojunnuo bfc948a9b4 build: prepare to build 2026-02-18 23:18:39 +08:00
xiaojunnuo c407206627 chore: 1 2026-02-18 23:16:13 +08:00
xiaojunnuo 39d3bf97d1 fix: 修复获取群辉deviceid报错的bug 2026-02-18 10:13:37 +08:00
xiaojunnuo 79be392775 fix: 修复获取群辉deviceid报错的bug 2026-02-18 10:13:24 +08:00
133 changed files with 2035 additions and 575 deletions
+6
View File
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.38.12](https://github.com/certd/certd/compare/v1.38.11...v1.38.12) (2026-02-18)
### Bug Fixes
* 修复获取群辉deviceid报错的bug ([39d3bf9](https://github.com/certd/certd/commit/39d3bf97d1935918bac575da9d0726310c83c19d))
## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16) ## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16)
### Bug Fixes ### Bug Fixes
+6
View File
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.38.12](https://github.com/certd/certd/compare/v1.38.11...v1.38.12) (2026-02-18)
### Bug Fixes
* 修复获取群辉deviceid报错的bug ([39d3bf9](https://github.com/certd/certd/commit/39d3bf97d1935918bac575da9d0726310c83c19d))
## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16) ## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16)
### Bug Fixes ### Bug Fixes
+1 -1
View File
@@ -9,5 +9,5 @@
} }
}, },
"npmClient": "pnpm", "npmClient": "pnpm",
"version": "1.38.11" "version": "1.38.12"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.38.12](https://github.com/publishlab/node-acme-client/compare/v1.38.11...v1.38.12) (2026-02-18)
**Note:** Version bump only for package @certd/acme-client
## [1.38.11](https://github.com/publishlab/node-acme-client/compare/v1.38.10...v1.38.11) (2026-02-16) ## [1.38.11](https://github.com/publishlab/node-acme-client/compare/v1.38.10...v1.38.11) (2026-02-16)
**Note:** Version bump only for package @certd/acme-client **Note:** Version bump only for package @certd/acme-client
+3 -3
View File
@@ -3,7 +3,7 @@
"description": "Simple and unopinionated ACME client", "description": "Simple and unopinionated ACME client",
"private": false, "private": false,
"author": "nmorsman", "author": "nmorsman",
"version": "1.38.11", "version": "1.38.12",
"type": "module", "type": "module",
"module": "scr/index.js", "module": "scr/index.js",
"main": "src/index.js", "main": "src/index.js",
@@ -18,7 +18,7 @@
"types" "types"
], ],
"dependencies": { "dependencies": {
"@certd/basic": "^1.38.11", "@certd/basic": "^1.38.12",
"@peculiar/x509": "^1.11.0", "@peculiar/x509": "^1.11.0",
"asn1js": "^3.0.5", "asn1js": "^3.0.5",
"axios": "^1.9.0", "axios": "^1.9.0",
@@ -70,5 +70,5 @@
"bugs": { "bugs": {
"url": "https://github.com/publishlab/node-acme-client/issues" "url": "https://github.com/publishlab/node-acme-client/issues"
}, },
"gitHead": "1f002159e2a3c73fb5e00341a344effa07d6f653" "gitHead": "49457505cdf8156fd9d936b8e9ace0b48e43a6b2"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.38.12](https://github.com/certd/certd/compare/v1.38.11...v1.38.12) (2026-02-18)
**Note:** Version bump only for package @certd/basic
## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16) ## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16)
**Note:** Version bump only for package @certd/basic **Note:** Version bump only for package @certd/basic
+1 -1
View File
@@ -1 +1 @@
23:40 23:18
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/basic", "name": "@certd/basic",
"private": false, "private": false,
"version": "1.38.11", "version": "1.38.12",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -47,5 +47,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1f002159e2a3c73fb5e00341a344effa07d6f653" "gitHead": "49457505cdf8156fd9d936b8e9ace0b48e43a6b2"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.38.12](https://github.com/certd/certd/compare/v1.38.11...v1.38.12) (2026-02-18)
**Note:** Version bump only for package @certd/pipeline
## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16) ## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16)
**Note:** Version bump only for package @certd/pipeline **Note:** Version bump only for package @certd/pipeline
+4 -4
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/pipeline", "name": "@certd/pipeline",
"private": false, "private": false,
"version": "1.38.11", "version": "1.38.12",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -18,8 +18,8 @@
"compile": "tsc --skipLibCheck --watch" "compile": "tsc --skipLibCheck --watch"
}, },
"dependencies": { "dependencies": {
"@certd/basic": "^1.38.11", "@certd/basic": "^1.38.12",
"@certd/plus-core": "^1.38.11", "@certd/plus-core": "^1.38.12",
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"reflect-metadata": "^0.1.13" "reflect-metadata": "^0.1.13"
@@ -45,5 +45,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1f002159e2a3c73fb5e00341a344effa07d6f653" "gitHead": "49457505cdf8156fd9d936b8e9ace0b48e43a6b2"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.38.12](https://github.com/certd/certd/compare/v1.38.11...v1.38.12) (2026-02-18)
**Note:** Version bump only for package @certd/lib-huawei
## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16) ## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16)
**Note:** Version bump only for package @certd/lib-huawei **Note:** Version bump only for package @certd/lib-huawei
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/lib-huawei", "name": "@certd/lib-huawei",
"private": false, "private": false,
"version": "1.38.11", "version": "1.38.12",
"main": "./dist/bundle.js", "main": "./dist/bundle.js",
"module": "./dist/bundle.js", "module": "./dist/bundle.js",
"types": "./dist/d/index.d.ts", "types": "./dist/d/index.d.ts",
@@ -24,5 +24,5 @@
"prettier": "^2.8.8", "prettier": "^2.8.8",
"tslib": "^2.8.1" "tslib": "^2.8.1"
}, },
"gitHead": "1f002159e2a3c73fb5e00341a344effa07d6f653" "gitHead": "49457505cdf8156fd9d936b8e9ace0b48e43a6b2"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.38.12](https://github.com/certd/certd/compare/v1.38.11...v1.38.12) (2026-02-18)
**Note:** Version bump only for package @certd/lib-iframe
## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16) ## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16)
**Note:** Version bump only for package @certd/lib-iframe **Note:** Version bump only for package @certd/lib-iframe
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/lib-iframe", "name": "@certd/lib-iframe",
"private": false, "private": false,
"version": "1.38.11", "version": "1.38.12",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -31,5 +31,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1f002159e2a3c73fb5e00341a344effa07d6f653" "gitHead": "49457505cdf8156fd9d936b8e9ace0b48e43a6b2"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.38.12](https://github.com/certd/certd/compare/v1.38.11...v1.38.12) (2026-02-18)
**Note:** Version bump only for package @certd/jdcloud
## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16) ## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16)
**Note:** Version bump only for package @certd/jdcloud **Note:** Version bump only for package @certd/jdcloud
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@certd/jdcloud", "name": "@certd/jdcloud",
"version": "1.38.11", "version": "1.38.12",
"description": "jdcloud openApi sdk", "description": "jdcloud openApi sdk",
"main": "./dist/bundle.js", "main": "./dist/bundle.js",
"module": "./dist/bundle.js", "module": "./dist/bundle.js",
@@ -56,5 +56,5 @@
"fetch" "fetch"
] ]
}, },
"gitHead": "1f002159e2a3c73fb5e00341a344effa07d6f653" "gitHead": "49457505cdf8156fd9d936b8e9ace0b48e43a6b2"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.38.12](https://github.com/certd/certd/compare/v1.38.11...v1.38.12) (2026-02-18)
**Note:** Version bump only for package @certd/lib-k8s
## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16) ## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16)
**Note:** Version bump only for package @certd/lib-k8s **Note:** Version bump only for package @certd/lib-k8s
+3 -3
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/lib-k8s", "name": "@certd/lib-k8s",
"private": false, "private": false,
"version": "1.38.11", "version": "1.38.12",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js", "module": "./dist/index.js",
@@ -17,7 +17,7 @@
"pub": "npm publish" "pub": "npm publish"
}, },
"dependencies": { "dependencies": {
"@certd/basic": "^1.38.11", "@certd/basic": "^1.38.12",
"@kubernetes/client-node": "0.21.0" "@kubernetes/client-node": "0.21.0"
}, },
"devDependencies": { "devDependencies": {
@@ -32,5 +32,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1f002159e2a3c73fb5e00341a344effa07d6f653" "gitHead": "49457505cdf8156fd9d936b8e9ace0b48e43a6b2"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.38.12](https://github.com/certd/certd/compare/v1.38.11...v1.38.12) (2026-02-18)
**Note:** Version bump only for package @certd/lib-server
## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16) ## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16)
**Note:** Version bump only for package @certd/lib-server **Note:** Version bump only for package @certd/lib-server
+7 -7
View File
@@ -1,6 +1,6 @@
{ {
"name": "@certd/lib-server", "name": "@certd/lib-server",
"version": "1.38.11", "version": "1.38.12",
"description": "midway with flyway, sql upgrade way ", "description": "midway with flyway, sql upgrade way ",
"private": false, "private": false,
"type": "module", "type": "module",
@@ -28,11 +28,11 @@
], ],
"license": "AGPL", "license": "AGPL",
"dependencies": { "dependencies": {
"@certd/acme-client": "^1.38.11", "@certd/acme-client": "^1.38.12",
"@certd/basic": "^1.38.11", "@certd/basic": "^1.38.12",
"@certd/pipeline": "^1.38.11", "@certd/pipeline": "^1.38.12",
"@certd/plugin-lib": "^1.38.11", "@certd/plugin-lib": "^1.38.12",
"@certd/plus-core": "^1.38.11", "@certd/plus-core": "^1.38.12",
"@midwayjs/cache": "3.14.0", "@midwayjs/cache": "3.14.0",
"@midwayjs/core": "3.20.11", "@midwayjs/core": "3.20.11",
"@midwayjs/i18n": "3.20.13", "@midwayjs/i18n": "3.20.13",
@@ -64,5 +64,5 @@
"typeorm": "^0.3.11", "typeorm": "^0.3.11",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1f002159e2a3c73fb5e00341a344effa07d6f653" "gitHead": "49457505cdf8156fd9d936b8e9ace0b48e43a6b2"
} }
@@ -34,7 +34,7 @@ export abstract class BaseController {
fail(msg: string, code?: any) { fail(msg: string, code?: any) {
return { return {
code: code ? code : Constants.res.error.code, code: code ? code : Constants.res.error.code,
msg: msg ? msg : Constants.res.error.code, message: msg ? msg : Constants.res.error.code,
}; };
} }
@@ -70,9 +70,7 @@ export abstract class BaseController {
projectIdStr = this.ctx.request.query["projectId"] as string; projectIdStr = this.ctx.request.query["projectId"] as string;
} }
if (!projectIdStr) { if (!projectIdStr) {
return null //这里必须抛异常,否则可能会有权限问题
}
if (!projectIdStr) {
throw new Error("projectId 不能为空") throw new Error("projectId 不能为空")
} }
const userId = this.getUserId() const userId = this.getUserId()
@@ -4,7 +4,7 @@
export class BaseException extends Error { export class BaseException extends Error {
code: number; code: number;
data?:any data?:any
constructor(name, code, message,data?:any) { constructor(name: string, code: number, message: string ,data?:any) {
super(message); super(message);
this.name = name; this.name = name;
this.code = code; this.code = code;
+7 -7
View File
@@ -1,19 +1,19 @@
export class Result<T> { export class Result<T> {
code: number; code: number;
msg: string; message: string;
data: T; data: T;
constructor(code, msg, data?) { constructor(code, message, data?) {
this.code = code; this.code = code;
this.msg = msg; this.message = message;
this.data = data; this.data = data;
} }
static error(code = 1, msg, data?: any) { static error(code = 1, message, data?: any) {
return new Result(code, msg, data); return new Result(code, message, data);
} }
static success(msg, data?) { static success(message, data?) {
return new Result(0, msg, data); return new Result(0, message, data);
} }
} }
@@ -24,6 +24,9 @@ export class AccessEntity {
@Column({ name: 'project_id', comment: '项目id' }) @Column({ name: 'project_id', comment: '项目id' })
projectId: number; projectId: number;
@Column({ comment: '权限等级', length: 100 })
level: string; // user common system
@Column({ @Column({
name: 'create_time', name: 'create_time',
comment: '创建时间', comment: '创建时间',
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.38.12](https://github.com/certd/certd/compare/v1.38.11...v1.38.12) (2026-02-18)
**Note:** Version bump only for package @certd/midway-flyway-js
## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16) ## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16)
**Note:** Version bump only for package @certd/midway-flyway-js **Note:** Version bump only for package @certd/midway-flyway-js
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@certd/midway-flyway-js", "name": "@certd/midway-flyway-js",
"version": "1.38.11", "version": "1.38.12",
"description": "midway with flyway, sql upgrade way ", "description": "midway with flyway, sql upgrade way ",
"private": false, "private": false,
"type": "module", "type": "module",
@@ -46,5 +46,5 @@
"typeorm": "^0.3.11", "typeorm": "^0.3.11",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1f002159e2a3c73fb5e00341a344effa07d6f653" "gitHead": "49457505cdf8156fd9d936b8e9ace0b48e43a6b2"
} }
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.38.12](https://github.com/certd/certd/compare/v1.38.11...v1.38.12) (2026-02-18)
**Note:** Version bump only for package @certd/plugin-cert
## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16) ## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16)
**Note:** Version bump only for package @certd/plugin-cert **Note:** Version bump only for package @certd/plugin-cert
+6 -6
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/plugin-cert", "name": "@certd/plugin-cert",
"private": false, "private": false,
"version": "1.38.11", "version": "1.38.12",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
@@ -17,10 +17,10 @@
"compile": "tsc --skipLibCheck --watch" "compile": "tsc --skipLibCheck --watch"
}, },
"dependencies": { "dependencies": {
"@certd/acme-client": "^1.38.11", "@certd/acme-client": "^1.38.12",
"@certd/basic": "^1.38.11", "@certd/basic": "^1.38.12",
"@certd/pipeline": "^1.38.11", "@certd/pipeline": "^1.38.12",
"@certd/plugin-lib": "^1.38.11", "@certd/plugin-lib": "^1.38.12",
"psl": "^1.9.0", "psl": "^1.9.0",
"punycode.js": "^2.3.1" "punycode.js": "^2.3.1"
}, },
@@ -38,5 +38,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1f002159e2a3c73fb5e00341a344effa07d6f653" "gitHead": "49457505cdf8156fd9d936b8e9ace0b48e43a6b2"
} }
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.38.12](https://github.com/certd/certd/compare/v1.38.11...v1.38.12) (2026-02-18)
**Note:** Version bump only for package @certd/plugin-lib
## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16) ## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16)
**Note:** Version bump only for package @certd/plugin-lib **Note:** Version bump only for package @certd/plugin-lib
+6 -6
View File
@@ -1,7 +1,7 @@
{ {
"name": "@certd/plugin-lib", "name": "@certd/plugin-lib",
"private": false, "private": false,
"version": "1.38.11", "version": "1.38.12",
"type": "module", "type": "module",
"main": "./dist/index.js", "main": "./dist/index.js",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
@@ -22,10 +22,10 @@
"@alicloud/pop-core": "^1.7.10", "@alicloud/pop-core": "^1.7.10",
"@alicloud/tea-util": "^1.4.11", "@alicloud/tea-util": "^1.4.11",
"@aws-sdk/client-s3": "^3.964.0", "@aws-sdk/client-s3": "^3.964.0",
"@certd/acme-client": "^1.38.11", "@certd/acme-client": "^1.38.12",
"@certd/basic": "^1.38.11", "@certd/basic": "^1.38.12",
"@certd/pipeline": "^1.38.11", "@certd/pipeline": "^1.38.12",
"@certd/plus-core": "^1.38.11", "@certd/plus-core": "^1.38.12",
"@kubernetes/client-node": "0.21.0", "@kubernetes/client-node": "0.21.0",
"ali-oss": "^6.22.0", "ali-oss": "^6.22.0",
"basic-ftp": "^5.0.5", "basic-ftp": "^5.0.5",
@@ -57,5 +57,5 @@
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.2"
}, },
"gitHead": "1f002159e2a3c73fb5e00341a344effa07d6f653" "gitHead": "49457505cdf8156fd9d936b8e9ace0b48e43a6b2"
} }
+6
View File
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.38.12](https://github.com/certd/certd/compare/v1.38.11...v1.38.12) (2026-02-18)
### Bug Fixes
* 修复获取群辉deviceid报错的bug ([39d3bf9](https://github.com/certd/certd/commit/39d3bf97d1935918bac575da9d0726310c83c19d))
## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16) ## [1.38.11](https://github.com/certd/certd/compare/v1.38.10...v1.38.11) (2026-02-16)
### Performance Improvements ### Performance Improvements
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@certd/ui-client", "name": "@certd/ui-client",
"version": "1.38.11", "version": "1.38.12",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite --open", "dev": "vite --open",
@@ -106,8 +106,8 @@
"zod-defaults": "^0.1.3" "zod-defaults": "^0.1.3"
}, },
"devDependencies": { "devDependencies": {
"@certd/lib-iframe": "^1.38.11", "@certd/lib-iframe": "^1.38.12",
"@certd/pipeline": "^1.38.11", "@certd/pipeline": "^1.38.12",
"@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-node-resolve": "^15.2.3",
"@types/chai": "^4.3.12", "@types/chai": "^4.3.12",
Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

+8 -6
View File
@@ -136,27 +136,29 @@ function createService() {
*/ */
function createRequestFunction(service: any) { function createRequestFunction(service: any) {
return function (config: any) { return function (config: any) {
const configDefault = { const configDefault: any = {
headers: { headers: {
"Content-Type": get(config, "headers.Content-Type", "application/json"), "Content-Type": get(config, "headers.Content-Type", "application/json"),
} as any, } as any,
timeout: 30000, timeout: 30000,
baseURL: env.API, baseURL: env.API,
data: {}, data: {},
params: {},
}; };
const projectStore = useProjectStore(); const projectStore = useProjectStore();
if (projectStore.isEnterprise && !config.url.startsWith("/sys")) {
configDefault.headers["project-id"] = projectStore.currentProjectId;
}
const userStore = useUserStore(); const userStore = useUserStore();
const token = userStore.getToken; const token = userStore.getToken;
if (token != null) { if (token != null) {
// @ts-ignore // @ts-ignore
configDefault.headers.Authorization = token; configDefault.headers.Authorization = token;
} }
return service(Object.assign(configDefault, config)); Object.assign(configDefault, config);
if (!configDefault.params.projectId && projectStore.isEnterprise && !config.url.startsWith("/sys") && !config.url.startsWith("http")) {
configDefault.params.projectId = projectStore.currentProject?.id;
}
return service(configDefault);
}; };
} }
+9 -9
View File
@@ -19,30 +19,30 @@ export function parse(jsonString = "{}", defaultValue = {}) {
/** /**
* @description * @description
* @param {Any} data * @param {Any} data
* @param {String} msg * @param {String} message
* @param {Number} code * @param {Number} code
*/ */
export function response(data = {}, msg = "", code = 0) { export function response(data = {}, message = "", code = 0) {
return [200, { code, msg, data }]; return [200, { code, message, data }];
} }
/** /**
* @description * @description
* @param {Any} data * @param {Any} data
* @param {String} msg * @param {String} message
*/ */
export function responseSuccess(data = {}, msg = "成功") { export function responseSuccess(data = {}, message = "成功") {
return response(data, msg); return response(data, message);
} }
/** /**
* @description * @description
* @param {Any} data * @param {Any} data
* @param {String} msg * @param {String} message
* @param {Number} code * @param {Number} code
*/ */
export function responseError(data = {}, msg = "请求失败", code = 500) { export function responseError(data = {}, message = "请求失败", code = 500) {
return response(data, msg, code); return response(data, message, code);
} }
/** /**
@@ -17,6 +17,8 @@ import NotificationSelector from "../views/certd/notification/notification-selec
import EmailSelector from "./email-selector/index.vue"; import EmailSelector from "./email-selector/index.vue";
import ValidTimeFormat from "./valid-time-format.vue"; import ValidTimeFormat from "./valid-time-format.vue";
import ProjectSelector from "./project-selector/index.vue"; import ProjectSelector from "./project-selector/index.vue";
import ProjectCurrent from "./project-selector/project-current.vue";
export default { export default {
install(app: any) { install(app: any) {
app.component( app.component(
@@ -47,5 +49,6 @@ export default {
app.use(vip); app.use(vip);
app.use(Plugins); app.use(Plugins);
app.component("ProjectSelector", ProjectSelector); app.component("ProjectSelector", ProjectSelector);
app.component("ProjectCurrent", ProjectCurrent);
}, },
}; };
@@ -13,6 +13,7 @@
import { inject, ref, useAttrs } from "vue"; import { inject, ref, useAttrs } from "vue";
import { Modal } from "ant-design-vue"; import { Modal } from "ant-design-vue";
import { ComponentPropsType, doRequest } from "/@/components/plugins/lib"; import { ComponentPropsType, doRequest } from "/@/components/plugins/lib";
import { getInputFromForm } from "../common/utils";
defineOptions({ defineOptions({
name: "DeviceIdGetter", name: "DeviceIdGetter",
@@ -34,7 +35,7 @@ const getPluginType: any = inject("get:plugin:type", () => {
async function loginWithOTPCode(otpCode: string) { async function loginWithOTPCode(otpCode: string) {
const { form } = getScope(); const { form } = getScope();
const pluginType = getPluginType(); const pluginType = getPluginType();
const { input, record } = getInputFromForm(form, pluginType);
return await doRequest({ return await doRequest({
type: pluginType, type: pluginType,
typeName: form.type, typeName: form.type,
@@ -42,7 +43,8 @@ async function loginWithOTPCode(otpCode: string) {
data: { data: {
otpCode, otpCode,
}, },
input: form, input: input,
record,
}); });
} }
@@ -3,34 +3,57 @@
<template #overlay> <template #overlay>
<a-menu @click="handleMenuClick"> <a-menu @click="handleMenuClick">
<a-menu-item v-for="item in projectStore.myProjects" :key="item.id"> <a-menu-item v-for="item in projectStore.myProjects" :key="item.id">
{{ item.name }} <div class="flex items-center justify-between w-full">
<span class="mr-1">{{ item.name }}</span>
<fs-values-format :model-value="item.permission" :dict="projectPermissionDict"></fs-values-format>
</div>
</a-menu-item>
<a-menu-item key="join">
<div class="flex items-center w-full">
<fs-icon icon="ion:add" class="mr-1"></fs-icon>
<span>加入其他项目</span>
</div>
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
</template> </template>
<div class="rounded pl-3 pr-3 px-2 py-1 flex-center flex pointer items-center bg-accent h-10 button-text" title="当前项目"> <div class="rounded pl-3 pr-3 px-2 py-1 flex-center flex pointer items-center bg-accent h-10 button-text" title="当前项目">
<fs-icon icon="ion:apps" class="mr-1"></fs-icon> <!-- <fs-icon icon="ion:apps" class="mr-1"></fs-icon> -->
当前项目{{ projectStore.currentProject?.name || "..." }} 当前项目{{ projectStore.currentProject?.name || "..." }}
<fs-icon icon="ion:chevron-down-outline" class="ml-1"></fs-icon> <fs-icon :icon="currentIcon" class="ml-5"></fs-icon>
</div> </div>
</a-dropdown> </a-dropdown>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted } from "vue"; import { computed, onMounted } from "vue";
import { useProjectStore } from "/@/store/project"; import { useProjectStore } from "/@/store/project";
import { useDicts } from "/@/views/certd/dicts";
import { useRouter } from "vue-router";
defineOptions({ defineOptions({
name: "ProjectSelector", name: "ProjectSelector",
}); });
const projectStore = useProjectStore(); const projectStore = useProjectStore();
onMounted(async () => { onMounted(async () => {
await projectStore.reload(); await projectStore.init();
console.log(projectStore.myProjects);
}); });
const router = useRouter();
function handleMenuClick({ key }: any) { function handleMenuClick({ key }: any) {
if (key === "join") {
router.push("/certd/project/join");
return;
}
projectStore.changeCurrentProject(key); projectStore.changeCurrentProject(key);
window.location.reload(); window.location.reload();
} }
const { projectPermissionDict } = useDicts();
const currentIcon = computed(() => {
return projectPermissionDict.dataMap[projectStore.currentProject?.permission || ""]?.icon || "";
});
</script> </script>
<style lang="less"> <style lang="less">
.project-selector { .project-selector {
@@ -0,0 +1,28 @@
<template>
<a-tag color="green" class="flex-center flex pointer items-center button-text" title="当前项目">
<!-- <fs-icon icon="ion:apps" class="mr-1"></fs-icon> -->
当前项目{{ projectStore.currentProject?.name || "..." }}
<fs-icon :icon="currentIcon" class="ml-5"></fs-icon>
</a-tag>
</template>
<script lang="ts" setup>
import { computed, onMounted } from "vue";
import { useProjectStore } from "/@/store/project";
import { useDicts } from "/@/views/certd/dicts";
defineOptions({
name: "ProjectCurrent",
});
const projectStore = useProjectStore();
// onMounted(async () => {
// await projectStore.reload();
// });
const { projectPermissionDict } = useDicts();
const currentIcon = computed(() => {
return projectPermissionDict.dataMap[projectStore.currentProject?.permission || ""]?.icon || "";
});
</script>
<style lang="less"></style>
@@ -84,7 +84,11 @@ const projectStore = useProjectStore();
<template> <template>
<BasicLayout @clear-preferences-and-logout="handleLogout"> <BasicLayout @clear-preferences-and-logout="handleLogout">
<template #header-left-0> </template> <template #header-left-0>
<div v-if="projectStore.isEnterprise" class="ml-1 mr-2">
<project-selector class="flex-center header-btn" />
</div>
</template>
<template #user-dropdown> <template #user-dropdown>
<UserDropdown :avatar="avatar" :menus="menus" :text="userStore.userInfo?.nickName || userStore.userInfo?.username" description="" tag-text="" @logout="handleLogout" /> <UserDropdown :avatar="avatar" :menus="menus" :text="userStore.userInfo?.nickName || userStore.userInfo?.username" description="" tag-text="" @logout="handleLogout" />
</template> </template>
@@ -92,9 +96,6 @@ const projectStore = useProjectStore();
<LockScreen :avatar @to-login="handleLogout" /> <LockScreen :avatar @to-login="handleLogout" />
</template> </template>
<template #header-right-0> <template #header-right-0>
<div v-if="projectStore.isEnterprise" class="ml-1 mr-2">
<project-selector class="flex-center header-btn" />
</div>
<div class="hover:bg-accent ml-1 mr-2 cursor-pointer rounded-full hidden md:block"> <div class="hover:bg-accent ml-1 mr-2 cursor-pointer rounded-full hidden md:block">
<tutorial-button class="flex-center header-btn" mode="nav" /> <tutorial-button class="flex-center header-btn" mode="nav" />
</div> </div>
@@ -1,3 +1,4 @@
//注意: @符号是保留字符,需要用{'@'}替换, AI请务必提醒我修改
export default { export default {
app: { app: {
crud: { crud: {
@@ -217,6 +218,8 @@ export default {
projectUserManager: "Project User Management", projectUserManager: "Project User Management",
myProjectManager: "My Projects", myProjectManager: "My Projects",
myProjectDetail: "Project Detail", myProjectDetail: "Project Detail",
projectJoin: "Join Project",
currentProject: "Current Project",
}, },
certificateRepo: { certificateRepo: {
title: "Certificate Repository", title: "Certificate Repository",
@@ -274,77 +277,6 @@ export default {
webhookEnabledHelper: "Support webhook trigger pipeline, please check webhook address in trigger source", webhookEnabledHelper: "Support webhook trigger pipeline, please check webhook address in trigger source",
}, },
notificationDefault: "Use Default Notification", notificationDefault: "Use Default Notification",
monitor: {
remark: "Remark",
title: "Site Certificate Monitoring",
description: "Check website certificates' expiration at 0:00 daily; reminders sent 10 days before expiration (using default notification channel);",
settingLink: "Site Monitoring Settings",
limitInfo: "Basic edition limited to 1, professional and above unlimited, current",
checkAll: "Check All",
confirmTitle: "Confirm",
confirmContent: "Confirm to trigger check for all site certificates?",
checkSubmitted: "Check task submitted",
pleaseRefresh: "Please refresh the page later to see the results",
siteName: "Site Name",
enterSiteName: "Please enter the site name",
domain: "Domain",
enterDomain: "Please enter the domain",
enterValidDomain: "Please enter a valid domain",
httpsPort: "HTTPS Port",
enterPort: "Please enter the port",
certInfo: "Certificate Info",
issuer: "Issuer",
certDomains: "Certificate Domains",
certProvider: "Issuer",
certStatus: "Certificate Status",
error: "Error",
status: {
ok: "Valid",
expired: "Expired",
},
certEffectiveTime: "Certificate Effective",
certExpiresTime: "Certificate Expiration",
remainingValidity: "Remaining Validity",
expired: "expired",
days: "days",
lastCheckTime: "Last Check Time",
disabled: "Enable/Disable",
ipCheck: "Enable IP Check",
ipCheckHelper: "Enable to check certificate expiration time on each IP (or source site domain) ",
ipSyncAuto: "Enable IP Sync Auto",
ipSyncMode: "IP Sync Mode",
ipIgnoreCoherence: "Ignore Certificate Coherence",
ipIgnoreCoherenceHelper: "Enable to ignore certificate coherence check, only check certificate expiration time",
selectRequired: "Please select",
ipCheckConfirm: "Are you sure to {status} IP check?",
ipCount: "IP Count",
checkStatus: "Check Status",
pipelineId: "Linked Pipeline ID",
certInfoId: "Certificate ID",
checkSubmittedRefresh: "Check task submitted. Please refresh later to view the result.",
ipManagement: "IP Management",
bulkImport: "Bulk Import",
basicLimitError: "Basic version allows only one monitoring site. Please upgrade to the Pro version.",
limitExceeded: "Sorry, you can only create up to {max} monitoring records. Please purchase or upgrade your plan.",
setting: {
siteMonitorSettings: "Site Monitor Settings",
notificationChannel: "Notification Channel",
setNotificationChannel: "Set the notification channel",
retryTimes: "Retry Times",
monitorRetryTimes: "Number of retry attempts for monitoring requests",
monitorCronSetting: "Monitoring Schedule",
cronTrigger: "Scheduled trigger for monitoring",
dnsServer: "DNS Server",
dnsServerHelper: "Use a custom domain name resolution server, such as: 1.1.1.1 , support multiple",
certValidDays: "Certificate Valid Days",
certValidDaysHelper: "Number of days before expiration to send a notification",
},
cert: {
expired: "Expired",
expiring: "Expiring",
noExpired: "Not Expired",
},
},
checkStatus: { checkStatus: {
success: "Success", success: "Success",
checking: "Checking", checking: "Checking",
@@ -698,7 +630,7 @@ export default {
password: "Password", password: "Password",
pleaseEnterPassword: "Please enter password", pleaseEnterPassword: "Please enter password",
qqEmailAuthCodeHelper: "If using QQ email, get an authorization code in QQ email settings as the password", qqEmailAuthCodeHelper: "If using QQ email, get an authorization code in QQ email settings as the password",
senderEmailHelper: "You can use the format: Name<Email> to set the sender name, e.g.: autossl<certd@example.com>", senderEmailHelper: "You can use the format: Name<Email> to set the sender name, e.g.: autossl<certd{'@'}example.com>",
senderEmail: "Sender Email", senderEmail: "Sender Email",
pleaseEnterSenderEmail: "Please enter sender email", pleaseEnterSenderEmail: "Please enter sender email",
useSsl: "Use SSL", useSsl: "Use SSL",
@@ -889,6 +821,24 @@ export default {
write: "Write", write: "Write",
admin: "Admin", admin: "Admin",
}, },
projectMemberStatus: "Member Status",
},
project: {
noProjectJoined: "You haven't joined any projects yet",
applyToJoin: "Please apply to join a project to start using",
systemProjects: "System Project List",
createdAt: "Created At",
applyJoin: "Apply to Join",
noSystemProjects: "No system projects available",
fetchFailed: "Failed to fetch project list",
applySuccess: "Application successful, waiting for admin approval",
applyFailed: "Application failed, please try again later",
leave: "Leave Project",
leaveSuccess: "Leave project successful",
leaveFailed: "Leave project failed, please try again later",
applyJoinConfirm: "Are you sure you want to apply to join this project?",
leaveConfirm: "Are you sure you want to leave this project?",
viewDetail: "View Detail",
}, },
addonSelector: { addonSelector: {
select: "Select", select: "Select",
@@ -6,7 +6,8 @@ import preferences from "./preferences";
import ui from "./ui"; import ui from "./ui";
import guide from "./guide"; import guide from "./guide";
import common from "./common"; import common from "./common";
import monitor from "./monitor";
//注意: @符号是保留字符,需要用{'@'}替换
export default { export default {
certd, certd,
authentication, authentication,
@@ -16,4 +17,5 @@ export default {
preferences, preferences,
guide, guide,
common, common,
monitor,
}; };
@@ -0,0 +1,73 @@
export default {
ipAddress: "IP地址",
ipAddressHelper: "填写则固定检查此IP,不从DNS获取域名的IP地址",
remark: "Remark",
title: "Site Certificate Monitoring",
description: "Check website certificates' expiration at 0:00 daily; reminders sent 10 days before expiration (using default notification channel);",
settingLink: "Site Monitoring Settings",
limitInfo: "Basic edition limited to 1, professional and above unlimited, current",
checkAll: "Check All",
confirmTitle: "Confirm",
confirmContent: "Confirm to trigger check for all site certificates?",
checkSubmitted: "Check task submitted",
pleaseRefresh: "Please refresh the page later to see the results",
siteName: "Site Name",
enterSiteName: "Please enter the site name",
domain: "Domain",
enterDomain: "Please enter the domain",
enterValidDomain: "Please enter a valid domain",
httpsPort: "HTTPS Port",
enterPort: "Please enter the port",
certInfo: "Certificate Info",
issuer: "Issuer",
certDomains: "Certificate Domains",
certProvider: "Issuer",
certStatus: "Certificate Status",
error: "Error",
status: {
ok: "Valid",
expired: "Expired",
},
certEffectiveTime: "Certificate Effective",
certExpiresTime: "Certificate Expiration",
remainingValidity: "Remaining Validity",
expired: "expired",
days: "days",
lastCheckTime: "Last Check Time",
disabled: "Enable/Disable",
ipCheck: "Enable IP Check",
ipCheckHelper: "Enable to check certificate expiration time on each IP (or source site domain) ",
ipSyncAuto: "Enable IP Sync Auto",
ipSyncMode: "IP Sync Mode",
ipIgnoreCoherence: "Ignore Certificate Coherence",
ipIgnoreCoherenceHelper: "Enable to ignore certificate coherence check, only check certificate expiration time",
selectRequired: "Please select",
ipCheckConfirm: "Are you sure to {status} IP check?",
ipCount: "IP Count",
checkStatus: "Check Status",
pipelineId: "Linked Pipeline ID",
certInfoId: "Certificate ID",
checkSubmittedRefresh: "Check task submitted. Please refresh later to view the result.",
ipManagement: "IP Management",
bulkImport: "Bulk Import",
basicLimitError: "Basic version allows only one monitoring site. Please upgrade to the Pro version.",
limitExceeded: "Sorry, you can only create up to {max} monitoring records. Please purchase or upgrade your plan.",
setting: {
siteMonitorSettings: "Site Monitor Settings",
notificationChannel: "Notification Channel",
setNotificationChannel: "Set the notification channel",
retryTimes: "Retry Times",
monitorRetryTimes: "Number of retry attempts for monitoring requests",
monitorCronSetting: "Monitoring Schedule",
cronTrigger: "Scheduled trigger for monitoring",
dnsServer: "DNS Server",
dnsServerHelper: "Use a custom domain name resolution server, such as: 1.1.1.1 , support multiple",
certValidDays: "Certificate Valid Days",
certValidDaysHelper: "Number of days before expiration to send a notification",
},
cert: {
expired: "Expired",
expiring: "Expiring",
noExpired: "Not Expired",
},
};
@@ -1,3 +1,4 @@
//注意: @符号是保留字符,需要用{'@'}替换, AI请务必提醒我修改
export default { export default {
app: { app: {
crud: { crud: {
@@ -223,6 +224,8 @@ export default {
enterpriseSetting: "企业设置", enterpriseSetting: "企业设置",
myProjectManager: "我的项目", myProjectManager: "我的项目",
myProjectDetail: "项目详情", myProjectDetail: "项目详情",
projectJoin: "加入项目",
currentProject: "当前项目",
}, },
certificateRepo: { certificateRepo: {
title: "证书仓库", title: "证书仓库",
@@ -277,84 +280,6 @@ export default {
webhookEnabledHelper: "支持webhook触发流水线,请在触发源中查看webhook地址", webhookEnabledHelper: "支持webhook触发流水线,请在触发源中查看webhook地址",
}, },
notificationDefault: "使用默认通知", notificationDefault: "使用默认通知",
monitor: {
remark: "备注",
title: "站点证书监控",
description: "每天0点,检查网站证书的过期时间,到期前10天时将发出提醒(使用默认通知渠道);",
settingLink: "站点监控设置",
limitInfo: "基础版限制1条,专业版以上无限制,当前",
checkAll: "检查全部",
confirmTitle: "确认",
confirmContent: "确认触发检查全部站点证书吗?",
checkSubmitted: "检查任务已提交",
pleaseRefresh: "请稍后刷新页面查看结果",
siteName: "站点名称",
enterSiteName: "请输入站点名称",
domain: "网站域名",
enterDomain: "请输入域名",
enterValidDomain: "请输入正确的域名",
httpsPort: "HTTPS端口",
enterPort: "请输入端口",
certInfo: "证书信息",
issuer: "证书颁发机构",
certDomains: "证书域名",
certProvider: "颁发机构",
certStatus: "证书状态",
error: "错误信息",
status: {
ok: "正常",
expired: "过期",
},
certEffectiveTime: "证书生效时间",
certExpiresTime: "证书到期时间",
remainingValidity: "到期剩余",
expired: "过期",
days: "天",
lastCheckTime: "上次检查时间",
disabled: "禁用启用",
ipAddress: "IP地址",
ipAddressHelper: "填写则固定检查此IP,不从DNS获取域名的IP地址",
ipCheck: "开启IP检查",
ipCheckHelper: "开启后,会检查IP(或源站)上的证书有效期",
ipSyncAuto: "自动同步IP",
ipSyncMode: "IP同步模式",
ipSyncModeHelper: "选择仅检查IPv4或IPv6,或检查所有IP",
ipSyncModeAll: "检查所有IP",
ipSyncModeIPV4Only: "仅检查IPv4",
ipSyncModeIPV6Only: "仅检查IPv6",
selectRequired: "请选择",
ipCheckConfirm: "确定{status}IP检查?",
ipCount: "IP数量",
ipIgnoreCoherence: "忽略证书一致性",
ipIgnoreCoherenceHelper: "开启后,即使IP上的证书与站点证书不一致,也会被认为是正常,仅校验证书过期时间",
checkStatus: "检查状态",
pipelineId: "关联流水线ID",
certInfoId: "证书ID",
checkSubmittedRefresh: "检查任务已提交,请稍后刷新查看结果",
ipManagement: "IP管理",
bulkImport: "批量导入",
basicLimitError: "基础版只能添加一个监控站点,请赞助升级专业版",
limitExceeded: "对不起,您最多只能创建条{max}监控记录,请购买或升级套餐",
setting: {
siteMonitorSettings: "站点监控设置",
notificationChannel: "通知渠道",
setNotificationChannel: "设置通知渠道",
retryTimes: "重试次数",
monitorRetryTimes: "监控请求重试次数",
monitorCronSetting: "监控定时设置",
cronTrigger: "定时触发监控",
dnsServer: "DNS服务器",
dnsServerHelper: "使用自定义的域名解析服务器,如:1.1.1.1 , 支持多个",
certValidDays: "证书到期前天数",
certValidDaysHelper: "证书到期前多少天发送通知",
},
cert: {
expired: "已过期",
expiring: "即将过期",
noExpired: "未过期",
},
},
checkStatus: { checkStatus: {
success: "成功", success: "成功",
checking: "检查中", checking: "检查中",
@@ -711,7 +636,7 @@ export default {
password: "密码", password: "密码",
pleaseEnterPassword: "请输入密码", pleaseEnterPassword: "请输入密码",
qqEmailAuthCodeHelper: "如果是qq邮箱,需要到qq邮箱的设置里面申请授权码作为密码", qqEmailAuthCodeHelper: "如果是qq邮箱,需要到qq邮箱的设置里面申请授权码作为密码",
senderEmailHelper: "您可以使用 名称<邮箱> 的格式,来修改发件人名称,例如: autossl<certd@example.com>", senderEmailHelper: "您可以使用 名称<邮箱> 的格式,来修改发件人名称,例如: autossl<certd{'@'}example.com>",
senderEmail: "发件邮箱", senderEmail: "发件邮箱",
pleaseEnterSenderEmail: "请输入发件邮箱", pleaseEnterSenderEmail: "请输入发件邮箱",
useSsl: "是否ssl", useSsl: "是否ssl",
@@ -908,9 +833,27 @@ export default {
projectDetailDescription: "管理项目成员", projectDetailDescription: "管理项目成员",
projectPermission: "权限", projectPermission: "权限",
permission: { permission: {
read: "读取", read: "查看",
write: "写入", write: "修改",
admin: "管理员", admin: "管理员",
}, },
projectMemberStatus: "成员状态",
},
project: {
noProjectJoined: "您还没有加入任何项目",
applyToJoin: "请申请加入项目以开始使用",
projectList: "项目列表",
createdAt: "创建时间",
applyJoin: "申请加入",
noProjects: "暂无项目",
fetchFailed: "获取项目列表失败",
applySuccess: "申请成功,等待管理员审核",
applyFailed: "申请失败,请稍后重试",
leave: "退出项目",
leaveSuccess: "退出项目成功",
leaveFailed: "退出项目失败,请稍后重试",
applyJoinConfirm: "确认加入项目?",
leaveConfirm: "确认退出项目?",
viewDetail: "查看详情",
}, },
}; };
@@ -6,7 +6,8 @@ import preferences from "./preferences";
import ui from "./ui"; import ui from "./ui";
import guide from "./guide"; import guide from "./guide";
import common from "./common"; import common from "./common";
import monitor from "./monitor";
//注意: @符号是保留字符,需要用{'@'}替换
export default { export default {
certd, certd,
authentication, authentication,
@@ -16,4 +17,5 @@ export default {
preferences, preferences,
guide, guide,
common, common,
monitor,
}; };
@@ -0,0 +1,77 @@
export default {
ipAddress: "IP地址",
ipAddressHelper: "填写则固定检查此IP,不从DNS获取域名的IP地址",
remark: "备注",
title: "站点证书监控",
description: "每天0点,检查网站证书的过期时间,到期前10天时将发出提醒(使用默认通知渠道);",
settingLink: "站点监控设置",
limitInfo: "基础版限制1条,专业版以上无限制,当前",
checkAll: "检查全部",
confirmTitle: "确认",
confirmContent: "确认触发检查全部站点证书吗?",
checkSubmitted: "检查任务已提交",
pleaseRefresh: "请稍后刷新页面查看结果",
siteName: "站点名称",
enterSiteName: "请输入站点名称",
domain: "网站域名",
enterDomain: "请输入域名",
enterValidDomain: "请输入正确的域名",
httpsPort: "HTTPS端口",
enterPort: "请输入端口",
certInfo: "证书信息",
issuer: "证书颁发机构",
certDomains: "证书域名",
certProvider: "颁发机构",
certStatus: "证书状态",
error: "错误信息",
status: {
ok: "正常",
expired: "过期",
},
certEffectiveTime: "证书生效时间",
certExpiresTime: "证书到期时间",
remainingValidity: "到期剩余",
expired: "过期",
days: "天",
lastCheckTime: "上次检查时间",
disabled: "禁用启用",
ipCheck: "开启IP检查",
ipCheckHelper: "开启后,会检查IP(或源站)上的证书有效期",
ipSyncAuto: "自动同步IP",
ipSyncMode: "IP同步模式",
ipSyncModeHelper: "选择仅检查IPv4或IPv6,或检查所有IP",
ipSyncModeAll: "检查所有IP",
ipSyncModeIPV4Only: "仅检查IPv4",
ipSyncModeIPV6Only: "仅检查IPv6",
selectRequired: "请选择",
ipCheckConfirm: "确定{status}IP检查?",
ipCount: "IP数量",
ipIgnoreCoherence: "忽略证书一致性",
ipIgnoreCoherenceHelper: "开启后,即使IP上的证书与站点证书不一致,也会被认为是正常,仅校验证书过期时间",
checkStatus: "检查状态",
pipelineId: "关联流水线ID",
certInfoId: "证书ID",
checkSubmittedRefresh: "检查任务已提交,请稍后刷新查看结果",
ipManagement: "IP管理",
bulkImport: "批量导入",
basicLimitError: "基础版只能添加一个监控站点,请赞助升级专业版",
limitExceeded: "对不起,您最多只能创建条{max}监控记录,请购买或升级套餐",
setting: {
siteMonitorSettings: "站点监控设置",
notificationChannel: "通知渠道",
setNotificationChannel: "设置通知渠道",
retryTimes: "重试次数",
monitorRetryTimes: "监控请求重试次数",
monitorCronSetting: "监控定时设置",
cronTrigger: "定时触发监控",
dnsServer: "DNS服务器",
dnsServerHelper: "使用自定义的域名解析服务器,如:1.1.1.1 , 支持多个",
certValidDays: "证书到期前天数",
certValidDaysHelper: "证书到期前多少天发送通知",
},
cert: {
expired: "已过期",
expiring: "即将过期",
noExpired: "未过期",
},
};
@@ -55,7 +55,7 @@ export default {
email_webhook_notifications: "邮件、webhook通知方式", email_webhook_notifications: "邮件、webhook通知方式",
professional_edition: "专业版", professional_edition: "专业版",
open_source_support: "开源需要您的赞助支持", open_source_support: "开源需要您的赞助支持,个人和企业内部使用",
vip_group_priority: "可加VIP群,您的需求将优先实现", vip_group_priority: "可加VIP群,您的需求将优先实现",
unlimited_site_certificate_monitoring: "站点证书监控无限制", unlimited_site_certificate_monitoring: "站点证书监控无限制",
more_notification_methods: "更多通知方式", more_notification_methods: "更多通知方式",
@@ -66,13 +66,13 @@ export default {
get_after_support: "立即赞助", get_after_support: "立即赞助",
business_edition: "商业版", business_edition: "商业版",
commercial_license: "商业授权,可对外运营", commercial_license: "商业授权,可对外运营,提供SaaS服务",
all_pro_privileges: "拥有专业版所有特权", all_pro_privileges: "拥有专业版所有特权",
allow_commercial_use_modify_logo_title: "允许商用,可修改logo、标题", allow_commercial_use_modify_logo_title: "允许商用,可修改logo、标题",
data_statistics: "数据统计", data_statistics: "数据统计",
plugin_management: "插件管理", plugin_management: "插件管理",
unlimited_multi_users: "多用户无限制", unlimited_multi_users: "多用户无限制",
support_user_payment: "支持用户支付", support_user_payment: "支持用户支付(购买套餐,按流水线条数、域名数量、部署次数计费)",
activate: "激活", activate: "激活",
get_pro_code_after_support: "前往获取", get_pro_code_after_support: "前往获取",
business_contact_author: "", business_contact_author: "",
@@ -123,7 +123,6 @@ function install(app: App, options: any = {}) {
if (scope.key === "__blank__") { if (scope.key === "__blank__") {
return false; return false;
} }
//不能用 !scope.value 否则switch组件设置为关之后就消失了 //不能用 !scope.value 否则switch组件设置为关之后就消失了
const { value, key, props } = scope; const { value, key, props } = scope;
return !value && key != "_index" && value != false && value != 0; return !value && key != "_index" && value != false && value != 0;
@@ -1,12 +1,15 @@
import { usePermission } from "/@/plugin/permission"; import { usePermission } from "/@/plugin/permission";
import { merge as LodashMerge } from "lodash-es"; import { merge as LodashMerge } from "lodash-es";
import { useProjectStore } from "/@/store/project";
export type UseCrudPermissionExtraProps = { export type UseCrudPermissionExtraProps = {
hasActionPermission: (action: string) => boolean; hasActionPermission: (action: string) => boolean;
}; };
export type UseCrudPermissionExtra = (props: UseCrudPermissionExtraProps) => any; export type UseCrudPermissionExtra = (props: UseCrudPermissionExtraProps) => any;
export type UseCrudPermissionCompProps = { export type UseCrudPermissionCompProps = {
prefix: string; isProjectPermission?: boolean;
projectPermission?: string;
prefix?: string;
extra?: UseCrudPermissionExtra; extra?: UseCrudPermissionExtra;
[key: string]: any; [key: string]: any;
}; };
@@ -20,14 +23,31 @@ export type UseCrudPermissionProps = {
export function useCrudPermission({ permission }: UseCrudPermissionProps) { export function useCrudPermission({ permission }: UseCrudPermissionProps) {
const { hasPermissions } = usePermission(); const { hasPermissions } = usePermission();
const prefix = permission instanceof Object ? permission.prefix : permission;
//根据权限显示按钮 //根据权限显示按钮
function hasActionPermission(action: string) { let hasActionPermission = (action: string) => {
if (!prefix) { if (!prefix) {
return true; return true;
} }
return hasPermissions(prefix + ":" + action); return hasPermissions(prefix + ":" + action);
};
let per: UseCrudPermissionCompProps = permission as any;
if (per == null) {
per = { prefix: "" };
}
if (typeof per === "string") {
per = {
prefix: per || "",
};
}
let prefix = per.prefix || "";
const isProjectPermission = per.isProjectPermission || false;
if (isProjectPermission) {
const projectStore = useProjectStore();
prefix = "";
hasActionPermission = function (value: string) {
return projectStore.hasPermission(value as string);
};
} }
function buildCrudPermission(): any { function buildCrudPermission(): any {
@@ -36,25 +56,45 @@ export function useCrudPermission({ permission }: UseCrudPermissionProps) {
} }
let extra = {}; let extra = {};
if (permission instanceof Object) { if (per instanceof Object) {
extra = permission.extra; extra = per.extra;
if (permission.extra && permission.extra instanceof Function) { if (per.extra && per.extra instanceof Function) {
extra = permission.extra({ hasActionPermission }); extra = per.extra({ hasActionPermission });
} }
} }
let viewPermission = "view";
if (isProjectPermission) {
viewPermission = "read";
}
let addPermission = "add";
if (isProjectPermission) {
addPermission = per.projectPermission || "write";
}
let editPermission = "edit";
if (isProjectPermission) {
editPermission = per.projectPermission || "write";
}
let removePermission = "remove";
if (isProjectPermission) {
removePermission = per.projectPermission || "write";
}
return LodashMerge( return LodashMerge(
{ {
actionbar: { actionbar: {
buttons: { buttons: {
add: { show: hasActionPermission("add") }, add: { show: hasActionPermission(addPermission) },
}, },
}, },
rowHandle: { rowHandle: {
buttons: { buttons: {
edit: { show: hasActionPermission("edit") }, edit: { show: hasActionPermission(editPermission) },
remove: { show: hasActionPermission("remove") }, remove: { show: hasActionPermission(removePermission) },
view: { show: hasActionPermission("view") }, view: { show: hasActionPermission(viewPermission) },
copy: { show: hasActionPermission(addPermission) },
}, },
}, },
}, },
@@ -9,6 +9,9 @@ import { useSettingStore } from "/@/store/settings";
import { usePermissionStore } from "/@/plugin/permission/store.permission"; import { usePermissionStore } from "/@/plugin/permission/store.permission";
import util from "/@/plugin/permission/util.permission"; import util from "/@/plugin/permission/util.permission";
import { useUserStore } from "/@/store/user"; import { useUserStore } from "/@/store/user";
import { useProjectStore } from "../store/project";
export const PROJECT_PATH_PREFIX = "/certd/project";
export const SYS_PATH_PREFIX = "/sys";
function buildAccessedMenus(menus: any) { function buildAccessedMenus(menus: any) {
if (menus == null) { if (menus == null) {
@@ -124,6 +127,20 @@ function setupAccessGuard(router: Router) {
}; };
} }
return true; return true;
} else {
// 如果是项目模式
const projectStore = useProjectStore();
if (projectStore.isEnterprise) {
//加载我的项目
await projectStore.init();
if (!projectStore.currentProject && !to.path.startsWith(PROJECT_PATH_PREFIX) && !to.path.startsWith(SYS_PATH_PREFIX)) {
//没有项目
return {
path: `${PROJECT_PATH_PREFIX}/join`,
replace: true,
};
}
}
} }
}); });
} }
@@ -1,7 +1,5 @@
import { useSettingStore } from "/@/store/settings";
import aboutResource from "/@/router/source/modules/about";
import i18n from "/@/locales/i18n";
import { useProjectStore } from "/@/store/project"; import { useProjectStore } from "/@/store/project";
import { useSettingStore } from "/@/store/settings";
export const certdResources = [ export const certdResources = [
{ {
@@ -25,21 +23,37 @@ export const certdResources = [
const projectStore = useProjectStore(); const projectStore = useProjectStore();
return projectStore.isEnterprise; return projectStore.isEnterprise;
}, },
isMenu: false,
icon: "ion:apps", icon: "ion:apps",
permission: "sys:settings:edit",
keepAlive: true, keepAlive: true,
auth: true,
}, },
}, },
{ {
title: "certd.sysResources.myProjectDetail", title: "certd.sysResources.currentProject",
name: "MyProjectDetail", name: "CurrentProject",
path: "/certd/project/detail", path: "/certd/project/detail",
component: "/certd/project/detail/index.vue", component: "/certd/project/detail/index.vue",
meta: {
show: () => {
const projectStore = useProjectStore();
return projectStore.isEnterprise;
},
isMenu: true,
icon: "ion:apps",
auth: true,
},
},
{
title: "certd.sysResources.projectJoin",
name: "ProjectJoin",
path: "/certd/project/join",
component: "/certd/project/join.vue",
meta: { meta: {
isMenu: false, isMenu: false,
show: true, show: true,
icon: "ion:apps", icon: "ion:apps",
permission: "sys:settings:edit", auth: true,
}, },
}, },
{ {
@@ -50,6 +64,7 @@ export const certdResources = [
meta: { meta: {
icon: "ion:analytics-sharp", icon: "ion:analytics-sharp",
keepAlive: true, keepAlive: true,
auth: true,
}, },
}, },
{ {
@@ -59,6 +74,7 @@ export const certdResources = [
component: "/certd/pipeline/detail.vue", component: "/certd/pipeline/detail.vue",
meta: { meta: {
isMenu: false, isMenu: false,
auth: true,
}, },
}, },
{ {
@@ -69,6 +85,7 @@ export const certdResources = [
meta: { meta: {
icon: "ion:timer-outline", icon: "ion:timer-outline",
keepAlive: true, keepAlive: true,
auth: true,
}, },
}, },
{ {
@@ -79,6 +96,7 @@ export const certdResources = [
meta: { meta: {
isMenu: true, isMenu: true,
icon: "ion:duplicate-outline", icon: "ion:duplicate-outline",
auth: true,
}, },
}, },
{ {
@@ -88,6 +106,7 @@ export const certdResources = [
component: "/certd/pipeline/template/edit.vue", component: "/certd/pipeline/template/edit.vue",
meta: { meta: {
isMenu: false, isMenu: false,
auth: true,
}, },
}, },
{ {
@@ -97,6 +116,7 @@ export const certdResources = [
component: "/certd/pipeline/template/import/index.vue", component: "/certd/pipeline/template/import/index.vue",
meta: { meta: {
isMenu: false, isMenu: false,
auth: true,
}, },
}, },
{ {
@@ -241,6 +261,10 @@ export const certdResources = [
icon: "mi:user-check", icon: "mi:user-check",
auth: true, auth: true,
isMenu: true, isMenu: true,
show: () => {
const projectStore = useProjectStore();
return !projectStore.isEnterprise;
},
}, },
}, },
{ {
@@ -1,7 +1,4 @@
import LayoutPass from "/@/layout/layout-pass.vue";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import aboutResource from "/@/router/source/modules/about";
import i18n from "/@/locales/i18n";
export const sysResources = [ export const sysResources = [
{ {
@@ -13,6 +10,7 @@ export const sysResources = [
icon: "ion:settings-outline", icon: "ion:settings-outline",
permission: "sys:settings:view", permission: "sys:settings:view",
order: 10, order: 10,
auth: true,
}, },
children: [ children: [
{ {
@@ -27,6 +25,7 @@ export const sysResources = [
}, },
icon: "ion:speedometer-outline", icon: "ion:speedometer-outline",
permission: "sys:auth:user:view", permission: "sys:auth:user:view",
auth: true,
}, },
}, },
@@ -38,6 +37,7 @@ export const sysResources = [
meta: { meta: {
icon: "ion:settings-outline", icon: "ion:settings-outline",
permission: "sys:settings:view", permission: "sys:settings:view",
auth: true,
}, },
}, },
{ {
@@ -47,6 +47,7 @@ export const sysResources = [
component: "/sys/enterprise/project/index.vue", component: "/sys/enterprise/project/index.vue",
meta: { meta: {
show: true, show: true,
auth: true,
icon: "ion:apps", icon: "ion:apps",
permission: "sys:settings:edit", permission: "sys:settings:edit",
keepAlive: true, keepAlive: true,
@@ -60,6 +61,7 @@ export const sysResources = [
meta: { meta: {
isMenu: false, isMenu: false,
show: true, show: true,
auth: true,
icon: "ion:apps", icon: "ion:apps",
permission: "sys:settings:edit", permission: "sys:settings:edit",
}, },
@@ -73,6 +75,7 @@ export const sysResources = [
icon: "ion:earth-outline", icon: "ion:earth-outline",
permission: "sys:settings:view", permission: "sys:settings:view",
keepAlive: true, keepAlive: true,
auth: true,
}, },
}, },
{ {
@@ -96,6 +99,7 @@ export const sysResources = [
const settingStore = useSettingStore(); const settingStore = useSettingStore();
return settingStore.isComm; return settingStore.isComm;
}, },
auth: true,
icon: "ion:document-text-outline", icon: "ion:document-text-outline",
permission: "sys:settings:view", permission: "sys:settings:view",
}, },
@@ -110,6 +114,7 @@ export const sysResources = [
const settingStore = useSettingStore(); const settingStore = useSettingStore();
return settingStore.isComm; return settingStore.isComm;
}, },
auth: true,
icon: "ion:menu", icon: "ion:menu",
permission: "sys:settings:view", permission: "sys:settings:view",
keepAlive: true, keepAlive: true,
@@ -125,6 +130,7 @@ export const sysResources = [
const settingStore = useSettingStore(); const settingStore = useSettingStore();
return settingStore.isComm; return settingStore.isComm;
}, },
auth: true,
icon: "ion:disc-outline", icon: "ion:disc-outline",
permission: "sys:settings:view", permission: "sys:settings:view",
keepAlive: true, keepAlive: true,
@@ -139,6 +145,7 @@ export const sysResources = [
icon: "ion:extension-puzzle-outline", icon: "ion:extension-puzzle-outline",
permission: "sys:settings:view", permission: "sys:settings:view",
keepAlive: true, keepAlive: true,
auth: true,
}, },
}, },
{ {
@@ -151,6 +158,7 @@ export const sysResources = [
icon: "ion:extension-puzzle", icon: "ion:extension-puzzle",
permission: "sys:settings:view", permission: "sys:settings:view",
keepAlive: true, keepAlive: true,
auth: true,
}, },
}, },
{ {
@@ -165,6 +173,7 @@ export const sysResources = [
}, },
icon: "ion:extension-puzzle", icon: "ion:extension-puzzle",
permission: "sys:settings:view", permission: "sys:settings:view",
auth: true,
}, },
}, },
{ {
@@ -176,6 +185,7 @@ export const sysResources = [
icon: "ion:golf-outline", icon: "ion:golf-outline",
permission: "sys:settings:view", permission: "sys:settings:view",
keepAlive: true, keepAlive: true,
auth: true,
}, },
}, },
{ {
@@ -187,6 +197,7 @@ export const sysResources = [
icon: "ion:list-outline", icon: "ion:list-outline",
permission: "sys:auth:per:view", permission: "sys:auth:per:view",
keepAlive: true, keepAlive: true,
auth: true,
}, },
}, },
{ {
@@ -198,6 +209,7 @@ export const sysResources = [
icon: "ion:people-outline", icon: "ion:people-outline",
permission: "sys:auth:role:view", permission: "sys:auth:role:view",
keepAlive: true, keepAlive: true,
auth: true,
}, },
}, },
{ {
@@ -209,6 +221,7 @@ export const sysResources = [
icon: "ion:person-outline", icon: "ion:person-outline",
permission: "sys:auth:user:view", permission: "sys:auth:user:view",
keepAlive: true, keepAlive: true,
auth: true,
}, },
}, },
{ {
@@ -224,6 +237,7 @@ export const sysResources = [
return settingStore.isComm; return settingStore.isComm;
}, },
keepAlive: true, keepAlive: true,
auth: true,
}, },
children: [ children: [
{ {
@@ -238,6 +252,7 @@ export const sysResources = [
}, },
icon: "ion:cart", icon: "ion:cart",
permission: "sys:settings:edit", permission: "sys:settings:edit",
auth: true,
}, },
}, },
{ {
@@ -253,6 +268,7 @@ export const sysResources = [
icon: "ion:bag-check", icon: "ion:bag-check",
permission: "sys:settings:edit", permission: "sys:settings:edit",
keepAlive: true, keepAlive: true,
auth: true,
}, },
}, },
{ {
@@ -4,6 +4,7 @@ import { message } from "ant-design-vue";
import { computed, ref } from "vue"; import { computed, ref } from "vue";
import { useSettingStore } from "../settings"; import { useSettingStore } from "../settings";
import { LocalStorage } from "/@/utils/util.storage"; import { LocalStorage } from "/@/utils/util.storage";
import { useUserStore } from "../user";
export type ProjectItem = { export type ProjectItem = {
id: string; id: string;
@@ -13,7 +14,11 @@ export type ProjectItem = {
export const useProjectStore = defineStore("app.project", () => { export const useProjectStore = defineStore("app.project", () => {
const myProjects = ref([]); const myProjects = ref([]);
const lastProjectId = LocalStorage.get("currentProjectId"); const inited = ref(false);
const userStore = useUserStore();
const userId = userStore.getUserInfo?.id;
const lastProjectIdCacheKey = "currentProjectId:" + userId;
const lastProjectId = LocalStorage.get(lastProjectIdCacheKey);
const currentProjectId = ref(lastProjectId); // 直接调用 const currentProjectId = ref(lastProjectId); // 直接调用
const projects = computed(() => { const projects = computed(() => {
@@ -59,34 +64,80 @@ export const useProjectStore = defineStore("app.project", () => {
function changeCurrentProject(id: string, silent?: boolean) { function changeCurrentProject(id: string, silent?: boolean) {
currentProjectId.value = id; currentProjectId.value = id;
LocalStorage.set("currentProjectId", id); LocalStorage.set(lastProjectIdCacheKey, id);
if (!silent) { if (!silent) {
message.success("切换项目成功"); message.success("切换项目成功");
} }
} }
async function reload() { async function reload() {
const projects = await api.MyProjectList(); inited.value = false;
myProjects.value = projects; await init();
} }
async function init() { async function init() {
if (!myProjects.value) { if (!inited.value) {
await reload(); await loadMyProjects();
inited.value = true;
} }
return myProjects.value; return myProjects.value;
} }
const isRead = computed(() => {
if (!isEnterprise.value) {
return true;
}
return currentProject.value;
});
const isWrite = computed(() => {
if (!isEnterprise.value) {
return true;
}
return currentProject.value?.permission === "write" || currentProject.value?.permission === "admin";
});
const isAdmin = computed(() => {
if (!isEnterprise.value) {
return true;
}
return currentProject.value?.permission === "admin";
});
function hasPermission(value: string) {
if (!isEnterprise.value) {
return true;
}
if (value === "read") {
return isRead.value;
} else if (value === "write") {
return isWrite.value;
} else if (value === "admin") {
return isAdmin.value;
}
return false;
}
function $reset() {
myProjects.value = [];
currentProjectId.value = "";
}
return { return {
projects, projects,
myProjects, myProjects,
currentProject, currentProject,
currentProjectId, currentProjectId,
isEnterprise, isEnterprise,
isRead,
isWrite,
isAdmin,
getSearchForm, getSearchForm,
loadMyProjects, loadMyProjects,
changeCurrentProject, changeCurrentProject,
reload, reload,
init, init,
$reset,
hasPermission,
}; };
}); });
@@ -6,6 +6,7 @@
@import "./antdv4.less"; @import "./antdv4.less";
@import "./certd.less"; @import "./certd.less";
@import "./dark.less"; @import "./dark.less";
@import "./vben.less";
html, html,
body { body {
@@ -4,4 +4,10 @@
color: #d5d5d5 !important; color: #d5d5d5 !important;
} }
} }
.vben-normal-menu__item.is-active{
background-color: #3b3b3b !important;
}
} }
@@ -0,0 +1,3 @@
.vben-normal-menu__item.is-active{
background-color: #ebf1f6 !important;
}
@@ -210,11 +210,9 @@ const headerSlots = computed(() => {
</template> </template>
<!-- 侧边额外区域 --> <!-- 侧边额外区域 -->
<template #side-extra> <template #side-extra>
1111
<LayoutExtraMenu :accordion="preferences.navigation.accordion" :collapse="preferences.sidebar.extraCollapse" :menus="wrapperMenus(extraMenus)" :rounded="isMenuRounded" :theme="sidebarTheme" /> <LayoutExtraMenu :accordion="preferences.navigation.accordion" :collapse="preferences.sidebar.extraCollapse" :menus="wrapperMenus(extraMenus)" :rounded="isMenuRounded" :theme="sidebarTheme" />
</template> </template>
<template #side-extra-title> <template #side-extra-title>
234234234
<VbenLogo v-if="preferences.logo.enable" :text="preferences.app.name" :theme="theme" /> <VbenLogo v-if="preferences.logo.enable" :text="preferences.app.name" :theme="theme" />
</template> </template>
@@ -4,7 +4,7 @@ import { getCommonColumnDefine } from "/@/views/certd/access/common";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud"; import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { useProjectStore } from "/@/store/project"; import { useProjectStore } from "/@/store/project";
import { myProjectDict } from "../../../dicts"; import { useDicts } from "../../../dicts";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const { t } = useI18n(); const { t } = useI18n();
@@ -41,7 +41,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
selectedRowKey.value = changed; selectedRowKey.value = changed;
ctx.emit("update:modelValue", changed[0]); ctx.emit("update:modelValue", changed[0]);
}; };
const { myProjectDict } = useDicts();
const typeRef = ref("aliyun"); const typeRef = ref("aliyun");
context.typeRef = typeRef; context.typeRef = typeRef;
const commonColumnsDefine = getCommonColumnDefine(crudExpose, typeRef, api); const commonColumnsDefine = getCommonColumnDefine(crudExpose, typeRef, api);
@@ -1,7 +1,7 @@
// @ts-ignore // @ts-ignore
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud"; import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import { ref } from "vue"; import { ref } from "vue";
import { myProjectDict } from "../dicts"; import { useDicts } from "../dicts";
import { useProjectStore } from "/@/store/project"; import { useProjectStore } from "/@/store/project";
import { getCommonColumnDefine } from "/@/views/certd/access/common"; import { getCommonColumnDefine } from "/@/views/certd/access/common";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
@@ -32,6 +32,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const typeRef = ref(); const typeRef = ref();
const commonColumnsDefine = getCommonColumnDefine(crudExpose, typeRef, api); const commonColumnsDefine = getCommonColumnDefine(crudExpose, typeRef, api);
const projectStore = useProjectStore(); const projectStore = useProjectStore();
const { myProjectDict } = useDicts();
return { return {
crudOptions: { crudOptions: {
request: { request: {
@@ -22,7 +22,7 @@ export default defineComponent({
setup() { setup() {
const { t } = useI18n(); const { t } = useI18n();
const api = createAccessApi("user"); const api = createAccessApi("user");
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { api } }); const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { api, permission: { isProjectPermission: true } } });
// //
onMounted(() => { onMounted(() => {
@@ -22,7 +22,10 @@ export default defineComponent({
setup() { setup() {
const api = createAddonApi({ from: "user", addonType: "" }); const api = createAddonApi({ from: "user", addonType: "" });
addonProvide(api); addonProvide(api);
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { api } }); const { crudBinding, crudRef, crudExpose } = useFs({
createCrudOptions,
context: { api, permission: { isProjectPermission: true } },
});
// //
onMounted(() => { onMounted(() => {
@@ -18,7 +18,12 @@ import createCrudOptions from "./crud";
export default defineComponent({ export default defineComponent({
name: "BasicGroupManager", name: "BasicGroupManager",
setup() { setup() {
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: {} }); const { crudBinding, crudRef, crudExpose } = useFs({
createCrudOptions,
context: {
permission: { isProjectPermission: true },
},
});
// //
onMounted(() => { onMounted(() => {
@@ -12,6 +12,7 @@ import { useI18n } from "/src/locales";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const { hasActionPermission } = context;
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => { const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
return await api.GetList(query); return await api.GetList(query);
}; };
@@ -96,6 +97,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
icon: "ion:add-circle-outline", icon: "ion:add-circle-outline",
}, },
import: { import: {
show: hasActionPermission("write"),
title: "从域名提供商导入域名", title: "从域名提供商导入域名",
type: "primary", type: "primary",
text: "从域名提供商导入", text: "从域名提供商导入",
@@ -111,6 +113,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
syncExpirationDate: { syncExpirationDate: {
show: hasActionPermission("write"),
title: "同步域名过期时间", title: "同步域名过期时间",
type: "primary", type: "primary",
icon: "ion:refresh-outline", icon: "ion:refresh-outline",
@@ -10,7 +10,7 @@
</template> </template>
<fs-crud ref="crudRef" v-bind="crudBinding"> <fs-crud ref="crudRef" v-bind="crudBinding">
<template #pagination-left> <template #pagination-left>
<a-tooltip :title="t('certd.batch_delete')"> <a-tooltip v-if="hasActionPermission('write')" :title="t('certd.batch_delete')">
<fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button> <fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>
</a-tooltip> </a-tooltip>
</template> </template>
@@ -25,13 +25,22 @@ import createCrudOptions from "./crud";
import { message, Modal } from "ant-design-vue"; import { message, Modal } from "ant-design-vue";
import { DeleteBatch } from "./api"; import { DeleteBatch } from "./api";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { useCrudPermission } from "/@/plugin/permission";
const { t } = useI18n(); const { t } = useI18n();
defineOptions({ defineOptions({
name: "DomainManager", name: "DomainManager",
}); });
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions }); const context: any = {
permission: {
isProjectPermission: true,
},
};
const { hasActionPermission } = useCrudPermission({ permission: context.permission });
context.hasActionPermission = hasActionPermission;
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
const selectedRowKeys = context.selectedRowKeys; const selectedRowKeys = context.selectedRowKeys;
const handleBatchDelete = () => { const handleBatchDelete = () => {
@@ -8,6 +8,7 @@ import { useSettingStore } from "/@/store/settings";
import { message, Modal } from "ant-design-vue"; import { message, Modal } from "ant-design-vue";
import CnameTip from "/@/components/plugins/cert/domains-verify-plan-editor/cname-tip.vue"; import CnameTip from "/@/components/plugins/cert/domains-verify-plan-editor/cname-tip.vue";
import { useCnameImport } from "./use"; import { useCnameImport } from "./use";
import { useCrudPermission } from "/@/plugin/permission";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const crudBinding = crudExpose.crudBinding; const crudBinding = crudExpose.crudBinding;
const router = useRouter(); const router = useRouter();
@@ -45,6 +46,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
{ label: t("certd.validation_timed_out"), value: "timeout", color: "red" }, { label: t("certd.validation_timed_out"), value: "timeout", color: "red" },
], ],
}); });
const { hasActionPermission } = useCrudPermission(context);
return { return {
crudOptions: { crudOptions: {
settings: { settings: {
@@ -75,6 +78,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
icon: "ion:add-circle-outline", icon: "ion:add-circle-outline",
}, },
import: { import: {
show: hasActionPermission("write"),
title: "导入CNAME记录", title: "导入CNAME记录",
type: "primary", type: "primary",
text: "批量导入", text: "批量导入",
@@ -12,7 +12,7 @@
</template> </template>
<fs-crud ref="crudRef" v-bind="crudBinding"> <fs-crud ref="crudRef" v-bind="crudBinding">
<template #pagination-left> <template #pagination-left>
<a-tooltip :title="t('certd.batch_delete')"> <a-tooltip v-if="hasActionPermission('write')" :title="t('certd.batch_delete')">
<fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button> <fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>
</a-tooltip> </a-tooltip>
</template> </template>
@@ -27,13 +27,20 @@ import createCrudOptions from "./crud";
import { message, Modal } from "ant-design-vue"; import { message, Modal } from "ant-design-vue";
import { DeleteBatch } from "./api"; import { DeleteBatch } from "./api";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { useCrudPermission } from "/@/plugin/permission";
const { t } = useI18n(); const { t } = useI18n();
defineOptions({ defineOptions({
name: "CnameRecord", name: "CnameRecord",
}); });
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });
const context: any = {
permission: { isProjectPermission: true },
};
const { hasActionPermission } = useCrudPermission(context);
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
const selectedRowKeys = context.selectedRowKeys; const selectedRowKeys = context.selectedRowKeys;
const handleBatchDelete = () => { const handleBatchDelete = () => {
@@ -1,34 +1,93 @@
import { dict } from "@fast-crud/fast-crud"; import { dict } from "@fast-crud/fast-crud";
import { GetMyProjectList } from "./project/api";
import { request } from "/@/api/service";
export const projectPermissionDict = dict({ const projectPermissionDict = dict({
data: [ data: [
{ {
label: "read", value: "read",
value: "只读", label: "查看",
color: "cyan",
icon: "material-symbols:folder-eye-outline-sharp",
}, },
{ {
label: "write", value: "write",
value: "读写", label: "修改",
color: "green",
icon: "material-symbols:edit-square-outline-rounded",
}, },
{ {
label: "admin", value: "admin",
value: "管理员", label: "管理员",
color: "orange",
icon: "material-symbols:manage-accounts-rounded",
}, },
], ],
}); });
export const myProjectDict = dict({ const projectMemberStatusDict = dict({
url: "/enterprise/project/list", data: [
value: "id", {
label: "name", value: "pending",
label: "待审核",
color: "orange",
icon: "material-symbols:hourglass-top",
},
{
value: "approved",
label: "已加入",
color: "green",
icon: "material-symbols:done-all",
},
{
value: "rejected",
label: "已拒绝",
color: "red",
icon: "material-symbols:close",
},
],
}); });
export const userDict = dict({ const myProjectDict = dict({
url: "/sys/authority/user/getSimpleUsers", url: "/enterprise/project/list",
getData: async () => {
const res = await GetMyProjectList();
return res;
},
value: "id", value: "id",
label: "name",
immediate: false,
onReady: ({ dict }) => {
for (const item of dict.data) {
item.label = item.name;
item.value = item.id;
}
},
});
const userDict = dict({
url: "/basic/user/getSimpleUsers",
value: "id",
getData: async () => {
const res = await request({
url: "/basic/user/getSimpleUsers",
method: "POST",
});
return res;
},
immediate: false,
onReady: ({ dict }) => { onReady: ({ dict }) => {
for (const item of dict.data) { for (const item of dict.data) {
item.label = item.nickName || item.username || item.phoneCode + item.mobile; item.label = item.nickName || item.username || item.phoneCode + item.mobile;
} }
}, },
}); });
export function useDicts() {
return {
projectPermissionDict,
myProjectDict,
userDict,
projectMemberStatusDict,
};
}
@@ -6,7 +6,7 @@ import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, Edi
import { useUserStore } from "/@/store/user"; import { useUserStore } from "/@/store/user";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import { statusUtil } from "/@/views/certd/pipeline/pipeline/utils/util.status"; import { statusUtil } from "/@/views/certd/pipeline/pipeline/utils/util.status";
import { myProjectDict } from "../dicts"; import { useDicts } from "../dicts";
import { useProjectStore } from "/@/store/project"; import { useProjectStore } from "/@/store/project";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
@@ -33,7 +33,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const settingStore = useSettingStore(); const settingStore = useSettingStore();
const selectedRowKeys: Ref<any[]> = ref([]); const selectedRowKeys: Ref<any[]> = ref([]);
context.selectedRowKeys = selectedRowKeys; context.selectedRowKeys = selectedRowKeys;
const { myProjectDict } = useDicts();
const projectStore = useProjectStore(); const projectStore = useProjectStore();
return { return {
@@ -5,7 +5,7 @@
</template> </template>
<fs-crud ref="crudRef" v-bind="crudBinding"> <fs-crud ref="crudRef" v-bind="crudBinding">
<template #pagination-left> <template #pagination-left>
<a-tooltip :title="t('certd.batchDelete')"> <a-tooltip v-if="hasActionPermission('write')" :title="t('certd.batchDelete')">
<fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button> <fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>
</a-tooltip> </a-tooltip>
</template> </template>
@@ -20,13 +20,20 @@ import createCrudOptions from "./crud";
import { message, Modal } from "ant-design-vue"; import { message, Modal } from "ant-design-vue";
import { DeleteBatch } from "./api"; import { DeleteBatch } from "./api";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { useCrudPermission } from "/@/plugin/permission";
const { t } = useI18n(); const { t } = useI18n();
defineOptions({ defineOptions({
name: "PipelineHistory", name: "PipelineHistory",
}); });
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });
const context: any = {
permission: { isProjectPermission: true },
};
const { hasActionPermission } = useCrudPermission(context);
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
const selectedRowKeys = context.selectedRowKeys; const selectedRowKeys = context.selectedRowKeys;
const handleBatchDelete = () => { const handleBatchDelete = () => {
@@ -11,7 +11,8 @@ import CertView from "/@/views/certd/pipeline/cert-view.vue";
import { useCertUpload } from "/@/views/certd/pipeline/cert-upload/use"; import { useCertUpload } from "/@/views/certd/pipeline/cert-upload/use";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import { useProjectStore } from "/@/store/project"; import { useProjectStore } from "/@/store/project";
import { myProjectDict } from "../../dicts"; import { useDicts } from "../../dicts";
import { useUserStore } from "/@/store/user";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const { t } = useI18n(); const { t } = useI18n();
@@ -36,9 +37,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
return res; return res;
}; };
const router = useRouter(); const router = useRouter();
const { myProjectDict } = useDicts();
const settingStore = useSettingStore(); const settingStore = useSettingStore();
const projectStore = useProjectStore(); const projectStore = useProjectStore();
const userStore = useUserStore();
const model = useModal(); const model = useModal();
const viewCert = async (row: any) => { const viewCert = async (row: any) => {
const cert = await api.GetCert(row.id); const cert = await api.GetCert(row.id);
@@ -140,7 +142,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
notification.error({ message: t("certd.certificateNotGenerated") }); notification.error({ message: t("certd.certificateNotGenerated") });
return; return;
} }
window.open("/api/monitor/cert/download?id=" + row.id); let url = "/api/monitor/cert/download?id=" + row.id;
if (projectStore.isEnterprise) {
url += `&projectId=${projectStore.currentProject?.id}`;
}
url += `&token=${userStore.getToken}`;
window.open(url);
}, },
}, },
}, },
@@ -230,9 +237,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
name: "fs-dict-select", name: "fs-dict-select",
dict: dict({ dict: dict({
data: [ data: [
{ label: t("certd.monitor.cert.expired"), value: "expired" }, { label: t("monitor.cert.expired"), value: "expired" },
{ label: t("certd.monitor.cert.expiring"), value: "expiring" }, { label: t("monitor.cert.expiring"), value: "expiring" },
{ label: t("certd.monitor.cert.noExpired"), value: "noExpired" }, { label: t("monitor.cert.noExpired"), value: "noExpired" },
], ],
}), }),
}, },
@@ -21,7 +21,7 @@ const { t } = useI18n();
defineOptions({ defineOptions({
name: "CertStore", name: "CertStore",
}); });
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: {} }); const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { permission: { isProjectPermission: true } } });
// //
onMounted(() => { onMounted(() => {
@@ -14,7 +14,8 @@ import { ref } from "vue";
import GroupSelector from "../../basic/group/group-selector.vue"; import GroupSelector from "../../basic/group/group-selector.vue";
import { createGroupDictRef } from "../../basic/group/api"; import { createGroupDictRef } from "../../basic/group/api";
import { useProjectStore } from "/@/store/project"; import { useProjectStore } from "/@/store/project";
import { myProjectDict } from "../../dicts"; import { useDicts } from "../../dicts";
import { useCrudPermission } from "/@/plugin/permission";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const { t } = useI18n(); const { t } = useI18n();
const api = siteInfoApi; const api = siteInfoApi;
@@ -39,7 +40,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const res = await api.AddObj(form); const res = await api.AddObj(form);
return res; return res;
}; };
const { myProjectDict } = useDicts();
const settingsStore = useSettingStore(); const settingsStore = useSettingStore();
const checkStatusDict = dict({ const checkStatusDict = dict({
@@ -86,13 +87,13 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
function checkAll() { function checkAll() {
Modal.confirm({ Modal.confirm({
title: t("certd.monitor.confirmTitle"), // "确认" title: t("monitor.confirmTitle"), // "确认"
content: t("certd.monitor.confirmContent"), // "确认触发检查全部站点证书吗?" content: t("monitor.confirmContent"), // "确认触发检查全部站点证书吗?"
onOk: async () => { onOk: async () => {
await siteInfoApi.CheckAll(); await siteInfoApi.CheckAll();
notification.success({ notification.success({
message: t("certd.monitor.checkSubmitted"), // "检查任务已提交" message: t("monitor.checkSubmitted"), // "检查任务已提交"
description: t("certd.monitor.pleaseRefresh"), // "请稍后刷新页面查看结果" description: t("monitor.pleaseRefresh"), // "请稍后刷新页面查看结果"
}); });
}, },
}); });
@@ -109,6 +110,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
} }
const projectStore = useProjectStore(); const projectStore = useProjectStore();
const { hasActionPermission } = useCrudPermission({ permission: context.permission });
return { return {
id: "siteMonitorCrud", id: "siteMonitorCrud",
crudOptions: { crudOptions: {
@@ -203,7 +205,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
// 非plus // 非plus
if (crudBinding.value.data.length >= 1) { if (crudBinding.value.data.length >= 1) {
notification.error({ notification.error({
message: t("certd.monitor.basicLimitError"), message: t("monitor.basicLimitError"),
}); });
mitter.emit("openVipModal"); mitter.emit("openVipModal");
return; return;
@@ -217,7 +219,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const max = suiteDetail.monitorCount.max; const max = suiteDetail.monitorCount.max;
if (max != -1 && max <= suiteDetail.monitorCount.used) { if (max != -1 && max <= suiteDetail.monitorCount.used) {
notification.error({ notification.error({
message: t("certd.monitor.limitExceeded", { max }), message: t("monitor.limitExceeded", { max }),
}); });
return; return;
} }
@@ -231,8 +233,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
//导入按钮 //导入按钮
import: { import: {
show: true, show: hasActionPermission("write"),
text: t("certd.monitor.bulkImport"), text: t("monitor.bulkImport"),
type: "primary", type: "primary",
async click() { async click() {
const defaultGroupId = getDefaultGroupId(); const defaultGroupId = getDefaultGroupId();
@@ -246,7 +248,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
checkAll: { checkAll: {
show: true, show: true,
text: t("certd.monitor.checkAll"), text: t("monitor.checkAll"),
type: "primary", type: "primary",
click() { click() {
checkAll(); checkAll();
@@ -270,7 +272,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
await api.DoCheck(row.id); await api.DoCheck(row.id);
await crudExpose.doRefresh(); await crudExpose.doRefresh();
notification.success({ notification.success({
message: t("certd.monitor.checkSubmittedRefresh"), message: t("monitor.checkSubmittedRefresh"),
}); });
}, },
}, },
@@ -280,7 +282,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
text: null, text: null,
show: compute(({ row }) => row.ipCheck === true), show: compute(({ row }) => row.ipCheck === true),
tooltip: { tooltip: {
title: t("certd.monitor.ipManagement"), title: t("monitor.ipManagement"),
}, },
icon: "entypo:address", icon: "entypo:address",
click: async ({ row }) => { click: async ({ row }) => {
@@ -315,29 +317,29 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
name: { name: {
title: t("certd.monitor.siteName"), title: t("monitor.siteName"),
search: { search: {
show: true, show: true,
}, },
type: "text", type: "text",
form: { form: {
rules: [{ required: true, message: t("certd.monitor.enterSiteName") }], rules: [{ required: true, message: t("monitor.enterSiteName") }],
}, },
column: { column: {
width: 160, width: 160,
}, },
}, },
domain: { domain: {
title: t("certd.monitor.domain"), title: t("monitor.domain"),
search: { search: {
show: true, show: true,
}, },
type: "text", type: "text",
form: { form: {
rules: [ rules: [
{ required: true, message: t("certd.monitor.enterDomain") }, { required: true, message: t("monitor.enterDomain") },
// @ts-ignore // @ts-ignore
{ type: "domains", message: t("certd.monitor.enterValidDomain") }, { type: "domains", message: t("monitor.enterValidDomain") },
], ],
}, },
column: { column: {
@@ -358,14 +360,14 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
httpsPort: { httpsPort: {
title: t("certd.monitor.httpsPort"), title: t("monitor.httpsPort"),
search: { search: {
show: false, show: false,
}, },
type: "number", type: "number",
form: { form: {
value: 443, value: 443,
rules: [{ required: true, message: t("certd.monitor.enterPort") }], rules: [{ required: true, message: t("monitor.enterPort") }],
}, },
column: { column: {
width: 100, width: 100,
@@ -373,7 +375,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
certInfo: { certInfo: {
title: t("certd.monitor.certInfo"), title: t("monitor.certInfo"),
type: "text", type: "text",
form: { show: false }, form: { show: false },
column: { column: {
@@ -387,10 +389,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
return ( return (
<div> <div>
<div> <div>
{t("certd.monitor.issuer")}: {row.certProvider} {t("monitor.issuer")}: {row.certProvider}
</div> </div>
<div> <div>
{t("certd.monitor.certDomains")}: {row.certDomains} {t("monitor.certDomains")}: {row.certDomains}
</div> </div>
</div> </div>
); );
@@ -405,7 +407,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
certDomains: { certDomains: {
title: t("certd.monitor.certDomains"), title: t("monitor.certDomains"),
search: { search: {
show: true, show: true,
}, },
@@ -427,7 +429,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
certProvider: { certProvider: {
title: t("certd.monitor.certProvider"), title: t("monitor.certProvider"),
search: { search: {
show: false, show: false,
}, },
@@ -445,15 +447,15 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
certStatus: { certStatus: {
title: t("certd.monitor.certStatus"), title: t("monitor.certStatus"),
search: { search: {
show: true, show: true,
}, },
type: "dict-select", type: "dict-select",
dict: dict({ dict: dict({
data: [ data: [
{ label: t("certd.monitor.status.ok"), value: "ok", color: "green" }, { label: t("monitor.status.ok"), value: "ok", color: "green" },
{ label: t("certd.monitor.status.expired"), value: "expired", color: "red" }, { label: t("monitor.status.expired"), value: "expired", color: "red" },
], ],
}), }),
form: { form: {
@@ -467,7 +469,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
checkStatus: { checkStatus: {
title: t("certd.monitor.checkStatus"), title: t("monitor.checkStatus"),
search: { search: {
show: false, show: false,
}, },
@@ -490,7 +492,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
certEffectiveTime: { certEffectiveTime: {
title: t("certd.monitor.certEffectiveTime"), title: t("monitor.certEffectiveTime"),
search: { search: {
show: false, show: false,
}, },
@@ -505,7 +507,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
certExpiresTime: { certExpiresTime: {
title: t("certd.monitor.certExpiresTime"), title: t("monitor.certExpiresTime"),
search: { search: {
show: false, show: false,
}, },
@@ -519,7 +521,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
remainingValidity: { remainingValidity: {
title: t("certd.monitor.remainingValidity"), title: t("monitor.remainingValidity"),
search: { search: {
show: false, show: false,
}, },
@@ -552,18 +554,18 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const color = leftDays < certValidDays ? "red" : "#389e0d"; const color = leftDays < certValidDays ? "red" : "#389e0d";
const percent = (leftDays / effectiveDays) * 100; const percent = (leftDays / effectiveDays) * 100;
// console.log('cellRender', 'effectiveDays', effectiveDays, 'expiresTime', expiresTime, 'applyTime', applyTime, 'percent', percent, row) // console.log('cellRender', 'effectiveDays', effectiveDays, 'expiresTime', expiresTime, 'applyTime', applyTime, 'percent', percent, row)
return <a-progress title={expireDate + t("certd.monitor.expired")} percent={percent} strokeColor={color} format={(percent: number) => `${leftDays}${t("certd.monitor.days")}`} />; return <a-progress title={expireDate + t("monitor.expired")} percent={percent} strokeColor={color} format={(percent: number) => `${leftDays}${t("monitor.days")}`} />;
}, },
}, },
}, },
ipAddress: { ipAddress: {
title: t("certd.monitor.ipAddress"), title: t("monitor.ipAddress"),
search: { search: {
show: false, show: false,
}, },
type: "text", type: "text",
form: { form: {
helper: t("certd.monitor.ipAddressHelper"), helper: t("monitor.ipAddressHelper"),
}, },
column: { column: {
width: 150, width: 150,
@@ -597,7 +599,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
remark: { remark: {
title: t("certd.monitor.remark"), title: t("monitor.remark"),
search: { search: {
show: false, show: false,
}, },
@@ -612,7 +614,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
lastCheckTime: { lastCheckTime: {
title: t("certd.monitor.lastCheckTime"), title: t("monitor.lastCheckTime"),
search: { search: {
show: false, show: false,
}, },
@@ -626,7 +628,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
disabled: { disabled: {
title: t("certd.monitor.disabled"), title: t("monitor.disabled"),
search: { search: {
show: false, show: false,
}, },
@@ -675,7 +677,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
// } // }
// }, // },
ipCheck: { ipCheck: {
title: t("certd.monitor.ipCheck"), title: t("monitor.ipCheck"),
type: "dict-switch", type: "dict-switch",
dict: dict({ dict: dict({
data: [ data: [
@@ -684,9 +686,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
], ],
}), }),
form: { form: {
helper: t("certd.monitor.ipCheckHelper"), helper: t("monitor.ipCheckHelper"),
value: false, value: false,
rules: [{ required: true, message: t("certd.monitor.selectRequired") }], rules: [{ required: true, message: t("monitor.selectRequired") }],
}, },
column: { column: {
align: "center", align: "center",
@@ -699,7 +701,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
change({ row, $event }) { change({ row, $event }) {
Modal.confirm({ Modal.confirm({
title: t("common.confirm"), title: t("common.confirm"),
content: t("certd.monitor.ipCheckConfirm", { status: $event ? t("common.enabled") : t("common.disabled") }), content: t("monitor.ipCheckConfirm", { status: $event ? t("common.enabled") : t("common.disabled") }),
onOk: async () => { onOk: async () => {
await api.IpCheckChange(row.id, $event); await api.IpCheckChange(row.id, $event);
await crudExpose.doRefresh(); await crudExpose.doRefresh();
@@ -717,7 +719,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
} as ColumnCompositionProps, } as ColumnCompositionProps,
ipSyncAuto: { ipSyncAuto: {
title: t("certd.monitor.ipSyncAuto"), title: t("monitor.ipSyncAuto"),
type: "dict-switch", type: "dict-switch",
dict: dict({ dict: dict({
data: [ data: [
@@ -738,13 +740,13 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
ipSyncMode: { ipSyncMode: {
title: t("certd.monitor.ipSyncMode"), title: t("monitor.ipSyncMode"),
type: "dict-select", type: "dict-select",
dict: dict({ dict: dict({
data: [ data: [
{ label: t("certd.monitor.ipSyncModeAll"), value: "all" }, { label: t("monitor.ipSyncModeAll"), value: "all" },
{ label: t("certd.monitor.ipSyncModeIPV4Only"), value: "ipv4" }, { label: t("monitor.ipSyncModeIPV4Only"), value: "ipv4" },
{ label: t("certd.monitor.ipSyncModeIPV6Only"), value: "ipv6" }, { label: t("monitor.ipSyncModeIPV6Only"), value: "ipv6" },
], ],
}), }),
form: { form: {
@@ -752,7 +754,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
show: compute(({ form }) => { show: compute(({ form }) => {
return form.ipSyncAuto; return form.ipSyncAuto;
}), }),
helper: t("certd.monitor.ipSyncModeHelper"), helper: t("monitor.ipSyncModeHelper"),
}, },
column: { column: {
width: 100, width: 100,
@@ -761,7 +763,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
ipIgnoreCoherence: { ipIgnoreCoherence: {
title: t("certd.monitor.ipIgnoreCoherence"), title: t("monitor.ipIgnoreCoherence"),
type: "dict-switch", type: "dict-switch",
dict: dict({ dict: dict({
data: [ data: [
@@ -774,7 +776,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
show: compute(({ form }) => { show: compute(({ form }) => {
return form.ipCheck; return form.ipCheck;
}), }),
helper: t("certd.monitor.ipIgnoreCoherenceHelper"), helper: t("monitor.ipIgnoreCoherenceHelper"),
}, },
column: { column: {
width: 100, width: 100,
@@ -783,7 +785,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
pipelineId: { pipelineId: {
title: t("certd.monitor.pipelineId"), title: t("monitor.pipelineId"),
search: { search: {
show: false, show: false,
}, },
@@ -796,7 +798,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
certInfoId: { certInfoId: {
title: t("certd.monitor.certInfoId"), title: t("monitor.certInfoId"),
search: { search: {
show: false, show: false,
}, },
@@ -809,7 +811,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
error: { error: {
title: t("certd.monitor.error"), title: t("monitor.error"),
search: { search: {
show: false, show: false,
}, },
@@ -2,14 +2,14 @@
<fs-page> <fs-page>
<template #header> <template #header>
<div class="title flex items-center"> <div class="title flex items-center">
{{ t("certd.monitor.title") }} {{ t("monitor.title") }}
<div class="sub flex-1"> <div class="sub flex-1">
<div> <div>
{{ t("certd.monitor.description") }} {{ t("monitor.description") }}
<router-link to="/certd/monitor/setting">{{ t("certd.monitor.settingLink") }}</router-link> <router-link to="/certd/monitor/setting">{{ t("monitor.settingLink") }}</router-link>
</div> </div>
<div class="flex items-center"> <div class="flex items-center">
{{ t("certd.monitor.limitInfo") }} {{ t("monitor.limitInfo") }}
<vip-button class="ml-5" mode="nav"></vip-button> <vip-button class="ml-5" mode="nav"></vip-button>
</div> </div>
</div> </div>
@@ -34,7 +34,12 @@ const { t } = useI18n();
defineOptions({ defineOptions({
name: "SiteCertMonitor", name: "SiteCertMonitor",
}); });
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions }); const context: any = {
permission: {
isProjectPermission: true,
},
};
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
const handleBatchDelete = context.handleBatchDelete; const handleBatchDelete = context.handleBatchDelete;
@@ -1,43 +1,43 @@
<template> <template>
<fs-page class="page-user-settings page-site-monitor-setting"> <fs-page class="page-user-settings page-site-monitor-setting">
<template #header> <template #header>
<div class="title">{{ t("certd.monitor.setting.siteMonitorSettings") }}</div> <div class="title">{{ t("monitor.setting.siteMonitorSettings") }}</div>
</template> </template>
<div class="user-settings-form settings-form"> <div class="user-settings-form settings-form">
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off"> <a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off">
<a-form-item :label="t('certd.monitor.setting.notificationChannel')" :name="['notificationId']"> <a-form-item :label="t('monitor.setting.notificationChannel')" :name="['notificationId']">
<div class="flex"> <div class="flex">
<NotificationSelector v-model="formState.notificationId" /> <NotificationSelector v-model="formState.notificationId" />
</div> </div>
<div class="helper">{{ t("certd.monitor.setting.setNotificationChannel") }}</div> <div class="helper">{{ t("monitor.setting.setNotificationChannel") }}</div>
</a-form-item> </a-form-item>
<a-form-item :label="t('certd.monitor.setting.retryTimes')" :name="['retryTimes']"> <a-form-item :label="t('monitor.setting.retryTimes')" :name="['retryTimes']">
<div class="flex"> <div class="flex">
<a-input-number v-model:value="formState.retryTimes" /> <a-input-number v-model:value="formState.retryTimes" />
</div> </div>
<div class="helper">{{ t("certd.monitor.setting.monitorRetryTimes") }}</div> <div class="helper">{{ t("monitor.setting.monitorRetryTimes") }}</div>
</a-form-item> </a-form-item>
<a-form-item :label="t('certd.monitor.setting.certValidDays')" :name="['certValidDays']"> <a-form-item :label="t('monitor.setting.certValidDays')" :name="['certValidDays']">
<div class="flex"> <div class="flex">
<a-input-number v-model:value="formState.certValidDays" /> <a-input-number v-model:value="formState.certValidDays" />
</div> </div>
<div class="helper">{{ t("certd.monitor.setting.certValidDaysHelper") }}</div> <div class="helper">{{ t("monitor.setting.certValidDaysHelper") }}</div>
</a-form-item> </a-form-item>
<a-form-item :label="t('certd.monitor.setting.dnsServer')" :name="['dnsServer']"> <a-form-item :label="t('monitor.setting.dnsServer')" :name="['dnsServer']">
<div class="flex"> <div class="flex">
<a-select v-model:value="formState.dnsServer" :token-separators="[' ', ',', '', '', '|']" mode="tags" :open="false" /> <a-select v-model:value="formState.dnsServer" :token-separators="[' ', ',', '', '', '|']" mode="tags" :open="false" />
</div> </div>
<div class="helper">{{ t("certd.monitor.setting.dnsServerHelper") }}</div> <div class="helper">{{ t("monitor.setting.dnsServerHelper") }}</div>
</a-form-item> </a-form-item>
<a-form-item :label="t('certd.monitor.setting.monitorCronSetting')" :name="['cron']"> <a-form-item :label="t('monitor.setting.monitorCronSetting')" :name="['cron']">
<div class="flex flex-baseline"> <div class="flex flex-baseline">
<cron-editor v-model="formState.cron" :disabled="!settingsStore.isPlus" :allow-every-min="userStore.isAdmin" /> <cron-editor v-model="formState.cron" :disabled="!settingsStore.isPlus" :allow-every-min="userStore.isAdmin" />
<vip-button class="ml-5" mode="button"></vip-button> <vip-button class="ml-5" mode="button"></vip-button>
</div> </div>
<div class="helper">{{ t("certd.monitor.setting.cronTrigger") }}</div> <div class="helper">{{ t("monitor.setting.cronTrigger") }}</div>
</a-form-item> </a-form-item>
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 16 }"> <a-form-item label=" " :colon="false" :wrapper-col="{ span: 16 }">
<loading-button type="primary" html-type="button" :click="doSave">{{ t("certd.save") }}</loading-button> <loading-button type="primary" html-type="button" :click="doSave" :disabled="!hasActionPermission('write')">{{ t("certd.save") }}</loading-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>
@@ -55,6 +55,7 @@ import { utils } from "/@/utils";
import NotificationSelector from "/@/views/certd/notification/notification-selector/index.vue"; import NotificationSelector from "/@/views/certd/notification/notification-selector/index.vue";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { useSettingStore } from "/src/store/settings"; import { useSettingStore } from "/src/store/settings";
import { useCrudPermission } from "/@/plugin/permission";
const { t } = useI18n(); const { t } = useI18n();
@@ -73,6 +74,8 @@ async function loadUserSettings() {
merge(formState, data); merge(formState, data);
} }
const { hasActionPermission } = useCrudPermission({ permission: { isProjectPermission: true } });
loadUserSettings(); loadUserSettings();
const doSave = async (form: any) => { const doSave = async (form: any) => {
await utils.sleep(300); await utils.sleep(300);
@@ -6,7 +6,7 @@ import { Modal } from "ant-design-vue";
import { mitter } from "/@/utils/util.mitt"; import { mitter } from "/@/utils/util.mitt";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { useProjectStore } from "/@/store/project"; import { useProjectStore } from "/@/store/project";
import { myProjectDict } from "../dicts"; import { useDicts } from "../dicts";
export function notificationProvide(api: any) { export function notificationProvide(api: any) {
provide("notificationApi", api); provide("notificationApi", api);
@@ -29,7 +29,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
}; };
const projectStore = useProjectStore(); const projectStore = useProjectStore();
const { myProjectDict } = useDicts();
provide("getCurrentPluginDefine", () => { provide("getCurrentPluginDefine", () => {
return currentDefine; return currentDefine;
}); });
@@ -22,7 +22,7 @@ export default defineComponent({
setup() { setup() {
const api = createNotificationApi(); const api = createNotificationApi();
notificationProvide(api); notificationProvide(api);
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { api } }); const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { api, permission: { isProjectPermission: true } } });
// //
onMounted(() => { onMounted(() => {
@@ -4,7 +4,8 @@ import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, Edi
import { OPEN_API_DOC, openkeyApi } from "./api"; import { OPEN_API_DOC, openkeyApi } from "./api";
import { useModal } from "/@/use/use-modal"; import { useModal } from "/@/use/use-modal";
import { useProjectStore } from "/@/store/project"; import { useProjectStore } from "/@/store/project";
import { myProjectDict } from "../../dicts"; import { computed } from "vue";
import { useDicts } from "../../dicts";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const { t } = useI18n(); const { t } = useI18n();
@@ -28,6 +29,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const res = await api.AddObj(form); const res = await api.AddObj(form);
return res; return res;
}; };
const { myProjectDict } = useDicts();
const projectStore = useProjectStore(); const projectStore = useProjectStore();
const model = useModal(); const model = useModal();
return { return {
@@ -176,6 +178,14 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
form: { form: {
show: false, show: false,
}, },
column: {
show: computed(() => {
return projectStore.isEnterprise;
}),
width: 120,
align: "center",
sorter: true,
},
}, },
createTime: { createTime: {
title: t("certd.fields.createTime"), title: t("certd.fields.createTime"),
@@ -19,7 +19,7 @@ import { OPEN_API_DOC } from "/@/views/certd/open/openkey/api";
defineOptions({ defineOptions({
name: "OpenKey", name: "OpenKey",
}); });
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: {} }); const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { permission: { isProjectPermission: true } } });
// //
onMounted(() => { onMounted(() => {
@@ -14,10 +14,10 @@ import GroupSelector from "/@/views/certd/pipeline/group/group-selector.vue";
import { statusUtil } from "/@/views/certd/pipeline/pipeline/utils/util.status"; import { statusUtil } from "/@/views/certd/pipeline/pipeline/utils/util.status";
import { useCertViewer } from "/@/views/certd/pipeline/use"; import { useCertViewer } from "/@/views/certd/pipeline/use";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { myProjectDict } from "../dicts"; import { useDicts } from "../dicts";
import { useProjectStore } from "/@/store/project"; import { useProjectStore } from "/@/store/project";
export default function ({ crudExpose, context: { selectedRowKeys, openCertApplyDialog } }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context: { selectedRowKeys, openCertApplyDialog, hasActionPermission } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter(); const router = useRouter();
const lastResRef = ref(); const lastResRef = ref();
@@ -50,6 +50,7 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
delete form.lastVars; delete form.lastVars;
delete form.createTime; delete form.createTime;
delete form.id; delete form.id;
delete form.webhook;
let pipeline = form.content; let pipeline = form.content;
if (typeof pipeline === "string" && pipeline.startsWith("{")) { if (typeof pipeline === "string" && pipeline.startsWith("{")) {
pipeline = JSON.parse(form.content); pipeline = JSON.parse(form.content);
@@ -69,14 +70,14 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
const settingStore = useSettingStore(); const settingStore = useSettingStore();
const projectStore = useProjectStore(); const projectStore = useProjectStore();
const { myProjectDict } = useDicts();
const DEFAULT_WILL_EXPIRE_DAYS = settingStore.sysPublic.defaultWillExpireDays || settingStore.sysPublic.defaultCertRenewDays || 15; const DEFAULT_WILL_EXPIRE_DAYS = settingStore.sysPublic.defaultWillExpireDays || settingStore.sysPublic.defaultCertRenewDays || 15;
function onDialogOpen(opt: any) { function onDialogOpen(opt: any) {
const searchForm = crudExpose.getSearchValidatedFormData(); const searchForm = crudExpose.getSearchValidatedFormData();
opt.initialForm = { opt.initialForm = {
...opt.initialForm,
groupId: searchForm.groupId, groupId: searchForm.groupId,
...opt.initialForm,
}; };
} }
@@ -124,9 +125,11 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
click() { click() {
openCertApplyDialog({ key: "CertApply" }); openCertApplyDialog({ key: "CertApply" });
}, },
show: hasActionPermission("write"),
}, },
uploadCert: { uploadCert: {
order: 2, order: 2,
show: hasActionPermission("write"),
text: t("certd.commercialCertHosting"), text: t("certd.commercialCertHosting"),
type: "primary", type: "primary",
tooltip: { tooltip: {
@@ -207,6 +210,7 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
}, },
}, },
copy: { copy: {
show: hasActionPermission("write"),
click: async context => { click: async context => {
settingStore.checkPlus(); settingStore.checkPlus();
const { ui } = useUi(); const { ui } = useUi();
@@ -216,7 +220,7 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
row = info.pipeline; row = info.pipeline;
row.content = JSON.parse(row.content); row.content = JSON.parse(row.content);
row.title = row.title + "_copy"; row.title = row.title + "_copy";
await crudExpose.openCopy({ await crudExpose.openAdd({
row: row, row: row,
index: context.index, index: context.index,
}); });
@@ -224,6 +228,7 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
class: "need-plus", class: "need-plus",
}, },
config: { config: {
show: hasActionPermission("write"),
order: 1, order: 1,
title: t("certd.actions.editPipeline"), title: t("certd.actions.editPipeline"),
type: "link", type: "link",
@@ -234,6 +239,7 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
}, },
}, },
edit: { edit: {
show: hasActionPermission("write"),
order: 2, order: 2,
title: t("certd.actions.editConfigGroup"), title: t("certd.actions.editConfigGroup"),
icon: "ant-design:setting-outlined", icon: "ant-design:setting-outlined",
@@ -656,6 +662,14 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
form: { form: {
show: false, show: false,
}, },
column: {
show: computed(() => {
return settingStore.isEnterprise;
}),
width: 120,
align: "center",
sorter: true,
},
}, },
updateTime: { updateTime: {
title: t("certd.fields.updateTime"), title: t("certd.fields.updateTime"),
@@ -2,7 +2,7 @@ import { useI18n } from "/src/locales";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud"; import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import { pipelineGroupApi } from "./api"; import { pipelineGroupApi } from "./api";
import { useProjectStore } from "/@/store/project"; import { useProjectStore } from "/@/store/project";
import { myProjectDict } from "../../dicts"; import { useDicts } from "../../dicts";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const { t } = useI18n(); const { t } = useI18n();
@@ -28,7 +28,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}; };
const projectStore = useProjectStore(); const projectStore = useProjectStore();
const { myProjectDict } = useDicts();
return { return {
crudOptions: { crudOptions: {
settings: { settings: {
@@ -14,12 +14,16 @@
import { defineComponent, onActivated, onMounted } from "vue"; import { defineComponent, onActivated, onMounted } from "vue";
import { useFs } from "@fast-crud/fast-crud"; import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud"; import createCrudOptions from "./crud";
import { createApi } from "./api";
export default defineComponent({ export default defineComponent({
name: "PipelineGroupManager", name: "PipelineGroupManager",
setup() { setup() {
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: {} }); const { crudBinding, crudRef, crudExpose } = useFs({
createCrudOptions,
context: {
permission: { isProjectPermission: true },
},
});
// //
onMounted(() => { onMounted(() => {
@@ -13,7 +13,7 @@
</a-alert> --> </a-alert> -->
<fs-crud ref="crudRef" v-bind="crudBinding"> <fs-crud ref="crudRef" v-bind="crudBinding">
<template #actionbar-right> <template #actionbar-right>
<a-dropdown class="ml-1"> <a-dropdown v-if="hasActionPermission('write')" class="ml-1">
<a-button type="primary" class="ant-dropdown-link" @click.prevent> <a-button type="primary" class="ant-dropdown-link" @click.prevent>
{{ t("certd.pipelinePage.addMore") }} {{ t("certd.pipelinePage.addMore") }}
<DownOutlined /> <DownOutlined />
@@ -37,11 +37,11 @@
<div v-if="selectedRowKeys.length > 0" class="batch-actions"> <div v-if="selectedRowKeys.length > 0" class="batch-actions">
<div class="batch-actions-inner"> <div class="batch-actions-inner">
<span>{{ t("certd.selectedCount", { count: selectedRowKeys.length }) }}</span> <span>{{ t("certd.selectedCount", { count: selectedRowKeys.length }) }}</span>
<fs-button icon="ion:trash-outline" class="color-red" type="link" :text="t('certd.batchDelete')" @click="batchDelete"></fs-button> <fs-button v-if="hasActionPermission('write')" icon="ion:trash-outline" class="color-red" type="link" :text="t('certd.batchDelete')" @click="batchDelete"></fs-button>
<batch-rerun :selected-row-keys="selectedRowKeys" @change="batchFinished"></batch-rerun> <batch-rerun :selected-row-keys="selectedRowKeys" @change="batchFinished"></batch-rerun>
<change-group :selected-row-keys="selectedRowKeys" @change="batchFinished"></change-group> <change-group v-if="hasActionPermission('write')" :selected-row-keys="selectedRowKeys" @change="batchFinished"></change-group>
<change-notification :selected-row-keys="selectedRowKeys" @change="batchFinished"></change-notification> <change-notification v-if="hasActionPermission('write')" :selected-row-keys="selectedRowKeys" @change="batchFinished"></change-notification>
<change-trigger :selected-row-keys="selectedRowKeys" @change="batchFinished"></change-trigger> <change-trigger v-if="hasActionPermission('write')" :selected-row-keys="selectedRowKeys" @change="batchFinished"></change-trigger>
</div> </div>
</div> </div>
<template #form-bottom> <template #form-bottom>
@@ -68,6 +68,7 @@ import { useSettingStore } from "/@/store/settings";
import { groupDictRef } from "./group/dicts"; import { groupDictRef } from "./group/dicts";
import { useCertPipelineCreator } from "./certd-form/use"; import { useCertPipelineCreator } from "./certd-form/use";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { useCrudPermission } from "/@/plugin/permission";
defineOptions({ defineOptions({
name: "PipelineManager", name: "PipelineManager",
@@ -106,7 +107,10 @@ function openCertApplyDialog(req: { key: string; title: string }) {
openAddCertdPipelineDialog({ pluginName: req.key, defaultGroupId, title: req.title }); openAddCertdPipelineDialog({ pluginName: req.key, defaultGroupId, title: req.title });
} }
context.openCertApplyDialog = openCertApplyDialog; context.openCertApplyDialog = openCertApplyDialog;
context.permission = { isProjectPermission: true };
const { hasActionPermission } = useCrudPermission({ permission: { isProjectPermission: true } });
context.hasActionPermission = hasActionPermission;
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context }); const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
// //
@@ -49,6 +49,7 @@
</div> </div>
</template> </template>
</v-draggable> </v-draggable>
<div v-if="currentTask.steps?.length > 0" class="helper mt-6">任务步骤会串行执行如果前面步骤失败后面的步骤不会运行</div>
</a-form-item> </a-form-item>
</div> </div>
</a-form> </a-form>
@@ -46,7 +46,7 @@
</span> </span>
</a-tag> </a-tag>
</div> </div>
<div class="basis-40 flex justify-end mr-10"> <div v-if="hasActionPermission('write')" class="basis-40 flex justify-end mr-10">
<template v-if="editMode"> <template v-if="editMode">
<fs-button type="primary" :loading="saveLoading" @click="save">保存</fs-button> <fs-button type="primary" :loading="saveLoading" @click="save">保存</fs-button>
<fs-button class="ml-5" @click="cancel">取消</fs-button> <fs-button class="ml-5" @click="cancel">取消</fs-button>
@@ -333,6 +333,7 @@ import { getCronNextTimes } from "/@/components/cron-editor/utils";
import { useCertViewer } from "/@/views/certd/pipeline/use"; import { useCertViewer } from "/@/views/certd/pipeline/use";
import { useI18n } from "/@/locales"; import { useI18n } from "/@/locales";
import TriggerIcon from "./component/trigger-icon.vue"; import TriggerIcon from "./component/trigger-icon.vue";
import { useCrudPermission } from "/@/plugin/permission";
export default defineComponent({ export default defineComponent({
name: "PipelineEdit", name: "PipelineEdit",
@@ -1002,12 +1003,15 @@ export default defineComponent({
const hasWebhookTrigger = computed(() => { const hasWebhookTrigger = computed(() => {
return currentPipeline.value?.triggers?.some((item: any) => item.type === "webhook"); return currentPipeline.value?.triggers?.some((item: any) => item.type === "webhook");
}); });
const { hasActionPermission } = useCrudPermission({ permission: { isProjectPermission: true } });
return { return {
isCert, isCert,
pipeline, pipeline,
currentHistory, currentHistory,
histories, histories,
goBack, goBack,
hasActionPermission,
userStore, userStore,
settingStore, settingStore,
...useTaskRet, ...useTaskRet,
@@ -17,7 +17,7 @@
</template> </template>
<fs-crud ref="crudRef" v-bind="crudBinding"> <fs-crud ref="crudRef" v-bind="crudBinding">
<template #pagination-left> <template #pagination-left>
<a-tooltip :title="t('certd.batchDelete')"> <a-tooltip v-if="hasActionPermission('write')" :title="t('certd.batchDelete')">
<fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button> <fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>
</a-tooltip> </a-tooltip>
</template> </template>
@@ -32,13 +32,21 @@ import createCrudOptions from "./crud";
import { message, Modal } from "ant-design-vue"; import { message, Modal } from "ant-design-vue";
import { DeleteBatch } from "./api"; import { DeleteBatch } from "./api";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { useCrudPermission } from "/@/plugin/permission";
const { t } = useI18n(); const { t } = useI18n();
defineOptions({ defineOptions({
name: "CnameRecord", name: "CnameRecord",
}); });
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions }); const context: any = {
permission: {
isProjectPermission: true,
},
};
const { hasActionPermission } = useCrudPermission({ permission: context.permission });
context.hasActionPermission = hasActionPermission;
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
const selectedRowKeys = context.selectedRowKeys; const selectedRowKeys = context.selectedRowKeys;
const handleBatchDelete = () => { const handleBatchDelete = () => {
@@ -7,7 +7,7 @@ import * as pipelineApi from "../api";
import { useTemplate } from "/@/views/certd/pipeline/template/use"; import { useTemplate } from "/@/views/certd/pipeline/template/use";
import { useI18n } from "/@/locales"; import { useI18n } from "/@/locales";
import { useProjectStore } from "/@/store/project"; import { useProjectStore } from "/@/store/project";
import { myProjectDict } from "../../dicts"; import { useDicts } from "../../dicts";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const api = templateApi; const api = templateApi;
const { t } = useI18n(); const { t } = useI18n();
@@ -36,7 +36,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const router = useRouter(); const router = useRouter();
const model = useModal(); const model = useModal();
const { myProjectDict } = useDicts();
const { openCreateFromTemplateDialog } = useTemplate(); const { openCreateFromTemplateDialog } = useTemplate();
return { return {
@@ -78,7 +78,6 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
add: { add: {
text: t("certd.template.createTemplate"), text: t("certd.template.createTemplate"),
type: "primary", type: "primary",
show: true,
}, },
}, },
}, },
@@ -21,7 +21,12 @@ import { useI18n } from "/src/locales";
defineOptions({ defineOptions({
name: "PipelineTemplate", name: "PipelineTemplate",
}); });
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: {} }); const { crudBinding, crudRef, crudExpose } = useFs({
createCrudOptions,
context: {
permission: { isProjectPermission: true },
},
});
const { t } = useI18n(); const { t } = useI18n();
// //
onMounted(() => { onMounted(() => {
@@ -3,8 +3,12 @@ import { notification } from "ant-design-vue";
import CertView from "/@/views/certd/pipeline/cert-view.vue"; import CertView from "/@/views/certd/pipeline/cert-view.vue";
import { env } from "/@/utils/util.env"; import { env } from "/@/utils/util.env";
import { useModal } from "/@/use/use-modal"; import { useModal } from "/@/use/use-modal";
import { useProjectStore } from "/@/store/project";
import { useUserStore } from "/@/store/user";
export function useCertViewer() { export function useCertViewer() {
const projectStore = useProjectStore();
const userStore = useUserStore();
const model = useModal(); const model = useModal();
const viewCert = async (id: number) => { const viewCert = async (id: number) => {
const cert = await api.GetCert(id); const cert = await api.GetCert(id);
@@ -33,7 +37,11 @@ export function useCertViewer() {
content: () => { content: () => {
const children = []; const children = [];
for (const file of files) { for (const file of files) {
const downloadUrl = `${env.API}/pi/history/download?pipelineId=${id}&fileId=${file.id}`; let downloadUrl = `${env.API}/pi/history/download?pipelineId=${id}&fileId=${file.id}`;
if (projectStore.isEnterprise) {
downloadUrl += `&projectId=${projectStore.currentProject?.id}`;
}
downloadUrl += `&token=${userStore.getToken}`;
children.push( children.push(
<div> <div>
<div class={"flex-o m-5"}> <div class={"flex-o m-5"}>
@@ -10,6 +10,13 @@ export async function GetList(query: any) {
}); });
} }
export async function GetMyProjectList() {
return await request({
url: apiPrefix + "/list",
method: "post",
});
}
export async function GetPage(query: any) { export async function GetPage(query: any) {
return await request({ return await request({
url: apiPrefix + "/page", url: apiPrefix + "/page",
@@ -6,7 +6,7 @@ import { AddReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq,
import { useUserStore } from "/@/store/user"; import { useUserStore } from "/@/store/user";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import { Modal } from "ant-design-vue"; import { Modal } from "ant-design-vue";
import { userDict } from "../dicts"; import { userDict } from "../../sys/enterprise/dicts";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter(); const router = useRouter();
@@ -1,6 +1,6 @@
import { request } from "/src/api/service"; import { request } from "/src/api/service";
const apiPrefix = "/enterprise/myProjectMember"; const apiPrefix = "/enterprise/projectMember";
const userApiPrefix = "/sys/authority/user"; const userApiPrefix = "/sys/authority/user";
export async function GetList(query: any) { export async function GetList(query: any) {
return await request({ return await request({
@@ -65,3 +65,11 @@ export async function GetUserSimpleByIds(query: any) {
data: query, data: query,
}); });
} }
export async function ApproveJoin(form: any) {
return await request({
url: "/enterprise/project/approveJoin",
method: "post",
data: form,
});
}
@@ -6,7 +6,8 @@ import * as api from "./api";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import { useUserStore } from "/@/store/user"; import { useUserStore } from "/@/store/user";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { userDict } from "../../dicts"; import { useDicts } from "../../dicts";
import { useApprove } from "./use";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter(); const router = useRouter();
@@ -34,6 +35,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const settingStore = useSettingStore(); const settingStore = useSettingStore();
const selectedRowKeys: Ref<any[]> = ref([]); const selectedRowKeys: Ref<any[]> = ref([]);
context.selectedRowKeys = selectedRowKeys; context.selectedRowKeys = selectedRowKeys;
const { hasActionPermission } = context;
const { userDict, projectMemberStatusDict, projectPermissionDict } = useDicts();
const { openApproveDialog } = useApprove();
return { return {
crudOptions: { crudOptions: {
@@ -105,7 +109,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
search: { search: {
show: true, show: true,
}, },
form: {}, form: {
show: true,
rules: [{ required: true, message: "请选择用户" }],
},
editForm: { editForm: {
show: false, show: false,
}, },
@@ -116,23 +123,64 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
permission: { permission: {
title: t("certd.ent.projectPermission"), title: t("certd.ent.projectPermission"),
type: "dict-select", type: "dict-select",
dict: dict({ dict: projectPermissionDict,
data: [
{ label: t("certd.ent.permission.read"), value: "read", color: "cyan" },
{ label: t("certd.ent.permission.write"), value: "write", color: "blue" },
{ label: t("certd.ent.permission.admin"), value: "admin", color: "green" },
],
}),
search: { search: {
show: true, show: true,
}, },
form: { form: {
show: true, show: true,
rules: [{ required: true, message: "请选择权限" }],
}, },
column: { column: {
width: 200, width: 200,
}, },
}, },
status: {
title: t("certd.ent.projectMemberStatus"),
type: "dict-select",
dict: projectMemberStatusDict,
search: {
show: true,
},
form: {
show: true,
rules: [{ required: true, message: "请选择状态" }],
},
column: {
width: 200,
cellRender: ({ row }) => {
let approveButton: any = "";
if (row.status === "pending" && hasActionPermission("admin")) {
approveButton = (
<fs-button
class="ml-2"
type="primary"
size="small"
onClick={async () => {
openApproveDialog({
id: row.id,
permission: row.permission,
onSubmit: async (form: any) => {
form.userId = row.userId;
await api.ApproveJoin(form);
crudExpose.doRefresh();
},
});
}}
>
</fs-button>
);
}
return (
<div class="flex items-center">
<fs-values-format model-value={row.status} dict={projectMemberStatusDict}></fs-values-format>
{approveButton}
</div>
);
},
},
},
createTime: { createTime: {
title: t("certd.createTime"), title: t("certd.createTime"),
type: "datetime", type: "datetime",
@@ -2,9 +2,13 @@
<fs-page class="page-project-detail"> <fs-page class="page-project-detail">
<template #header> <template #header>
<div class="title"> <div class="title">
{{ t("certd.ent.projectDetailManager") }} 当前项目 {{ project?.name }}
<span class="sub"> <span class="sub flex-inline items-center">
{{ t("certd.ent.projectDetailDescription") }} 管理员<fs-values-format :model-value="project.adminId" :dict="userDict" color="green"></fs-values-format>
<!-- <a-divider type="vertical"></a-divider>
<fs-values-format :model-value="project.permission" :dict="projectPermissionDict"></fs-values-format>
<a-divider type="vertical"></a-divider>
<fs-values-format :model-value="project.status" :dict="projectMemberStatusDict"></fs-values-format> -->
</span> </span>
</div> </div>
</template> </template>
@@ -19,13 +23,17 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onActivated, onMounted } from "vue"; import { onActivated, onMounted, Ref, ref } from "vue";
import { useFs } from "@fast-crud/fast-crud"; import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud"; import createCrudOptions from "./crud";
import { message, Modal } from "ant-design-vue"; import { message, Modal } from "ant-design-vue";
import { DeleteBatch } from "./api"; import { DeleteBatch } from "./api";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { useProjectStore } from "/@/store/project";
import { request } from "/@/api/service";
import { useDicts } from "../../dicts";
import { useCrudPermission } from "/@/plugin/permission";
const { t } = useI18n(); const { t } = useI18n();
@@ -35,11 +43,38 @@ defineOptions({
const route = useRoute(); const route = useRoute();
const projectIdStr = route.query.projectId as string; const projectIdStr = route.query.projectId as string;
const projectId = Number(projectIdStr); let projectId = Number(projectIdStr);
const projectStore = useProjectStore();
if (!projectId) {
projectId = projectStore.currentProject?.id;
}
const { projectPermissionDict, projectMemberStatusDict, userDict } = useDicts();
const project: Ref<any> = ref({});
async function loadProjectDetail() {
if (projectId) {
const res = await request({
url: `/enterprise/project/detail`,
method: "post",
params: {
projectId,
},
});
project.value = res;
}
}
const context: any = { const context: any = {
projectId, projectId,
permission: {
isProjectPermission: true,
projectPermission: "admin",
},
}; };
const { hasActionPermission } = useCrudPermission(context);
context.hasActionPermission = hasActionPermission;
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context }); const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
const selectedRowKeys = context.selectedRowKeys; const selectedRowKeys = context.selectedRowKeys;
@@ -61,7 +96,12 @@ const handleBatchDelete = () => {
}; };
// //
onMounted(() => { onMounted(async () => {
if (!projectId) {
message.error("您还未选择项目");
return;
}
await loadProjectDetail();
crudExpose.doRefresh(); crudExpose.doRefresh();
}); });
onActivated(async () => { onActivated(async () => {
@@ -0,0 +1,46 @@
import { dict } from "@fast-crud/fast-crud";
import { useDicts } from "../../dicts";
import { useFormDialog } from "/@/use/use-dialog";
export function useApprove() {
const { openFormDialog } = useFormDialog();
const { projectPermissionDict, projectMemberStatusDict, userDict } = useDicts();
function openApproveDialog({ id, permission, onSubmit }: { id: any; permission: any; onSubmit: any }) {
openFormDialog({
title: "审批加入申请",
columns: {
permission: {
title: "成员权限",
type: "dict-select",
dict: projectPermissionDict,
},
status: {
title: "审批结果",
type: "dict-radio",
dict: dict({
data: [
{
label: "通过",
value: "approved",
},
{
label: "拒绝",
value: "rejected",
},
],
}),
},
},
onSubmit: onSubmit,
initialForm: {
id: id,
permission: permission,
status: "approved",
},
});
}
return {
openApproveDialog,
};
}
@@ -30,7 +30,8 @@ const { t } = useI18n();
defineOptions({ defineOptions({
name: "MyProjectManager", name: "MyProjectManager",
}); });
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions }); const context: any = { permission: { isProjectPermission: true, projectPermission: "admin" } };
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
const selectedRowKeys = context.selectedRowKeys; const selectedRowKeys = context.selectedRowKeys;
const handleBatchDelete = () => { const handleBatchDelete = () => {
@@ -0,0 +1,171 @@
<template>
<fs-page class="page-project-join">
<template #header>
<div class="title">
{{ t("certd.sysResources.projectJoin") }}
<span v-if="projectStore.projects.length === 0" class="sub">{{ t("certd.project.noProjectJoined") }}</span>
</div>
<div class="more">
<a-button v-if="userStore.isAdmin" @click="goProjectManager">{{ t("certd.project.projectManager") }}</a-button>
</div>
</template>
<div class="project-container">
<h3 class="text-lg font-medium mb-4">{{ t("certd.project.projectList") }}</h3>
<div class="flex flex-wrap gap-4">
<div v-for="project in projects" :key="project.id" class="w-full md:w-1/4">
<a-card :bordered="true" class="project-card">
<div class="project-card-content">
<div class="project-info">
<div class="text-md font-bold title">{{ project.name }}</div>
<div class="flex items-center justify-start">管理员 <fs-values-format :model-value="project.adminId" :dict="userDict" color="green"></fs-values-format></div>
<p class="text-gray-500 text-sm">创建时间{{ formatDate(project.createTime) }}</p>
</div>
<div class="flex-col items-start">
<div v-if="project.status" class="mt-1 flex items-center justify-start">状态:<fs-values-format :model-value="project.status" :dict="projectMemberStatusDict"></fs-values-format></div>
<div v-if="project.permission" class="mt-1 flex items-center justify-start">权限:<fs-values-format :model-value="project.permission" :dict="projectPermissionDict"></fs-values-format></div>
</div>
</div>
<template #actions>
<span v-if="project.status === 'approved'" class="flex-inline items-center text-blue-500" :title="t('certd.project.viewDetail')" @click="goProjectDetail(project.id)">
<fs-icon class="fs-18 mr-2" icon="mdi:eye-outline"></fs-icon>
{{ t("certd.project.viewDetail") }}
</span>
<span v-if="!project.status || project.status === 'rejected'" class="flex-inline items-center text-blue-500" :title="t('certd.project.applyJoin')" @click="applyToJoin(project.id)">
<fs-icon class="fs-18 mr-2" icon="mdi:checkbox-marked-circle-outline"></fs-icon>
{{ t("certd.project.applyJoin") }}
</span>
<span v-if="project.status === 'pending' || project.status === 'approved'" class="flex-inline items-center text-red-500" :title="t('certd.project.leave')" @click="leaveProject(project.id)">
<fs-icon class="fs-18 mr-2" icon="mdi:arrow-right-thin-circle-outline"></fs-icon>
{{ t("certd.project.leave") }}
</span>
</template>
</a-card>
</div>
</div>
</div>
</fs-page>
</template>
<script lang="ts" setup>
import { ref, onMounted } from "vue";
import { useI18n } from "/src/locales";
import { message, Modal } from "ant-design-vue";
import { request } from "/src/api/service";
import { useProjectStore } from "/@/store/project";
import dayjs from "dayjs";
import { useDicts } from "../dicts";
import { useRouter } from "vue-router";
import { useUserStore } from "/@/store/user";
defineOptions({
name: "ProjectJoin",
});
const { t } = useI18n();
const { projectMemberStatusDict, projectPermissionDict, userDict } = useDicts();
const projects = ref<any[]>([]);
const projectStore = useProjectStore();
const userStore = useUserStore();
function goProjectManager() {
// API
router.push(`/sys/enterprise/project`);
}
const router = useRouter();
function goProjectDetail(projectId: number) {
// API
router.push(`/certd/project/detail?projectId=${projectId}`);
}
const getSystemProjects = async () => {
try {
// API
const response = await request({
url: "/enterprise/project/all",
method: "post",
});
projects.value = response || [];
} catch (error) {
message.error(t("certd.project.fetchFailed"));
console.error("获取项目列表失败:", error);
}
};
const applyToJoin = async (projectId: number) => {
// API
Modal.confirm({
title: t("certd.project.applyJoin"),
content: t("certd.project.applyJoinConfirm"),
onOk: async () => {
await request({
url: "/enterprise/project/applyJoin",
method: "post",
data: { projectId },
});
message.success(t("certd.project.applySuccess"));
await getSystemProjects();
//
},
});
};
const formatDate = (dateString: string) => {
if (!dateString) {
return "";
}
return dayjs(dateString).format("YYYY-MM-DD HH:mm:ss");
};
onMounted(() => {
getSystemProjects();
});
async function leaveProject(projectId: number) {
// 退API
Modal.confirm({
title: t("certd.project.leave"),
content: t("certd.project.leaveConfirm"),
onOk: async () => {
await request({
url: "/enterprise/project/leave",
method: "post",
data: { projectId },
});
message.success(t("certd.project.leaveSuccess"));
// 退
await getSystemProjects();
},
});
}
</script>
<style lang="less">
.page-project-join {
.project-container {
padding: 24px;
margin: 0 auto;
.project-card {
margin-bottom: 16px;
transition: all 0.3s;
&:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.project-card-content {
display: flex;
justify-content: space-between;
align-items: center;
}
.title {
font-size: 16px;
font-weight: bold;
}
}
}
}
</style>
@@ -35,6 +35,11 @@
<a-divider type="vertical" /> <a-divider type="vertical" />
<vip-button mode="nav" style="font-size: 12px"></vip-button> <vip-button mode="nav" style="font-size: 12px"></vip-button>
</template> </template>
<template v-if="settingsStore.isEnterprise">
<a-divider type="vertical" />
<project-current></project-current>
</template>
<template v-if="settingsStore.isComm"> <template v-if="settingsStore.isComm">
<a-divider type="vertical" /> <a-divider type="vertical" />
<suite-card class="m-0"></suite-card> <suite-card class="m-0"></suite-card>
@@ -1,12 +1,12 @@
import * as api from "./api"; import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import { useI18n } from "/src/locales";
import { computed, Ref, ref } from "vue";
import { useRouter } from "vue-router";
import { AddReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes, utils } from "@fast-crud/fast-crud";
import { useUserStore } from "/@/store/user";
import { useSettingStore } from "/@/store/settings";
import { Modal } from "ant-design-vue"; import { Modal } from "ant-design-vue";
import { Ref, ref } from "vue";
import { useRouter } from "vue-router";
import { userDict } from "../dicts"; import { userDict } from "../dicts";
import * as api from "./api";
import { useSettingStore } from "/@/store/settings";
import { useUserStore } from "/@/store/user";
import { useI18n } from "/src/locales";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter(); const router = useRouter();
@@ -7,6 +7,7 @@ import { useSettingStore } from "/@/store/settings";
import { useUserStore } from "/@/store/user"; import { useUserStore } from "/@/store/user";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { userDict } from "../../dicts"; import { userDict } from "../../dicts";
import { useDicts } from "/@/views/certd/dicts";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter(); const router = useRouter();
@@ -35,6 +36,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const selectedRowKeys: Ref<any[]> = ref([]); const selectedRowKeys: Ref<any[]> = ref([]);
context.selectedRowKeys = selectedRowKeys; context.selectedRowKeys = selectedRowKeys;
const { projectMemberStatusDict } = useDicts();
return { return {
crudOptions: { crudOptions: {
settings: { settings: {
@@ -105,7 +108,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
search: { search: {
show: true, show: true,
}, },
form: {}, form: {
rules: [{ required: true, message: "请选择用户" }],
},
editForm: { editForm: {
show: false, show: false,
}, },
@@ -128,11 +133,34 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
form: { form: {
show: true, show: true,
rules: [{ required: true, message: "请选择权限" }],
}, },
column: { column: {
width: 200, width: 200,
}, },
}, },
status: {
title: t("certd.ent.projectMemberStatus"),
type: "dict-select",
dict: projectMemberStatusDict,
search: {
show: true,
},
form: {
show: true,
rules: [{ required: true, message: "请选择状态" }],
},
column: {
width: 200,
cellRender: ({ row }) => {
return (
<div class="flex items-center">
<fs-values-format model-value={row.status} dict={projectMemberStatusDict}></fs-values-format>
</div>
);
},
},
},
createTime: { createTime: {
title: t("certd.createTime"), title: t("certd.createTime"),
type: "datetime", type: "datetime",
@@ -12,6 +12,7 @@
</a-tooltip> </a-tooltip>
</template> </template>
</fs-crud> </fs-crud>
<AdminModeIntro v-if="!projectStore.isEnterprise" title="当前为SaaS管理模式,项目管理需要切换到企业模式" :open="true"></AdminModeIntro>
</fs-page> </fs-page>
</template> </template>
@@ -22,7 +23,8 @@ import createCrudOptions from "./crud";
import { message, Modal } from "ant-design-vue"; import { message, Modal } from "ant-design-vue";
import { DeleteBatch } from "./api"; import { DeleteBatch } from "./api";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { useProjectStore } from "/@/store/project";
import AdminModeIntro from "./intro.vue";
const { t } = useI18n(); const { t } = useI18n();
defineOptions({ defineOptions({
@@ -30,6 +32,7 @@ defineOptions({
}); });
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions }); const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });
const projectStore = useProjectStore();
const selectedRowKeys = context.selectedRowKeys; const selectedRowKeys = context.selectedRowKeys;
const handleBatchDelete = () => { const handleBatchDelete = () => {
if (selectedRowKeys.value?.length > 0) { if (selectedRowKeys.value?.length > 0) {

Some files were not shown because too many files have changed in this diff Show More