diff --git a/.gitignore b/.gitignore index a69930932..9818dfc3f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ node_modules /dist vue.config.js -.env.production task obj bin diff --git a/apps/vue/.env.production b/apps/vue/.env.production new file mode 100644 index 000000000..69be9cbf4 --- /dev/null +++ b/apps/vue/.env.production @@ -0,0 +1,44 @@ +# Whether to open mock +VITE_USE_MOCK=false + +# public path +VITE_PUBLIC_PATH=/ + +# Delete console +VITE_DROP_CONSOLE=true + +# Whether to enable gzip or brotli compression +# Optional: gzip | brotli | none +# If you need multiple forms, you can use `,` to separate +VITE_BUILD_COMPRESS='none' + +# Whether to delete origin files when using compress, default false +VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE=false + +# Basic interface address SPA +VITE_GLOB_API_URL=/api + +# File upload address, optional +# It can be forwarded by nginx or write the actual address directly +VITE_GLOB_UPLOAD_URL=/upload + +# Interface prefix +VITE_GLOB_API_URL_PREFIX= + +# Whether to enable image compression +VITE_USE_IMAGEMIN=true + +# use pwa +VITE_USE_PWA=false + +# Is it compatible with older browsers +VITE_LEGACY=false + +# Multi-tenancy key +VITE_GLOB_MULTITENANCY_KEY='__tenant' + +# STS Connect +VITE_GLOB_AUTHORITY='http://127.0.0.1:44385' +VITE_GLOB_CLIENT_ID='vue-admin-element' +VITE_GLOB_CLIENT_SECRET='1q2w3e*' + diff --git a/apps/vue/src/api/webhooks/model/sendAttemptsModel.ts b/apps/vue/src/api/webhooks/model/sendAttemptsModel.ts new file mode 100644 index 000000000..a9d779d21 --- /dev/null +++ b/apps/vue/src/api/webhooks/model/sendAttemptsModel.ts @@ -0,0 +1,30 @@ +import { PagedAndSortedResultRequestDto } from '../../model/baseModel'; +import { HttpStatusCode } from '/@/enums/httpEnum'; + +export interface WebhookEvent { + tenantId?: string; + webhookName: string; + data: string; + creationTime: Date; +} + +export interface WebhookSendAttempt { + id: string; + tenantId?: string; + webhookEventId: string; + webhookSubscriptionId: string; + response: string; + responseStatusCode?: HttpStatusCode; + creationTime: Date; + lastModificationTime?: Date; + webhookEvent: WebhookEvent; +} + +export interface WebhookSendAttemptGetListInput extends PagedAndSortedResultRequestDto { + filter?: string; + webhookEventId?: string; + subscriptionId?: string; + responseStatusCode?: HttpStatusCode; + beginCreationTime?: Date; + endCreationTime?: Date; +} diff --git a/apps/vue/src/api/webhooks/model/subscriptionsModel.ts b/apps/vue/src/api/webhooks/model/subscriptionsModel.ts new file mode 100644 index 000000000..beff0f293 --- /dev/null +++ b/apps/vue/src/api/webhooks/model/subscriptionsModel.ts @@ -0,0 +1,46 @@ +import { CreationAuditedEntityDto, PagedAndSortedResultRequestDto } from '../../model/baseModel'; + +export interface WebhookSubscription extends CreationAuditedEntityDto { + id: string; + tenantId?: string; + webhookUri: string; + secret: string; + isActive: boolean; + webhooks: string[]; + headers: { [key: string]: string }; +} + +export interface WebhookSubscriptionCreateOrUpdate { + webhookUri: string; + secret: string; + isActive: boolean; + webhooks: string[]; + headers: { [key: string]: string }; +} + +export type CreateWebhookSubscription = WebhookSubscriptionCreateOrUpdate; + +export type UpdateWebhookSubscription = WebhookSubscriptionCreateOrUpdate; + +export interface WebhookAvailable { + name: string; + displayName: string; + description: string; +} + +export interface WebhookAvailableGroup { + name: string; + displayName: string; + webhooks: WebhookAvailable[]; +} + +export interface WebhookSubscriptionGetListInput extends PagedAndSortedResultRequestDto { + filter?: string; + tenantId?: string; + webhookUri?: string; + secret?: string; + isActive?: boolean; + webhooks?: string; + beginCreationTime?: Date; + endCreationTime?: Date; +} diff --git a/apps/vue/src/api/webhooks/send-attempts.ts b/apps/vue/src/api/webhooks/send-attempts.ts new file mode 100644 index 000000000..a1341305b --- /dev/null +++ b/apps/vue/src/api/webhooks/send-attempts.ts @@ -0,0 +1,48 @@ +import { defAbpHttp } from '/@/utils/http/abp'; +import { PagedResultDto } from '../model/baseModel'; +import { WebhookSendAttempt, WebhookSendAttemptGetListInput } from './model/sendAttemptsModel'; + +const remoteServiceName = 'WebhooksManagement'; +const controllerName = 'WebhookSendRecord'; + +export const getById = (id: string) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'GetAsync', + params: { + id: id, + }, + }); +}; + +export const deleteById = (id: string) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'DeleteAsync', + params: { + id: id, + }, + }); +} + +export const getList = (input: WebhookSendAttemptGetListInput) => { + return defAbpHttp.request>({ + service: remoteServiceName, + controller: controllerName, + action: 'GetListAsync', + params: input, + }); +}; + +export const resend = (id: string) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'ResendAsync', + params: { + id: id, + }, + }); +} \ No newline at end of file diff --git a/apps/vue/src/api/webhooks/subscriptions.ts b/apps/vue/src/api/webhooks/subscriptions.ts new file mode 100644 index 000000000..4905218c2 --- /dev/null +++ b/apps/vue/src/api/webhooks/subscriptions.ts @@ -0,0 +1,72 @@ +import { defAbpHttp } from '/@/utils/http/abp'; +import { + WebhookSubscription, + WebhookAvailableGroup, + CreateWebhookSubscription, + UpdateWebhookSubscription, + WebhookSubscriptionGetListInput, +} from './model/subscriptionsModel'; +import { ListResultDto, PagedResultDto } from '../model/baseModel'; + +const remoteServiceName = 'WebhooksManagement'; +const controllerName = 'WebhookSubscription'; + +export const create = (input: CreateWebhookSubscription) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'CreateAsync', + data: input, + }); +}; + +export const update = (id: string, input: UpdateWebhookSubscription) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'UpdateAsync', + data: input, + params: { + id: id, + }, + }); +}; + +export const getById = (id: string) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'GetAsync', + params: { + id: id, + }, + }); +}; + +export const deleteById = (id: string) => { + return defAbpHttp.request({ + service: remoteServiceName, + controller: controllerName, + action: 'DeleteAsync', + params: { + id: id, + }, + }); +}; + +export const getList = (input: WebhookSubscriptionGetListInput) => { + return defAbpHttp.request>({ + service: remoteServiceName, + controller: controllerName, + action: 'GetListAsync', + params: input, + }); +}; + +export const getAllAvailableWebhooks = () => { + return defAbpHttp.request>({ + service: remoteServiceName, + controller: controllerName, + action: 'GetAllAvailableWebhooksAsync', + }); +}; diff --git a/apps/vue/src/enums/httpEnum.ts b/apps/vue/src/enums/httpEnum.ts index 493916d6c..853e21921 100644 --- a/apps/vue/src/enums/httpEnum.ts +++ b/apps/vue/src/enums/httpEnum.ts @@ -28,3 +28,53 @@ export enum ContentTypeEnum { // form-data upload FORM_DATA = 'multipart/form-data;charset=UTF-8', } + +export enum HttpStatusCode { + Continue = 100, + SwitchingProtocols = 101, + OK = 200, + Created = 201, + Accepted = 202, + NonAuthoritativeInformation = 203, + NoContent = 204, + ResetContent = 205, + PartialContent = 206, + Ambiguous = 300, + MultipleChoices = 300, + Moved = 301, + MovedPermanently = 301, + Found = 302, + Redirect = 302, + RedirectMethod = 303, + SeeOther = 303, + NotModified = 304, + UseProxy = 305, + Unused = 306, + RedirectKeepVerb = 307, + TemporaryRedirect = 307, + BadRequest = 400, + Unauthorized = 401, + PaymentRequired = 402, + Forbidden = 403, + NotFound = 404, + MethodNotAllowed = 405, + NotAcceptable = 406, + ProxyAuthenticationRequired = 407, + RequestTimeout = 408, + Conflict = 409, + Gone = 410, + LengthRequired = 411, + PreconditionFailed = 412, + RequestEntityTooLarge = 413, + RequestUriTooLong = 414, + UnsupportedMediaType = 415, + RequestedRangeNotSatisfiable = 416, + ExpectationFailed = 417, + UpgradeRequired = 426, + InternalServerError = 500, + NotImplemented = 501, + BadGateway = 502, + ServiceUnavailable = 503, + GatewayTimeout = 504, + HttpVersionNotSupported = 505, +} diff --git a/apps/vue/src/views/webhooks/send-attempts/components/SendAttemptModal.vue b/apps/vue/src/views/webhooks/send-attempts/components/SendAttemptModal.vue new file mode 100644 index 000000000..01fc46afa --- /dev/null +++ b/apps/vue/src/views/webhooks/send-attempts/components/SendAttemptModal.vue @@ -0,0 +1,163 @@ +