diff --git a/apps/vben5/apps/app-antd/src/locales/langs/en-US/abp.json b/apps/vben5/apps/app-antd/src/locales/langs/en-US/abp.json index 80be45b1f..6de53754e 100644 --- a/apps/vben5/apps/app-antd/src/locales/langs/en-US/abp.json +++ b/apps/vben5/apps/app-antd/src/locales/langs/en-US/abp.json @@ -117,6 +117,7 @@ "webhooks": { "title": "Webhooks", "groups": "Groups", - "definitions": "Definitions" + "definitions": "Definitions", + "subscriptions": "Subscriptions" } } diff --git a/apps/vben5/apps/app-antd/src/locales/langs/zh-CN/abp.json b/apps/vben5/apps/app-antd/src/locales/langs/zh-CN/abp.json index 4d3eff156..08ff8f8e5 100644 --- a/apps/vben5/apps/app-antd/src/locales/langs/zh-CN/abp.json +++ b/apps/vben5/apps/app-antd/src/locales/langs/zh-CN/abp.json @@ -117,6 +117,7 @@ "webhooks": { "title": "Webhook管理", "groups": "Webhook分组", - "definitions": "Webhook定义" + "definitions": "Webhook定义", + "subscriptions": "管理订阅" } } diff --git a/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts b/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts index 709a89c04..2ec6407a1 100644 --- a/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts +++ b/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts @@ -476,6 +476,15 @@ const routes: RouteRecordRaw[] = [ path: '/webhooks/definitions', component: () => import('#/views/webhooks/definitions/index.vue'), }, + { + meta: { + title: $t('abp.webhooks.subscriptions'), + icon: 'material-symbols:subscriptions', + }, + name: 'WebhookSubscriptions', + path: '/webhooks/subscriptions', + component: () => import('#/views/webhooks/subscriptions/index.vue'), + }, ], }, { diff --git a/apps/vben5/apps/app-antd/src/views/webhooks/subscriptions/index.vue b/apps/vben5/apps/app-antd/src/views/webhooks/subscriptions/index.vue new file mode 100644 index 000000000..a05d1bf98 --- /dev/null +++ b/apps/vben5/apps/app-antd/src/views/webhooks/subscriptions/index.vue @@ -0,0 +1,15 @@ + + + + + + + diff --git a/apps/vben5/packages/@abp/webhooks/package.json b/apps/vben5/packages/@abp/webhooks/package.json index 54f439f47..f62762874 100644 --- a/apps/vben5/packages/@abp/webhooks/package.json +++ b/apps/vben5/packages/@abp/webhooks/package.json @@ -20,9 +20,11 @@ } }, "dependencies": { + "@abp/components": "workspace:*", "@abp/core": "workspace:*", "@abp/features": "workspace:*", "@abp/request": "workspace:*", + "@abp/saas": "workspace:*", "@abp/ui": "workspace:*", "@ant-design/icons-vue": "catalog:", "@vben/access": "workspace:*", @@ -33,10 +35,12 @@ "@vben/locales": "workspace:*", "ant-design-vue": "catalog:", "lodash.clonedeep": "catalog:", + "lodash.debounce": "catalog:", "vue": "catalog:*", "vxe-table": "catalog:" }, "devDependencies": { - "@types/lodash.clonedeep": "catalog:" + "@types/lodash.clonedeep": "catalog:", + "@types/lodash.debounce": "catalog:" } } diff --git a/apps/vben5/packages/@abp/webhooks/src/api/index.ts b/apps/vben5/packages/@abp/webhooks/src/api/index.ts index 12a6e651a..0a30bdd2a 100644 --- a/apps/vben5/packages/@abp/webhooks/src/api/index.ts +++ b/apps/vben5/packages/@abp/webhooks/src/api/index.ts @@ -1,2 +1,3 @@ +export * from './useSubscriptionsApi'; export * from './useWebhookDefinitionsApi'; export * from './useWebhookGroupDefinitionsApi'; diff --git a/apps/vben5/packages/@abp/webhooks/src/api/useSubscriptionsApi.ts b/apps/vben5/packages/@abp/webhooks/src/api/useSubscriptionsApi.ts new file mode 100644 index 000000000..50c8914e8 --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/api/useSubscriptionsApi.ts @@ -0,0 +1,123 @@ +import type { ListResultDto, PagedResultDto } from '@abp/core'; + +import type { + WebhookAvailableGroupDto, + WebhookSubscriptionCreateDto, + WebhookSubscriptionDeleteManyInput, + WebhookSubscriptionDto, + WebhookSubscriptionGetListInput, + WebhookSubscriptionUpdateDto, +} from '../types/subscriptions'; + +import { useRequest } from '@abp/request'; + +export function useSubscriptionsApi() { + const { cancel, request } = useRequest(); + + /** + * 创建订阅 + * @param input 参数 + * @returns 订阅Dto + */ + function createApi( + input: WebhookSubscriptionCreateDto, + ): Promise { + return request(`/api/webhooks/subscriptions`, { + data: input, + method: 'POST', + }); + } + /** + * 删除订阅 + * @param id 订阅Id + */ + function deleteApi(id: string): Promise { + return request(`/api/webhooks/subscriptions/${id}`, { + method: 'DELETE', + }); + } + /** + * 批量删除订阅 + * @param input 参数 + */ + function bulkDeleteApi( + input: WebhookSubscriptionDeleteManyInput, + ): Promise { + return request(`/api/webhooks/subscriptions/delete-many`, { + data: input, + method: 'DELETE', + }); + } + /** + * 查询所有可用的Webhook分组列表 + * @returns Webhook分组列表 + */ + function getAllAvailableWebhooksApi(): Promise< + ListResultDto + > { + return request>( + `/api/webhooks/subscriptions/availables`, + { + method: 'GET', + }, + ); + } + /** + * 查询订阅 + * @param id 订阅Id + * @returns 订阅Dto + */ + function getApi(id: string): Promise { + return request( + `/api/webhooks/subscriptions/${id}`, + { + method: 'GET', + }, + ); + } + /** + * 查询订阅分页列表 + * @param input 过滤参数 + * @returns 订阅Dto列表 + */ + function getPagedListApi( + input: WebhookSubscriptionGetListInput, + ): Promise> { + return request>( + `/api/webhooks/subscriptions`, + { + method: 'GET', + params: input, + }, + ); + } + /** + * 更新订阅 + * @param id 订阅Id + * @param input 更新参数 + * @returns 订阅Dto + */ + function updateApi( + id: string, + input: WebhookSubscriptionUpdateDto, + ): Promise { + return request( + `/api/webhooks/subscriptions/${id}`, + { + data: input, + method: 'PUT', + }, + ); + } + + return { + bulkDeleteApi, + cancel, + createApi, + deleteApi, + getAllAvailableWebhooksApi, + getApi, + getPagedListApi, + updateApi, + }; +} diff --git a/apps/vben5/packages/@abp/webhooks/src/components/index.ts b/apps/vben5/packages/@abp/webhooks/src/components/index.ts index 14b4c03ac..41763338c 100644 --- a/apps/vben5/packages/@abp/webhooks/src/components/index.ts +++ b/apps/vben5/packages/@abp/webhooks/src/components/index.ts @@ -1,2 +1,3 @@ export { default as WebhookGroupDefinitionTable } from './definitions/groups/WebhookGroupDefinitionTable.vue'; export { default as WebhookDefinitionTable } from './definitions/webhooks/WebhookDefinitionTable.vue'; +export { default as WebhookSubscriptionTable } from './subscriptions/WebhookSubscriptionTable.vue'; diff --git a/apps/vben5/packages/@abp/webhooks/src/components/subscriptions/WebhookSubscriptionModal.vue b/apps/vben5/packages/@abp/webhooks/src/components/subscriptions/WebhookSubscriptionModal.vue new file mode 100644 index 000000000..8fa68daa4 --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/components/subscriptions/WebhookSubscriptionModal.vue @@ -0,0 +1,309 @@ + + + + + + + + + + {{ $t('WebhooksManagement.DisplayName:IsActive') }} + + + + + + + + + + + + {{ option.description }} + + {{ option.displayName }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/vben5/packages/@abp/webhooks/src/components/subscriptions/WebhookSubscriptionTable.vue b/apps/vben5/packages/@abp/webhooks/src/components/subscriptions/WebhookSubscriptionTable.vue new file mode 100644 index 000000000..46e1f9474 --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/components/subscriptions/WebhookSubscriptionTable.vue @@ -0,0 +1,317 @@ + + + + + + + {{ $t('WebhooksManagement.Subscriptions:AddNew') }} + + + + + + + + + + + + {{ webhook }} + + + + + + + {{ $t('AbpUi.Edit') }} + + + {{ $t('AbpUi.Delete') }} + + + + + gridApi.query()" /> + + + diff --git a/apps/vben5/packages/@abp/webhooks/src/constants/permissions.ts b/apps/vben5/packages/@abp/webhooks/src/constants/permissions.ts index 73156c1b8..f64defbbc 100644 --- a/apps/vben5/packages/@abp/webhooks/src/constants/permissions.ts +++ b/apps/vben5/packages/@abp/webhooks/src/constants/permissions.ts @@ -19,3 +19,14 @@ export const WebhookDefinitionsPermissions = { /** 更新 */ Update: 'AbpWebhooks.Definitions.Update', }; + +/** Webhook订阅权限 */ +export const WebhookSubscriptionPermissions = { + /** 新增 */ + Create: 'AbpWebhooks.Subscriptions.Create', + Default: 'AbpWebhooks.Subscriptions', + /** 删除 */ + Delete: 'AbpWebhooks.Subscriptions.Delete', + /** 更新 */ + Update: 'AbpWebhooks.Subscriptions.Update', +}; diff --git a/apps/vben5/packages/@abp/webhooks/src/types/index.ts b/apps/vben5/packages/@abp/webhooks/src/types/index.ts index 6a41718f6..2815a630b 100644 --- a/apps/vben5/packages/@abp/webhooks/src/types/index.ts +++ b/apps/vben5/packages/@abp/webhooks/src/types/index.ts @@ -1,2 +1,3 @@ export * from './definitions'; export * from './groups'; +export * from './subscriptions'; diff --git a/apps/vben5/packages/@abp/webhooks/src/types/subscriptions.ts b/apps/vben5/packages/@abp/webhooks/src/types/subscriptions.ts new file mode 100644 index 000000000..e88459dfb --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/types/subscriptions.ts @@ -0,0 +1,73 @@ +import type { + CreationAuditedEntityDto, + IHasConcurrencyStamp, + PagedAndSortedResultRequestDto, +} from '@abp/core'; + +interface WebhookSubscriptionDto + extends CreationAuditedEntityDto, + IHasConcurrencyStamp { + description?: string; + headers?: Record; + isActive: boolean; + secret?: string; + tenantId?: string; + timeoutDuration?: number; + webhooks: string[]; + webhookUri: string; +} + +interface WebhookSubscriptionCreateOrUpdateDto { + description?: string; + headers?: Record; + isActive: boolean; + secret?: string; + tenantId?: string; + timeoutDuration?: number; + webhooks: string[]; + webhookUri: string; +} + +type WebhookSubscriptionCreateDto = WebhookSubscriptionCreateOrUpdateDto; + +interface WebhookSubscriptionUpdateDto + extends IHasConcurrencyStamp, + WebhookSubscriptionCreateOrUpdateDto {} + +interface WebhookSubscriptionDeleteManyInput { + recordIds: string[]; +} + +interface WebhookSubscriptionGetListInput + extends PagedAndSortedResultRequestDto { + beginCreationTime?: Date; + endCreationTime?: Date; + filter?: string; + isActive?: boolean; + secret?: string; + tenantId?: string; + webhooks?: string; + webhookUri?: string; +} + +interface WebhookAvailableDto { + description?: string; + displayName: string; + name: string; +} + +interface WebhookAvailableGroupDto { + displayName: string; + name: string; + webhooks: WebhookAvailableDto[]; +} + +export type { + WebhookAvailableDto, + WebhookAvailableGroupDto, + WebhookSubscriptionCreateDto, + WebhookSubscriptionDeleteManyInput, + WebhookSubscriptionDto, + WebhookSubscriptionGetListInput, + WebhookSubscriptionUpdateDto, +};