@webiny/webhooks 0.0.0-unstable.7be00a75a9 → 0.0.0-unstable.7c2def32a7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/WebhookRoutes.js +27 -17
- package/admin/WebhookRoutes.js.map +1 -1
- package/admin/Webhooks.js +0 -3
- package/admin/Webhooks.js.map +1 -1
- package/admin/features/ListWebhooks/ListWebhooksGateway.js +8 -2
- package/admin/features/ListWebhooks/ListWebhooksGateway.js.map +1 -1
- package/admin/features/ListWebhooks/abstractions.d.ts +1 -0
- package/admin/features/ListWebhooks/abstractions.js.map +1 -1
- package/admin/features/permissions/feature.d.ts +1 -1
- package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/WebhookDeliveriesDataSource.d.ts +2 -3
- package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/WebhookDeliveriesDataSource.js +5 -7
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesDataSource.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.d.ts +9 -5
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js +67 -40
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/abstractions.d.ts +6 -3
- package/admin/presentation/WebhookDeliveriesPage/abstractions.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.d.ts +2 -2
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.d.ts +2 -2
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js +50 -18
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.d.ts +2 -2
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js +24 -8
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.d.ts +2 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js +16 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js +26 -17
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.d.ts +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.js.map +1 -0
- package/admin/presentation/WebhookForm/WebhookFormPresenter.d.ts +1 -4
- package/admin/presentation/WebhookForm/WebhookFormPresenter.js +8 -12
- package/admin/presentation/WebhookForm/WebhookFormPresenter.js.map +1 -1
- package/admin/presentation/WebhookForm/abstractions.d.ts +1 -4
- package/admin/presentation/WebhookForm/abstractions.js.map +1 -1
- package/admin/presentation/WebhookForm/components/SigningSecret.d.ts +2 -2
- package/admin/presentation/WebhookForm/components/WebhookFormView.js +34 -36
- package/admin/presentation/WebhookForm/components/WebhookFormView.js.map +1 -1
- package/admin/presentation/WebhookList/WebhookListDataSource.d.ts +7 -8
- package/admin/presentation/WebhookList/WebhookListDataSource.js +23 -50
- package/admin/presentation/WebhookList/WebhookListDataSource.js.map +1 -1
- package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.d.ts +2 -0
- package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.js +16 -0
- package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.js.map +1 -0
- package/admin/presentation/WebhookList/components/WebhookListContent.d.ts +2 -2
- package/admin/presentation/WebhookList/components/WebhookListContent.js +20 -8
- package/admin/presentation/WebhookList/components/WebhookListContent.js.map +1 -1
- package/admin/presentation/WebhookList/components/WebhookListView.js +4 -1
- package/admin/presentation/WebhookList/components/WebhookListView.js.map +1 -1
- package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.js +3 -1
- package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.js.map +1 -1
- package/admin/routes.d.ts +3 -1
- package/admin/routes.js +4 -1
- package/admin/routes.js.map +1 -1
- package/api/features/DeleteWebhook/DeleteWebhookRepository.js +2 -1
- package/api/features/DeleteWebhook/DeleteWebhookRepository.js.map +1 -1
- package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js +7 -4
- package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js.map +1 -1
- package/api/features/ListWebhooks/ListWebhooksRepository.js +7 -4
- package/api/features/ListWebhooks/ListWebhooksRepository.js.map +1 -1
- package/api/features/SendWebhookTask/SendWebhookTask.d.ts +11 -6
- package/api/features/SendWebhookTask/SendWebhookTask.js +21 -12
- package/api/features/SendWebhookTask/SendWebhookTask.js.map +1 -1
- package/api/features/UpdateWebhook/UpdateWebhookRepository.js +3 -1
- package/api/features/UpdateWebhook/UpdateWebhookRepository.js.map +1 -1
- package/api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.js +3 -1
- package/api/features/UpdateWebhookDelivery/UpdateWebhookDeliveryRepository.js.map +1 -1
- package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.js +3 -1
- package/api/features/UpdateWebhookSettings/UpdateWebhookSettingsRepository.js.map +1 -1
- package/api/graphql/WebhookCrudSchema.d.ts +3 -2
- package/api/graphql/WebhookCrudSchema.js +17 -2
- package/api/graphql/WebhookCrudSchema.js.map +1 -1
- package/api/graphql/WebhookDeliverySchema.d.ts +3 -2
- package/api/graphql/WebhookDeliverySchema.js +6 -2
- package/api/graphql/WebhookDeliverySchema.js.map +1 -1
- package/api/graphql/WebhookEventSchema.d.ts +3 -2
- package/api/graphql/WebhookEventSchema.js +6 -2
- package/api/graphql/WebhookEventSchema.js.map +1 -1
- package/api/graphql/WebhookSettingsSchema.d.ts +3 -2
- package/api/graphql/WebhookSettingsSchema.js +6 -2
- package/api/graphql/WebhookSettingsSchema.js.map +1 -1
- package/api/graphql/WebhookTriggerSchema.d.ts +3 -2
- package/api/graphql/WebhookTriggerSchema.js +6 -2
- package/api/graphql/WebhookTriggerSchema.js.map +1 -1
- package/api/index.d.ts +3 -0
- package/api/index.js +6 -2
- package/api/index.js.map +1 -1
- package/api/models/WebhookDeliveryModel.d.ts +1 -1
- package/api/models/WebhookDeliveryModel.js +3 -3
- package/api/models/WebhookDeliveryModel.js.map +1 -1
- package/api/models/WebhookModel.d.ts +1 -1
- package/api/models/WebhookModel.js +4 -4
- package/api/models/WebhookModel.js.map +1 -1
- package/api/models/WebhookSettingsModel.d.ts +1 -1
- package/api/models/WebhookSettingsModel.js +3 -3
- package/api/models/WebhookSettingsModel.js.map +1 -1
- package/package.json +24 -23
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesDataSource.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.d.ts +0 -21
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.js +0 -57
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/abstractions.d.ts +0 -18
- package/admin/presentation/WebhookDeliveries/abstractions.js +0 -5
- package/admin/presentation/WebhookDeliveries/abstractions.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/DeliveryAccordionRow.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.d.ts +0 -11
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.js +0 -32
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailContent.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailPanel.d.ts +0 -9
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailPanel.js +0 -22
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailPanel.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.d.ts +0 -8
- package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.js +0 -119
- package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/statusVariant.d.ts +0 -1
- package/admin/presentation/WebhookDeliveries/components/statusVariant.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/feature.d.ts +0 -3
- package/admin/presentation/WebhookDeliveries/feature.js +0 -17
- package/admin/presentation/WebhookDeliveries/feature.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/index.d.ts +0 -2
- package/admin/presentation/WebhookDeliveries/index.js +0 -2
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/DeliveryAccordionRow.d.ts +0 -0
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/DeliveryAccordionRow.js +0 -0
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/DeliveryDetailContent.d.ts +0 -0
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/DeliveryDetailContent.js +0 -0
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/statusVariant.js +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { WebhookDelivery } from "../../../admin/shared/types.js";
|
|
2
2
|
import type { IListViewModel } from "@webiny/app-admin/presentation/listPresenter/abstractions.js";
|
|
3
3
|
export interface IDeliveryPageFilters {
|
|
4
|
+
webhookId: string | null;
|
|
4
5
|
app: string | null;
|
|
5
6
|
entity: string | null;
|
|
6
7
|
eventName: string | null;
|
|
@@ -11,24 +12,26 @@ export interface IDeliveryFilterOption {
|
|
|
11
12
|
label: string;
|
|
12
13
|
}
|
|
13
14
|
export interface IWebhookDeliveriesPageViewModel {
|
|
15
|
+
availableWebhooks: IDeliveryFilterOption[];
|
|
14
16
|
availableApps: IDeliveryFilterOption[];
|
|
15
17
|
availableEntities: IDeliveryFilterOption[];
|
|
16
18
|
availableEventNames: IDeliveryFilterOption[];
|
|
17
19
|
filters: IDeliveryPageFilters;
|
|
18
20
|
list: IListViewModel<WebhookDelivery>;
|
|
19
|
-
expandedDeliveryId: string | null;
|
|
20
21
|
resendingIds: Set<string>;
|
|
22
|
+
hasFilters: boolean;
|
|
21
23
|
loading: boolean;
|
|
22
24
|
error: string | null;
|
|
23
25
|
}
|
|
24
26
|
export interface IWebhookDeliveriesPagePresenter {
|
|
25
27
|
vm: IWebhookDeliveriesPageViewModel;
|
|
26
|
-
init(): Promise<void>;
|
|
28
|
+
init(webhookId?: string): Promise<void>;
|
|
29
|
+
setWebhookFilter(webhookId: string | null): void;
|
|
27
30
|
setAppFilter(app: string | null): void;
|
|
28
31
|
setEntityFilter(entity: string | null): void;
|
|
29
32
|
setEventFilter(eventName: string | null): void;
|
|
30
33
|
setStatusFilter(status: string[]): void;
|
|
31
|
-
|
|
34
|
+
clearFilters(): void;
|
|
32
35
|
loadMore(): Promise<void>;
|
|
33
36
|
resend(id: string): Promise<void>;
|
|
34
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/abstractions.js","sources":["../../../../src/admin/presentation/WebhookDeliveriesPage/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { WebhookDelivery } from \"~/admin/shared/types.js\";\nimport type { IListViewModel } from \"@webiny/app-admin/presentation/listPresenter/abstractions.js\";\n\nexport interface IDeliveryPageFilters {\n app: string | null;\n entity: string | null;\n eventName: string | null;\n status: string[];\n}\n\nexport interface IDeliveryFilterOption {\n value: string;\n label: string;\n}\n\nexport interface IWebhookDeliveriesPageViewModel {\n availableApps: IDeliveryFilterOption[];\n availableEntities: IDeliveryFilterOption[];\n availableEventNames: IDeliveryFilterOption[];\n filters: IDeliveryPageFilters;\n list: IListViewModel<WebhookDelivery>;\n
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/abstractions.js","sources":["../../../../src/admin/presentation/WebhookDeliveriesPage/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { WebhookDelivery } from \"~/admin/shared/types.js\";\nimport type { IListViewModel } from \"@webiny/app-admin/presentation/listPresenter/abstractions.js\";\n\nexport interface IDeliveryPageFilters {\n webhookId: string | null;\n app: string | null;\n entity: string | null;\n eventName: string | null;\n status: string[];\n}\n\nexport interface IDeliveryFilterOption {\n value: string;\n label: string;\n}\n\nexport interface IWebhookDeliveriesPageViewModel {\n availableWebhooks: IDeliveryFilterOption[];\n availableApps: IDeliveryFilterOption[];\n availableEntities: IDeliveryFilterOption[];\n availableEventNames: IDeliveryFilterOption[];\n filters: IDeliveryPageFilters;\n list: IListViewModel<WebhookDelivery>;\n resendingIds: Set<string>;\n hasFilters: boolean;\n loading: boolean;\n error: string | null;\n}\n\nexport interface IWebhookDeliveriesPagePresenter {\n vm: IWebhookDeliveriesPageViewModel;\n init(webhookId?: string): Promise<void>;\n setWebhookFilter(webhookId: string | null): void;\n setAppFilter(app: string | null): void;\n setEntityFilter(entity: string | null): void;\n setEventFilter(eventName: string | null): void;\n setStatusFilter(status: string[]): void;\n clearFilters(): void;\n loadMore(): Promise<void>;\n resend(id: string): Promise<void>;\n}\n\nexport const WebhookDeliveriesPagePresenter = createAbstraction<IWebhookDeliveriesPagePresenter>(\n \"WebhookDeliveriesPagePresenter\"\n);\n\nexport namespace WebhookDeliveriesPagePresenter {\n export type Interface = IWebhookDeliveriesPagePresenter;\n export type ViewModel = IWebhookDeliveriesPageViewModel;\n}\n"],"names":["WebhookDeliveriesPagePresenter","createAbstraction"],"mappings":";AA2CO,MAAMA,iCAAiCC,kBAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.tsx"],"sourcesContent":["import React from \"react\";\nimport { Accordion, Tag, Text, TimeAgo } from \"@webiny/admin-ui\";\nimport { ReactComponent as ReplayIcon } from \"@webiny/icons/replay.svg\";\nimport type { WebhookDelivery } from \"~/admin/shared/types.js\";\nimport { DeliveryDetailContent } from \"./DeliveryDetailContent.js\";\nimport { statusVariant } from \"./statusVariant.js\";\n\ninterface DeliveryAccordionRowProps {\n delivery: WebhookDelivery;\n open: boolean;\n resending: boolean;\n onOpenChange: (open: boolean) => void;\n onResend: (id: string) => void;\n}\n\nexport const DeliveryAccordionRow = ({\n delivery,\n open,\n resending,\n onOpenChange,\n onResend\n}: DeliveryAccordionRowProps) => {\n return (\n <Accordion.Item\n open={open}\n onOpenChange={onOpenChange}\n title={delivery.eventType}\n description={\n <div className=\"flex items-center gap-sm\">\n <Tag variant={statusVariant(delivery.status)} content={delivery.status} />\n {delivery.responseStatus !== null ? (\n <Text size=\"sm\">HTTP {delivery.responseStatus}</Text>\n ) : null}\n {delivery.responseTime ? (\n <Text size=\"sm\">{delivery.responseTime}ms</Text>\n ) : null}\n <Text size=\"sm\" className=\"text-neutral-strong\">\n <TimeAgo datetime={delivery.createdOn} />\n </Text>\n </div>\n }\n actions={\n <Accordion.Item.Action\n icon={<ReplayIcon />}\n onClick={() => onResend(delivery.id)}\n aria-label=\"Resend delivery\"\n disabled={resending}\n />\n }\n >\n <DeliveryDetailContent delivery={delivery} />\n </Accordion.Item>\n );\n};\n"],"names":["DeliveryAccordionRow","delivery","open","resending","onOpenChange","onResend","Accordion","Tag","statusVariant","Text","TimeAgo","ReplayIcon","DeliveryDetailContent"],"mappings":";;;;;AAeO,MAAMA,uBAAuB,CAAC,EACjCC,QAAQ,EACRC,IAAI,EACJC,SAAS,EACTC,YAAY,EACZC,QAAQ,EACgB,GACjB,WAAP,GACI,oBAACC,UAAU,IAAI;QACX,MAAMJ;QACN,cAAcE;QACd,OAAOH,SAAS,SAAS;QACzB,2BACI,oBAAC;YAAI,WAAU;yBACX,oBAACM,KAAGA;YAAC,SAASC,cAAcP,SAAS,MAAM;YAAG,SAASA,SAAS,MAAM;YACrEA,AAA4B,SAA5BA,SAAS,cAAc,GAAY,WAAP,GACzB,oBAACQ,MAAIA;YAAC,MAAK;WAAK,SAAMR,SAAS,cAAc,IAC7C,MACHA,SAAS,YAAY,GAAG,WAAH,GAClB,oBAACQ,MAAIA;YAAC,MAAK;WAAMR,SAAS,YAAY,EAAC,QACvC,oBACJ,oBAACQ,MAAIA;YAAC,MAAK;YAAK,WAAU;yBACtB,oBAACC,SAAOA;YAAC,UAAUT,SAAS,SAAS;;QAIjD,uBACI,oBAACK,UAAU,IAAI,CAAC,MAAM;YAClB,oBAAM,oBAACK,gBAAUA;YACjB,SAAS,IAAMN,SAASJ,SAAS,EAAE;YACnC,cAAW;YACX,UAAUE;;qBAIlB,oBAACS,uBAAqBA;QAAC,UAAUX"}
|
|
@@ -3,7 +3,7 @@ import type { IWebhookDeliveriesPagePresenter } from "../abstractions.js";
|
|
|
3
3
|
interface DeliveryBottomInfoBarProps {
|
|
4
4
|
presenter: IWebhookDeliveriesPagePresenter;
|
|
5
5
|
}
|
|
6
|
-
export declare const DeliveryBottomInfoBar: (({ presenter }: DeliveryBottomInfoBarProps) => React.JSX.Element | null) & {
|
|
7
|
-
|
|
6
|
+
export declare const DeliveryBottomInfoBar: (({ presenter }: DeliveryBottomInfoBarProps) => React.JSX.Element | null) & React.NamedExoticComponent<DeliveryBottomInfoBarProps> & {
|
|
7
|
+
readonly type: ({ presenter }: DeliveryBottomInfoBarProps) => React.JSX.Element | null;
|
|
8
8
|
};
|
|
9
9
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.tsx"],"sourcesContent":["import React from \"react\";\nimport { Separator, Tabs } from \"@webiny/admin-ui\";\nimport type { WebhookDelivery } from \"~/admin/shared/types.js\";\n\ninterface DeliveryDetailContentProps {\n delivery: WebhookDelivery;\n}\n\nconst formatJson = (value: unknown): string => {\n if (value === null || value === undefined) {\n return \"—\";\n }\n if (typeof value === \"string\") {\n try {\n return JSON.stringify(JSON.parse(value), null, 2);\n } catch {\n return value;\n }\n }\n return JSON.stringify(value, null, 2);\n};\n\nconst getContentType = (responseHeaders: unknown): string | null => {\n if (!responseHeaders || typeof responseHeaders !== \"object\") {\n return null;\n }\n const headers = responseHeaders as Record<string, string>;\n const key = Object.keys(headers).find(k => k.toLowerCase() === \"content-type\");\n if (!key) {\n return null;\n }\n return headers[key].split(\";\")[0].trim().toLowerCase();\n};\n\nconst getContentTypeLabel = (contentType: string | null): string | null => {\n if (!contentType) {\n return null;\n }\n if (contentType.includes(\"json\")) {\n return \"JSON\";\n }\n if (contentType.includes(\"html\")) {\n return \"HTML\";\n }\n if (contentType.includes(\"xml\")) {\n return \"XML\";\n }\n if (contentType.includes(\"plain\")) {\n return \"TEXT\";\n }\n return null;\n};\n\nconst renderResponseBody = (body: string | null, contentType: string | null): string => {\n if (body === null) {\n return \"—\";\n }\n if (!contentType || contentType.includes(\"json\")) {\n return formatJson(body);\n }\n return body;\n};\n\nexport const DeliveryDetailContent = ({ delivery }: DeliveryDetailContentProps) => {\n const contentType = getContentType(delivery.responseHeaders);\n const contentTypeLabel = getContentTypeLabel(contentType);\n\n return (\n <div className=\"flex flex-col gap-md\">\n <Separator />\n <Tabs\n tabs={[\n <Tabs.Tab\n key=\"payload\"\n value=\"payload\"\n trigger=\"Payload\"\n content={\n <pre className=\"bg-neutral-light rounded-sm p-sm text-xs overflow-auto max-h-[250px]\">\n {formatJson(delivery.payload)}\n </pre>\n }\n />,\n <Tabs.Tab\n key=\"req-headers\"\n value=\"req-headers\"\n trigger=\"Request Headers\"\n content={\n <pre className=\"bg-neutral-light rounded-sm p-sm text-xs overflow-auto max-h-[200px]\">\n {formatJson(delivery.requestHeaders)}\n </pre>\n }\n />,\n <Tabs.Tab\n key=\"resp-headers\"\n value=\"resp-headers\"\n trigger=\"Response Headers\"\n content={\n <pre className=\"bg-neutral-light rounded-sm p-sm text-xs overflow-auto max-h-[200px]\">\n {formatJson(delivery.responseHeaders)}\n </pre>\n }\n />,\n <Tabs.Tab\n key=\"resp-body\"\n value=\"resp-body\"\n trigger={\n contentTypeLabel\n ? `Response Body (${contentTypeLabel})`\n : \"Response Body\"\n }\n content={\n <pre className=\"bg-neutral-light rounded-sm p-sm text-xs overflow-auto max-h-[200px]\">\n {renderResponseBody(delivery.responseBody, contentType)}\n </pre>\n }\n />\n ]}\n />\n </div>\n );\n};\n"],"names":["formatJson","value","JSON","getContentType","responseHeaders","headers","key","Object","k","getContentTypeLabel","contentType","renderResponseBody","body","DeliveryDetailContent","delivery","contentTypeLabel","Separator","Tabs"],"mappings":";;AAQA,MAAMA,aAAa,CAACC;IAChB,IAAIA,QAAAA,OACA,OAAO;IAEX,IAAI,AAAiB,YAAjB,OAAOA,OACP,IAAI;QACA,OAAOC,KAAK,SAAS,CAACA,KAAK,KAAK,CAACD,QAAQ,MAAM;IACnD,EAAE,OAAM;QACJ,OAAOA;IACX;IAEJ,OAAOC,KAAK,SAAS,CAACD,OAAO,MAAM;AACvC;AAEA,MAAME,iBAAiB,CAACC;IACpB,IAAI,CAACA,mBAAmB,AAA2B,YAA3B,OAAOA,iBAC3B,OAAO;IAEX,MAAMC,UAAUD;IAChB,MAAME,MAAMC,OAAO,IAAI,CAACF,SAAS,IAAI,CAACG,CAAAA,IAAKA,AAAoB,mBAApBA,EAAE,WAAW;IACxD,IAAI,CAACF,KACD,OAAO;IAEX,OAAOD,OAAO,CAACC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,GAAG,WAAW;AACxD;AAEA,MAAMG,sBAAsB,CAACC;IACzB,IAAI,CAACA,aACD,OAAO;IAEX,IAAIA,YAAY,QAAQ,CAAC,SACrB,OAAO;IAEX,IAAIA,YAAY,QAAQ,CAAC,SACrB,OAAO;IAEX,IAAIA,YAAY,QAAQ,CAAC,QACrB,OAAO;IAEX,IAAIA,YAAY,QAAQ,CAAC,UACrB,OAAO;IAEX,OAAO;AACX;AAEA,MAAMC,qBAAqB,CAACC,MAAqBF;IAC7C,IAAIE,AAAS,SAATA,MACA,OAAO;IAEX,IAAI,CAACF,eAAeA,YAAY,QAAQ,CAAC,SACrC,OAAOV,WAAWY;IAEtB,OAAOA;AACX;AAEO,MAAMC,wBAAwB,CAAC,EAAEC,QAAQ,EAA8B;IAC1E,MAAMJ,cAAcP,eAAeW,SAAS,eAAe;IAC3D,MAAMC,mBAAmBN,oBAAoBC;IAE7C,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAACM,WAASA,OAAAA,WAAAA,GACV,oBAACC,MAAIA;QACD,MAAM;0BACF,oBAACA,KAAK,GAAG;gBACL,KAAI;gBACJ,OAAM;gBACN,SAAQ;gBACR,uBACI,oBAAC;oBAAI,WAAU;mBACVjB,WAAWc,SAAS,OAAO;;0BAIxC,oBAACG,KAAK,GAAG;gBACL,KAAI;gBACJ,OAAM;gBACN,SAAQ;gBACR,uBACI,oBAAC;oBAAI,WAAU;mBACVjB,WAAWc,SAAS,cAAc;;0BAI/C,oBAACG,KAAK,GAAG;gBACL,KAAI;gBACJ,OAAM;gBACN,SAAQ;gBACR,uBACI,oBAAC;oBAAI,WAAU;mBACVjB,WAAWc,SAAS,eAAe;;0BAIhD,oBAACG,KAAK,GAAG;gBACL,KAAI;gBACJ,OAAM;gBACN,SACIF,mBACM,CAAC,eAAe,EAAEA,iBAAiB,CAAC,CAAC,GACrC;gBAEV,uBACI,oBAAC;oBAAI,WAAU;mBACVJ,mBAAmBG,SAAS,YAAY,EAAEJ;;SAI1D;;AAIjB"}
|
|
@@ -3,7 +3,7 @@ import type { IWebhookDeliveriesPagePresenter } from "../abstractions.js";
|
|
|
3
3
|
interface DeliveryFiltersProps {
|
|
4
4
|
presenter: IWebhookDeliveriesPagePresenter;
|
|
5
5
|
}
|
|
6
|
-
export declare const DeliveryFilters: (({ presenter }: DeliveryFiltersProps) => React.JSX.Element) & {
|
|
7
|
-
|
|
6
|
+
export declare const DeliveryFilters: (({ presenter }: DeliveryFiltersProps) => React.JSX.Element) & React.NamedExoticComponent<DeliveryFiltersProps> & {
|
|
7
|
+
readonly type: ({ presenter }: DeliveryFiltersProps) => React.JSX.Element;
|
|
8
8
|
};
|
|
9
9
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import react from "react";
|
|
1
|
+
import react, { useState } from "react";
|
|
2
2
|
import { observer } from "mobx-react-lite";
|
|
3
|
-
import {
|
|
3
|
+
import { Drawer, IconButton, MultiSelect, Select } from "@webiny/admin-ui";
|
|
4
|
+
import { ReactComponent } from "@webiny/icons/filter_list.svg";
|
|
4
5
|
const STATUS_OPTIONS = [
|
|
5
6
|
{
|
|
6
7
|
value: "pending",
|
|
@@ -19,22 +20,53 @@ const STATUS_OPTIONS = [
|
|
|
19
20
|
label: "Failed"
|
|
20
21
|
}
|
|
21
22
|
];
|
|
22
|
-
const
|
|
23
|
+
const DeliveryFilters = observer(({ presenter })=>{
|
|
23
24
|
const { vm } = presenter;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const [open, setOpen] = useState(false);
|
|
26
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(IconButton, {
|
|
27
|
+
variant: vm.hasFilters ? "primary" : "ghost",
|
|
28
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
29
|
+
onClick: ()=>setOpen(true),
|
|
30
|
+
"data-testid": "webhooks.toggle-filters"
|
|
31
|
+
}), /*#__PURE__*/ react.createElement(Drawer, {
|
|
32
|
+
open: open,
|
|
33
|
+
onClose: ()=>setOpen(false),
|
|
34
|
+
modal: true,
|
|
35
|
+
width: 360,
|
|
36
|
+
title: "Filters",
|
|
37
|
+
headerSeparator: true,
|
|
38
|
+
footerSeparator: true,
|
|
39
|
+
bodyPadding: false,
|
|
40
|
+
actions: /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Drawer.CancelButton, {
|
|
41
|
+
text: "Clear all",
|
|
42
|
+
onClick: ()=>presenter.clearFilters()
|
|
43
|
+
}), /*#__PURE__*/ react.createElement(Drawer.ConfirmButton, {
|
|
44
|
+
text: "Apply filters",
|
|
45
|
+
onClick: ()=>setOpen(false)
|
|
46
|
+
}))
|
|
47
|
+
}, /*#__PURE__*/ react.createElement("div", {
|
|
48
|
+
className: "flex flex-col gap-lg p-lg"
|
|
28
49
|
}, /*#__PURE__*/ react.createElement(Select, {
|
|
50
|
+
size: "md",
|
|
51
|
+
label: "Webhook",
|
|
52
|
+
placeholder: "All webhooks",
|
|
53
|
+
value: vm.filters.webhookId ?? "",
|
|
54
|
+
options: vm.availableWebhooks,
|
|
55
|
+
onChange: (value)=>presenter.setWebhookFilter(value || null),
|
|
56
|
+
displayResetAction: true,
|
|
57
|
+
onValueReset: ()=>presenter.setWebhookFilter(null)
|
|
58
|
+
}), /*#__PURE__*/ react.createElement(Select, {
|
|
59
|
+
size: "md",
|
|
60
|
+
label: "Application",
|
|
29
61
|
placeholder: "All apps",
|
|
30
62
|
value: vm.filters.app ?? "",
|
|
31
63
|
options: vm.availableApps,
|
|
32
64
|
onChange: (value)=>presenter.setAppFilter(value || null),
|
|
33
65
|
displayResetAction: true,
|
|
34
66
|
onValueReset: ()=>presenter.setAppFilter(null)
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
|
|
67
|
+
}), /*#__PURE__*/ react.createElement(Select, {
|
|
68
|
+
size: "md",
|
|
69
|
+
label: "Entity",
|
|
38
70
|
placeholder: "All entities",
|
|
39
71
|
value: vm.filters.entity ?? "",
|
|
40
72
|
options: vm.availableEntities,
|
|
@@ -42,9 +74,9 @@ const DeliveryFilters_DeliveryFilters = observer(function({ presenter }) {
|
|
|
42
74
|
disabled: !vm.filters.app,
|
|
43
75
|
displayResetAction: true,
|
|
44
76
|
onValueReset: ()=>presenter.setEntityFilter(null)
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
|
|
77
|
+
}), /*#__PURE__*/ react.createElement(Select, {
|
|
78
|
+
size: "md",
|
|
79
|
+
label: "Event",
|
|
48
80
|
placeholder: "All events",
|
|
49
81
|
value: vm.filters.eventName ?? "",
|
|
50
82
|
options: vm.availableEventNames,
|
|
@@ -52,15 +84,15 @@ const DeliveryFilters_DeliveryFilters = observer(function({ presenter }) {
|
|
|
52
84
|
disabled: !vm.filters.app,
|
|
53
85
|
displayResetAction: true,
|
|
54
86
|
onValueReset: ()=>presenter.setEventFilter(null)
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
|
|
87
|
+
}), /*#__PURE__*/ react.createElement(MultiSelect, {
|
|
88
|
+
size: "md",
|
|
89
|
+
label: "Status",
|
|
58
90
|
placeholder: "All statuses",
|
|
59
91
|
value: vm.filters.status,
|
|
60
92
|
options: STATUS_OPTIONS,
|
|
61
93
|
onChange: (values)=>presenter.setStatusFilter(values)
|
|
62
|
-
})));
|
|
94
|
+
}))));
|
|
63
95
|
});
|
|
64
|
-
export {
|
|
96
|
+
export { DeliveryFilters };
|
|
65
97
|
|
|
66
98
|
//# sourceMappingURL=DeliveryFilters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.tsx"],"sourcesContent":["import React from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport {
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { Drawer, IconButton, MultiSelect, Select } from \"@webiny/admin-ui\";\nimport { ReactComponent as FilterIcon } from \"@webiny/icons/filter_list.svg\";\nimport type { IWebhookDeliveriesPagePresenter } from \"../abstractions.js\";\n\ninterface DeliveryFiltersProps {\n presenter: IWebhookDeliveriesPagePresenter;\n}\n\nconst STATUS_OPTIONS = [\n { value: \"pending\", label: \"Pending\" },\n { value: \"delivering\", label: \"Delivering\" },\n { value: \"delivered\", label: \"Delivered\" },\n { value: \"failed\", label: \"Failed\" }\n];\n\nexport const DeliveryFilters = observer(({ presenter }: DeliveryFiltersProps) => {\n const { vm } = presenter;\n const [open, setOpen] = useState(false);\n\n return (\n <>\n <IconButton\n variant={vm.hasFilters ? \"primary\" : \"ghost\"}\n icon={<FilterIcon />}\n onClick={() => setOpen(true)}\n data-testid=\"webhooks.toggle-filters\"\n />\n <Drawer\n open={open}\n onClose={() => setOpen(false)}\n modal={true}\n width={360}\n title=\"Filters\"\n headerSeparator={true}\n footerSeparator={true}\n bodyPadding={false}\n actions={\n <>\n <Drawer.CancelButton\n text=\"Clear all\"\n onClick={() => presenter.clearFilters()}\n />\n <Drawer.ConfirmButton text=\"Apply filters\" onClick={() => setOpen(false)} />\n </>\n }\n >\n <div className=\"flex flex-col gap-lg p-lg\">\n <Select\n size={\"md\"}\n label=\"Webhook\"\n placeholder=\"All webhooks\"\n value={vm.filters.webhookId ?? \"\"}\n options={vm.availableWebhooks}\n onChange={value => presenter.setWebhookFilter(value || null)}\n displayResetAction={true}\n onValueReset={() => presenter.setWebhookFilter(null)}\n />\n <Select\n size={\"md\"}\n label=\"Application\"\n placeholder=\"All apps\"\n value={vm.filters.app ?? \"\"}\n options={vm.availableApps}\n onChange={value => presenter.setAppFilter(value || null)}\n displayResetAction={true}\n onValueReset={() => presenter.setAppFilter(null)}\n />\n <Select\n size={\"md\"}\n label=\"Entity\"\n placeholder=\"All entities\"\n value={vm.filters.entity ?? \"\"}\n options={vm.availableEntities}\n onChange={value => presenter.setEntityFilter(value || null)}\n disabled={!vm.filters.app}\n displayResetAction={true}\n onValueReset={() => presenter.setEntityFilter(null)}\n />\n <Select\n size={\"md\"}\n label=\"Event\"\n placeholder=\"All events\"\n value={vm.filters.eventName ?? \"\"}\n options={vm.availableEventNames}\n onChange={value => presenter.setEventFilter(value || null)}\n disabled={!vm.filters.app}\n displayResetAction={true}\n onValueReset={() => presenter.setEventFilter(null)}\n />\n <MultiSelect\n size={\"md\"}\n label=\"Status\"\n placeholder=\"All statuses\"\n value={vm.filters.status}\n options={STATUS_OPTIONS}\n onChange={values => presenter.setStatusFilter(values)}\n />\n </div>\n </Drawer>\n </>\n );\n});\n"],"names":["STATUS_OPTIONS","DeliveryFilters","observer","presenter","vm","open","setOpen","useState","IconButton","FilterIcon","Drawer","Select","value","MultiSelect","values"],"mappings":";;;;AAUA,MAAMA,iBAAiB;IACnB;QAAE,OAAO;QAAW,OAAO;IAAU;IACrC;QAAE,OAAO;QAAc,OAAO;IAAa;IAC3C;QAAE,OAAO;QAAa,OAAO;IAAY;IACzC;QAAE,OAAO;QAAU,OAAO;IAAS;CACtC;AAEM,MAAMC,kBAAkBC,SAAS,CAAC,EAAEC,SAAS,EAAwB;IACxE,MAAM,EAAEC,EAAE,EAAE,GAAGD;IACf,MAAM,CAACE,MAAMC,QAAQ,GAAGC,SAAS;IAEjC,OAAO,WAAP,GACI,wDACI,oBAACC,YAAUA;QACP,SAASJ,GAAG,UAAU,GAAG,YAAY;QACrC,oBAAM,oBAACK,gBAAUA;QACjB,SAAS,IAAMH,QAAQ;QACvB,eAAY;sBAEhB,oBAACI,QAAMA;QACH,MAAML;QACN,SAAS,IAAMC,QAAQ;QACvB,OAAO;QACP,OAAO;QACP,OAAM;QACN,iBAAiB;QACjB,iBAAiB;QACjB,aAAa;QACb,uBACI,wDACI,oBAACI,OAAO,YAAY;YAChB,MAAK;YACL,SAAS,IAAMP,UAAU,YAAY;0BAEzC,oBAACO,OAAO,aAAa;YAAC,MAAK;YAAgB,SAAS,IAAMJ,QAAQ;;qBAI1E,oBAAC;QAAI,WAAU;qBACX,oBAACK,QAAMA;QACH,MAAM;QACN,OAAM;QACN,aAAY;QACZ,OAAOP,GAAG,OAAO,CAAC,SAAS,IAAI;QAC/B,SAASA,GAAG,iBAAiB;QAC7B,UAAUQ,CAAAA,QAAST,UAAU,gBAAgB,CAACS,SAAS;QACvD,oBAAoB;QACpB,cAAc,IAAMT,UAAU,gBAAgB,CAAC;sBAEnD,oBAACQ,QAAMA;QACH,MAAM;QACN,OAAM;QACN,aAAY;QACZ,OAAOP,GAAG,OAAO,CAAC,GAAG,IAAI;QACzB,SAASA,GAAG,aAAa;QACzB,UAAUQ,CAAAA,QAAST,UAAU,YAAY,CAACS,SAAS;QACnD,oBAAoB;QACpB,cAAc,IAAMT,UAAU,YAAY,CAAC;sBAE/C,oBAACQ,QAAMA;QACH,MAAM;QACN,OAAM;QACN,aAAY;QACZ,OAAOP,GAAG,OAAO,CAAC,MAAM,IAAI;QAC5B,SAASA,GAAG,iBAAiB;QAC7B,UAAUQ,CAAAA,QAAST,UAAU,eAAe,CAACS,SAAS;QACtD,UAAU,CAACR,GAAG,OAAO,CAAC,GAAG;QACzB,oBAAoB;QACpB,cAAc,IAAMD,UAAU,eAAe,CAAC;sBAElD,oBAACQ,QAAMA;QACH,MAAM;QACN,OAAM;QACN,aAAY;QACZ,OAAOP,GAAG,OAAO,CAAC,SAAS,IAAI;QAC/B,SAASA,GAAG,mBAAmB;QAC/B,UAAUQ,CAAAA,QAAST,UAAU,cAAc,CAACS,SAAS;QACrD,UAAU,CAACR,GAAG,OAAO,CAAC,GAAG;QACzB,oBAAoB;QACpB,cAAc,IAAMD,UAAU,cAAc,CAAC;sBAEjD,oBAACU,aAAWA;QACR,MAAM;QACN,OAAM;QACN,aAAY;QACZ,OAAOT,GAAG,OAAO,CAAC,MAAM;QACxB,SAASJ;QACT,UAAUc,CAAAA,SAAUX,UAAU,eAAe,CAACW;;AAMtE"}
|
|
@@ -3,7 +3,7 @@ import type { IWebhookDeliveriesPagePresenter } from "../abstractions.js";
|
|
|
3
3
|
interface DeliveryListProps {
|
|
4
4
|
presenter: IWebhookDeliveriesPagePresenter;
|
|
5
5
|
}
|
|
6
|
-
export declare const DeliveryList: (({ presenter }: DeliveryListProps) => React.JSX.Element) & {
|
|
7
|
-
|
|
6
|
+
export declare const DeliveryList: (({ presenter }: DeliveryListProps) => React.JSX.Element) & React.NamedExoticComponent<DeliveryListProps> & {
|
|
7
|
+
readonly type: ({ presenter }: DeliveryListProps) => React.JSX.Element;
|
|
8
8
|
};
|
|
9
9
|
export {};
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import react, { useMemo } from "react";
|
|
1
|
+
import react, { useMemo, useState } from "react";
|
|
2
2
|
import debounce from "lodash/debounce.js";
|
|
3
3
|
import { observer } from "mobx-react-lite";
|
|
4
|
-
import { Accordion, Scrollbar, Text } from "@webiny/admin-ui";
|
|
4
|
+
import { Accordion, Scrollbar, Skeleton, Text } from "@webiny/admin-ui";
|
|
5
5
|
import { useConfirmationDialog } from "@webiny/app-admin/hooks/index.js";
|
|
6
|
-
import { DeliveryAccordionRow } from "
|
|
6
|
+
import { DeliveryAccordionRow } from "./DeliveryAccordionRow.js";
|
|
7
7
|
import { DeliveryBottomInfoBar } from "./DeliveryBottomInfoBar.js";
|
|
8
|
-
|
|
8
|
+
function useExpandedState() {
|
|
9
|
+
const [expandedId, setExpandedId] = useState(null);
|
|
10
|
+
return {
|
|
11
|
+
expandedId,
|
|
12
|
+
toggle (id) {
|
|
13
|
+
setExpandedId((prev)=>prev === id ? null : id);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const DeliveryList = observer(({ presenter })=>{
|
|
9
18
|
const { vm } = presenter;
|
|
19
|
+
const expanded = useExpandedState();
|
|
10
20
|
const { showConfirmation: showResendConfirmation } = useConfirmationDialog({
|
|
11
21
|
title: "Resend Delivery",
|
|
12
22
|
message: "Are you sure you want to resend this delivery?"
|
|
@@ -32,14 +42,20 @@ const DeliveryList_DeliveryList = observer(function({ presenter }) {
|
|
|
32
42
|
}, vm.list.rows.map((delivery)=>/*#__PURE__*/ react.createElement(DeliveryAccordionRow, {
|
|
33
43
|
key: delivery.id,
|
|
34
44
|
delivery: delivery,
|
|
35
|
-
open:
|
|
45
|
+
open: expanded.expandedId === delivery.id,
|
|
36
46
|
resending: vm.resendingIds.has(delivery.id),
|
|
37
|
-
onOpenChange: (
|
|
47
|
+
onOpenChange: ()=>expanded.toggle(delivery.id),
|
|
38
48
|
onResend: (id)=>showResendConfirmation(()=>presenter.resend(id))
|
|
39
|
-
})))
|
|
49
|
+
}))), vm.list.pagination.loadingMore ? /*#__PURE__*/ react.createElement("div", {
|
|
50
|
+
className: "flex flex-col gap-sm p-md"
|
|
51
|
+
}, /*#__PURE__*/ react.createElement(Skeleton, {
|
|
52
|
+
className: "h-8 w-full"
|
|
53
|
+
}), /*#__PURE__*/ react.createElement(Skeleton, {
|
|
54
|
+
className: "h-8 w-full"
|
|
55
|
+
})) : null), /*#__PURE__*/ react.createElement(DeliveryBottomInfoBar, {
|
|
40
56
|
presenter: presenter
|
|
41
57
|
}));
|
|
42
58
|
});
|
|
43
|
-
export {
|
|
59
|
+
export { DeliveryList };
|
|
44
60
|
|
|
45
61
|
//# sourceMappingURL=DeliveryList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport debounce from \"lodash/debounce.js\";\nimport { observer } from \"mobx-react-lite\";\nimport { Accordion, Scrollbar, Text } from \"@webiny/admin-ui\";\nimport { useConfirmationDialog } from \"@webiny/app-admin/hooks/index.js\";\nimport { DeliveryAccordionRow } from \"
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.tsx"],"sourcesContent":["import React, { useMemo, useState } from \"react\";\nimport debounce from \"lodash/debounce.js\";\nimport { observer } from \"mobx-react-lite\";\nimport { Accordion, Scrollbar, Skeleton, Text } from \"@webiny/admin-ui\";\nimport { useConfirmationDialog } from \"@webiny/app-admin/hooks/index.js\";\nimport { DeliveryAccordionRow } from \"./DeliveryAccordionRow.js\";\nimport { DeliveryBottomInfoBar } from \"./DeliveryBottomInfoBar.js\";\nimport type { IWebhookDeliveriesPagePresenter } from \"../abstractions.js\";\nimport type { WebhookDelivery } from \"~/admin/shared/types.js\";\n\ninterface ExpandedState {\n expandedId: string | null;\n toggle(id: string): void;\n}\n\nfunction useExpandedState(): ExpandedState {\n const [expandedId, setExpandedId] = useState<string | null>(null);\n return {\n expandedId,\n toggle(id: string) {\n setExpandedId(prev => (prev === id ? null : id));\n }\n };\n}\n\ninterface DeliveryListProps {\n presenter: IWebhookDeliveriesPagePresenter;\n}\n\nexport const DeliveryList = observer(({ presenter }: DeliveryListProps) => {\n const { vm } = presenter;\n const expanded = useExpandedState();\n\n const { showConfirmation: showResendConfirmation } = useConfirmationDialog({\n title: \"Resend Delivery\",\n message: \"Are you sure you want to resend this delivery?\"\n });\n\n const loadMoreOnScroll = useMemo(\n () =>\n debounce(async ({ scrollFrame }: { scrollFrame: { top: number } }) => {\n if (scrollFrame.top > 0.8) {\n await presenter.loadMore();\n }\n }, 200),\n [presenter]\n );\n\n if (vm.list.rows.length === 0 && !vm.loading) {\n return (\n <div className=\"flex justify-center py-xl\">\n <Text className=\"text-neutral-strong\">No deliveries found.</Text>\n </div>\n );\n }\n\n return (\n <div className=\"flex-1 overflow-hidden relative\">\n <Scrollbar onScrollFrame={scrollFrame => loadMoreOnScroll({ scrollFrame })}>\n <Accordion variant=\"underline\">\n {vm.list.rows.map((delivery: WebhookDelivery) => (\n <DeliveryAccordionRow\n key={delivery.id}\n delivery={delivery}\n open={expanded.expandedId === delivery.id}\n resending={vm.resendingIds.has(delivery.id)}\n onOpenChange={() => expanded.toggle(delivery.id)}\n onResend={id => showResendConfirmation(() => presenter.resend(id))}\n />\n ))}\n </Accordion>\n {vm.list.pagination.loadingMore ? (\n <div className=\"flex flex-col gap-sm p-md\">\n <Skeleton className=\"h-8 w-full\" />\n <Skeleton className=\"h-8 w-full\" />\n </div>\n ) : null}\n </Scrollbar>\n <DeliveryBottomInfoBar presenter={presenter} />\n </div>\n );\n});\n"],"names":["useExpandedState","expandedId","setExpandedId","useState","id","prev","DeliveryList","observer","presenter","vm","expanded","showResendConfirmation","useConfirmationDialog","loadMoreOnScroll","useMemo","debounce","scrollFrame","Text","Scrollbar","Accordion","delivery","DeliveryAccordionRow","Skeleton","DeliveryBottomInfoBar"],"mappings":";;;;;;;AAeA,SAASA;IACL,MAAM,CAACC,YAAYC,cAAc,GAAGC,SAAwB;IAC5D,OAAO;QACHF;QACA,QAAOG,EAAU;YACbF,cAAcG,CAAAA,OAASA,SAASD,KAAK,OAAOA;QAChD;IACJ;AACJ;AAMO,MAAME,eAAeC,SAAS,CAAC,EAAEC,SAAS,EAAqB;IAClE,MAAM,EAAEC,EAAE,EAAE,GAAGD;IACf,MAAME,WAAWV;IAEjB,MAAM,EAAE,kBAAkBW,sBAAsB,EAAE,GAAGC,sBAAsB;QACvE,OAAO;QACP,SAAS;IACb;IAEA,MAAMC,mBAAmBC,QACrB,IACIC,SAAS,OAAO,EAAEC,WAAW,EAAoC;YAC7D,IAAIA,YAAY,GAAG,GAAG,KAClB,MAAMR,UAAU,QAAQ;QAEhC,GAAG,MACP;QAACA;KAAU;IAGf,IAAIC,AAAwB,MAAxBA,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,IAAU,CAACA,GAAG,OAAO,EACxC,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAACQ,MAAIA;QAAC,WAAU;OAAsB;IAKlD,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAACC,WAASA;QAAC,eAAeF,CAAAA,cAAeH,iBAAiB;gBAAEG;YAAY;qBACpE,oBAACG,WAASA;QAAC,SAAQ;OACdV,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAACW,WAAAA,WAAAA,GACf,oBAACC,sBAAoBA;YACjB,KAAKD,SAAS,EAAE;YAChB,UAAUA;YACV,MAAMV,SAAS,UAAU,KAAKU,SAAS,EAAE;YACzC,WAAWX,GAAG,YAAY,CAAC,GAAG,CAACW,SAAS,EAAE;YAC1C,cAAc,IAAMV,SAAS,MAAM,CAACU,SAAS,EAAE;YAC/C,UAAUhB,CAAAA,KAAMO,uBAAuB,IAAMH,UAAU,MAAM,CAACJ;cAIzEK,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,GAAG,WAAH,GAC3B,oBAAC;QAAI,WAAU;qBACX,oBAACa,UAAQA;QAAC,WAAU;sBACpB,oBAACA,UAAQA;QAAC,WAAU;UAExB,qBAER,oBAACC,uBAAqBA;QAAC,WAAWf;;AAG9C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { useRouter } from "@webiny/app-admin";
|
|
3
|
+
import { Button } from "@webiny/admin-ui";
|
|
4
|
+
import { ReactComponent } from "@webiny/icons/list.svg";
|
|
5
|
+
import { Routes } from "../../../routes.js";
|
|
6
|
+
const WebhookDefinitionsButton = ()=>{
|
|
7
|
+
const { goToRoute } = useRouter();
|
|
8
|
+
return /*#__PURE__*/ react.createElement(Button, {
|
|
9
|
+
variant: "secondary",
|
|
10
|
+
onClick: ()=>goToRoute(Routes.List),
|
|
11
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null)
|
|
12
|
+
}, "Webhooks");
|
|
13
|
+
};
|
|
14
|
+
export { WebhookDefinitionsButton };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=WebhookDefinitionsButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.tsx"],"sourcesContent":["import React from \"react\";\nimport { useRouter } from \"@webiny/app-admin\";\nimport { Button } from \"@webiny/admin-ui\";\nimport { ReactComponent as ListIcon } from \"@webiny/icons/list.svg\";\nimport { Routes } from \"~/admin/routes.js\";\n\nexport const WebhookDefinitionsButton = () => {\n const { goToRoute } = useRouter();\n\n return (\n <Button variant=\"secondary\" onClick={() => goToRoute(Routes.List)} icon={<ListIcon />}>\n Webhooks\n </Button>\n );\n};\n"],"names":["WebhookDefinitionsButton","goToRoute","useRouter","Button","Routes","ListIcon"],"mappings":";;;;;AAMO,MAAMA,2BAA2B;IACpC,MAAM,EAAEC,SAAS,EAAE,GAAGC;IAEtB,OAAO,WAAP,GACI,oBAACC,QAAMA;QAAC,SAAQ;QAAY,SAAS,IAAMF,UAAUG,OAAO,IAAI;QAAG,oBAAM,oBAACC,gBAAQA;OAAK;AAI/F"}
|
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
import react, { useEffect, useMemo } from "react";
|
|
2
2
|
import { observer } from "mobx-react-lite";
|
|
3
|
-
import { DiContainerProvider, useContainer, useFeature } from "@webiny/app";
|
|
4
|
-
import { Button, Heading, Skeleton, Text } from "@webiny/admin-ui";
|
|
3
|
+
import { DiContainerProvider, useContainer, useFeature, useRoute } from "@webiny/app";
|
|
4
|
+
import { Button, Heading, Separator, Skeleton, Text } from "@webiny/admin-ui";
|
|
5
5
|
import { ListWebhookDeliveriesFeature } from "../../../features/listWebhookDeliveries/feature.js";
|
|
6
6
|
import { ListAvailableEventsFeature } from "../../../features/listAvailableEvents/feature.js";
|
|
7
7
|
import { ResendWebhookDeliveryFeature } from "../../../features/resendWebhookDelivery/feature.js";
|
|
8
|
+
import { ListWebhooksFeature } from "../../../features/ListWebhooks/feature.js";
|
|
8
9
|
import { WebhookDeliveriesPagePresenterFeature } from "../feature.js";
|
|
10
|
+
import { Routes } from "../../../routes.js";
|
|
9
11
|
import { DeliveryFilters } from "./DeliveryFilters.js";
|
|
10
12
|
import { DeliveryList } from "./DeliveryList.js";
|
|
13
|
+
import { WebhookDefinitionsButton } from "./WebhookDefinitionsButton.js";
|
|
14
|
+
const Loader = ()=>/*#__PURE__*/ react.createElement("div", {
|
|
15
|
+
className: "flex flex-col gap-sm p-md"
|
|
16
|
+
}, /*#__PURE__*/ react.createElement(Skeleton, {
|
|
17
|
+
className: "h-8 w-full"
|
|
18
|
+
}), /*#__PURE__*/ react.createElement(Skeleton, {
|
|
19
|
+
className: "h-8 w-full"
|
|
20
|
+
}), /*#__PURE__*/ react.createElement(Skeleton, {
|
|
21
|
+
className: "h-8 w-full"
|
|
22
|
+
}));
|
|
11
23
|
const WebhookDeliveriesPage_WebhookDeliveriesPageInner = observer(function() {
|
|
12
24
|
const { presenter } = useFeature(WebhookDeliveriesPagePresenterFeature);
|
|
25
|
+
const { route } = useRoute(Routes.Deliveries);
|
|
26
|
+
const webhookId = route?.params?.webhookId;
|
|
13
27
|
useEffect(()=>{
|
|
14
|
-
presenter.init();
|
|
28
|
+
presenter.init(webhookId);
|
|
15
29
|
}, [
|
|
16
|
-
presenter
|
|
30
|
+
presenter,
|
|
31
|
+
webhookId
|
|
17
32
|
]);
|
|
18
33
|
const { vm } = presenter;
|
|
19
|
-
if (vm.loading && 0 === vm.list.rows.length) return /*#__PURE__*/ react.createElement("div", {
|
|
20
|
-
className: "flex flex-col gap-sm p-md"
|
|
21
|
-
}, /*#__PURE__*/ react.createElement(Skeleton, {
|
|
22
|
-
className: "h-10 w-full"
|
|
23
|
-
}), /*#__PURE__*/ react.createElement(Skeleton, {
|
|
24
|
-
className: "h-10 w-full"
|
|
25
|
-
}), /*#__PURE__*/ react.createElement(Skeleton, {
|
|
26
|
-
className: "h-10 w-full"
|
|
27
|
-
}));
|
|
28
34
|
if (vm.error) return /*#__PURE__*/ react.createElement("div", {
|
|
29
35
|
className: "flex flex-col items-center gap-sm p-md"
|
|
30
36
|
}, /*#__PURE__*/ react.createElement(Text, null, vm.error), /*#__PURE__*/ react.createElement(Button, {
|
|
@@ -34,12 +40,14 @@ const WebhookDeliveriesPage_WebhookDeliveriesPageInner = observer(function() {
|
|
|
34
40
|
return /*#__PURE__*/ react.createElement("div", {
|
|
35
41
|
className: "flex flex-col h-main-content"
|
|
36
42
|
}, /*#__PURE__*/ react.createElement("div", {
|
|
37
|
-
className: "
|
|
43
|
+
className: "flex items-center justify-between py-sm px-md"
|
|
38
44
|
}, /*#__PURE__*/ react.createElement(Heading, {
|
|
39
|
-
level:
|
|
40
|
-
}, "
|
|
45
|
+
level: 5
|
|
46
|
+
}, "Webhook Deliveries"), /*#__PURE__*/ react.createElement("div", {
|
|
47
|
+
className: "flex items-center gap-sm"
|
|
48
|
+
}, /*#__PURE__*/ react.createElement(DeliveryFilters, {
|
|
41
49
|
presenter: presenter
|
|
42
|
-
})), /*#__PURE__*/ react.createElement(DeliveryList, {
|
|
50
|
+
}), /*#__PURE__*/ react.createElement(WebhookDefinitionsButton, null))), /*#__PURE__*/ react.createElement(Separator, null), vm.loading ? /*#__PURE__*/ react.createElement(Loader, null) : /*#__PURE__*/ react.createElement(DeliveryList, {
|
|
43
51
|
presenter: presenter
|
|
44
52
|
}));
|
|
45
53
|
});
|
|
@@ -50,6 +58,7 @@ const WebhookDeliveriesPage = ()=>{
|
|
|
50
58
|
ListWebhookDeliveriesFeature.register(child);
|
|
51
59
|
ListAvailableEventsFeature.register(child);
|
|
52
60
|
ResendWebhookDeliveryFeature.register(child);
|
|
61
|
+
ListWebhooksFeature.register(child);
|
|
53
62
|
WebhookDeliveriesPagePresenterFeature.register(child);
|
|
54
63
|
return child;
|
|
55
64
|
}, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.tsx"],"sourcesContent":["import React, { useMemo, useEffect } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { DiContainerProvider, useContainer, useFeature } from \"@webiny/app\";\nimport { Button, Heading,
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.tsx"],"sourcesContent":["import React, { useMemo, useEffect } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { DiContainerProvider, useContainer, useFeature, useRoute } from \"@webiny/app\";\nimport { Separator } from \"@webiny/admin-ui\";\nimport { Skeleton } from \"@webiny/admin-ui\";\nimport { Button, Heading, Text } from \"@webiny/admin-ui\";\nimport { ListWebhookDeliveriesFeature } from \"~/admin/features/listWebhookDeliveries/feature.js\";\nimport { ListAvailableEventsFeature } from \"~/admin/features/listAvailableEvents/feature.js\";\nimport { ResendWebhookDeliveryFeature } from \"~/admin/features/resendWebhookDelivery/feature.js\";\nimport { ListWebhooksFeature } from \"~/admin/features/ListWebhooks/feature.js\";\nimport { WebhookDeliveriesPagePresenterFeature } from \"../feature.js\";\nimport { Routes } from \"~/admin/routes.js\";\nimport { DeliveryFilters } from \"./DeliveryFilters.js\";\nimport { DeliveryList } from \"./DeliveryList.js\";\nimport { WebhookDefinitionsButton } from \"~/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js\";\n\nconst Loader = () => {\n return (\n <div className=\"flex flex-col gap-sm p-md\">\n <Skeleton className=\"h-8 w-full\" />\n <Skeleton className=\"h-8 w-full\" />\n <Skeleton className=\"h-8 w-full\" />\n </div>\n );\n};\n\nconst WebhookDeliveriesPageInner = observer(function WebhookDeliveriesPageInner() {\n const { presenter } = useFeature(WebhookDeliveriesPagePresenterFeature);\n const { route } = useRoute(Routes.Deliveries);\n const webhookId = route?.params?.webhookId;\n\n useEffect(() => {\n void presenter.init(webhookId);\n }, [presenter, webhookId]);\n\n const { vm } = presenter;\n\n if (vm.error) {\n return (\n <div className=\"flex flex-col items-center gap-sm p-md\">\n <Text>{vm.error}</Text>\n <Button variant=\"secondary\" onClick={() => void presenter.init()}>\n Retry\n </Button>\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-col h-main-content\">\n <div className=\"flex items-center justify-between py-sm px-md\">\n <Heading level={5}>Webhook Deliveries</Heading>\n <div className=\"flex items-center gap-sm\">\n <DeliveryFilters presenter={presenter} />\n <WebhookDefinitionsButton />\n </div>\n </div>\n <Separator />\n {vm.loading ? <Loader /> : <DeliveryList presenter={presenter} />}\n </div>\n );\n});\n\nexport const WebhookDeliveriesPage = () => {\n const container = useContainer();\n\n const scopedContainer = useMemo(() => {\n const child = container.createChildContainer();\n ListWebhookDeliveriesFeature.register(child);\n ListAvailableEventsFeature.register(child);\n ResendWebhookDeliveryFeature.register(child);\n ListWebhooksFeature.register(child);\n WebhookDeliveriesPagePresenterFeature.register(child);\n return child;\n }, [container]);\n\n return (\n <DiContainerProvider container={scopedContainer}>\n <WebhookDeliveriesPageInner />\n </DiContainerProvider>\n );\n};\n"],"names":["Loader","Skeleton","WebhookDeliveriesPageInner","observer","presenter","useFeature","WebhookDeliveriesPagePresenterFeature","route","useRoute","Routes","webhookId","useEffect","vm","Text","Button","Heading","DeliveryFilters","WebhookDefinitionsButton","Separator","DeliveryList","WebhookDeliveriesPage","container","useContainer","scopedContainer","useMemo","child","ListWebhookDeliveriesFeature","ListAvailableEventsFeature","ResendWebhookDeliveryFeature","ListWebhooksFeature","DiContainerProvider"],"mappings":";;;;;;;;;;;;;AAgBA,MAAMA,SAAS,IACJ,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAACC,UAAQA;QAAC,WAAU;sBACpB,oBAACA,UAAQA;QAAC,WAAU;sBACpB,oBAACA,UAAQA;QAAC,WAAU;;AAKhC,MAAMC,mDAA6BC,SAAS;IACxC,MAAM,EAAEC,SAAS,EAAE,GAAGC,WAAWC;IACjC,MAAM,EAAEC,KAAK,EAAE,GAAGC,SAASC,OAAO,UAAU;IAC5C,MAAMC,YAAYH,OAAO,QAAQ;IAEjCI,UAAU;QACDP,UAAU,IAAI,CAACM;IACxB,GAAG;QAACN;QAAWM;KAAU;IAEzB,MAAM,EAAEE,EAAE,EAAE,GAAGR;IAEf,IAAIQ,GAAG,KAAK,EACR,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAACC,MAAIA,MAAED,GAAG,KAAK,iBACf,oBAACE,QAAMA;QAAC,SAAQ;QAAY,SAAS,IAAM,KAAKV,UAAU,IAAI;OAAI;IAO9E,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAAC;QAAI,WAAU;qBACX,oBAACW,SAAOA;QAAC,OAAO;OAAG,qCACnB,oBAAC;QAAI,WAAU;qBACX,oBAACC,iBAAeA;QAAC,WAAWZ;sBAC5B,oBAACa,0BAAwBA,SAAAA,WAAAA,GAGjC,oBAACC,WAASA,OACTN,GAAG,OAAO,GAAG,WAAH,GAAG,oBAACZ,QAAMA,QAAAA,WAAAA,GAAM,oBAACmB,cAAYA;QAAC,WAAWf;;AAGhE;AAEO,MAAMgB,wBAAwB;IACjC,MAAMC,YAAYC;IAElB,MAAMC,kBAAkBC,QAAQ;QAC5B,MAAMC,QAAQJ,UAAU,oBAAoB;QAC5CK,6BAA6B,QAAQ,CAACD;QACtCE,2BAA2B,QAAQ,CAACF;QACpCG,6BAA6B,QAAQ,CAACH;QACtCI,oBAAoB,QAAQ,CAACJ;QAC7BnB,sCAAsC,QAAQ,CAACmB;QAC/C,OAAOA;IACX,GAAG;QAACJ;KAAU;IAEd,OAAO,WAAP,GACI,oBAACS,qBAAmBA;QAAC,WAAWP;qBAC5B,oBAACrB,kDAA0BA;AAGvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const statusVariant: (status: string) => "destructive" | "success" | "warning";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/statusVariant.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/statusVariant.ts"],"sourcesContent":["export const statusVariant = (status: string) => {\n switch (status) {\n case \"delivered\":\n return \"success\" as const;\n case \"failed\":\n return \"destructive\" as const;\n default:\n return \"warning\" as const;\n }\n};\n"],"names":["statusVariant","status"],"mappings":"AAAO,MAAMA,gBAAgB,CAACC;IAC1B,OAAQA;QACJ,KAAK;YACD,OAAO;QACX,KAAK;YACD,OAAO;QACX;YACI,OAAO;IACf;AACJ"}
|
|
@@ -18,7 +18,6 @@ declare class WebhookFormPresenterImpl implements IWebhookFormPresenter {
|
|
|
18
18
|
private _saving;
|
|
19
19
|
private _isNew;
|
|
20
20
|
private _webhook;
|
|
21
|
-
private _showDeliveries;
|
|
22
21
|
private _webhookId;
|
|
23
22
|
private _form;
|
|
24
23
|
private _entityFieldNames;
|
|
@@ -30,10 +29,8 @@ declare class WebhookFormPresenterImpl implements IWebhookFormPresenter {
|
|
|
30
29
|
private addEventFields;
|
|
31
30
|
private collectEvents;
|
|
32
31
|
private distributeEvents;
|
|
33
|
-
save(): Promise<
|
|
32
|
+
save(): Promise<boolean>;
|
|
34
33
|
deleteWebhook(): Promise<void>;
|
|
35
|
-
openDeliveries(): void;
|
|
36
|
-
closeDeliveries(): void;
|
|
37
34
|
init(id: string): Promise<void>;
|
|
38
35
|
}
|
|
39
36
|
export declare const WebhookFormPresenter: typeof WebhookFormPresenterImpl & {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computed, makeAutoObservable, runInAction } from "mobx";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import { WebhookFormPresenter } from "./abstractions.js";
|
|
3
4
|
import { GetWebhookUseCase } from "../../features/getWebhook/abstractions.js";
|
|
4
5
|
import { CreateWebhookUseCase } from "../../features/createWebhook/abstractions.js";
|
|
@@ -14,7 +15,6 @@ class WebhookFormPresenterImpl {
|
|
|
14
15
|
saving: this._saving,
|
|
15
16
|
isNew: this._isNew,
|
|
16
17
|
webhook: this._webhook,
|
|
17
|
-
showDeliveries: this._showDeliveries,
|
|
18
18
|
permissions: {
|
|
19
19
|
canEdit: this.permissions.canEdit("webhook"),
|
|
20
20
|
canDelete: this.permissions.canDelete("webhook")
|
|
@@ -34,7 +34,6 @@ class WebhookFormPresenterImpl {
|
|
|
34
34
|
this._saving = false;
|
|
35
35
|
this._isNew = false;
|
|
36
36
|
this._webhook = null;
|
|
37
|
-
this._showDeliveries = false;
|
|
38
37
|
this._webhookId = null;
|
|
39
38
|
this._entityFieldNames = [];
|
|
40
39
|
this._entityGroups = new Map();
|
|
@@ -47,10 +46,10 @@ class WebhookFormPresenterImpl {
|
|
|
47
46
|
return this.formModelFactory.create({
|
|
48
47
|
fields: (fields)=>({
|
|
49
48
|
name: fields.text().label("Name").required("Name is required"),
|
|
50
|
-
slug: fields.text().label("Slug").required("Slug is required").computedUntilDirty((form)=>{
|
|
49
|
+
slug: fields.text().label("Slug").required("Slug is required").computedUntilDirty(({ form })=>{
|
|
51
50
|
const name = String(form.field("name").getValue() ?? "");
|
|
52
51
|
return name.trim().toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-");
|
|
53
|
-
}),
|
|
52
|
+
}).schema(z.string().min(3, "Slug must be at least 3 characters long")),
|
|
54
53
|
endpointUrl: fields.text().label("Endpoint URL").required("Endpoint URL is required").placeholder("https://"),
|
|
55
54
|
description: fields.text().label("Description").renderer("textarea"),
|
|
56
55
|
enabled: fields.boolean().label("Enabled").defaultValue(false)
|
|
@@ -159,8 +158,10 @@ class WebhookFormPresenterImpl {
|
|
|
159
158
|
}
|
|
160
159
|
async save() {
|
|
161
160
|
const data = await this._form.submit();
|
|
162
|
-
if (false === data) return;
|
|
163
|
-
|
|
161
|
+
if (false === data) return false;
|
|
162
|
+
runInAction(()=>{
|
|
163
|
+
this._saving = true;
|
|
164
|
+
});
|
|
164
165
|
try {
|
|
165
166
|
const merged = {
|
|
166
167
|
name: data.name,
|
|
@@ -189,17 +190,12 @@ class WebhookFormPresenterImpl {
|
|
|
189
190
|
this._saving = false;
|
|
190
191
|
});
|
|
191
192
|
}
|
|
193
|
+
return true;
|
|
192
194
|
}
|
|
193
195
|
async deleteWebhook() {
|
|
194
196
|
if (!this._webhookId || this._isNew) return;
|
|
195
197
|
await this.deleteWebhookUseCase.execute(this._webhookId);
|
|
196
198
|
}
|
|
197
|
-
openDeliveries() {
|
|
198
|
-
this._showDeliveries = true;
|
|
199
|
-
}
|
|
200
|
-
closeDeliveries() {
|
|
201
|
-
this._showDeliveries = false;
|
|
202
|
-
}
|
|
203
199
|
async init(id) {
|
|
204
200
|
this._loading = true;
|
|
205
201
|
this._isNew = "new" === id;
|