diff --git a/apps/vben5/apps/app-antd/package.json b/apps/vben5/apps/app-antd/package.json index 4b1e3c565..74ec14a0d 100644 --- a/apps/vben5/apps/app-antd/package.json +++ b/apps/vben5/apps/app-antd/package.json @@ -43,6 +43,7 @@ "@abp/settings": "workspace:*", "@abp/tasks": "workspace:*", "@abp/ui": "workspace:*", + "@abp/webhooks": "workspace:*", "@vben/access": "workspace:*", "@vben/common-ui": "workspace:*", "@vben/constants": "workspace:*", 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 0ba5e1273..2bda6ce06 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 @@ -113,5 +113,12 @@ "jobInfo": { "title": "Job Manage" } + }, + "webhooks": { + "title": "Webhooks", + "groups": "Groups", + "definitions": "Definitions", + "subscriptions": "Subscriptions", + "sendAttempts": "Send Attempts" } } 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 d6eaf0e02..5efb8914d 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 @@ -113,5 +113,12 @@ "jobInfo": { "title": "作业管理" } + }, + "webhooks": { + "title": "Webhook管理", + "groups": "Webhook分组", + "definitions": "Webhook定义", + "subscriptions": "管理订阅", + "sendAttempts": "发送记录" } } 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 1b4e0f24d..11889b8f0 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 @@ -450,6 +450,52 @@ const routes: RouteRecordRaw[] = [ }, ], }, + { + meta: { + title: $t('abp.webhooks.title'), + icon: 'material-symbols:webhook', + }, + name: 'WebhooksManagement', + path: '/webhooks', + children: [ + { + meta: { + title: $t('abp.webhooks.groups'), + icon: 'lucide:group', + }, + name: 'WebhookGroupDefinitions', + path: '/webhooks/groups', + component: () => import('#/views/webhooks/groups/index.vue'), + }, + { + meta: { + title: $t('abp.webhooks.definitions'), + icon: 'material-symbols:webhook', + }, + name: 'WebhookDefinitions', + 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'), + }, + { + meta: { + title: $t('abp.webhooks.sendAttempts'), + icon: 'material-symbols:history', + }, + name: 'WebhookSendAttempts', + path: '/webhooks/send-attempts', + component: () => import('#/views/webhooks/send-attempts/index.vue'), + }, + ], + }, { name: 'AbpDemo', path: '/abp/demos', diff --git a/apps/vben5/apps/app-antd/src/views/webhooks/definitions/index.vue b/apps/vben5/apps/app-antd/src/views/webhooks/definitions/index.vue new file mode 100644 index 000000000..c8a497b4b --- /dev/null +++ b/apps/vben5/apps/app-antd/src/views/webhooks/definitions/index.vue @@ -0,0 +1,15 @@ + + + + + + + diff --git a/apps/vben5/apps/app-antd/src/views/webhooks/groups/index.vue b/apps/vben5/apps/app-antd/src/views/webhooks/groups/index.vue new file mode 100644 index 000000000..660110dc7 --- /dev/null +++ b/apps/vben5/apps/app-antd/src/views/webhooks/groups/index.vue @@ -0,0 +1,15 @@ + + + + + + + diff --git a/apps/vben5/apps/app-antd/src/views/webhooks/send-attempts/index.vue b/apps/vben5/apps/app-antd/src/views/webhooks/send-attempts/index.vue new file mode 100644 index 000000000..c4ba9230d --- /dev/null +++ b/apps/vben5/apps/app-antd/src/views/webhooks/send-attempts/index.vue @@ -0,0 +1,15 @@ + + + + + + + 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/request/src/constants/httpStatus.ts b/apps/vben5/packages/@abp/request/src/constants/httpStatus.ts new file mode 100644 index 000000000..4256fe315 --- /dev/null +++ b/apps/vben5/packages/@abp/request/src/constants/httpStatus.ts @@ -0,0 +1,44 @@ +export enum HttpStatusCode { + Accepted = 202, + Ambiguous = 300, + BadGateway = 502, + BadRequest = 400, + Conflict = 409, + Continue = 100, + Created = 201, + ExpectationFailed = 417, + Forbidden = 403, + GatewayTimeout = 504, + Gone = 410, + HttpVersionNotSupported = 505, + InternalServerError = 500, + LengthRequired = 411, + MethodNotAllowed = 405, + Moved = 301, + NoContent = 204, + NonAuthoritativeInformation = 203, + NotAcceptable = 406, + NotFound = 404, + NotImplemented = 501, + NotModified = 304, + OK = 200, + PartialContent = 206, + PaymentRequired = 402, + PreconditionFailed = 412, + ProxyAuthenticationRequired = 407, + Redirect = 302, + RedirectKeepVerb = 307, + RedirectMethod = 303, + RequestedRangeNotSatisfiable = 416, + RequestEntityTooLarge = 413, + RequestTimeout = 408, + RequestUriTooLong = 414, + ResetContent = 205, + ServiceUnavailable = 503, + SwitchingProtocols = 101, + Unauthorized = 401, + UnsupportedMediaType = 415, + Unused = 306, + UpgradeRequired = 426, + UseProxy = 305, +} diff --git a/apps/vben5/packages/@abp/request/src/constants/index.ts b/apps/vben5/packages/@abp/request/src/constants/index.ts new file mode 100644 index 000000000..6b6cc383f --- /dev/null +++ b/apps/vben5/packages/@abp/request/src/constants/index.ts @@ -0,0 +1 @@ +export * from './httpStatus'; diff --git a/apps/vben5/packages/@abp/request/src/hooks/index.ts b/apps/vben5/packages/@abp/request/src/hooks/index.ts index 0c4767a5f..229c41551 100644 --- a/apps/vben5/packages/@abp/request/src/hooks/index.ts +++ b/apps/vben5/packages/@abp/request/src/hooks/index.ts @@ -1,3 +1,4 @@ export * from './useErrorFormat'; +export * from './useHttpStatusCodeMap'; export * from './useRequest'; export * from './useWrapperResult'; diff --git a/apps/vben5/packages/@abp/request/src/hooks/useHttpStatusCodeMap.ts b/apps/vben5/packages/@abp/request/src/hooks/useHttpStatusCodeMap.ts new file mode 100644 index 000000000..ac442b7d1 --- /dev/null +++ b/apps/vben5/packages/@abp/request/src/hooks/useHttpStatusCodeMap.ts @@ -0,0 +1,76 @@ +import { HttpStatusCode } from '../constants/httpStatus'; + +export function useHttpStatusCodeMap() { + const httpStatusCodeMap: { [key: number]: string } = { + [HttpStatusCode.Accepted]: '202 - Accepted', + [HttpStatusCode.Ambiguous]: '300 - Ambiguous/Multiple Choices', + [HttpStatusCode.BadGateway]: '502 - Bad Gateway', + [HttpStatusCode.BadRequest]: '400 - Bad Request', + [HttpStatusCode.Conflict]: '409 - Conflict', + [HttpStatusCode.Continue]: '100 - Continue', + [HttpStatusCode.Created]: '201 - Created', + [HttpStatusCode.ExpectationFailed]: '417 - Expectation Failed', + [HttpStatusCode.Forbidden]: '403 - Forbidden', + [HttpStatusCode.GatewayTimeout]: '504 - Gateway Timeout', + [HttpStatusCode.Gone]: '410 - Gone', + [HttpStatusCode.HttpVersionNotSupported]: + '505 - Http Version Not Supported', + [HttpStatusCode.InternalServerError]: '500 - Internal Server Error', + [HttpStatusCode.LengthRequired]: '411 - Length Required', + [HttpStatusCode.MethodNotAllowed]: '405 - Method Not Allowed', + [HttpStatusCode.Moved]: '301 - Moved/Moved Permanently', + [HttpStatusCode.NoContent]: '204 - No Content', + [HttpStatusCode.NonAuthoritativeInformation]: + '203 - Non Authoritative Information', + [HttpStatusCode.NotAcceptable]: '406 - Not Acceptable', + [HttpStatusCode.NotFound]: '404 - Not Found', + [HttpStatusCode.NotImplemented]: '501 - Not Implemented', + [HttpStatusCode.NotModified]: '304 - Not Modified', + [HttpStatusCode.OK]: '200 - OK', + [HttpStatusCode.PartialContent]: '206 - Partial Content', + [HttpStatusCode.PaymentRequired]: '402 - Payment Required', + [HttpStatusCode.PreconditionFailed]: '412 - Precondition Failed', + [HttpStatusCode.ProxyAuthenticationRequired]: + '407 - Proxy Authentication Required', + [HttpStatusCode.Redirect]: '302 - Found/Redirect', + [HttpStatusCode.RedirectKeepVerb]: + '307 - Redirect Keep Verb/Temporary Redirect', + [HttpStatusCode.RedirectMethod]: '303 - Redirect Method/See Other', + [HttpStatusCode.RequestedRangeNotSatisfiable]: + '416 - Requested Range Not Satisfiable', + [HttpStatusCode.RequestEntityTooLarge]: '413 - Request Entity Too Large', + [HttpStatusCode.RequestTimeout]: '408 - Request Timeout', + [HttpStatusCode.RequestUriTooLong]: '414 - Request Uri Too Long', + [HttpStatusCode.ResetContent]: '205 - Reset Content', + [HttpStatusCode.ServiceUnavailable]: '503 - Service Unavailable', + [HttpStatusCode.SwitchingProtocols]: '101 - Switching Protocols', + [HttpStatusCode.Unauthorized]: '401 - Unauthorized', + [HttpStatusCode.UnsupportedMediaType]: '415 - Unsupported Media Type', + [HttpStatusCode.Unused]: '306 - Unused', + [HttpStatusCode.UpgradeRequired]: '426 - Upgrade Required', + [HttpStatusCode.UseProxy]: '305 - Use Proxy', + }; + + function getHttpStatusColor(statusCode: HttpStatusCode) { + if (statusCode < 200) { + return 'default'; + } + if (statusCode >= 200 && statusCode < 300) { + return 'success'; + } + if (statusCode >= 300 && statusCode < 400) { + return 'processing'; + } + if (statusCode >= 400 && statusCode < 500) { + return 'warning'; + } + if (statusCode >= 500) { + return 'error'; + } + } + + return { + getHttpStatusColor, + httpStatusCodeMap, + }; +} diff --git a/apps/vben5/packages/@abp/request/src/index.ts b/apps/vben5/packages/@abp/request/src/index.ts index 5c13205f7..af59094a0 100644 --- a/apps/vben5/packages/@abp/request/src/index.ts +++ b/apps/vben5/packages/@abp/request/src/index.ts @@ -6,6 +6,7 @@ import type { RequestClientOptions } from '@vben/request'; import { useAppConfig } from '@vben/hooks'; import { RequestClient } from '@vben/request'; +export * from './constants'; export * from './hooks'; export * from './types'; diff --git a/apps/vben5/packages/@abp/webhooks/package.json b/apps/vben5/packages/@abp/webhooks/package.json new file mode 100644 index 000000000..f62762874 --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/package.json @@ -0,0 +1,46 @@ +{ + "name": "@abp/webhooks", + "version": "9.0.4", + "homepage": "https://github.com/colinin/abp-next-admin", + "bugs": "https://github.com/colinin/abp-next-admin/issues", + "repository": { + "type": "git", + "url": "git+https://github.com/colinin/abp-next-admin.git", + "directory": "packages/@abp/webhooks" + }, + "license": "MIT", + "type": "module", + "sideEffects": [ + "**/*.css" + ], + "exports": { + ".": { + "types": "./src/index.ts", + "default": "./src/index.ts" + } + }, + "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:*", + "@vben/common-ui": "workspace:*", + "@vben/hooks": "workspace:*", + "@vben/icons": "workspace:*", + "@vben/layouts": "workspace:*", + "@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.debounce": "catalog:" + } +} diff --git a/apps/vben5/packages/@abp/webhooks/src/api/index.ts b/apps/vben5/packages/@abp/webhooks/src/api/index.ts new file mode 100644 index 000000000..acbff7f7e --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/api/index.ts @@ -0,0 +1,4 @@ +export * from './useSendAttemptsApi'; +export * from './useSubscriptionsApi'; +export * from './useWebhookDefinitionsApi'; +export * from './useWebhookGroupDefinitionsApi'; diff --git a/apps/vben5/packages/@abp/webhooks/src/api/useSendAttemptsApi.ts b/apps/vben5/packages/@abp/webhooks/src/api/useSendAttemptsApi.ts new file mode 100644 index 000000000..5cf292be5 --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/api/useSendAttemptsApi.ts @@ -0,0 +1,93 @@ +import type { PagedResultDto } from '@abp/core'; + +import type { + WebhookSendRecordDeleteManyInput, + WebhookSendRecordDto, + WebhookSendRecordGetListInput, + WebhookSendRecordResendManyInput, +} from '../types/sendAttempts'; + +import { useRequest } from '@abp/request'; + +export function useSendAttemptsApi() { + const { cancel, request } = useRequest(); + + /** + * 查询发送记录 + * @param id 记录Id + * @returns 发送记录Dto + */ + function getApi(id: string): Promise { + return request(`/api/webhooks/send-attempts/${id}`, { + method: 'GET', + }); + } + /** + * 删除发送记录 + * @param id 记录Id + */ + function deleteApi(id: string): Promise { + return request(`/api/webhooks/send-attempts/${id}`, { + method: 'DELETE', + }); + } + /** + * 批量删除发送记录 + * @param input 参数 + */ + function bulkDeleteApi( + input: WebhookSendRecordDeleteManyInput, + ): Promise { + return request(`/api/webhooks/send-attempts/delete-many`, { + data: input, + method: 'DELETE', + }); + } + /** + * 查询发送记录分页列表 + * @param input 过滤参数 + * @returns 发送记录Dto分页列表 + */ + function getPagedListApi( + input: WebhookSendRecordGetListInput, + ): Promise> { + return request>( + `/api/webhooks/send-attempts`, + { + method: 'GET', + params: input, + }, + ); + } + /** + * 重新发送 + * @param id 记录Id + */ + function reSendApi(id: string): Promise { + return request(`/api/webhooks/send-attempts/${id}/resend`, { + method: 'POST', + }); + } + /** + * 批量重新发送 + * @param input 参数 + */ + function bulkReSendApi( + input: WebhookSendRecordResendManyInput, + ): Promise { + return request(`/api/webhooks/send-attempts/resend-many`, { + data: input, + method: 'POST', + }); + } + + return { + bulkDeleteApi, + bulkReSendApi, + cancel, + deleteApi, + getApi, + getPagedListApi, + reSendApi, + }; +} 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/api/useWebhookDefinitionsApi.ts b/apps/vben5/packages/@abp/webhooks/src/api/useWebhookDefinitionsApi.ts new file mode 100644 index 000000000..e582b62f4 --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/api/useWebhookDefinitionsApi.ts @@ -0,0 +1,91 @@ +import type { ListResultDto } from '@abp/core'; + +import type { + WebhookDefinitionCreateDto, + WebhookDefinitionDto, + WebhookDefinitionGetListInput, + WebhookDefinitionUpdateDto, +} from '../types/definitions'; + +import { useRequest } from '@abp/request'; + +export function useWebhookDefinitionsApi() { + const { cancel, request } = useRequest(); + + /** + * 删除Webhook定义 + * @param name Webhook名称 + */ + function deleteApi(name: string): Promise { + return request(`/api/webhooks/definitions/${name}`, { + method: 'DELETE', + }); + } + + /** + * 查询Webhook定义 + * @param name Webhook名称 + * @returns Webhook定义数据传输对象 + */ + function getApi(name: string): Promise { + return request(`/api/webhooks/definitions/${name}`, { + method: 'GET', + }); + } + + /** + * 查询Webhook定义列表 + * @param input Webhook过滤条件 + * @returns Webhook定义数据传输对象列表 + */ + function getListApi( + input?: WebhookDefinitionGetListInput, + ): Promise> { + return request>( + `/api/webhooks/definitions`, + { + method: 'GET', + params: input, + }, + ); + } + + /** + * 创建Webhook定义 + * @param input Webhook定义参数 + * @returns Webhook定义数据传输对象 + */ + function createApi( + input: WebhookDefinitionCreateDto, + ): Promise { + return request('/api/webhooks/definitions', { + data: input, + method: 'POST', + }); + } + + /** + * 更新Webhook定义 + * @param name Webhook名称 + * @param input Webhook定义参数 + * @returns Webhook定义数据传输对象 + */ + function updateApi( + name: string, + input: WebhookDefinitionUpdateDto, + ): Promise { + return request(`/api/webhooks/definitions/${name}`, { + data: input, + method: 'PUT', + }); + } + + return { + cancel, + createApi, + deleteApi, + getApi, + getListApi, + updateApi, + }; +} diff --git a/apps/vben5/packages/@abp/webhooks/src/api/useWebhookGroupDefinitionsApi.ts b/apps/vben5/packages/@abp/webhooks/src/api/useWebhookGroupDefinitionsApi.ts new file mode 100644 index 000000000..2cbd2559e --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/api/useWebhookGroupDefinitionsApi.ts @@ -0,0 +1,100 @@ +import type { ListResultDto } from '@abp/core'; + +import type { + WebhookGroupDefinitionCreateDto, + WebhookGroupDefinitionDto, + WebhookGroupDefinitionGetListInput, + WebhookGroupDefinitionUpdateDto, +} from '../types/groups'; + +import { useRequest } from '@abp/request'; + +export function useWebhookGroupDefinitionsApi() { + const { cancel, request } = useRequest(); + + /** + * 删除Webhook分组定义 + * @param name Webhook分组名称 + */ + function deleteApi(name: string): Promise { + return request(`/api/webhooks/definitions/groups/${name}`, { + method: 'DELETE', + }); + } + + /** + * 查询Webhook分组定义 + * @param name Webhook分组名称 + * @returns Webhook分组定义数据传输对象 + */ + function getApi(name: string): Promise { + return request( + `/api/webhooks/definitions/groups/${name}`, + { + method: 'GET', + }, + ); + } + + /** + * 查询Webhook分组定义列表 + * @param input Webhook分组过滤条件 + * @returns Webhook分组定义数据传输对象列表 + */ + function getListApi( + input?: WebhookGroupDefinitionGetListInput, + ): Promise> { + return request>( + `/api/webhooks/definitions/groups`, + { + method: 'GET', + params: input, + }, + ); + } + + /** + * 创建Webhook分组定义 + * @param input Webhook分组定义参数 + * @returns Webhook分组定义数据传输对象 + */ + function createApi( + input: WebhookGroupDefinitionCreateDto, + ): Promise { + return request( + '/api/webhooks/definitions/groups', + { + data: input, + method: 'POST', + }, + ); + } + + /** + * 更新Webhook分组定义 + * @param name Webhook分组名称 + * @param input Webhook分组定义参数 + * @returns Webhook分组定义数据传输对象 + */ + function updateApi( + name: string, + input: WebhookGroupDefinitionUpdateDto, + ): Promise { + return request( + `/api/webhooks/definitions/groups/${name}`, + { + data: input, + method: 'PUT', + }, + ); + } + + return { + cancel, + createApi, + deleteApi, + getApi, + getListApi, + updateApi, + }; +} diff --git a/apps/vben5/packages/@abp/webhooks/src/components/definitions/groups/WebhookGroupDefinitionModal.vue b/apps/vben5/packages/@abp/webhooks/src/components/definitions/groups/WebhookGroupDefinitionModal.vue new file mode 100644 index 000000000..019bb8934 --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/components/definitions/groups/WebhookGroupDefinitionModal.vue @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/vben5/packages/@abp/webhooks/src/components/definitions/groups/WebhookGroupDefinitionTable.vue b/apps/vben5/packages/@abp/webhooks/src/components/definitions/groups/WebhookGroupDefinitionTable.vue new file mode 100644 index 000000000..20dc6a10c --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/components/definitions/groups/WebhookGroupDefinitionTable.vue @@ -0,0 +1,258 @@ + + + + + + + {{ $t('WebhooksManagement.GroupDefinitions:AddNew') }} + + + + + + + {{ $t('AbpUi.Edit') }} + + + + + + {{ $t('AbpUi.Delete') }} + + + + + + onMenuClick(row, info)"> + + {{ $t('WebhooksManagement.Webhooks:AddNew') }} + + + + + + + + + + + onGet()" /> + + + + diff --git a/apps/vben5/packages/@abp/webhooks/src/components/definitions/webhooks/WebhookDefinitionModal.vue b/apps/vben5/packages/@abp/webhooks/src/components/definitions/webhooks/WebhookDefinitionModal.vue new file mode 100644 index 000000000..1496b80bb --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/components/definitions/webhooks/WebhookDefinitionModal.vue @@ -0,0 +1,357 @@ + + + + + + + + + + + {{ $t('WebhooksManagement.DisplayName:IsEnabled') }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/vben5/packages/@abp/webhooks/src/components/definitions/webhooks/WebhookDefinitionTable.vue b/apps/vben5/packages/@abp/webhooks/src/components/definitions/webhooks/WebhookDefinitionTable.vue new file mode 100644 index 000000000..e25660be3 --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/components/definitions/webhooks/WebhookDefinitionTable.vue @@ -0,0 +1,342 @@ + + + + + + + {{ $t('WebhooksManagement.Webhooks:AddNew') }} + + + + + + + + + + + + + + {{ feature }} + + + + + + + {{ $t('AbpUi.Edit') }} + + + {{ $t('AbpUi.Delete') }} + + + + + + + onGet()" /> + + + diff --git a/apps/vben5/packages/@abp/webhooks/src/components/index.ts b/apps/vben5/packages/@abp/webhooks/src/components/index.ts new file mode 100644 index 000000000..55dd81137 --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/components/index.ts @@ -0,0 +1,4 @@ +export { default as WebhookGroupDefinitionTable } from './definitions/groups/WebhookGroupDefinitionTable.vue'; +export { default as WebhookDefinitionTable } from './definitions/webhooks/WebhookDefinitionTable.vue'; +export { default as WebhookSendAttemptTable } from './send-attempts/WebhookSendAttemptTable.vue'; +export { default as WebhookSubscriptionTable } from './subscriptions/WebhookSubscriptionTable.vue'; diff --git a/apps/vben5/packages/@abp/webhooks/src/components/send-attempts/WebhookSendAttemptDrawer.vue b/apps/vben5/packages/@abp/webhooks/src/components/send-attempts/WebhookSendAttemptDrawer.vue new file mode 100644 index 000000000..36f0245a5 --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/components/send-attempts/WebhookSendAttemptDrawer.vue @@ -0,0 +1,239 @@ + + + + + + + + + + + + + {{ $t('WebhooksManagement.DisplayName:SendExactSameData') }} + + + + + + + + + + + {{ httpStatusCodeMap[formModel.responseStatusCode] }} + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ $t('WebhooksManagement.DisplayName:IsActive') }} + + + + + + + + + + + + + + + + + + + + + {{ webhook }} + + + + + + + + + + + + + diff --git a/apps/vben5/packages/@abp/webhooks/src/components/send-attempts/WebhookSendAttemptTable.vue b/apps/vben5/packages/@abp/webhooks/src/components/send-attempts/WebhookSendAttemptTable.vue new file mode 100644 index 000000000..277bdb5b4 --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/components/send-attempts/WebhookSendAttemptTable.vue @@ -0,0 +1,397 @@ + + + + + + + + {{ $t('WebhooksManagement.Resend') }} + + + {{ $t('AbpUi.Delete') }} + + + + + + {{ httpStatusCodeMap[row.responseStatusCode] }} + + + + + + {{ $t('AbpUi.Edit') }} + + + {{ $t('AbpUi.Delete') }} + + + + onMenuClick(row, info)"> + + + + {{ $t('WebhooksManagement.Resend') }} + + + + + + + + + + + + + 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..d96f61d43 --- /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 new file mode 100644 index 000000000..c4b6468dc --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/constants/permissions.ts @@ -0,0 +1,41 @@ +/** 分组权限 */ +export const GroupDefinitionsPermissions = { + /** 新增 */ + Create: 'AbpWebhooks.GroupDefinitions.Create', + Default: 'AbpWebhooks.GroupDefinitions', + /** 删除 */ + Delete: 'AbpWebhooks.GroupDefinitions.Delete', + /** 更新 */ + Update: 'AbpWebhooks.GroupDefinitions.Update', +}; + +/** Webhook定义权限 */ +export const WebhookDefinitionsPermissions = { + /** 新增 */ + Create: 'AbpWebhooks.Definitions.Create', + Default: 'AbpWebhooks.Definitions', + /** 删除 */ + Delete: 'AbpWebhooks.Definitions.Delete', + /** 更新 */ + Update: 'AbpWebhooks.Definitions.Update', +}; + +/** Webhook订阅权限 */ +export const WebhookSubscriptionPermissions = { + /** 新增 */ + Create: 'AbpWebhooks.Subscriptions.Create', + Default: 'AbpWebhooks.Subscriptions', + /** 删除 */ + Delete: 'AbpWebhooks.Subscriptions.Delete', + /** 更新 */ + Update: 'AbpWebhooks.Subscriptions.Update', +}; + +/** Webhook发送记录权限 */ +export const WebhooksSendAttemptsPermissions = { + Default: 'AbpWebhooks.SendAttempts', + /** 删除 */ + Delete: 'AbpWebhooks.SendAttempts.Delete', + /** 更新 */ + Resend: 'AbpWebhooks.SendAttempts.Resend', +}; diff --git a/apps/vben5/packages/@abp/webhooks/src/index.ts b/apps/vben5/packages/@abp/webhooks/src/index.ts new file mode 100644 index 000000000..314dad0cd --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/index.ts @@ -0,0 +1,3 @@ +export * from './api'; +export * from './components'; +export * from './types'; diff --git a/apps/vben5/packages/@abp/webhooks/src/types/definitions.ts b/apps/vben5/packages/@abp/webhooks/src/types/definitions.ts new file mode 100644 index 000000000..2f3391d7d --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/types/definitions.ts @@ -0,0 +1,40 @@ +import type { IHasConcurrencyStamp, IHasExtraProperties } from '@abp/core'; + +interface WebhookDefinitionDto extends IHasExtraProperties { + description?: string; + displayName: string; + groupName: string; + isEnabled: boolean; + isStatic: boolean; + name: string; + requiredFeatures?: string[]; +} + +interface WebhookDefinitionCreateOrUpdateDto extends IHasExtraProperties { + description?: string; + displayName: string; + isEnabled: boolean; + requiredFeatures?: string[]; +} + +interface WebhookDefinitionCreateDto + extends WebhookDefinitionCreateOrUpdateDto { + groupName: string; + name: string; +} + +interface WebhookDefinitionUpdateDto + extends IHasConcurrencyStamp, + WebhookDefinitionCreateOrUpdateDto {} + +interface WebhookDefinitionGetListInput { + filter?: string; + groupName?: string; +} + +export type { + WebhookDefinitionCreateDto, + WebhookDefinitionDto, + WebhookDefinitionGetListInput, + WebhookDefinitionUpdateDto, +}; diff --git a/apps/vben5/packages/@abp/webhooks/src/types/groups.ts b/apps/vben5/packages/@abp/webhooks/src/types/groups.ts new file mode 100644 index 000000000..d02df50b7 --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/types/groups.ts @@ -0,0 +1,31 @@ +import type { IHasConcurrencyStamp, IHasExtraProperties } from '@abp/core'; + +interface WebhookGroupDefinitionDto extends IHasExtraProperties { + displayName: string; + isStatic: boolean; + name: string; +} + +interface WebhookGroupDefinitionCreateOrUpdateDto extends IHasExtraProperties { + displayName: string; +} + +interface WebhookGroupDefinitionCreateDto + extends WebhookGroupDefinitionCreateOrUpdateDto { + name: string; +} + +interface WebhookGroupDefinitionUpdateDto + extends IHasConcurrencyStamp, + WebhookGroupDefinitionCreateOrUpdateDto {} + +interface WebhookGroupDefinitionGetListInput { + filter?: string; +} + +export type { + WebhookGroupDefinitionCreateDto, + WebhookGroupDefinitionDto, + WebhookGroupDefinitionGetListInput, + WebhookGroupDefinitionUpdateDto, +}; diff --git a/apps/vben5/packages/@abp/webhooks/src/types/index.ts b/apps/vben5/packages/@abp/webhooks/src/types/index.ts new file mode 100644 index 000000000..371b52ee2 --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/types/index.ts @@ -0,0 +1,4 @@ +export * from './definitions'; +export * from './groups'; +export * from './sendAttempts'; +export * from './subscriptions'; diff --git a/apps/vben5/packages/@abp/webhooks/src/types/sendAttempts.ts b/apps/vben5/packages/@abp/webhooks/src/types/sendAttempts.ts new file mode 100644 index 000000000..6f68e36c3 --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/src/types/sendAttempts.ts @@ -0,0 +1,51 @@ +import type { EntityDto, PagedAndSortedResultRequestDto } from '@abp/core'; + +import { HttpStatusCode } from '@abp/request'; + +interface WebhookEventRecordDto extends EntityDto { + creationTime: string; + data?: string; + tenantId?: string; + webhookName: string; +} + +interface WebhookSendRecordDto extends EntityDto { + creationTime: string; + lastModificationTime?: string; + requestHeaders?: Record; + response?: string; + responseHeaders?: Record; + responseStatusCode?: HttpStatusCode; + sendExactSameData: boolean; + tenantId?: string; + webhookEvent: WebhookEventRecordDto; + webhookEventId: string; + webhookSubscriptionId: string; +} + +interface WebhookSendRecordDeleteManyInput { + recordIds: string[]; +} + +interface WebhookSendRecordResendManyInput { + recordIds: string[]; +} + +interface WebhookSendRecordGetListInput extends PagedAndSortedResultRequestDto { + beginCreationTime?: Date; + endCreationTime?: Date; + filter?: string; + responseStatusCode?: HttpStatusCode; + state?: boolean; + subscriptionId?: string; + tenantId?: string; + webhookEventId?: string; +} + +export type { + WebhookEventRecordDto, + WebhookSendRecordDeleteManyInput, + WebhookSendRecordDto, + WebhookSendRecordGetListInput, + WebhookSendRecordResendManyInput, +}; 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, +}; diff --git a/apps/vben5/packages/@abp/webhooks/tsconfig.json b/apps/vben5/packages/@abp/webhooks/tsconfig.json new file mode 100644 index 000000000..ce1a891fb --- /dev/null +++ b/apps/vben5/packages/@abp/webhooks/tsconfig.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "@vben/tsconfig/web.json", + "include": ["src"], + "exclude": ["node_modules"] +}