fix(admin): organize admin panel (#7840)

This commit is contained in:
forehalo
2024-08-13 05:45:02 +00:00
parent 6dea831d8a
commit 0ec1995add
45 changed files with 746 additions and 955 deletions

View File

@@ -1,3 +0,0 @@
mutation addToAdmin($email: String!) {
addAdminister(email: $email)
}

View File

@@ -0,0 +1,17 @@
#import './fragments/password-limits.gql'
#import './fragments/credentials-requirement.gql'
query adminServerConfig {
serverConfig {
version
baseUrl
name
features
type
initialized
credentialsRequirement {
...CredentialsRequirement
}
availableUserFeatures
}
}

View File

@@ -1,3 +0,0 @@
mutation addToEarlyAccess($email: String!, $type: EarlyAccessType!) {
addToEarlyAccess(email: $email, type: $type)
}

View File

@@ -1,16 +0,0 @@
query earlyAccessUsers {
earlyAccessUsers {
id
name
email
avatarUrl
emailVerified
subscription {
plan
recurring
status
start
end
}
}
}

View File

@@ -1,3 +0,0 @@
mutation removeEarlyAccess($email: String!, $type: EarlyAccessType!) {
removeEarlyAccess(email: $email, type: $type)
}

View File

@@ -18,15 +18,27 @@ fragment CredentialsRequirement on CredentialsRequirementType {
...PasswordLimits
}
}`
export const addToAdminMutation = {
id: 'addToAdminMutation' as const,
operationName: 'addToAdmin',
definitionName: 'addAdminister',
export const adminServerConfigQuery = {
id: 'adminServerConfigQuery' as const,
operationName: 'adminServerConfig',
definitionName: 'serverConfig',
containsFile: false,
query: `
mutation addToAdmin($email: String!) {
addAdminister(email: $email)
}`,
query adminServerConfig {
serverConfig {
version
baseUrl
name
features
type
initialized
credentialsRequirement {
...CredentialsRequirement
}
availableUserFeatures
}
}${passwordLimitsFragment}
${credentialsRequirementFragment}`,
};
export const deleteBlobMutation = {
@@ -254,52 +266,6 @@ mutation deleteWorkspace($id: String!) {
}`,
};
export const addToEarlyAccessMutation = {
id: 'addToEarlyAccessMutation' as const,
operationName: 'addToEarlyAccess',
definitionName: 'addToEarlyAccess',
containsFile: false,
query: `
mutation addToEarlyAccess($email: String!, $type: EarlyAccessType!) {
addToEarlyAccess(email: $email, type: $type)
}`,
};
export const earlyAccessUsersQuery = {
id: 'earlyAccessUsersQuery' as const,
operationName: 'earlyAccessUsers',
definitionName: 'earlyAccessUsers',
containsFile: false,
query: `
query earlyAccessUsers {
earlyAccessUsers {
id
name
email
avatarUrl
emailVerified
subscription {
plan
recurring
status
start
end
}
}
}`,
};
export const removeEarlyAccessMutation = {
id: 'removeEarlyAccessMutation' as const,
operationName: 'removeEarlyAccess',
definitionName: 'removeEarlyAccess',
containsFile: false,
query: `
mutation removeEarlyAccess($email: String!, $type: EarlyAccessType!) {
removeEarlyAccess(email: $email, type: $type)
}`,
};
export const forkCopilotSessionMutation = {
id: 'forkCopilotSessionMutation' as const,
operationName: 'forkCopilotSession',
@@ -803,15 +769,6 @@ query listUsers($filter: ListUserInput!) {
hasPassword
emailVerified
avatarUrl
quota {
humanReadable {
blobLimit
historyPeriod
memberLimit
name
storageQuota
}
}
}
}`,
};
@@ -889,17 +846,6 @@ mutation recoverDoc($workspaceId: String!, $docId: String!, $timestamp: DateTime
}`,
};
export const removeAdminMutation = {
id: 'removeAdminMutation' as const,
operationName: 'removeAdmin',
definitionName: 'removeAdminister',
containsFile: false,
query: `
mutation removeAdmin($email: String!) {
removeAdminister(email: $email)
}`,
};
export const removeAvatarMutation = {
id: 'removeAvatarMutation' as const,
operationName: 'removeAvatar',
@@ -1024,7 +970,6 @@ query serverConfig {
name
features
type
initialized
credentialsRequirement {
...CredentialsRequirement
}
@@ -1069,6 +1014,17 @@ query subscription {
}`,
};
export const updateAccountFeaturesMutation = {
id: 'updateAccountFeaturesMutation' as const,
operationName: 'updateAccountFeatures',
definitionName: 'updateUserFeatures',
containsFile: false,
query: `
mutation updateAccountFeatures($userId: String!, $features: [FeatureType!]!) {
updateUserFeatures(id: $userId, features: $features)
}`,
};
export const updateAccountMutation = {
id: 'updateAccountMutation' as const,
operationName: 'updateAccount',

View File

@@ -7,14 +7,5 @@ query listUsers($filter: ListUserInput!) {
hasPassword
emailVerified
avatarUrl
quota {
humanReadable {
blobLimit
historyPeriod
memberLimit
name
storageQuota
}
}
}
}

