Compare commits

..

18 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
73 changed files with 1431 additions and 225 deletions
@@ -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,
}; };
} }
@@ -69,10 +69,8 @@ export abstract class BaseController {
if (!projectIdStr){ if (!projectIdStr){
projectIdStr = this.ctx.request.query["projectId"] as string; projectIdStr = this.ctx.request.query["projectId"] as string;
} }
if (!projectIdStr){
return null
}
if (!projectIdStr) { 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: '创建时间',
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") && !config.url.startsWith("http")) {
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);
}, },
}; };
@@ -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>
@@ -218,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",
@@ -819,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",
@@ -224,6 +224,8 @@ export default {
enterpriseSetting: "企业设置", enterpriseSetting: "企业设置",
myProjectManager: "我的项目", myProjectManager: "我的项目",
myProjectDetail: "项目详情", myProjectDetail: "项目详情",
projectJoin: "加入项目",
currentProject: "当前项目",
}, },
certificateRepo: { certificateRepo: {
title: "证书仓库", title: "证书仓库",
@@ -831,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: "查看详情",
}, },
}; };
@@ -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;
@@ -8,6 +8,7 @@ export type UseCrudPermissionExtraProps = {
export type UseCrudPermissionExtra = (props: UseCrudPermissionExtraProps) => any; export type UseCrudPermissionExtra = (props: UseCrudPermissionExtraProps) => any;
export type UseCrudPermissionCompProps = { export type UseCrudPermissionCompProps = {
isProjectPermission?: boolean; isProjectPermission?: boolean;
projectPermission?: string;
prefix?: string; prefix?: string;
extra?: UseCrudPermissionExtra; extra?: UseCrudPermissionExtra;
[key: string]: any; [key: string]: any;
@@ -69,17 +70,17 @@ export function useCrudPermission({ permission }: UseCrudPermissionProps) {
let addPermission = "add"; let addPermission = "add";
if (isProjectPermission) { if (isProjectPermission) {
addPermission = "write"; addPermission = per.projectPermission || "write";
} }
let editPermission = "edit"; let editPermission = "edit";
if (isProjectPermission) { if (isProjectPermission) {
editPermission = "write"; editPermission = per.projectPermission || "write";
} }
let removePermission = "remove"; let removePermission = "remove";
if (isProjectPermission) { if (isProjectPermission) {
removePermission = "write"; removePermission = per.projectPermission || "write";
} }
return LodashMerge( return LodashMerge(
{ {
@@ -93,6 +94,7 @@ export function useCrudPermission({ permission }: UseCrudPermissionProps) {
edit: { show: hasActionPermission(editPermission) }, edit: { show: hasActionPermission(editPermission) },
remove: { show: hasActionPermission(removePermission) }, remove: { show: hasActionPermission(removePermission) },
view: { show: hasActionPermission(viewPermission) }, 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,20 +64,21 @@ 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;
} }
@@ -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(() => {
@@ -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,19 +1,49 @@
import { dict } from "@fast-crud/fast-crud"; import { dict } from "@fast-crud/fast-crud";
import { GetMyProjectList } from "./project/api"; import { GetMyProjectList } from "./project/api";
import { request } from "/@/api/service";
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",
},
],
});
const projectMemberStatusDict = dict({
data: [
{
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",
}, },
], ],
}); });
@@ -36,8 +66,16 @@ const myProjectDict = dict({
}); });
const userDict = dict({ const userDict = dict({
url: "/sys/authority/user/getSimpleUsers", url: "/basic/user/getSimpleUsers",
value: "id", 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;
@@ -50,5 +88,6 @@ export function useDicts() {
projectPermissionDict, projectPermissionDict,
myProjectDict, myProjectDict,
userDict, userDict,
projectMemberStatusDict,
}; };
} }
@@ -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 = () => {
@@ -12,6 +12,7 @@ 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 { useDicts } 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();
@@ -39,6 +40,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const { myProjectDict } = useDicts(); 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);
}, },
}, },
}, },
@@ -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(() => {
@@ -37,7 +37,7 @@
<div class="helper">{{ t("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);
@@ -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(() => {
@@ -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(() => {
@@ -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);
@@ -75,8 +76,8 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
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,11 +125,11 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
click() { click() {
openCertApplyDialog({ key: "CertApply" }); openCertApplyDialog({ key: "CertApply" });
}, },
show: hasActionPermission("add"), show: hasActionPermission("write"),
}, },
uploadCert: { uploadCert: {
order: 2, order: 2,
show: hasActionPermission("uploadCert"), show: hasActionPermission("write"),
text: t("certd.commercialCertHosting"), text: t("certd.commercialCertHosting"),
type: "primary", type: "primary",
tooltip: { tooltip: {
@@ -219,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,
}); });
@@ -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(() => {
@@ -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>
@@ -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>
@@ -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 = () => {
@@ -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"}>
@@ -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>
@@ -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) {
@@ -0,0 +1,86 @@
<template>
<div v-if="open" class="admin-mode-intro" :style="fixed ? 'position: fixed;' : 'position: absolute;'" @click="close()">
<div class="mask">
<div class="intro-content">
<h2 class="intro-title text-xl font-bold">{{ title || "管理模式介绍" }}</h2>
<div class="mt-8 image-block">
<div class="flex gap-8">
<div class="intro-desc flex-1">SaaS模式每个用户管理自己的流水线和授权资源每个用户独立使用</div>
<div class="intro-desc flex-1">企业模式通过项目合作管理流水线证书和授权资源所有用户视为企业内部员工</div>
</div>
<div class="image-intro">
<img :src="src" alt="" />
</div>
</div>
<div class="action">
<a-button type="primary" html-type="button" @click="goSwitchMode">立即前往切换模式</a-button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="tsx">
import { ref } from "vue";
import { useRouter } from "vue-router";
defineOptions({
name: "AdminModeIntro",
});
const props = defineProps<{
title?: string;
open?: boolean;
fixed?: boolean;
}>();
const emit = defineEmits(["update:open"]);
function close() {
emit("update:open", false);
}
const src = ref("static/images/ent/admin_mode.png");
const router = useRouter();
function goSwitchMode() {
router.push("/sys/settings?tab=mode");
}
</script>
<style lang="less">
.admin-mode-intro {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
.mask {
padding: 20px;
border-radius: 10px;
}
.intro-content {
background-color: #fff;
padding: 20px;
border-radius: 10px;
text-align: center;
}
.image-block {
text-align: center;
.image-intro {
width: 100%;
img {
margin: 0 auto;
max-width: 100%;
}
}
}
}
</style>
@@ -2,13 +2,22 @@
<div class="sys-settings-form sys-settings-mode"> <div class="sys-settings-form sys-settings-mode">
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onFinish"> <a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onFinish">
<a-form-item :label="t('certd.sys.setting.adminMode')" :name="['public', 'adminMode']"> <a-form-item :label="t('certd.sys.setting.adminMode')" :name="['public', 'adminMode']">
<fs-dict-radio v-model:value="formState.public.adminMode" :dict="adminModeDict" /> <div class="w-full flex items-center">
<fs-dict-radio v-model:value="formState.public.adminMode" :disabled="!settingsStore.isPlus" :dict="adminModeDict" />
<vip-button class="ml-5" mode="button"></vip-button>
</div>
<div class="helper">SaaS模式每个用户管理自己的流水线和授权资源独立使用</div>
<div class="helper">企业模式通过项目合作管理流水线证书和授权资源所有用户视为企业内部员工</div>
<div class="helper text-red-500">建议在开始使用时固定一个合适的模式之后就不要随意切换了</div>
<div><a @click="adminModeIntroOpen = true"> 更多管理模式介绍</a></div>
</a-form-item> </a-form-item>
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 8 }"> <a-form-item label=" " :colon="false" :wrapper-col="{ span: 8 }">
<a-button :loading="saveLoading" type="primary" html-type="submit">{{ t("certd.saveButton") }}</a-button> <a-button :loading="saveLoading" type="primary" html-type="submit">{{ t("certd.saveButton") }}</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
<AdminModeIntro v-model:open="adminModeIntroOpen" fixed></AdminModeIntro>
</div> </div>
</template> </template>
@@ -22,22 +31,25 @@ import { notification } from "ant-design-vue";
import { useI18n } from "/src/locales"; import { useI18n } from "/src/locales";
import { dict } from "@fast-crud/fast-crud"; import { dict } from "@fast-crud/fast-crud";
import { useProjectStore } from "/@/store/project"; import { useProjectStore } from "/@/store/project";
import AdminModeIntro from "/@/views/sys/enterprise/project/intro.vue";
const { t } = useI18n(); const { t } = useI18n();
defineOptions({ defineOptions({
name: "SettingMode", name: "SettingMode",
}); });
const adminModeIntroOpen = ref(false);
const adminModeDict = dict({ const adminModeDict = dict({
data: [ data: [
{
label: t("certd.sys.setting.enterpriseMode"),
value: "enterprise",
},
{ {
label: t("certd.sys.setting.saasMode"), label: t("certd.sys.setting.saasMode"),
value: "saas", value: "saas",
}, },
{
label: t("certd.sys.setting.enterpriseMode"),
value: "enterprise",
},
], ],
}); });
@@ -82,6 +82,7 @@ CREATE TABLE "cd_project_member"
"update_time" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP) "update_time" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP)
); );
ALTER TABLE cd_project_member ADD COLUMN status varchar(128);
CREATE INDEX "index_project_member_user_id" ON "cd_project_member" ("user_id"); CREATE INDEX "index_project_member_user_id" ON "cd_project_member" ("user_id");
CREATE INDEX "index_project_member_project_id" ON "cd_project_member" ("project_id"); CREATE INDEX "index_project_member_project_id" ON "cd_project_member" ("project_id");
@@ -40,9 +40,7 @@ export class LoginController extends BaseController {
} }
private writeTokenCookie(token: { expire: any; token: any }) { private writeTokenCookie(token: { expire: any; token: any }) {
this.ctx.cookies.set("certd_token", token.token, { // this.loginService.writeTokenCookie(this.ctx,token);
maxAge: 1000 * token.expire
});
} }
@Post('/loginBySms', { summary: Constants.per.guest }) @Post('/loginBySms', { summary: Constants.per.guest })
@@ -70,6 +70,8 @@ export class ConnectController extends BaseController {
}) })
return this.ok({ loginUrl, ticket }); return this.ok({ loginUrl, ticket });
} }
@Get('/callback/:type', { summary: Constants.per.guest }) @Get('/callback/:type', { summary: Constants.per.guest })
public async callback(@Param('type') type: string, @Query() query: Record<string, string>) { public async callback(@Param('type') type: string, @Query() query: Record<string, string>) {
@@ -154,10 +156,15 @@ export class ConnectController extends BaseController {
}); });
} }
this.writeTokenCookie(loginRes);
//返回登录成功token //返回登录成功token
return this.ok(loginRes); return this.ok(loginRes);
} }
private writeTokenCookie(token: { expire: any; token: any }) {
// this.loginService.writeTokenCookie(this.ctx,token);
}
@Post('/autoRegister', { summary: Constants.per.guest }) @Post('/autoRegister', { summary: Constants.per.guest })
public async autoRegister(@Body(ALL) body: { validationCode: string, type: string }) { public async autoRegister(@Body(ALL) body: { validationCode: string, type: string }) {
@@ -183,6 +190,7 @@ export class ConnectController extends BaseController {
}); });
const loginRes = await this.loginService.generateToken(newUser); const loginRes = await this.loginService.generateToken(newUser);
this.writeTokenCookie(loginRes);
return this.ok(loginRes); return this.ok(loginRes);
} }
@@ -1,5 +1,5 @@
import { AccessService } from "@certd/lib-server";
import { ALL, Body, Controller, Inject, Post, Provide, Query } from "@midwayjs/core"; import { ALL, Body, Controller, Inject, Post, Provide, Query } from "@midwayjs/core";
import { AccessService, Constants } from "@certd/lib-server";
import { AccessController } from "../../user/pipeline/access-controller.js"; import { AccessController } from "../../user/pipeline/access-controller.js";
/** /**
@@ -15,6 +15,12 @@ export class SysAccessController extends AccessController {
return this.service2; return this.service2;
} }
async getProjectUserId(permission:string){
return {
projectId:null,userId:0
}
}
getUserId() { getUserId() {
// checkComm(); // checkComm();
return 0; return 0;
@@ -54,7 +60,7 @@ export class SysAccessController extends AccessController {
return await super.define(type); return await super.define(type);
} }
@Post('/getSecretPlain', { summary: Constants.per.authOnly }) @Post('/getSecretPlain', { summary: 'sys:settings:view' })
async getSecretPlain(@Body(ALL) body: { id: number; key: string }) { async getSecretPlain(@Body(ALL) body: { id: number; key: string }) {
const value = await this.service.getById(body.id, 0); const value = await this.service.getById(body.id, 0);
return this.ok(value[body.key]); return this.ok(value[body.key]);
@@ -69,4 +75,9 @@ export class SysAccessController extends AccessController {
async simpleInfo(@Query('id') id: number) { async simpleInfo(@Query('id') id: number) {
return await super.simpleInfo(id); return await super.simpleInfo(id);
} }
@Post('/getDictByIds', { summary: 'sys:settings:view' })
async getDictByIds(@Body('ids') ids: number[]) {
return await super.getDictByIds(ids);
}
} }
@@ -12,6 +12,11 @@ export class SysAddonController extends AddonController {
return this.service2; return this.service2;
} }
async getProjectUserId(permission:string){
return {
projectId:null,userId:0
}
}
getUserId() { getUserId() {
// checkComm(); // checkComm();
return 0; return 0;
@@ -60,10 +60,12 @@ export class SysProjectMemberController extends CrudController<ProjectMemberEnti
userId: this.getUserId(), userId: this.getUserId(),
projectId: projectId, projectId: projectId,
}); });
return super.update({ const res =await this.service.update({
id: bean.id, id: bean.id,
permission: bean.permission, permission: bean.permission,
status: bean.status,
}); });
return this.ok(res);
} }
@Post("/info", { summary: "sys:settings:view" }) @Post("/info", { summary: "sys:settings:view" })
@@ -0,0 +1,60 @@
import { Constants, isEnterprise } from '@certd/lib-server';
import { Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
import { In } from 'typeorm';
import { AuthService } from '../../../modules/sys/authority/service/auth-service.js';
import { UserService } from '../../../modules/sys/authority/service/user-service.js';
import { BasicController } from '../../basic/code-controller.js';
/**
*
*/
@Provide()
@Controller('/api/basic/user')
export class BasicUserController extends BasicController {
@Inject()
service: UserService;
@Inject()
authService: AuthService;
getService(): UserService {
return this.service;
}
@Post('/getSimpleUserByIds', { summary: Constants.per.authOnly })
async getSimpleUserByIds(@Body('ids') ids: number[]) {
if(!isEnterprise()){
throw new Error('非企业模式不能获取用户信息');
}
const users = await this.service.find({
select: {
id: true,
username: true,
nickName: true,
mobile: true,
phoneCode: true,
},
where: {
id: In(ids),
},
});
return this.ok(users);
}
@Post('/getSimpleUsers', {summary: Constants.per.authOnly})
async getSimpleUsers() {
if(!isEnterprise()){
throw new Error('非企业模式不能获取所有用户信息');
}
const users = await this.service.find({
select: {
id: true,
username: true,
nickName: true,
mobile: true,
phoneCode: true,
},
});
return this.ok(users);
}
}
@@ -46,14 +46,15 @@ export class StatisticController extends BaseController {
@Post('/count', { summary: Constants.per.authOnly }) @Post('/count', { summary: Constants.per.authOnly })
public async count() { public async count() {
const pipelineCount = await this.pipelineService.count({ userId: this.getUserId() }); const {userId,projectId} = await this.getProjectUserIdRead();
const pipelineStatusCount = await this.pipelineService.statusCount({ userId: this.getUserId() }); const pipelineCount = await this.pipelineService.count({ userId,projectId });
const pipelineEnableCount = await this.pipelineService.enableCount({ userId: this.getUserId() }); const pipelineStatusCount = await this.pipelineService.statusCount({ userId,projectId });
const pipelineEnableCount = await this.pipelineService.enableCount({ userId,projectId });
const historyCount = await this.historyService.countPerDay({ userId: this.getUserId(), days: 7 }); const historyCount = await this.historyService.countPerDay({ userId,projectId, days: 7 });
const expiringList = await this.pipelineService.latestExpiringList({ userId: this.getUserId(), count: 5 }); const expiringList = await this.pipelineService.latestExpiringList({ userId,projectId, count: 5 });
const certCount = await this.certInfoService.count({ userId: this.getUserId() }); const certCount = await this.certInfoService.count({ userId,projectId });
const count: UserStatisticCount = { const count: UserStatisticCount = {
pipelineCount, pipelineCount,
@@ -2,6 +2,7 @@ import { BaseController, Constants } from '@certd/lib-server';
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core'; import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
import { AuthService } from '../../../modules/sys/authority/service/auth-service.js'; import { AuthService } from '../../../modules/sys/authority/service/auth-service.js';
import { ProjectService } from '../../../modules/sys/enterprise/service/project-service.js'; import { ProjectService } from '../../../modules/sys/enterprise/service/project-service.js';
import { ProjectMemberService } from '../../../modules/sys/enterprise/service/project-member-service.js';
/** /**
*/ */
@@ -10,6 +11,10 @@ import { ProjectService } from '../../../modules/sys/enterprise/service/project-
export class UserProjectController extends BaseController { export class UserProjectController extends BaseController {
@Inject() @Inject()
service: ProjectService; service: ProjectService;
@Inject()
projectMemberService: ProjectMemberService;
@Inject() @Inject()
authService: AuthService; authService: AuthService;
@@ -17,6 +22,23 @@ export class UserProjectController extends BaseController {
return this.service; return this.service;
} }
/**
* @param body
* @returns
*/
@Post('/detail', { summary: Constants.per.authOnly })
async detail(@Body(ALL) body: any) {
const {projectId} = await this.getProjectUserIdRead();
const res = await this.service.getDetail(projectId,this.getUserId());
return this.ok(res);
}
/**
*
* @param body
* @returns
*/
@Post('/list', { summary: Constants.per.authOnly }) @Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) { async list(@Body(ALL) body: any) {
const userId= this.getUserId(); const userId= this.getUserId();
@@ -24,4 +46,74 @@ export class UserProjectController extends BaseController {
return this.ok(res); return this.ok(res);
} }
/**
*
* @param body
* @returns
*/
@Post('/all', { summary: Constants.per.authOnly })
async all(@Body(ALL) body: any) {
const userId= this.getUserId();
const res = await this.service.getAllWithStatus(userId);
return this.ok(res);
}
@Post('/applyJoin', { summary: Constants.per.authOnly })
async applyJoin(@Body(ALL) body: any) {
const userId= this.getUserId();
const res = await this.service.applyJoin({ userId, projectId: body.projectId });
return this.ok(res);
}
@Post('/updateMember', { summary: Constants.per.authOnly })
async updateMember(@Body(ALL) body: any) {
const {projectId} = await this.getProjectUserIdAdmin();
const {status,permission,userId} = body;
const member = await this.projectMemberService.findOne({
where: {
projectId,
userId,
},
});
if (!member) {
throw new Error('成员不存在');
}
const res = await this.projectMemberService.update({
id: member.id,
status,
permission,
});
return this.ok(res);
}
@Post('/approveJoin', { summary: Constants.per.authOnly })
async approveJoin(@Body(ALL) body: any) {
const {projectId} = await this.getProjectUserIdAdmin();
const {status,permission,userId} = body;
const res = await this.service.approveJoin({ userId, projectId: projectId,status,permission });
return this.ok(res);
}
@Post('/delete', { summary: Constants.per.authOnly })
async delete(@Body(ALL) body: any) {
const {projectId} = await this.getProjectUserIdAdmin();
await this.projectMemberService.deleteWhere({
projectId,
userId: this.getUserId(),
});
return this.ok();
}
@Post('/leave', { summary: Constants.per.authOnly })
async leave(@Body(ALL) body: any) {
const {projectId} = body
const userId = this.getUserId();
await this.projectMemberService.deleteWhere({
projectId,
userId,
});
return this.ok();
}
} }
@@ -0,0 +1,118 @@
import { CrudController, SysSettingsService,Constants } from "@certd/lib-server";
import { ALL, Body, Controller, Inject, Post, Provide, Query } from "@midwayjs/core";
import { ProjectMemberEntity } from "../../../modules/sys/enterprise/entity/project-member.js";
import { ProjectMemberService } from "../../../modules/sys/enterprise/service/project-member-service.js";
import { merge } from "lodash-es";
import { ProjectService } from "../../../modules/sys/enterprise/service/project-service.js";
/**
*/
@Provide()
@Controller("/api/enterprise/projectMember")
export class ProjectMemberController extends CrudController<ProjectMemberEntity> {
@Inject()
service: ProjectMemberService;
@Inject()
sysSettingsService: SysSettingsService;
@Inject()
projectService: ProjectService;
getService<T>() {
return this.service;
}
@Post("/page", { summary: Constants.per.authOnly })
async page(@Body(ALL) body: any) {
const {projectId} = await this.getProjectUserIdRead();
body.query = body.query ?? {};
body.query.projectId = projectId;
return await super.page(body);
}
@Post("/list", { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
const {projectId} = await this.getProjectUserIdRead();
body.query = body.query ?? {};
body.query.projectId = projectId;
return super.list(body);
}
@Post("/add", { summary: Constants.per.authOnly })
async add(@Body(ALL) bean: any) {
const def: any = {
isDefault: false,
disabled: false,
};
merge(bean, def);
await this.projectService.checkAdminPermission({
userId: this.getUserId(),
projectId: bean.projectId,
});
return super.add(bean);
}
@Post("/update", { summary: Constants.per.authOnly })
async update(@Body(ALL) bean: any) {
if (!bean.id) {
throw new Error("id is required");
}
const projectId = await this.service.getProjectId(bean.id)
await this.projectService.checkAdminPermission({
userId: this.getUserId(),
projectId: projectId,
});
const res = await this.service.update({
id: bean.id,
permission: bean.permission,
status: bean.status,
});
return this.ok(res);
}
@Post("/info", { summary: Constants.per.authOnly })
async info(@Query("id") id: number) {
if (!id) {
throw new Error("id is required");
}
const projectId = await this.service.getProjectId(id)
await this.projectService.checkReadPermission({
userId: this.getUserId(),
projectId:projectId,
});
return super.info(id);
}
@Post("/delete", { summary: Constants.per.authOnly })
async delete(@Query("id") id: number) {
if (!id) {
throw new Error("id is required");
}
const projectId = await this.service.getProjectId(id)
await this.projectService.checkAdminPermission({
userId: this.getUserId(),
projectId:projectId,
});
return super.delete(id);
}
@Post("/deleteByIds", { summary: Constants.per.authOnly })
async deleteByIds(@Body("ids") ids: number[]) {
for (const id of ids) {
if (!id) {
throw new Error("id is required");
}
const projectId = await this.service.getProjectId(id)
await this.projectService.checkAdminPermission({
userId: this.getUserId(),
projectId:projectId,
});
await this.service.delete(id as any);
}
return this.ok({});
}
}
@@ -162,12 +162,15 @@ export class CertInfoController extends CrudController<CertInfoService> {
@Get('/download', { summary: Constants.per.authOnly }) @Get('/download', { summary: Constants.per.authOnly })
async download(@Query('id') id: number) { async download(@Query('id') id: number) {
await this.checkOwner(this.getService(),id,"read"); const {userId,projectId} =await this.checkOwner(this.getService(),id,"read");
const certInfo = await this.getService().info(id) const certInfo = await this.getService().info(id)
if (certInfo == null) { if (certInfo == null) {
throw new CommonException('file not found'); throw new CommonException('file not found');
} }
if (certInfo.userId !== this.getUserId()) { if (certInfo.userId !== userId) {
throw new CommonException('file not found');
}
if (projectId && certInfo.projectId !== projectId) {
throw new CommonException('file not found'); throw new CommonException('file not found');
} }
// koa send file // koa send file
@@ -111,7 +111,7 @@ export class AccessController extends CrudController<AccessService> {
@Post('/simpleInfo', { summary: Constants.per.authOnly }) @Post('/simpleInfo', { summary: Constants.per.authOnly })
async simpleInfo(@Query('id') id: number) { async simpleInfo(@Query('id') id: number) {
// await this.authService.checkUserIdButAllowAdmin(this.ctx, this.service, id); // await this.authService.checkUserIdButAllowAdmin(this.ctx, this.service, id);
await this.checkOwner(this.getService(), id, "read",true); // await this.checkOwner(this.getService(), id, "read",true);
const res = await this.service.getSimpleInfo(id); const res = await this.service.getSimpleInfo(id);
return this.ok(res); return this.ok(res);
} }
@@ -241,7 +241,7 @@ export class HistoryController extends CrudController<HistoryService> {
history = await this.service.getLastHistory(pipelineId); history = await this.service.getLastHistory(pipelineId);
} }
if (history == null) { if (history == null) {
throw new CommonException('historyId is null'); throw new CommonException('流水线还未运行过');
} }
const {projectId} = await this.getProjectUserIdRead() const {projectId} = await this.getProjectUserIdRead()
if (projectId) { if (projectId) {
@@ -199,6 +199,12 @@ export class LoginService {
return this.generateToken(info); return this.generateToken(info);
} }
writeTokenCookie(ctx:any,token: { expire: any; token: any }) {
ctx.cookies.set("certd_token", token.token, {
maxAge: 1000 * token.expire
});
}
/** /**
* token * token
@@ -191,11 +191,12 @@ export class CertInfoService extends BaseService<CertInfoEntity> {
}); });
} }
async count({ userId }: { userId: number }) { async count({ userId,projectId }: { userId: number,projectId?:number }) {
const total = await this.repository.count({ const total = await this.repository.count({
where: { where: {
userId, userId,
expiresTime: Not(IsNull()), expiresTime: Not(IsNull()),
projectId,
}, },
}); });
@@ -203,6 +204,7 @@ export class CertInfoService extends BaseService<CertInfoEntity> {
where: { where: {
userId, userId,
expiresTime: LessThan(new Date().getTime()), expiresTime: LessThan(new Date().getTime()),
projectId,
}, },
}); });
@@ -210,6 +212,7 @@ export class CertInfoService extends BaseService<CertInfoEntity> {
where: { where: {
userId, userId,
expiresTime: Between(new Date().getTime(), new Date().getTime() + 15 * 24 * 60 * 60 * 1000), expiresTime: Between(new Date().getTime(), new Date().getTime() + 15 * 24 * 60 * 60 * 1000),
projectId,
}, },
}); });
@@ -183,7 +183,7 @@ export class HistoryService extends BaseService<HistoryEntity> {
} }
} }
async countPerDay(param: { days: number; userId?: any }) { async countPerDay(param: { days: number; userId?: any,projectId?:number }) {
const todayEnd = dayjs().endOf('day'); const todayEnd = dayjs().endOf('day');
const where: any = { const where: any = {
createTime: MoreThan(todayEnd.add(-param.days, 'day').toDate()), createTime: MoreThan(todayEnd.add(-param.days, 'day').toDate()),
@@ -191,6 +191,9 @@ export class HistoryService extends BaseService<HistoryEntity> {
if (param.userId > 0) { if (param.userId > 0) {
where.userId = param.userId; where.userId = param.userId;
} }
if (param.projectId > 0) {
where.projectId = param.projectId;
}
const result = await this.getRepository() const result = await this.getRepository()
.createQueryBuilder('main') .createQueryBuilder('main')
.select(`${this.dbAdapter.date('main.createTime')} AS date`) // 将UNIX时间戳转换为日期 .select(`${this.dbAdapter.date('main.createTime')} AS date`) // 将UNIX时间戳转换为日期
@@ -251,6 +251,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
if (bean.id > 0) { if (bean.id > 0) {
//修改 //修改
old = await this.info(bean.id); old = await this.info(bean.id);
bean.order = old.order;
} }
if (!old || !old.webhookKey) { if (!old || !old.webhookKey) {
bean.webhookKey = await this.genWebhookKey(); bean.webhookKey = await this.genWebhookKey();
@@ -824,35 +825,41 @@ export class PipelineService extends BaseService<PipelineEntity> {
await this.historyLogService.addOrUpdate(logEntity); await this.historyLogService.addOrUpdate(logEntity);
} }
async count(param: { userId?: any }) { async count(param: { userId?: any,projectId?:number }) {
const count = await this.repository.count({ const count = await this.repository.count({
where: { where: {
userId: param.userId userId: param.userId,
projectId: param.projectId,
isTemplate: false
} }
}); });
return count; return count;
} }
async statusCount(param: { userId?: any } = {}) { async statusCount(param: { userId?: any,projectId?:number } = {}) {
const statusCount = await this.repository const statusCount = await this.repository
.createQueryBuilder() .createQueryBuilder()
.select("status") .select("status")
.addSelect("count(1)", "count") .addSelect("count(1)", "count")
.where({ .where({
userId: param.userId userId: param.userId,
projectId: param.projectId,
isTemplate: false
}) })
.groupBy("status") .groupBy("status")
.getRawMany(); .getRawMany();
return statusCount; return statusCount;
} }
async enableCount(param: { userId?: any } = {}) { async enableCount(param: { userId?: any,projectId?:number } = {}) {
const statusCount = await this.repository const statusCount = await this.repository
.createQueryBuilder() .createQueryBuilder()
.select("disabled") .select("disabled")
.addSelect("count(1)", "count") .addSelect("count(1)", "count")
.where({ .where({
userId: param.userId userId: param.userId,
projectId: param.projectId,
isTemplate: false
}) })
.groupBy("disabled") .groupBy("disabled")
.getRawMany(); .getRawMany();
@@ -866,7 +873,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
return result; return result;
} }
async latestExpiringList({ userId }: any) { async latestExpiringList({ userId,projectId }: any) {
let list = await this.repository.find({ let list = await this.repository.find({
select: { select: {
id: true, id: true,
@@ -875,7 +882,9 @@ export class PipelineService extends BaseService<PipelineEntity> {
}, },
where: { where: {
userId, userId,
disabled: false disabled: false,
projectId,
isTemplate: false
} }
}); });
await this.fillLastVars(list); await this.fillLastVars(list);
@@ -897,7 +906,8 @@ export class PipelineService extends BaseService<PipelineEntity> {
.addSelect("COUNT(1) AS count") .addSelect("COUNT(1) AS count")
.where({ .where({
// 0点 // 0点
createTime: MoreThan(todayEnd.add(-param.days, "day").toDate()) createTime: MoreThan(todayEnd.add(-param.days, "day").toDate()),
isTemplate: false
}) })
.groupBy("date") .groupBy("date")
.getRawMany(); .getRawMany();
@@ -16,6 +16,9 @@ export class ProjectMemberEntity {
@Column({ name: 'permission', comment: '权限' }) @Column({ name: 'permission', comment: '权限' })
permission: string; // read / write / admin permission: string; // read / write / admin
@Column({ name: 'status', comment: '申请状态' })
status: string; // pending / approved / rejected
@Column({ @Column({
name: 'create_time', name: 'create_time',
comment: '创建时间', comment: '创建时间',
@@ -34,4 +34,10 @@ export class ProjectEntity {
// user permission read write admin // user permission read write admin
permission:string permission:string
} }
export type ProjectMemberItem = {
memberId: number;
status: string;
} & ProjectEntity
@@ -18,7 +18,7 @@ export class ProjectMemberService extends BaseService<ProjectMemberEntity> {
return this.repository; return this.repository;
} }
async add(bean: ProjectMemberEntity) { async add(bean: Partial<ProjectMemberEntity>) {
const {projectId, userId} = bean; const {projectId, userId} = bean;
if (!projectId) { if (!projectId) {
throw new Error('项目ID不能为空'); throw new Error('项目ID不能为空');
@@ -38,19 +38,21 @@ export class ProjectMemberService extends BaseService<ProjectMemberEntity> {
return await super.add(bean) return await super.add(bean)
} }
async getByUserId(userId: number) { async getByUserId(userId: number,status?:string) {
return await this.repository.find({ return await this.repository.find({
where: { where: {
userId, userId,
status,
}, },
}); });
} }
async getMember(projectId: number,userId: number) { async getMember(projectId: number,userId: number,status?:string) {
return await this.repository.findOne({ return await this.repository.findOne({
where: { where: {
userId, userId,
projectId, projectId,
status,
}, },
}); });
} }
@@ -3,7 +3,7 @@ import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
import { InjectEntityModel } from '@midwayjs/typeorm'; import { InjectEntityModel } from '@midwayjs/typeorm';
import { LRUCache } from 'lru-cache'; import { LRUCache } from 'lru-cache';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { ProjectEntity } from '../entity/project.js'; import { ProjectEntity, ProjectMemberItem } from '../entity/project.js';
import { ProjectMemberService } from './project-member-service.js'; import { ProjectMemberService } from './project-member-service.js';
const projectCache = new LRUCache<string, any>({ const projectCache = new LRUCache<string, any>({
@@ -43,13 +43,13 @@ export class ProjectService extends BaseService<ProjectEntity> {
throw new Error('项目名称已存在'); throw new Error('项目名称已存在');
} }
bean.disabled = false bean.disabled = false
const res= await super.add(bean) const res = await super.add(bean)
projectCache.clear(); projectCache.clear();
return res; return res;
} }
async update( bean: ProjectEntity) { async update(bean: ProjectEntity) {
const res= await super.update(bean) const res = await super.update(bean)
projectCache.clear(); projectCache.clear();
return res; return res;
} }
@@ -65,7 +65,7 @@ export class ProjectService extends BaseService<ProjectEntity> {
async getUserProjects(userId: number) { async getUserProjects(userId: number) {
const memberList = await this.projectMemberService.getByUserId(userId); const memberList = await this.projectMemberService.getByUserId(userId, 'approved');
const projectIds = memberList.map(item => item.projectId); const projectIds = memberList.map(item => item.projectId);
const projectList = await this.repository.createQueryBuilder('project') const projectList = await this.repository.createQueryBuilder('project')
.where(' project.disabled = false') .where(' project.disabled = false')
@@ -89,6 +89,60 @@ export class ProjectService extends BaseService<ProjectEntity> {
return projectList return projectList
} }
async getAllWithStatus(userId: number): Promise<ProjectMemberItem[]> {
let projectList: any = await this.find({
where: {
disabled: false,
userId: 0,
},
})
const projectMemberItemList: ProjectMemberItem[] = projectList
const memberList = await this.projectMemberService.getByUserId(userId);
const memberMap = memberList.reduce((prev, cur) => {
prev[cur.projectId] = cur as any;
return prev;
}, {} as Record<number, ProjectMemberItem>);
projectMemberItemList.forEach(item => {
if (item.adminId === userId) {
item.permission = 'admin';
item.status = 'approved';
item.memberId = userId
} else {
const memberItem: any = memberMap[item.id]
if (memberItem) {
item.permission = memberItem.permission;
item.status = memberItem.status;
item.memberId = memberItem.userId
}
}
})
return projectMemberItemList
}
async getDetail(projectId: number, userId?: number): Promise<ProjectMemberItem[]> {
const project: any = await this.info(projectId);
if (!project) {
throw new Error('项目不存在');
}
if (project.adminId === userId) {
project.permission = 'admin';
project.status = 'approved';
project.memberId = userId
} else {
const member = await this.projectMemberService.getMember(projectId, userId);
if (member) {
project.permission = member.permission;
project.status = member.status;
project.memberId = member.userId
}
}
return project
}
async checkAdminPermission({ userId, projectId }: { userId: number, projectId: number }) { async checkAdminPermission({ userId, projectId }: { userId: number, projectId: number }) {
return await this.checkPermission({ return await this.checkPermission({
userId, userId,
@@ -124,36 +178,36 @@ export class ProjectService extends BaseService<ProjectEntity> {
const cacheKey = `projectPermission:${projectId}:${userId}` const cacheKey = `projectPermission:${projectId}:${userId}`
let savedPermission = projectCache.get(cacheKey); let savedPermission = projectCache.get(cacheKey);
if (!savedPermission){ if (!savedPermission) {
const project = await this.findOne({ const project = await this.findOne({
select: ['id', 'userId', 'adminId', 'disabled'], select: ['id', 'userId', 'adminId', 'disabled'],
where: { where: {
id: projectId, id: projectId,
}, },
}); });
if (!project) { if (!project) {
throw new Error('项目不存在'); throw new Error('项目不存在');
}
if (project.adminId === userId) {
//创建者拥有管理权限
savedPermission = 'admin';
} else {
if (project.disabled) {
throw new Error('项目已禁用');
} }
if (project.adminId === userId) { const member = await this.projectMemberService.getMember(projectId, userId);
//创建者拥有管理权限 if (!member || member.status !== 'approved') {
savedPermission = 'admin'; throw new Error(`用户${userId}还不是项目${projectId}的成员`);
}else{
if (project.disabled) {
throw new Error('项目已禁用');
}
const member = await this.projectMemberService.getMember(projectId, userId);
if (!member) {
throw new Error(`用户${userId}不是该项目${projectId}成员`);
}
savedPermission = member.permission;
} }
savedPermission = member.permission;
}
} }
projectCache.set(cacheKey, savedPermission,{ttl: 3 * 60 * 1000}); projectCache.set(cacheKey, savedPermission, { ttl: 3 * 60 * 1000 });
if (!savedPermission) { if (!savedPermission) {
throw new Error(`权限不足,需要${permission}权限`); throw new Error(`权限不足,需要${permission}权限`);
} }
if (permission === 'read') { if (permission === 'read') {
return true return true
} }
@@ -169,4 +223,50 @@ export class ProjectService extends BaseService<ProjectEntity> {
} }
return true return true
} }
async applyJoin({ userId, projectId }: { userId: number, projectId: number }) {
const project = await this.info(projectId);
if (!project) {
throw new Error('项目不存在');
}
if (project.disabled) {
throw new Error('项目已禁用');
}
if (project.adminId === userId) {
throw new Error('申请用户已经是该项目的管理员');
}
const member = await this.projectMemberService.getMember(projectId, userId);
if (member && member.status === 'approved') {
throw new Error('用户已加入项目');
}
if (member) {
this.projectMemberService.update({
id: member.id,
status: 'pending',
})
} else {
// 加入项目
await this.projectMemberService.add({
userId,
projectId,
permission: 'read',
status: 'pending',
})
}
}
async approveJoin({ userId, projectId, status, permission }: { userId: number, projectId: number, status: string, permission: string }) {
const member = await this.projectMemberService.getMember(projectId, userId);
if (!member) {
throw new Error('找不到用户的申请记录');
}
await this.projectMemberService.update({
id: member.id,
status: status,
permission,
})
}
} }
@@ -83,6 +83,7 @@ export class DeployCertToAliyunDCDN extends AbstractTaskPlugin {
this.logger.info(`[${domainName}]开始部署`) this.logger.info(`[${domainName}]开始部署`)
const params = await this.buildParams(domainName); const params = await this.buildParams(domainName);
await this.doRequest(client, params); await this.doRequest(client, params);
await this.ctx.utils.sleep(1000);
this.logger.info(`[${domainName}]部署成功`) this.logger.info(`[${domainName}]部署成功`)
} }
@@ -133,7 +133,7 @@ export abstract class CertApplyBasePlugin extends CertApplyBaseConvertPlugin {
} }
/** /**
* 35 * 15
* @param expires * @param expires
* @param maxDays * @param maxDays
*/ */
@@ -16,7 +16,7 @@ import { PrivateKeyType } from "./dns.js";
desc: "支持海量DNS解析提供商,推荐使用,一样的免费通配符域名证书申请,支持多个域名打到同一个证书上", desc: "支持海量DNS解析提供商,推荐使用,一样的免费通配符域名证书申请,支持多个域名打到同一个证书上",
default: { default: {
input: { input: {
renewDays: 35, renewDays: 15,
forceUpdate: false, forceUpdate: false,
}, },
strategy: { strategy: {
@@ -71,11 +71,18 @@ export class UpyunClient {
Cookie: req.cookie Cookie: req.cookie
} }
}); });
let errorMessage = null;
if (res.msg?.errors?.length > 0) { if (res.msg?.errors?.length > 0) {
throw new Error(JSON.stringify(res.msg)); errorMessage = JSON.stringify(res.msg);
} }
if(res.data?.error_code){ if(res.data?.error_code){
throw new Error(res.data?.message); errorMessage = res.data?.message;
}
if(errorMessage){
if (errorMessage.includes("domain has been bound to this certificate")) {
return res;
}
throw new Error(errorMessage);
} }
return res; return res;
} }
+110 -50
View File
@@ -49,7 +49,7 @@ importers:
packages/core/acme-client: packages/core/acme-client:
dependencies: dependencies:
'@certd/basic': '@certd/basic':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../basic version: link:../basic
'@peculiar/x509': '@peculiar/x509':
specifier: ^1.11.0 specifier: ^1.11.0
@@ -213,11 +213,11 @@ importers:
packages/core/pipeline: packages/core/pipeline:
dependencies: dependencies:
'@certd/basic': '@certd/basic':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../basic version: link:../basic
'@certd/plus-core': '@certd/plus-core':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../pro/plus-core version: 1.38.12
dayjs: dayjs:
specifier: ^1.11.7 specifier: ^1.11.7
version: 1.11.13 version: 1.11.13
@@ -412,7 +412,7 @@ importers:
packages/libs/lib-k8s: packages/libs/lib-k8s:
dependencies: dependencies:
'@certd/basic': '@certd/basic':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../core/basic version: link:../../core/basic
'@kubernetes/client-node': '@kubernetes/client-node':
specifier: 0.21.0 specifier: 0.21.0
@@ -452,20 +452,20 @@ importers:
packages/libs/lib-server: packages/libs/lib-server:
dependencies: dependencies:
'@certd/acme-client': '@certd/acme-client':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../core/acme-client version: link:../../core/acme-client
'@certd/basic': '@certd/basic':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../core/basic version: link:../../core/basic
'@certd/pipeline': '@certd/pipeline':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../core/pipeline version: link:../../core/pipeline
'@certd/plugin-lib': '@certd/plugin-lib':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../plugins/plugin-lib version: link:../../plugins/plugin-lib
'@certd/plus-core': '@certd/plus-core':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../pro/plus-core version: 1.38.12
'@midwayjs/cache': '@midwayjs/cache':
specifier: 3.14.0 specifier: 3.14.0
version: 3.14.0 version: 3.14.0
@@ -610,16 +610,16 @@ importers:
packages/plugins/plugin-cert: packages/plugins/plugin-cert:
dependencies: dependencies:
'@certd/acme-client': '@certd/acme-client':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../core/acme-client version: link:../../core/acme-client
'@certd/basic': '@certd/basic':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../core/basic version: link:../../core/basic
'@certd/pipeline': '@certd/pipeline':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../core/pipeline version: link:../../core/pipeline
'@certd/plugin-lib': '@certd/plugin-lib':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../plugin-lib version: link:../plugin-lib
psl: psl:
specifier: ^1.9.0 specifier: ^1.9.0
@@ -683,17 +683,17 @@ importers:
specifier: ^3.964.0 specifier: ^3.964.0
version: 3.964.0(aws-crt@1.26.2) version: 3.964.0(aws-crt@1.26.2)
'@certd/acme-client': '@certd/acme-client':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../core/acme-client version: link:../../core/acme-client
'@certd/basic': '@certd/basic':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../core/basic version: link:../../core/basic
'@certd/pipeline': '@certd/pipeline':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../core/pipeline version: link:../../core/pipeline
'@certd/plus-core': '@certd/plus-core':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../pro/plus-core version: 1.38.12
'@kubernetes/client-node': '@kubernetes/client-node':
specifier: 0.21.0 specifier: 0.21.0
version: 0.21.0 version: 0.21.0
@@ -783,16 +783,16 @@ importers:
packages/pro/commercial-core: packages/pro/commercial-core:
dependencies: dependencies:
'@certd/basic': '@certd/basic':
specifier: ^1.38.9 specifier: ^1.38.8
version: link:../../core/basic version: link:../../core/basic
'@certd/lib-server': '@certd/lib-server':
specifier: ^1.38.9 specifier: ^1.38.8
version: link:../../libs/lib-server version: link:../../libs/lib-server
'@certd/pipeline': '@certd/pipeline':
specifier: ^1.38.9 specifier: ^1.38.8
version: link:../../core/pipeline version: link:../../core/pipeline
'@certd/plus-core': '@certd/plus-core':
specifier: ^1.38.9 specifier: ^1.38.8
version: link:../plus-core version: link:../plus-core
'@midwayjs/core': '@midwayjs/core':
specifier: 3.20.11 specifier: 3.20.11
@@ -865,16 +865,16 @@ importers:
packages/pro/plugin-plus: packages/pro/plugin-plus:
dependencies: dependencies:
'@certd/basic': '@certd/basic':
specifier: ^1.38.9 specifier: ^1.38.8
version: link:../../core/basic version: link:../../core/basic
'@certd/pipeline': '@certd/pipeline':
specifier: ^1.38.9 specifier: ^1.38.8
version: link:../../core/pipeline version: link:../../core/pipeline
'@certd/plugin-lib': '@certd/plugin-lib':
specifier: ^1.38.9 specifier: ^1.38.8
version: link:../../plugins/plugin-lib version: link:../../plugins/plugin-lib
'@certd/plus-core': '@certd/plus-core':
specifier: ^1.38.9 specifier: ^1.38.8
version: link:../plus-core version: link:../plus-core
crypto-js: crypto-js:
specifier: ^4.2.0 specifier: ^4.2.0
@@ -950,7 +950,7 @@ importers:
packages/pro/plus-core: packages/pro/plus-core:
dependencies: dependencies:
'@certd/basic': '@certd/basic':
specifier: ^1.38.9 specifier: ^1.38.8
version: link:../../core/basic version: link:../../core/basic
dayjs: dayjs:
specifier: ^1.11.7 specifier: ^1.11.7
@@ -1246,10 +1246,10 @@ importers:
version: 0.1.3(zod@3.24.4) version: 0.1.3(zod@3.24.4)
devDependencies: devDependencies:
'@certd/lib-iframe': '@certd/lib-iframe':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../libs/lib-iframe version: link:../../libs/lib-iframe
'@certd/pipeline': '@certd/pipeline':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../core/pipeline version: link:../../core/pipeline
'@rollup/plugin-commonjs': '@rollup/plugin-commonjs':
specifier: ^25.0.7 specifier: ^25.0.7
@@ -1444,47 +1444,47 @@ importers:
specifier: ^3.990.0 specifier: ^3.990.0
version: 3.990.0(aws-crt@1.26.2) version: 3.990.0(aws-crt@1.26.2)
'@certd/acme-client': '@certd/acme-client':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../core/acme-client version: link:../../core/acme-client
'@certd/basic': '@certd/basic':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../core/basic version: link:../../core/basic
'@certd/commercial-core': '@certd/commercial-core':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../pro/commercial-core version: 1.38.12(better-sqlite3@11.10.0)(mysql2@3.14.1)(pg@8.16.0)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.100)(typescript@5.9.3))
'@certd/cv4pve-api-javascript': '@certd/cv4pve-api-javascript':
specifier: ^8.4.2 specifier: ^8.4.2
version: 8.4.2 version: 8.4.2
'@certd/jdcloud': '@certd/jdcloud':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../libs/lib-jdcloud version: link:../../libs/lib-jdcloud
'@certd/lib-huawei': '@certd/lib-huawei':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../libs/lib-huawei version: link:../../libs/lib-huawei
'@certd/lib-k8s': '@certd/lib-k8s':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../libs/lib-k8s version: link:../../libs/lib-k8s
'@certd/lib-server': '@certd/lib-server':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../libs/lib-server version: link:../../libs/lib-server
'@certd/midway-flyway-js': '@certd/midway-flyway-js':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../libs/midway-flyway-js version: link:../../libs/midway-flyway-js
'@certd/pipeline': '@certd/pipeline':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../core/pipeline version: link:../../core/pipeline
'@certd/plugin-cert': '@certd/plugin-cert':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../plugins/plugin-cert version: link:../../plugins/plugin-cert
'@certd/plugin-lib': '@certd/plugin-lib':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../plugins/plugin-lib version: link:../../plugins/plugin-lib
'@certd/plugin-plus': '@certd/plugin-plus':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../pro/plugin-plus version: 1.38.12
'@certd/plus-core': '@certd/plus-core':
specifier: ^1.38.9 specifier: ^1.38.12
version: link:../../pro/plus-core version: 1.38.12
'@google-cloud/publicca': '@google-cloud/publicca':
specifier: ^1.3.0 specifier: ^1.3.0
version: 1.3.0(encoding@0.1.13) version: 1.3.0(encoding@0.1.13)
@@ -2820,9 +2820,18 @@ packages:
'@better-scroll/zoom@2.5.1': '@better-scroll/zoom@2.5.1':
resolution: {integrity: sha512-aGvFY5ooeZWS4RcxQLD+pGLpQHQxpPy0sMZV3yadcd2QK53PK9gS4Dp+BYfRv8lZ4/P2LoNEhr6Wq1DN6+uPlA==} resolution: {integrity: sha512-aGvFY5ooeZWS4RcxQLD+pGLpQHQxpPy0sMZV3yadcd2QK53PK9gS4Dp+BYfRv8lZ4/P2LoNEhr6Wq1DN6+uPlA==}
'@certd/commercial-core@1.38.12':
resolution: {integrity: sha512-kP4vM3F+D6TME9NYSM7Q1YqTx6Ig1dseWQUFVf7GnfG9E3A2odaRwmeYwy5QomChF0vbPHPkJqOtfYv9WItikQ==}
'@certd/cv4pve-api-javascript@8.4.2': '@certd/cv4pve-api-javascript@8.4.2':
resolution: {integrity: sha512-udGce7ewrVl4DmZvX+17PjsnqsdDIHEDatr8QP0AVrY2p+8JkaSPW4mXCKiLGf82C9K2+GXgT+qNIqgW7tfF9Q==} resolution: {integrity: sha512-udGce7ewrVl4DmZvX+17PjsnqsdDIHEDatr8QP0AVrY2p+8JkaSPW4mXCKiLGf82C9K2+GXgT+qNIqgW7tfF9Q==}
'@certd/plugin-plus@1.38.12':
resolution: {integrity: sha512-I0aQAzIRaDFSwM2vb/ycLqaNjVcb/fWUOgmX/BpHEnN446oNk5+pl8d4KFE+OMzEDQcwOwZhdXhjrOsskqY3PA==}
'@certd/plus-core@1.38.12':
resolution: {integrity: sha512-2BKhInDmMrH4l/WRKcSq7E6PA4ANcE1PVMIVoWlhSnnW+sghYUioymRaSoGTxJYfSvGHlLrqZXAassQHAzm98g==}
'@certd/vue-js-cron-core@6.0.3': '@certd/vue-js-cron-core@6.0.3':
resolution: {integrity: sha512-kqzoAMhYz9j6FGNWEODRYtt4NpUEUwjpkU89z5WVg2tCtOcI5VhwyUGOd8AxiBCRfd6PtXvzuqw85PaOps9wrQ==} resolution: {integrity: sha512-kqzoAMhYz9j6FGNWEODRYtt4NpUEUwjpkU89z5WVg2tCtOcI5VhwyUGOd8AxiBCRfd6PtXvzuqw85PaOps9wrQ==}
@@ -15028,12 +15037,63 @@ snapshots:
dependencies: dependencies:
'@better-scroll/core': 2.5.1 '@better-scroll/core': 2.5.1
'@certd/commercial-core@1.38.12(better-sqlite3@11.10.0)(mysql2@3.14.1)(pg@8.16.0)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.100)(typescript@5.9.3))':
dependencies:
'@certd/basic': link:packages/core/basic
'@certd/lib-server': link:packages/libs/lib-server
'@certd/pipeline': link:packages/core/pipeline
'@certd/plus-core': 1.38.12
'@midwayjs/core': 3.20.11
'@midwayjs/koa': 3.20.13
'@midwayjs/logger': 3.4.2
'@midwayjs/typeorm': 3.20.11
dayjs: 1.11.13
typeorm: 0.3.24(better-sqlite3@11.10.0)(mysql2@3.14.1)(pg@8.16.0)(reflect-metadata@0.2.2)(ts-node@10.9.2(@types/node@18.19.100)(typescript@5.9.3))
transitivePeerDependencies:
- '@google-cloud/spanner'
- '@sap/hana-client'
- babel-plugin-macros
- better-sqlite3
- hdb-pool
- ioredis
- mongodb
- mssql
- mysql2
- oracledb
- pg
- pg-native
- pg-query-stream
- redis
- reflect-metadata
- sql.js
- sqlite3
- supports-color
- ts-node
- typeorm-aurora-data-api-driver
'@certd/cv4pve-api-javascript@8.4.2': '@certd/cv4pve-api-javascript@8.4.2':
dependencies: dependencies:
debug: 4.4.3(supports-color@8.1.1) debug: 4.4.3(supports-color@8.1.1)
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
'@certd/plugin-plus@1.38.12':
dependencies:
'@certd/basic': link:packages/core/basic
'@certd/pipeline': link:packages/core/pipeline
'@certd/plugin-lib': link:packages/plugins/plugin-lib
'@certd/plus-core': 1.38.12
crypto-js: 4.2.0
dayjs: 1.11.13
form-data: 4.0.2
jsrsasign: 11.1.0
querystring: 0.2.1
'@certd/plus-core@1.38.12':
dependencies:
'@certd/basic': link:packages/core/basic
dayjs: 1.11.13
'@certd/vue-js-cron-core@6.0.3': '@certd/vue-js-cron-core@6.0.3':
dependencies: dependencies:
mustache: 4.2.0 mustache: 4.2.0
@@ -20599,13 +20659,13 @@ snapshots:
resolve: 1.22.10 resolve: 1.22.10
semver: 6.3.1 semver: 6.3.1
eslint-plugin-prettier@3.4.1(eslint-config-prettier@8.10.0(eslint@7.32.0))(eslint@7.32.0)(prettier@2.8.8): eslint-plugin-prettier@3.4.1(eslint-config-prettier@8.10.0(eslint@8.57.0))(eslint@7.32.0)(prettier@2.8.8):
dependencies: dependencies:
eslint: 7.32.0 eslint: 7.32.0
prettier: 2.8.8 prettier: 2.8.8
prettier-linter-helpers: 1.0.0 prettier-linter-helpers: 1.0.0
optionalDependencies: optionalDependencies:
eslint-config-prettier: 8.10.0(eslint@7.32.0) eslint-config-prettier: 8.10.0(eslint@8.57.0)
eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.0))(eslint@8.57.0)(prettier@2.8.8): eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.0))(eslint@8.57.0)(prettier@2.8.8):
dependencies: dependencies:
@@ -23009,7 +23069,7 @@ snapshots:
eslint: 7.32.0 eslint: 7.32.0
eslint-config-prettier: 8.10.0(eslint@7.32.0) eslint-config-prettier: 8.10.0(eslint@7.32.0)
eslint-plugin-node: 11.1.0(eslint@7.32.0) eslint-plugin-node: 11.1.0(eslint@7.32.0)
eslint-plugin-prettier: 3.4.1(eslint-config-prettier@8.10.0(eslint@7.32.0))(eslint@7.32.0)(prettier@2.8.8) eslint-plugin-prettier: 3.4.1(eslint-config-prettier@8.10.0(eslint@8.57.0))(eslint@7.32.0)(prettier@2.8.8)
execa: 5.1.1 execa: 5.1.1
inquirer: 7.3.3 inquirer: 7.3.3
json5: 2.2.3 json5: 2.2.3