mirror of
https://github.com/langgenius/dify.git
synced 2026-01-06 06:26:00 +00:00
refactor: simplify default value assignment in EditModal and update TriggerSubscription types
- Updated the default value assignment in the EditModal component to use a more concise syntax. - Changed TriggerSubscription structure to use generic Record types for credentials, parameters, and properties, enhancing flexibility.
This commit is contained in:
@@ -122,7 +122,7 @@ export const EditModal = ({ onClose, subscription, pluginDetail }: Props) => {
|
||||
...schema,
|
||||
type: normalizeFormType(schema.type as string),
|
||||
tooltip: schema.description,
|
||||
default: (subscription.properties as Record<string, any>)?.[schema.name] ?? schema.default,
|
||||
default: subscription.properties?.[schema.name] || schema.default,
|
||||
})),
|
||||
], [t, subscription.name, subscription.endpoint, subscription.properties, propertiesSchema])
|
||||
|
||||
|
||||
@@ -237,32 +237,15 @@ type TriggerSubscriptionStructure = {
|
||||
name: string
|
||||
provider: string
|
||||
credential_type: TriggerCredentialTypeEnum
|
||||
credentials: TriggerSubCredentials
|
||||
credentials: Record<string, any>
|
||||
endpoint: string
|
||||
parameters: TriggerSubParameters
|
||||
properties: TriggerSubProperties
|
||||
parameters: Record<string, any>
|
||||
properties: Record<string, any>
|
||||
workflows_in_use: number
|
||||
}
|
||||
|
||||
export type TriggerSubscription = TriggerSubscriptionStructure
|
||||
|
||||
export type TriggerSubCredentials = {
|
||||
access_tokens: string
|
||||
}
|
||||
|
||||
export type TriggerSubParameters = {
|
||||
repository: string
|
||||
webhook_secret?: string
|
||||
}
|
||||
|
||||
export type TriggerSubProperties = {
|
||||
active: boolean
|
||||
events: string[]
|
||||
external_id: string
|
||||
repository: string
|
||||
webhook_secret?: string
|
||||
}
|
||||
|
||||
export type TriggerSubscriptionBuilder = TriggerSubscriptionStructure
|
||||
|
||||
// OAuth configuration types
|
||||
|
||||
Reference in New Issue
Block a user