mirror of
https://github.com/langgenius/dify.git
synced 2026-01-08 07:14:14 +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,
|
...schema,
|
||||||
type: normalizeFormType(schema.type as string),
|
type: normalizeFormType(schema.type as string),
|
||||||
tooltip: schema.description,
|
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])
|
], [t, subscription.name, subscription.endpoint, subscription.properties, propertiesSchema])
|
||||||
|
|
||||||
|
|||||||
@@ -237,32 +237,15 @@ type TriggerSubscriptionStructure = {
|
|||||||
name: string
|
name: string
|
||||||
provider: string
|
provider: string
|
||||||
credential_type: TriggerCredentialTypeEnum
|
credential_type: TriggerCredentialTypeEnum
|
||||||
credentials: TriggerSubCredentials
|
credentials: Record<string, any>
|
||||||
endpoint: string
|
endpoint: string
|
||||||
parameters: TriggerSubParameters
|
parameters: Record<string, any>
|
||||||
properties: TriggerSubProperties
|
properties: Record<string, any>
|
||||||
workflows_in_use: number
|
workflows_in_use: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TriggerSubscription = TriggerSubscriptionStructure
|
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
|
export type TriggerSubscriptionBuilder = TriggerSubscriptionStructure
|
||||||
|
|
||||||
// OAuth configuration types
|
// OAuth configuration types
|
||||||
|
|||||||
Reference in New Issue
Block a user