chore(admin): remove useless config diff (#12545)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Added a GraphQL mutation to validate multiple app configuration updates, returning detailed validation results for each item.
  - Extended the API schema to support validation feedback, enabling client-side checks before applying changes.
  - Introduced a detailed, parameterized error message system for configuration validation errors.
  - Enabled validation of configuration inputs via the admin UI with clear, descriptive error messages.

- **Improvements**
  - Enhanced error reporting with specific, context-rich messages for invalid app configurations.
  - Simplified admin settings UI by removing the confirmation dialog and streamlining save actions.
  - Improved clarity and maintainability of validation logic and error handling components.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
forehalo
2025-05-27 06:07:26 +00:00
parent eed95366c9
commit 2f139bd02c
19 changed files with 291 additions and 185 deletions

View File

@@ -109,6 +109,15 @@ export interface AlreadyInSpaceDataType {
spaceId: Scalars['String']['output'];
}
export interface AppConfigValidateResult {
__typename?: 'AppConfigValidateResult';
error: Maybe<Scalars['String']['output']>;
key: Scalars['String']['output'];
module: Scalars['String']['output'];
valid: Scalars['Boolean']['output'];
value: Scalars['JSON']['output'];
}
export interface BlobNotFoundDataType {
__typename?: 'BlobNotFoundDataType';
blobId: Scalars['String']['output'];
@@ -665,6 +674,8 @@ export type ErrorDataUnion =
| ExpectToUpdateDocUserRoleDataType
| GraphqlBadRequestDataType
| HttpRequestErrorDataType
| InvalidAppConfigDataType
| InvalidAppConfigInputDataType
| InvalidEmailDataType
| InvalidHistoryTimestampDataType
| InvalidIndexerInputDataType
@@ -762,6 +773,7 @@ export enum ErrorNames {
HTTP_REQUEST_ERROR = 'HTTP_REQUEST_ERROR',
INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR',
INVALID_APP_CONFIG = 'INVALID_APP_CONFIG',
INVALID_APP_CONFIG_INPUT = 'INVALID_APP_CONFIG_INPUT',
INVALID_AUTH_STATE = 'INVALID_AUTH_STATE',
INVALID_CHECKOUT_PARAMETERS = 'INVALID_CHECKOUT_PARAMETERS',
INVALID_EMAIL = 'INVALID_EMAIL',
@@ -906,6 +918,18 @@ export interface ImportUsersInput {
users: Array<CreateUserInput>;
}
export interface InvalidAppConfigDataType {
__typename?: 'InvalidAppConfigDataType';
hint: Scalars['String']['output'];
key: Scalars['String']['output'];
module: Scalars['String']['output'];
}
export interface InvalidAppConfigInputDataType {
__typename?: 'InvalidAppConfigInputDataType';
message: Scalars['String']['output'];
}
export interface InvalidEmailDataType {
__typename?: 'InvalidEmailDataType';
email: Scalars['String']['output'];
@@ -1334,6 +1358,8 @@ export interface Mutation {
updateWorkspaceEmbeddingIgnoredDocs: Scalars['Int']['output'];
/** Upload user avatar */
uploadAvatar: UserType;
/** validate app configuration */
validateAppConfig: Array<AppConfigValidateResult>;
verifyEmail: Scalars['Boolean']['output'];
}
@@ -1712,6 +1738,10 @@ export interface MutationUploadAvatarArgs {
avatar: Scalars['Upload']['input'];
}
export interface MutationValidateAppConfigArgs {
updates: Array<UpdateAppConfigInput>;
}
export interface MutationVerifyEmailArgs {
token: Scalars['String']['input'];
}
@@ -2900,6 +2930,22 @@ export type UpdateAppConfigMutation = {
updateAppConfig: any;
};
export type ValidateConfigMutationVariables = Exact<{
updates: Array<UpdateAppConfigInput> | UpdateAppConfigInput;
}>;
export type ValidateConfigMutation = {
__typename?: 'Mutation';
validateAppConfig: Array<{
__typename?: 'AppConfigValidateResult';
module: string;
key: string;
value: Record<string, string>;
valid: boolean;
error: string | null;
}>;
};
export type DeleteBlobMutationVariables = Exact<{
workspaceId: Scalars['String']['input'];
key: Scalars['String']['input'];
@@ -5312,6 +5358,11 @@ export type Mutations =
variables: UpdateAppConfigMutationVariables;
response: UpdateAppConfigMutation;
}
| {
name: 'validateConfigMutation';
variables: ValidateConfigMutationVariables;
response: ValidateConfigMutation;
}
| {
name: 'deleteBlobMutation';
variables: DeleteBlobMutationVariables;