Fix commented issues
This commit is contained in:
parent
fa5151241a
commit
7bd69bf833
17 changed files with 64 additions and 174 deletions
|
@ -11,8 +11,7 @@ import {
|
||||||
AuthorizationKeyType,
|
AuthorizationKeyType,
|
||||||
OrderStatus,
|
OrderStatus,
|
||||||
PaymentChargeStatusEnum,
|
PaymentChargeStatusEnum,
|
||||||
TaxRateType,
|
TaxRateType
|
||||||
WebhookEventTypeEnum
|
|
||||||
} from "./types/globalTypes";
|
} from "./types/globalTypes";
|
||||||
|
|
||||||
export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<
|
export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<
|
||||||
|
|
|
@ -6,7 +6,7 @@ import FormSpacer from "@saleor/components/FormSpacer";
|
||||||
import Grid from "@saleor/components/Grid";
|
import Grid from "@saleor/components/Grid";
|
||||||
import PageHeader from "@saleor/components/PageHeader";
|
import PageHeader from "@saleor/components/PageHeader";
|
||||||
import SaveButtonBar from "@saleor/components/SaveButtonBar";
|
import SaveButtonBar from "@saleor/components/SaveButtonBar";
|
||||||
import useStateFromProps from "@saleor/hooks/useStateFromProps";
|
import { SearchServiceAccount_serviceAccounts_edges_node } from "@saleor/containers/SearchServiceAccount/types/SearchServiceAccount";
|
||||||
import { sectionNames } from "@saleor/intl";
|
import { sectionNames } from "@saleor/intl";
|
||||||
import { maybe } from "@saleor/misc";
|
import { maybe } from "@saleor/misc";
|
||||||
import { UserError } from "@saleor/types";
|
import { UserError } from "@saleor/types";
|
||||||
|
@ -32,12 +32,9 @@ export interface FormData {
|
||||||
export interface WebhookCreatePageProps {
|
export interface WebhookCreatePageProps {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
errors: UserError[];
|
errors: UserError[];
|
||||||
services?: Array<{
|
services?: SearchServiceAccount_serviceAccounts_edges_node[];
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
}>;
|
|
||||||
saveButtonBarState: ConfirmButtonTransitionState;
|
saveButtonBarState: ConfirmButtonTransitionState;
|
||||||
fetchServiceAccount: (data: string) => void;
|
fetchServiceAccounts: (data: string) => void;
|
||||||
onBack: () => void;
|
onBack: () => void;
|
||||||
onSubmit: (data: FormData) => void;
|
onSubmit: (data: FormData) => void;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +44,7 @@ const WebhookCreatePage: React.StatelessComponent<WebhookCreatePageProps> = ({
|
||||||
errors,
|
errors,
|
||||||
saveButtonBarState,
|
saveButtonBarState,
|
||||||
services,
|
services,
|
||||||
fetchServiceAccount,
|
fetchServiceAccounts,
|
||||||
onBack,
|
onBack,
|
||||||
onSubmit
|
onSubmit
|
||||||
}) => {
|
}) => {
|
||||||
|
@ -62,10 +59,9 @@ const WebhookCreatePage: React.StatelessComponent<WebhookCreatePageProps> = ({
|
||||||
serviceAccount: "",
|
serviceAccount: "",
|
||||||
targetUrl: ""
|
targetUrl: ""
|
||||||
};
|
};
|
||||||
const [
|
const [selectedServiceAcccount, setSelectedServiceAcccount] = React.useState(
|
||||||
selectedServiceAcccounts,
|
""
|
||||||
setSelectedServiceAcccounts
|
);
|
||||||
] = useStateFromProps("");
|
|
||||||
const servicesChoiceList = maybe(
|
const servicesChoiceList = maybe(
|
||||||
() =>
|
() =>
|
||||||
services.map(node => ({
|
services.map(node => ({
|
||||||
|
@ -80,7 +76,7 @@ const WebhookCreatePage: React.StatelessComponent<WebhookCreatePageProps> = ({
|
||||||
{({ data, errors, hasChanged, submit, change }) => {
|
{({ data, errors, hasChanged, submit, change }) => {
|
||||||
const handleServiceSelect = createSingleAutocompleteSelectHandler(
|
const handleServiceSelect = createSingleAutocompleteSelectHandler(
|
||||||
change,
|
change,
|
||||||
setSelectedServiceAcccounts,
|
setSelectedServiceAcccount,
|
||||||
servicesChoiceList
|
servicesChoiceList
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
|
@ -99,9 +95,9 @@ const WebhookCreatePage: React.StatelessComponent<WebhookCreatePageProps> = ({
|
||||||
<WebhookInfo
|
<WebhookInfo
|
||||||
data={data}
|
data={data}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
serviceDisplayValue={selectedServiceAcccounts}
|
serviceDisplayValue={selectedServiceAcccount}
|
||||||
services={servicesChoiceList}
|
services={servicesChoiceList}
|
||||||
fetchServiceAccount={fetchServiceAccount}
|
fetchServiceAccounts={fetchServiceAccounts}
|
||||||
errors={errors}
|
errors={errors}
|
||||||
serviceOnChange={handleServiceSelect}
|
serviceOnChange={handleServiceSelect}
|
||||||
onChange={change}
|
onChange={change}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import WebhookCreatePage, { WebhookCreatePageProps } from "./WebhookCreatePage";
|
||||||
const props: WebhookCreatePageProps = {
|
const props: WebhookCreatePageProps = {
|
||||||
disabled: false,
|
disabled: false,
|
||||||
errors: [],
|
errors: [],
|
||||||
fetchServiceAccount: () => undefined,
|
fetchServiceAccounts: () => undefined,
|
||||||
onBack: () => undefined,
|
onBack: () => undefined,
|
||||||
onSubmit: () => undefined,
|
onSubmit: () => undefined,
|
||||||
saveButtonBarState: "default",
|
saveButtonBarState: "default",
|
||||||
|
|
|
@ -14,6 +14,6 @@ const props: WebhookDeleteDialogProps = {
|
||||||
open: true
|
open: true
|
||||||
};
|
};
|
||||||
|
|
||||||
storiesOf("Views / Services / Delete service", module)
|
storiesOf("Views / Webhooks / Delete webhook", module)
|
||||||
.addDecorator(Decorator)
|
.addDecorator(Decorator)
|
||||||
.add("default", () => <WebhookDeleteDialog {...props} />);
|
.add("default", () => <WebhookDeleteDialog {...props} />);
|
||||||
|
|
|
@ -64,7 +64,7 @@ const WebhookEvents: React.StatelessComponent<WebhookEventsProps> = ({
|
||||||
name: "events",
|
name: "events",
|
||||||
value: event.target.value ? WebhookEventTypeEnum.ANY_EVENTS : []
|
value: event.target.value ? WebhookEventTypeEnum.ANY_EVENTS : []
|
||||||
}
|
}
|
||||||
} as any)
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleEventsChange = (event: ChangeEvent) => {
|
const handleEventsChange = (event: ChangeEvent) => {
|
||||||
|
@ -75,7 +75,7 @@ const WebhookEvents: React.StatelessComponent<WebhookEventsProps> = ({
|
||||||
? data.events.concat([event.target.name])
|
? data.events.concat([event.target.name])
|
||||||
: data.events.filter(events => events !== event.target.name)
|
: data.events.filter(events => events !== event.target.name)
|
||||||
}
|
}
|
||||||
} as any);
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -104,19 +104,17 @@ const WebhookEvents: React.StatelessComponent<WebhookEventsProps> = ({
|
||||||
{!data.allEvents && (
|
{!data.allEvents && (
|
||||||
<>
|
<>
|
||||||
<Hr />
|
<Hr />
|
||||||
{eventsEnum.slice(1).map(event => {
|
{eventsEnum.slice(1).map(event => (
|
||||||
return (
|
<div key={event}>
|
||||||
<div key={event}>
|
<ControlledCheckbox
|
||||||
<ControlledCheckbox
|
checked={data.events.includes(event)}
|
||||||
checked={data.events.includes(event)}
|
disabled={disabled}
|
||||||
disabled={disabled}
|
label={translatedEvents[event]}
|
||||||
label={translatedEvents[event]}
|
name={event}
|
||||||
name={event}
|
onChange={handleEventsChange}
|
||||||
onChange={handleEventsChange}
|
/>
|
||||||
/>
|
</div>
|
||||||
</div>
|
))}
|
||||||
);
|
|
||||||
})}
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|
|
@ -26,7 +26,7 @@ interface WebhookInfoProps {
|
||||||
errors: FormErrors<"name" | "targetUrl" | "secretKey">;
|
errors: FormErrors<"name" | "targetUrl" | "secretKey">;
|
||||||
onChange: (event: React.ChangeEvent<any>) => void;
|
onChange: (event: React.ChangeEvent<any>) => void;
|
||||||
serviceOnChange: (event: ChangeEvent) => void;
|
serviceOnChange: (event: ChangeEvent) => void;
|
||||||
fetchServiceAccount: (data: string) => void;
|
fetchServiceAccounts: (data: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = makeStyles(() => ({
|
const useStyles = makeStyles(() => ({
|
||||||
|
@ -45,7 +45,7 @@ const WebhookInfo: React.StatelessComponent<WebhookInfoProps> = ({
|
||||||
disabled,
|
disabled,
|
||||||
services,
|
services,
|
||||||
serviceDisplayValue,
|
serviceDisplayValue,
|
||||||
fetchServiceAccount,
|
fetchServiceAccounts,
|
||||||
errors,
|
errors,
|
||||||
onChange,
|
onChange,
|
||||||
serviceOnChange
|
serviceOnChange
|
||||||
|
@ -97,7 +97,7 @@ const WebhookInfo: React.StatelessComponent<WebhookInfoProps> = ({
|
||||||
onChange={serviceOnChange}
|
onChange={serviceOnChange}
|
||||||
value={data.serviceAccount}
|
value={data.serviceAccount}
|
||||||
choices={services}
|
choices={services}
|
||||||
fetchChoices={fetchServiceAccount}
|
fetchChoices={fetchServiceAccounts}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
autoComplete: "off"
|
autoComplete: "off"
|
||||||
}}
|
}}
|
||||||
|
@ -107,7 +107,7 @@ const WebhookInfo: React.StatelessComponent<WebhookInfoProps> = ({
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
error={!!errors.targetUrl}
|
error={!!errors.targetUrl}
|
||||||
helperText={intl.formatMessage({
|
helperText={intl.formatMessage({
|
||||||
defaultMessage: "This URL will recieve webhook POST requests",
|
defaultMessage: "This URL will receive webhook POST requests",
|
||||||
description: "webhook target url help text"
|
description: "webhook target url help text"
|
||||||
})}
|
})}
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
|
|
|
@ -10,7 +10,7 @@ import WebhooksDetailsPage, {
|
||||||
const props: WebhooksDetailsPageProps = {
|
const props: WebhooksDetailsPageProps = {
|
||||||
disabled: false,
|
disabled: false,
|
||||||
errors: [],
|
errors: [],
|
||||||
fetchServiceAccount: () => undefined,
|
fetchServiceAccounts: () => undefined,
|
||||||
onBack: () => undefined,
|
onBack: () => undefined,
|
||||||
onDelete: () => undefined,
|
onDelete: () => undefined,
|
||||||
onSubmit: () => undefined,
|
onSubmit: () => undefined,
|
||||||
|
|
|
@ -6,6 +6,7 @@ import FormSpacer from "@saleor/components/FormSpacer";
|
||||||
import Grid from "@saleor/components/Grid";
|
import Grid from "@saleor/components/Grid";
|
||||||
import PageHeader from "@saleor/components/PageHeader";
|
import PageHeader from "@saleor/components/PageHeader";
|
||||||
import SaveButtonBar from "@saleor/components/SaveButtonBar";
|
import SaveButtonBar from "@saleor/components/SaveButtonBar";
|
||||||
|
import { SearchServiceAccount_serviceAccounts_edges_node } from "@saleor/containers/SearchServiceAccount/types/SearchServiceAccount";
|
||||||
import useStateFromProps from "@saleor/hooks/useStateFromProps";
|
import useStateFromProps from "@saleor/hooks/useStateFromProps";
|
||||||
import { sectionNames } from "@saleor/intl";
|
import { sectionNames } from "@saleor/intl";
|
||||||
import { maybe } from "@saleor/misc";
|
import { maybe } from "@saleor/misc";
|
||||||
|
@ -15,7 +16,7 @@ import createSingleAutocompleteSelectHandler from "@saleor/utils/handlers/single
|
||||||
import WebhookEvents from "@saleor/webhooks/components/WebhookEvents";
|
import WebhookEvents from "@saleor/webhooks/components/WebhookEvents";
|
||||||
import WebhookInfo from "@saleor/webhooks/components/WebhookInfo";
|
import WebhookInfo from "@saleor/webhooks/components/WebhookInfo";
|
||||||
import WebhookStatus from "@saleor/webhooks/components/WebhookStatus";
|
import WebhookStatus from "@saleor/webhooks/components/WebhookStatus";
|
||||||
import { Webhook_webhook } from "@saleor/webhooks/types/Webhook";
|
import { WebhookDetails_webhook } from "@saleor/webhooks/types/WebhookDetails";
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useIntl } from "react-intl";
|
import { useIntl } from "react-intl";
|
||||||
|
@ -34,27 +35,22 @@ export interface FormData {
|
||||||
export interface WebhooksDetailsPageProps {
|
export interface WebhooksDetailsPageProps {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
errors: UserError[];
|
errors: UserError[];
|
||||||
webhook: Webhook_webhook;
|
webhook: WebhookDetails_webhook;
|
||||||
services?: Array<{
|
services?: SearchServiceAccount_serviceAccounts_edges_node[];
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
}>;
|
|
||||||
saveButtonBarState: ConfirmButtonTransitionState;
|
saveButtonBarState: ConfirmButtonTransitionState;
|
||||||
onBack: () => void;
|
onBack: () => void;
|
||||||
onDelete: () => void;
|
onDelete: () => void;
|
||||||
fetchServiceAccount: (data: string) => void;
|
fetchServiceAccounts: (data: string) => void;
|
||||||
onSubmit: (data: FormData) => void;
|
onSubmit: (data: FormData) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const WebhooksDetailsPage: React.StatelessComponent<
|
const WebhooksDetailsPage: React.FC<WebhooksDetailsPageProps> = ({
|
||||||
WebhooksDetailsPageProps
|
|
||||||
> = ({
|
|
||||||
disabled,
|
disabled,
|
||||||
errors,
|
errors,
|
||||||
webhook,
|
webhook,
|
||||||
saveButtonBarState,
|
saveButtonBarState,
|
||||||
services,
|
services,
|
||||||
fetchServiceAccount,
|
fetchServiceAccounts,
|
||||||
onBack,
|
onBack,
|
||||||
onDelete,
|
onDelete,
|
||||||
onSubmit
|
onSubmit
|
||||||
|
@ -115,7 +111,7 @@ const WebhooksDetailsPage: React.StatelessComponent<
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
serviceDisplayValue={selectedServiceAcccounts}
|
serviceDisplayValue={selectedServiceAcccounts}
|
||||||
services={servicesChoiceList}
|
services={servicesChoiceList}
|
||||||
fetchServiceAccount={fetchServiceAccount}
|
fetchServiceAccounts={fetchServiceAccounts}
|
||||||
errors={errors}
|
errors={errors}
|
||||||
serviceOnChange={handleServiceSelect}
|
serviceOnChange={handleServiceSelect}
|
||||||
onChange={change}
|
onChange={change}
|
||||||
|
|
|
@ -43,7 +43,7 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const numberOfColumns = 4;
|
const numberOfColumns = 3;
|
||||||
|
|
||||||
const WebhooksList: React.FC<WebhooksListProps> = ({
|
const WebhooksList: React.FC<WebhooksListProps> = ({
|
||||||
settings,
|
settings,
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
import { ServiceList_serviceAccounts_edges_node } from "./types/ServiceList";
|
import { SearchServiceAccount_serviceAccounts_edges_node } from "@saleor/containers/SearchServiceAccount/types/SearchServiceAccount";
|
||||||
import { Webhook_webhook } from "./types/Webhook";
|
import { WebhookDetails_webhook } from "./types/WebhookDetails";
|
||||||
import { Webhooks_webhooks_edges_node } from "./types/Webhooks";
|
import { Webhooks_webhooks_edges_node } from "./types/Webhooks";
|
||||||
|
|
||||||
export const services: ServiceList_serviceAccounts_edges_node[] = [
|
export const services: SearchServiceAccount_serviceAccounts_edges_node[] = [
|
||||||
{
|
{
|
||||||
__typename: "ServiceAccount",
|
__typename: "ServiceAccount",
|
||||||
id: "Jzx123sEt==",
|
id: "Jzx123sEt==",
|
||||||
isActive: true,
|
|
||||||
name: "Facebook"
|
name: "Facebook"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: "ServiceAccount",
|
__typename: "ServiceAccount",
|
||||||
id: "Jzx123sEt==",
|
id: "Jzx123sEt==",
|
||||||
isActive: false,
|
|
||||||
name: "Twittwe"
|
name: "Twittwe"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -26,7 +24,7 @@ export const webhookList: Webhooks_webhooks_edges_node[] = [
|
||||||
__typename: "ServiceAccount",
|
__typename: "ServiceAccount",
|
||||||
id: "Jzx123sEt==",
|
id: "Jzx123sEt==",
|
||||||
name: "Test Account"
|
name: "Test Account"
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: "Webhook",
|
__typename: "Webhook",
|
||||||
|
@ -37,10 +35,10 @@ export const webhookList: Webhooks_webhooks_edges_node[] = [
|
||||||
__typename: "ServiceAccount",
|
__typename: "ServiceAccount",
|
||||||
id: "Jzx1ss23sEt==",
|
id: "Jzx1ss23sEt==",
|
||||||
name: "Test Account 2"
|
name: "Test Account 2"
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
export const webhook: Webhook_webhook = {
|
export const webhook: WebhookDetails_webhook = {
|
||||||
__typename: "Webhook",
|
__typename: "Webhook",
|
||||||
events: [],
|
events: [],
|
||||||
id: "Jzx123sEt==",
|
id: "Jzx123sEt==",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
|
|
||||||
import { TypedQuery } from "../queries";
|
import { TypedQuery } from "../queries";
|
||||||
import { Webhook, WebhookVariables } from "./types/Webhook";
|
import { WebhookDetails, WebhookDetailsVariables } from "./types/WebhookDetails";
|
||||||
import { Webhooks, WebhooksVariables } from "./types/Webhooks";
|
import { Webhooks, WebhooksVariables } from "./types/Webhooks";
|
||||||
|
|
||||||
export const webhooksFragment = gql`
|
export const webhooksFragment = gql`
|
||||||
|
@ -70,6 +70,6 @@ const webhooksDetails = gql`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
export const TypedWebhooksDetailsQuery = TypedQuery<Webhook, WebhookVariables>(
|
export const TypedWebhooksDetailsQuery = TypedQuery<WebhookDetails, WebhookDetailsVariables>(
|
||||||
webhooksDetails
|
webhooksDetails
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
// This file was automatically generated and should not be edited.
|
|
||||||
|
|
||||||
// ====================================================
|
|
||||||
// GraphQL fragment: ServiceFragment
|
|
||||||
// ====================================================
|
|
||||||
|
|
||||||
export interface ServiceFragment {
|
|
||||||
__typename: "ServiceAccount";
|
|
||||||
id: string;
|
|
||||||
name: string | null;
|
|
||||||
isActive: boolean | null;
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
// This file was automatically generated and should not be edited.
|
|
||||||
|
|
||||||
// ====================================================
|
|
||||||
// GraphQL query operation: ServiceList
|
|
||||||
// ====================================================
|
|
||||||
|
|
||||||
export interface ServiceList_serviceAccounts_edges_node {
|
|
||||||
__typename: "ServiceAccount";
|
|
||||||
id: string;
|
|
||||||
name: string | null;
|
|
||||||
isActive: boolean | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ServiceList_serviceAccounts_edges {
|
|
||||||
__typename: "ServiceAccountCountableEdge";
|
|
||||||
node: ServiceList_serviceAccounts_edges_node;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ServiceList_serviceAccounts_pageInfo {
|
|
||||||
__typename: "PageInfo";
|
|
||||||
hasPreviousPage: boolean;
|
|
||||||
hasNextPage: boolean;
|
|
||||||
startCursor: string | null;
|
|
||||||
endCursor: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ServiceList_serviceAccounts {
|
|
||||||
__typename: "ServiceAccountCountableConnection";
|
|
||||||
edges: ServiceList_serviceAccounts_edges[];
|
|
||||||
pageInfo: ServiceList_serviceAccounts_pageInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ServiceList {
|
|
||||||
serviceAccounts: ServiceList_serviceAccounts | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ServiceListVariables {
|
|
||||||
first?: number | null;
|
|
||||||
after?: string | null;
|
|
||||||
last?: number | null;
|
|
||||||
before?: string | null;
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
// This file was automatically generated and should not be edited.
|
|
||||||
|
|
||||||
import { WebhookEventTypeEnum } from "./../../types/globalTypes";
|
|
||||||
|
|
||||||
// ====================================================
|
|
||||||
// GraphQL query operation: Webhook
|
|
||||||
// ====================================================
|
|
||||||
|
|
||||||
export interface Webhook_webhook_events {
|
|
||||||
__typename: "WebhookEvent";
|
|
||||||
eventType: WebhookEventTypeEnum | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Webhook_webhook_serviceAccount {
|
|
||||||
__typename: "ServiceAccount";
|
|
||||||
id: string;
|
|
||||||
name: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Webhook_webhook {
|
|
||||||
__typename: "Webhook";
|
|
||||||
id: string;
|
|
||||||
name: string | null;
|
|
||||||
events: (Webhook_webhook_events | null)[] | null;
|
|
||||||
isActive: boolean;
|
|
||||||
secretKey: string | null;
|
|
||||||
targetUrl: string;
|
|
||||||
serviceAccount: Webhook_webhook_serviceAccount;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Webhook {
|
|
||||||
webhook: Webhook_webhook | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface WebhookVariables {
|
|
||||||
id: string;
|
|
||||||
}
|
|
|
@ -44,9 +44,9 @@ export const WebhooksCreate: React.StatelessComponent<
|
||||||
<SearchServiceAccount variables={DEFAULT_INITIAL_SEARCH_DATA}>
|
<SearchServiceAccount variables={DEFAULT_INITIAL_SEARCH_DATA}>
|
||||||
{({ search: searchServiceAccount, result: searchServiceAccountOpt }) => (
|
{({ search: searchServiceAccount, result: searchServiceAccountOpt }) => (
|
||||||
<TypedWebhookCreate onCompleted={onSubmit}>
|
<TypedWebhookCreate onCompleted={onSubmit}>
|
||||||
{(WebhookCreate, webhookCreateOpts) => {
|
{(webhookCreate, webhookCreateOpts) => {
|
||||||
const handleSubmit = (data: FormData) =>
|
const handleSubmit = (data: FormData) =>
|
||||||
WebhookCreate({
|
webhookCreate({
|
||||||
variables: {
|
variables: {
|
||||||
input: {
|
input: {
|
||||||
events: data.allEvents
|
events: data.allEvents
|
||||||
|
@ -81,7 +81,7 @@ export const WebhooksCreate: React.StatelessComponent<
|
||||||
() => webhookCreateOpts.data.webhookCreate.errors,
|
() => webhookCreateOpts.data.webhookCreate.errors,
|
||||||
[]
|
[]
|
||||||
)}
|
)}
|
||||||
fetchServiceAccount={searchServiceAccount}
|
fetchServiceAccounts={searchServiceAccount}
|
||||||
services={maybe(() =>
|
services={maybe(() =>
|
||||||
searchServiceAccountOpt.data.serviceAccounts.edges.map(
|
searchServiceAccountOpt.data.serviceAccounts.edges.map(
|
||||||
edge => edge.node
|
edge => edge.node
|
||||||
|
|
|
@ -26,9 +26,10 @@ export interface WebhooksDetailsProps {
|
||||||
params: WebhooksListUrlQueryParams;
|
params: WebhooksListUrlQueryParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const WebhooksDetails: React.StatelessComponent<
|
export const WebhooksDetails: React.FC<WebhooksDetailsProps> = ({
|
||||||
WebhooksDetailsProps
|
id,
|
||||||
> = ({ id, params }) => {
|
params
|
||||||
|
}) => {
|
||||||
const navigate = useNavigator();
|
const navigate = useNavigator();
|
||||||
const notify = useNotifier();
|
const notify = useNotifier();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
@ -78,7 +79,7 @@ export const WebhooksDetails: React.StatelessComponent<
|
||||||
<TypedWebhookDelete onCompleted={onWebhookDelete}>
|
<TypedWebhookDelete onCompleted={onWebhookDelete}>
|
||||||
{(webhookDelete, webhookDeleteOpts) => (
|
{(webhookDelete, webhookDeleteOpts) => (
|
||||||
<TypedWebhooksDetailsQuery variables={{ id }}>
|
<TypedWebhooksDetailsQuery variables={{ id }}>
|
||||||
{WebhookDetails => {
|
{webhookDetails => {
|
||||||
const formTransitionState = getMutationState(
|
const formTransitionState = getMutationState(
|
||||||
webhookUpdateOpts.called,
|
webhookUpdateOpts.called,
|
||||||
webhookUpdateOpts.loading,
|
webhookUpdateOpts.loading,
|
||||||
|
@ -106,14 +107,14 @@ export const WebhooksDetails: React.StatelessComponent<
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<WindowTitle
|
<WindowTitle
|
||||||
title={maybe(() => WebhookDetails.data.webhook.name)}
|
title={maybe(() => webhookDetails.data.webhook.name)}
|
||||||
/>
|
/>
|
||||||
<WebhooksDetailsPage
|
<WebhooksDetailsPage
|
||||||
disabled={WebhookDetails.loading}
|
disabled={webhookDetails.loading}
|
||||||
errors={formErrors}
|
errors={formErrors}
|
||||||
saveButtonBarState={formTransitionState}
|
saveButtonBarState={formTransitionState}
|
||||||
webhook={maybe(() => WebhookDetails.data.webhook)}
|
webhook={maybe(() => webhookDetails.data.webhook)}
|
||||||
fetchServiceAccount={searchServiceAccount}
|
fetchServiceAccounts={searchServiceAccount}
|
||||||
services={maybe(() =>
|
services={maybe(() =>
|
||||||
searchServiceAccountOpt.data.serviceAccounts.edges.map(
|
searchServiceAccountOpt.data.serviceAccounts.edges.map(
|
||||||
edge => edge.node
|
edge => edge.node
|
||||||
|
@ -142,7 +143,7 @@ export const WebhooksDetails: React.StatelessComponent<
|
||||||
<WebhookDeleteDialog
|
<WebhookDeleteDialog
|
||||||
confirmButtonState={deleteTransitionState}
|
confirmButtonState={deleteTransitionState}
|
||||||
name={maybe(
|
name={maybe(
|
||||||
() => WebhookDetails.data.webhook.name,
|
() => webhookDetails.data.webhook.name,
|
||||||
"..."
|
"..."
|
||||||
)}
|
)}
|
||||||
onClose={closeModal}
|
onClose={closeModal}
|
||||||
|
|
|
@ -20,7 +20,8 @@ import { useIntl } from "react-intl";
|
||||||
import WebhooksListPage from "../components/WebhooksListPage/WebhooksListPage";
|
import WebhooksListPage from "../components/WebhooksListPage/WebhooksListPage";
|
||||||
import { TypedWebhookDelete } from "../mutations";
|
import { TypedWebhookDelete } from "../mutations";
|
||||||
import { TypedWebhooksListQuery } from "../queries";
|
import { TypedWebhooksListQuery } from "../queries";
|
||||||
import { WebhookListUrlDialog,
|
import {
|
||||||
|
WebhookListUrlDialog,
|
||||||
WebhookListUrlFilters,
|
WebhookListUrlFilters,
|
||||||
webhooksAddUrl,
|
webhooksAddUrl,
|
||||||
webhooksListUrl,
|
webhooksListUrl,
|
||||||
|
@ -40,9 +41,7 @@ interface WebhooksListProps {
|
||||||
params: WebhooksListUrlQueryParams;
|
params: WebhooksListUrlQueryParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const WebhooksList: React.StatelessComponent<WebhooksListProps> = ({
|
export const WebhooksList: React.FC<WebhooksListProps> = ({ params }) => {
|
||||||
params
|
|
||||||
}) => {
|
|
||||||
const navigate = useNavigator();
|
const navigate = useNavigator();
|
||||||
const paginate = usePaginator();
|
const paginate = usePaginator();
|
||||||
const notify = useNotifier();
|
const notify = useNotifier();
|
||||||
|
|
Loading…
Reference in a new issue