chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// TODO: 替换成Project接口导出的idl
|
||||
// TODO: replace with idl exported by Project interface
|
||||
export enum ProjectRoleType {
|
||||
Owner = 'owner',
|
||||
Editor = 'editor',
|
||||
@@ -22,51 +22,51 @@ export enum ProjectRoleType {
|
||||
|
||||
export enum EProjectPermission {
|
||||
/**
|
||||
* 访问/查看project
|
||||
* Visit/view projects
|
||||
*/
|
||||
View,
|
||||
/**
|
||||
* 编辑project基础信息
|
||||
* Edit project basic information
|
||||
*/
|
||||
EDIT_INFO,
|
||||
/**
|
||||
* 删除project
|
||||
* Delete project
|
||||
*/
|
||||
DELETE,
|
||||
/**
|
||||
* 发布project
|
||||
* Publish project
|
||||
*/
|
||||
PUBLISH,
|
||||
/**
|
||||
* 创建project内资源
|
||||
* Create project resources
|
||||
*/
|
||||
CREATE_RESOURCE,
|
||||
/**
|
||||
* 在project内复制资源
|
||||
* Copy resources within the project
|
||||
*/
|
||||
COPY_RESOURCE,
|
||||
/**
|
||||
* 复制project/创建副本
|
||||
* Copy project/create copy
|
||||
*/
|
||||
COPY,
|
||||
/**
|
||||
* 试运行plugin
|
||||
* Practice running plugins
|
||||
*/
|
||||
TEST_RUN_PLUGIN,
|
||||
/**
|
||||
* 试运行workflow
|
||||
* Practice running workflow
|
||||
*/
|
||||
TEST_RUN_WORKFLOW,
|
||||
/**
|
||||
* 添加project协作者
|
||||
* Add project collaborators
|
||||
*/
|
||||
ADD_COLLABORATOR,
|
||||
/**
|
||||
* 删除project协作者
|
||||
* Delete project collaborator
|
||||
*/
|
||||
DELETE_COLLABORATOR,
|
||||
/**
|
||||
* 回滚 APP 版本
|
||||
* Roll back the APP version
|
||||
*/
|
||||
ROLLBACK,
|
||||
}
|
||||
|
||||
@@ -20,26 +20,26 @@ import { create } from 'zustand';
|
||||
import { type ProjectRoleType } from './constants';
|
||||
|
||||
interface ProjectAuthStoreState {
|
||||
// 每一个Project的角色数据
|
||||
// Role Data for Each Project
|
||||
roles: {
|
||||
[projectId: string]: ProjectRoleType[];
|
||||
};
|
||||
// 每一个Project的角色数据的初始化状态,是否完成初始化。
|
||||
// The initialization status of each Project's role data, and whether the initialization has been completed.
|
||||
isReady: {
|
||||
[projectId: string]: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface SpaceAuthStoreAction {
|
||||
// 设置projectId对应的Project的角色
|
||||
// Set the role of the Project corresponding to the projectId
|
||||
setRoles: (projectId: string, role: ProjectRoleType[]) => void;
|
||||
// 设置projectId对应的Project的数据是否ready
|
||||
// Set whether the data of the Project corresponding to the projectId is ready
|
||||
setIsReady: (projectId: string, isReady: boolean) => void;
|
||||
// 回收Project数据
|
||||
// Recovering Project Data
|
||||
destory: (projectId) => void;
|
||||
}
|
||||
/**
|
||||
* ProjectAuthStore设计成支持多Project切换,维护多个Project的数据,防止因为Project切换时序导致的bug。
|
||||
* ProjectAuthStore is designed to support multi-project switching, maintain data of multiple projects, and prevent bugs caused by project switching timing.
|
||||
*/
|
||||
export const useProjectAuthStore = create<
|
||||
ProjectAuthStoreState & SpaceAuthStoreAction
|
||||
|
||||
@@ -23,7 +23,7 @@ export function useDestoryProject(projectId: string) {
|
||||
|
||||
return useEffect(
|
||||
() => () => {
|
||||
// 空间组件销毁时,清空对应space数据
|
||||
// When the space component is destroyed, empty the corresponding space data
|
||||
destorySpace(projectId);
|
||||
},
|
||||
[],
|
||||
|
||||
@@ -26,7 +26,7 @@ export function useProjectAuth(
|
||||
projectId: string,
|
||||
spaceId: string,
|
||||
) {
|
||||
// 获取space类型信息
|
||||
// Get space type information
|
||||
const space = useSpace(spaceId);
|
||||
|
||||
if (!space?.space_type) {
|
||||
@@ -35,13 +35,13 @@ export function useProjectAuth(
|
||||
);
|
||||
}
|
||||
|
||||
// 获取space role信息
|
||||
// Get space role information
|
||||
const spaceRoles = useSpaceRole(spaceId);
|
||||
|
||||
// 获取project role信息
|
||||
// Get project role information
|
||||
const projectRoles = useProjectRole(projectId);
|
||||
|
||||
// 计算权限点
|
||||
// Calculate permission spot
|
||||
return calcPermission(key, {
|
||||
projectRoles,
|
||||
spaceRoles,
|
||||
|
||||
@@ -15,44 +15,44 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 空间相关的权限点枚举
|
||||
* Spatially dependent permission spot enumeration
|
||||
*/
|
||||
export enum ESpacePermisson {
|
||||
/**
|
||||
* 更新空间
|
||||
* update space
|
||||
*/
|
||||
UpdateSpace,
|
||||
/**
|
||||
* 删除空间
|
||||
* delete space
|
||||
*/
|
||||
DeleteSpace,
|
||||
/**
|
||||
* 添加成员
|
||||
* Add member
|
||||
*/
|
||||
AddBotSpaceMember,
|
||||
/**
|
||||
* 移除空间成员
|
||||
* Remove space member
|
||||
*/
|
||||
RemoveSpaceMember,
|
||||
/**
|
||||
* 退出空间
|
||||
* exit space
|
||||
*/
|
||||
ExitSpace,
|
||||
/**
|
||||
* 转移owner权限
|
||||
* Transfer owner permissions
|
||||
*/
|
||||
TransferSpace,
|
||||
/**
|
||||
* 更新成员
|
||||
* update member
|
||||
*/
|
||||
UpdateSpaceMember,
|
||||
/**
|
||||
* 管理API-KEY
|
||||
* Manage API-KEY
|
||||
*/
|
||||
API,
|
||||
}
|
||||
|
||||
/**
|
||||
* 空间角色枚举
|
||||
* Spatial Role Enumeration
|
||||
*/
|
||||
export { SpaceRoleType } from '@coze-arch/idl/developer_api';
|
||||
|
||||
@@ -19,26 +19,26 @@ import { create } from 'zustand';
|
||||
import { type SpaceRoleType } from '@coze-arch/idl/developer_api';
|
||||
|
||||
interface SpaceAuthStoreState {
|
||||
// 每一个空间的角色数据
|
||||
// Role data for each space
|
||||
roles: {
|
||||
[spaceId: string]: SpaceRoleType[];
|
||||
};
|
||||
// 每一个空间的角色数据的初始化状态,是否完成初始化。
|
||||
// The initialization status of the character data in each space, and whether the initialization is completed.
|
||||
isReady: {
|
||||
[spaceId: string]: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface SpaceAuthStoreAction {
|
||||
// 设置spaceId对应的空间的角色
|
||||
// Set the role of the space corresponding to the spaceId
|
||||
setRoles: (spaceId: string, roles: SpaceRoleType[]) => void;
|
||||
// 设置spaceId对应的空间的数据是否ready
|
||||
// Set whether the data of the space corresponding to the spaceId is ready
|
||||
setIsReady: (spaceId: string, isReady: boolean) => void;
|
||||
// 回收空间数据
|
||||
// Recovering spatial data
|
||||
destory: (spaceId) => void;
|
||||
}
|
||||
/**
|
||||
* SpaceAuthStore设计成支持多空间切换,维护多个空间的数据,位置因为空间切换时序导致的bug。
|
||||
* SpaceAuthStore is designed to support multi-space switching and maintain data in multiple spaces. The location is due to bugs caused by the timing of space switching.
|
||||
*/
|
||||
export const useSpaceAuthStore = create<
|
||||
SpaceAuthStoreState & SpaceAuthStoreAction
|
||||
|
||||
@@ -23,7 +23,7 @@ export function useDestorySpace(spaceId: string) {
|
||||
|
||||
return useEffect(
|
||||
() => () => {
|
||||
// 空间组件销毁时,清空对应space数据
|
||||
// When the space component is destroyed, empty the corresponding space data
|
||||
destorySpace(spaceId);
|
||||
},
|
||||
[],
|
||||
|
||||
@@ -19,8 +19,8 @@ import { type ESpacePermisson } from './constants';
|
||||
import { calcPermission } from './calc-permission';
|
||||
|
||||
export function useSpaceAuth(key: ESpacePermisson, spaceId: string) {
|
||||
// 获取space role信息
|
||||
// Get space role information
|
||||
const role = useSpaceRole(spaceId);
|
||||
// 计算权限点
|
||||
// Calculate permission spot
|
||||
return calcPermission(key, role);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import { useSpace } from '@coze-arch/foundation-sdk';
|
||||
import { useSpaceAuthStore } from './store';
|
||||
|
||||
export function useSpaceRole(spaceId: string) {
|
||||
// 获取space信息,已有hook。
|
||||
// Get space information, there are hooks.
|
||||
const space = useSpace(spaceId);
|
||||
|
||||
if (!space) {
|
||||
|
||||
Reference in New Issue
Block a user