View File

@@ -1,3 +0,0 @@
mutation removeAdmin($email: String!) {
removeAdminister(email: $email)
}

View File

@@ -8,7 +8,6 @@ query serverConfig {
name
features
type
initialized
credentialsRequirement {
...CredentialsRequirement
}

View File

@@ -0,0 +1,3 @@
mutation updateAccountFeatures($userId: String!, $features: [FeatureType!]!) {
updateUserFeatures(id: $userId, features: $features)
}

View File

@@ -200,7 +200,6 @@ export interface CreateCopilotPromptInput {
export interface CreateUserInput {
email: Scalars['String']['input'];
name: InputMaybe<Scalars['String']['input']>;
password: InputMaybe<Scalars['String']['input']>;
}
export interface CredentialsRequirementType {
@@ -245,11 +244,6 @@ export interface DocNotFoundDataType {
workspaceId: Scalars['String']['output'];
}
export enum EarlyAccessType {
AI = 'AI',
App = 'App',
}
export type ErrorDataUnion =
| BlobNotFoundDataType
| CopilotMessageNotFoundDataType
@@ -280,6 +274,8 @@ export enum ErrorNames {
AUTHENTICATION_REQUIRED = 'AUTHENTICATION_REQUIRED',
BLOB_NOT_FOUND = 'BLOB_NOT_FOUND',
BLOB_QUOTA_EXCEEDED = 'BLOB_QUOTA_EXCEEDED',
CANNOT_DELETE_ALL_ADMIN_ACCOUNT = 'CANNOT_DELETE_ALL_ADMIN_ACCOUNT',
CANNOT_DELETE_OWN_ACCOUNT = 'CANNOT_DELETE_OWN_ACCOUNT',
CANT_CHANGE_WORKSPACE_OWNER = 'CANT_CHANGE_WORKSPACE_OWNER',
CANT_UPDATE_LIFETIME_SUBSCRIPTION = 'CANT_UPDATE_LIFETIME_SUBSCRIPTION',
COPILOT_ACTION_TAKEN = 'COPILOT_ACTION_TAKEN',
@@ -455,7 +451,7 @@ export interface ListUserInput {
export interface ManageUserInput {
/** User email */
email: Scalars['String']['input'];
email: InputMaybe<Scalars['String']['input']>;
/** User name */
name: InputMaybe<Scalars['String']['input']>;
}
@@ -468,8 +464,6 @@ export interface MissingOauthQueryParameterDataType {
export interface Mutation {
__typename?: 'Mutation';
acceptInviteById: Scalars['Boolean']['output'];
addAdminister: Scalars['Boolean']['output'];
addToEarlyAccess: Scalars['Int']['output'];
addWorkspaceFeature: Scalars['Int']['output'];
cancelSubscription: UserSubscription;
changeEmail: UserType;
@@ -503,10 +497,8 @@ export interface Mutation {
leaveWorkspace: Scalars['Boolean']['output'];
publishPage: WorkspacePage;
recoverDoc: Scalars['DateTime']['output'];
removeAdminister: Scalars['Boolean']['output'];
/** Remove user avatar */
removeAvatar: RemoveAvatar;
removeEarlyAccess: Scalars['Int']['output'];
removeWorkspaceFeature: Scalars['Int']['output'];
resumeSubscription: UserSubscription;
revoke: Scalars['Boolean']['output'];
@@ -532,6 +524,8 @@ export interface Mutation {
updateSubscriptionRecurring: UserSubscription;
/** Update a user */
updateUser: UserType;
/** update user enabled feature */
updateUserFeatures: Array<FeatureType>;
/** Update workspace */
updateWorkspace: WorkspaceType;
/** Upload user avatar */
@@ -545,15 +539,6 @@ export interface MutationAcceptInviteByIdArgs {
workspaceId: Scalars['String']['input'];
}
export interface MutationAddAdministerArgs {
email: Scalars['String']['input'];
}
export interface MutationAddToEarlyAccessArgs {
email: Scalars['String']['input'];
type: EarlyAccessType;
}
export interface MutationAddWorkspaceFeatureArgs {
feature: FeatureType;
workspaceId: Scalars['String']['input'];
@@ -649,15 +634,6 @@ export interface MutationRecoverDocArgs {
workspaceId: Scalars['String']['input'];
}
export interface MutationRemoveAdministerArgs {
email: Scalars['String']['input'];
}
export interface MutationRemoveEarlyAccessArgs {
email: Scalars['String']['input'];
type: EarlyAccessType;
}
export interface MutationRemoveWorkspaceFeatureArgs {
feature: FeatureType;
workspaceId: Scalars['String']['input'];
@@ -753,6 +729,11 @@ export interface MutationUpdateUserArgs {
input: ManageUserInput;
}
export interface MutationUpdateUserFeaturesArgs {
features: Array<FeatureType>;
id: Scalars['String']['input'];
}
export interface MutationUpdateWorkspaceArgs {
input: UpdateWorkspaceInput;
}
@@ -804,7 +785,6 @@ export interface Query {
collectAllBlobSizes: WorkspaceBlobSizes;
/** Get current user */
currentUser: Maybe<UserType>;
earlyAccessUsers: Array<UserType>;
error: ErrorDataUnion;
/** send workspace invitation */
getInviteInfo: InvitationType;
@@ -932,6 +912,8 @@ export interface SameSubscriptionRecurringDataType {
export interface ServerConfigType {
__typename?: 'ServerConfigType';
/** Features for user that can be configured */
availableUserFeatures: Array<FeatureType>;
/** server base url */
baseUrl: Scalars['String']['output'];
/** credentials requirement */
@@ -1254,13 +1236,28 @@ export interface TokenType {
token: Scalars['String']['output'];
}
export type AddToAdminMutationVariables = Exact<{
email: Scalars['String']['input'];
}>;
export type AdminServerConfigQueryVariables = Exact<{ [key: string]: never }>;
export type AddToAdminMutation = {
__typename?: 'Mutation';
addAdminister: boolean;
export type AdminServerConfigQuery = {
__typename?: 'Query';
serverConfig: {
__typename?: 'ServerConfigType';
version: string;
baseUrl: string;
name: string;
features: Array<ServerFeature>;
type: ServerDeploymentType;
initialized: boolean;
availableUserFeatures: Array<FeatureType>;
credentialsRequirement: {
__typename?: 'CredentialsRequirementType';
password: {
__typename?: 'PasswordLimitsType';
minLength: number;
maxLength: number;
};
};
};
};
export type DeleteBlobMutationVariables = Exact<{
@@ -1440,48 +1437,6 @@ export type DeleteWorkspaceMutation = {
deleteWorkspace: boolean;
};
export type AddToEarlyAccessMutationVariables = Exact<{
email: Scalars['String']['input'];
type: EarlyAccessType;
}>;
export type AddToEarlyAccessMutation = {
__typename?: 'Mutation';
addToEarlyAccess: number;
};
export type EarlyAccessUsersQueryVariables = Exact<{ [key: string]: never }>;
export type EarlyAccessUsersQuery = {
__typename?: 'Query';
earlyAccessUsers: Array<{
__typename?: 'UserType';
id: string;
name: string;
email: string;
avatarUrl: string | null;
emailVerified: boolean;
subscription: {
__typename?: 'UserSubscription';
plan: SubscriptionPlan;
recurring: SubscriptionRecurring;
status: SubscriptionStatus;
start: string;
end: string | null;
} | null;
}>;
};
export type RemoveEarlyAccessMutationVariables = Exact<{
email: Scalars['String']['input'];
type: EarlyAccessType;
}>;
export type RemoveEarlyAccessMutation = {
__typename?: 'Mutation';
removeEarlyAccess: number;
};
export type ForkCopilotSessionMutationVariables = Exact<{
options: ForkChatSessionInput;
}>;
@@ -1956,17 +1911,6 @@ export type ListUsersQuery = {
hasPassword: boolean | null;
emailVerified: boolean;
avatarUrl: string | null;
quota: {
__typename?: 'UserQuota';
humanReadable: {
__typename?: 'UserQuotaHumanReadable';
blobLimit: string;
historyPeriod: string;
memberLimit: string;
name: string;
storageQuota: string;
};
} | null;
}>;
};
@@ -2038,15 +1982,6 @@ export type RecoverDocMutation = {
recoverDoc: string;
};
export type RemoveAdminMutationVariables = Exact<{
email: Scalars['String']['input'];
}>;
export type RemoveAdminMutation = {
__typename?: 'Mutation';
removeAdminister: boolean;
};
export type RemoveAvatarMutationVariables = Exact<{ [key: string]: never }>;
export type RemoveAvatarMutation = {
@@ -2154,7 +2089,6 @@ export type ServerConfigQuery = {
name: string;
features: Array<ServerFeature>;
type: ServerDeploymentType;
initialized: boolean;
credentialsRequirement: {
__typename?: 'CredentialsRequirementType';
password: {
@@ -2197,6 +2131,16 @@ export type SubscriptionQuery = {
} | null;
};
export type UpdateAccountFeaturesMutationVariables = Exact<{
userId: Scalars['String']['input'];
features: Array<FeatureType> | FeatureType;
}>;
export type UpdateAccountFeaturesMutation = {
__typename?: 'Mutation';
updateUserFeatures: Array<FeatureType>;
};
export type UpdateAccountMutationVariables = Exact<{
id: Scalars['String']['input'];
input: ManageUserInput;
@@ -2422,6 +2366,11 @@ export type WorkspaceQuotaQuery = {
};
export type Queries =
| {
name: 'adminServerConfigQuery';
variables: AdminServerConfigQueryVariables;
response: AdminServerConfigQuery;
}
| {
name: 'listBlobsQuery';
variables: ListBlobsQueryVariables;
@@ -2432,11 +2381,6 @@ export type Queries =
variables: CopilotQuotaQueryVariables;
response: CopilotQuotaQuery;
}
| {
name: 'earlyAccessUsersQuery';
variables: EarlyAccessUsersQueryVariables;
response: EarlyAccessUsersQuery;
}
| {
name: 'getCopilotHistoriesQuery';
variables: GetCopilotHistoriesQueryVariables;
@@ -2614,11 +2558,6 @@ export type Queries =
};
export type Mutations =
| {
name: 'addToAdminMutation';
variables: AddToAdminMutationVariables;
response: AddToAdminMutation;
}
| {
name: 'deleteBlobMutation';
variables: DeleteBlobMutationVariables;
@@ -2699,16 +2638,6 @@ export type Mutations =
variables: DeleteWorkspaceMutationVariables;
response: DeleteWorkspaceMutation;
}
| {
name: 'addToEarlyAccessMutation';
variables: AddToEarlyAccessMutationVariables;
response: AddToEarlyAccessMutation;
}
| {
name: 'removeEarlyAccessMutation';
variables: RemoveEarlyAccessMutationVariables;
response: RemoveEarlyAccessMutation;
}
| {
name: 'forkCopilotSessionMutation';
variables: ForkCopilotSessionMutationVariables;
@@ -2729,11 +2658,6 @@ export type Mutations =
variables: RecoverDocMutationVariables;
response: RecoverDocMutation;
}
| {
name: 'removeAdminMutation';
variables: RemoveAdminMutationVariables;
response: RemoveAdminMutation;
}
| {
name: 'removeAvatarMutation';
variables: RemoveAvatarMutationVariables;
@@ -2784,6 +2708,11 @@ export type Mutations =
variables: SetWorkspacePublicByIdMutationVariables;
response: SetWorkspacePublicByIdMutation;
}
| {
name: 'updateAccountFeaturesMutation';
variables: UpdateAccountFeaturesMutationVariables;
response: UpdateAccountFeaturesMutation;
}
| {
name: 'updateAccountMutation';
variables: UpdateAccountMutationVariables;