Fix service account search
This commit is contained in:
parent
7bd69bf833
commit
f84493fdab
8 changed files with 40 additions and 22 deletions
|
@ -1,24 +1,34 @@
|
||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
|
|
||||||
import BaseSearch from "../BaseSearch";
|
import { pageInfoFragment } from "@saleor/queries";
|
||||||
|
import TopLevelSearch from "../TopLevelSearch";
|
||||||
import {
|
import {
|
||||||
SearchServiceAccount,
|
SearchServiceAccount,
|
||||||
SearchServiceAccountVariables
|
SearchServiceAccountVariables
|
||||||
} from "./types/searchServiceAccount";
|
} from "./types/searchServiceAccount";
|
||||||
|
|
||||||
export const searchServiceAccount = gql`
|
export const searchServiceAccount = gql`
|
||||||
|
${pageInfoFragment}
|
||||||
query SearchServiceAccount($after: String, $first: Int!, $query: String!) {
|
query SearchServiceAccount($after: String, $first: Int!, $query: String!) {
|
||||||
serviceAccounts(after: $after, first: $first, filter: { search: $query }) {
|
search: serviceAccounts(
|
||||||
|
after: $after
|
||||||
|
first: $first
|
||||||
|
filter: { search: $query }
|
||||||
|
) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pageInfo {
|
||||||
|
...PageInfoFragment
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default BaseSearch<SearchServiceAccount, SearchServiceAccountVariables>(
|
export default TopLevelSearch<
|
||||||
searchServiceAccount
|
SearchServiceAccount,
|
||||||
);
|
SearchServiceAccountVariables
|
||||||
|
>(searchServiceAccount);
|
||||||
|
|
|
@ -6,24 +6,33 @@
|
||||||
// GraphQL query operation: SearchServiceAccount
|
// GraphQL query operation: SearchServiceAccount
|
||||||
// ====================================================
|
// ====================================================
|
||||||
|
|
||||||
export interface SearchServiceAccount_serviceAccounts_edges_node {
|
export interface SearchServiceAccount_search_edges_node {
|
||||||
__typename: "ServiceAccount";
|
__typename: "ServiceAccount";
|
||||||
id: string;
|
id: string;
|
||||||
name: string | null;
|
name: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchServiceAccount_serviceAccounts_edges {
|
export interface SearchServiceAccount_search_edges {
|
||||||
__typename: "ServiceAccountCountableEdge";
|
__typename: "ServiceAccountCountableEdge";
|
||||||
node: SearchServiceAccount_serviceAccounts_edges_node;
|
node: SearchServiceAccount_search_edges_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchServiceAccount_serviceAccounts {
|
export interface SearchServiceAccount_search_pageInfo {
|
||||||
|
__typename: "PageInfo";
|
||||||
|
endCursor: string | null;
|
||||||
|
hasNextPage: boolean;
|
||||||
|
hasPreviousPage: boolean;
|
||||||
|
startCursor: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SearchServiceAccount_search {
|
||||||
__typename: "ServiceAccountCountableConnection";
|
__typename: "ServiceAccountCountableConnection";
|
||||||
edges: SearchServiceAccount_serviceAccounts_edges[];
|
edges: SearchServiceAccount_search_edges[];
|
||||||
|
pageInfo: SearchServiceAccount_search_pageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchServiceAccount {
|
export interface SearchServiceAccount {
|
||||||
serviceAccounts: SearchServiceAccount_serviceAccounts | null;
|
search: SearchServiceAccount_search | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchServiceAccountVariables {
|
export interface SearchServiceAccountVariables {
|
||||||
|
|
|
@ -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 { SearchServiceAccount_serviceAccounts_edges_node } from "@saleor/containers/SearchServiceAccount/types/SearchServiceAccount";
|
import { SearchServiceAccount_search_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,7 +32,7 @@ export interface FormData {
|
||||||
export interface WebhookCreatePageProps {
|
export interface WebhookCreatePageProps {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
errors: UserError[];
|
errors: UserError[];
|
||||||
services?: SearchServiceAccount_serviceAccounts_edges_node[];
|
services?: SearchServiceAccount_search_edges_node[];
|
||||||
saveButtonBarState: ConfirmButtonTransitionState;
|
saveButtonBarState: ConfirmButtonTransitionState;
|
||||||
fetchServiceAccounts: (data: string) => void;
|
fetchServiceAccounts: (data: string) => void;
|
||||||
onBack: () => void;
|
onBack: () => void;
|
||||||
|
|
|
@ -9,9 +9,8 @@ import { useIntl } from "react-intl";
|
||||||
import CardTitle from "@saleor/components/CardTitle";
|
import CardTitle from "@saleor/components/CardTitle";
|
||||||
import FormSpacer from "@saleor/components/FormSpacer";
|
import FormSpacer from "@saleor/components/FormSpacer";
|
||||||
import Hr from "@saleor/components/Hr";
|
import Hr from "@saleor/components/Hr";
|
||||||
import {
|
import SingleAutocompleteSelectField, {
|
||||||
SingleAutocompleteChoiceType,
|
SingleAutocompleteChoiceType
|
||||||
SingleAutocompleteSelectField
|
|
||||||
} from "@saleor/components/SingleAutocompleteSelectField";
|
} from "@saleor/components/SingleAutocompleteSelectField";
|
||||||
import { ChangeEvent } from "@saleor/hooks/useForm";
|
import { ChangeEvent } from "@saleor/hooks/useForm";
|
||||||
import { commonMessages } from "@saleor/intl";
|
import { commonMessages } from "@saleor/intl";
|
||||||
|
|
|
@ -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 { SearchServiceAccount_serviceAccounts_edges_node } from "@saleor/containers/SearchServiceAccount/types/SearchServiceAccount";
|
import { SearchServiceAccount_search_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";
|
||||||
|
@ -36,7 +36,7 @@ export interface WebhooksDetailsPageProps {
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
errors: UserError[];
|
errors: UserError[];
|
||||||
webhook: WebhookDetails_webhook;
|
webhook: WebhookDetails_webhook;
|
||||||
services?: SearchServiceAccount_serviceAccounts_edges_node[];
|
services?: SearchServiceAccount_search_edges_node[];
|
||||||
saveButtonBarState: ConfirmButtonTransitionState;
|
saveButtonBarState: ConfirmButtonTransitionState;
|
||||||
onBack: () => void;
|
onBack: () => void;
|
||||||
onDelete: () => void;
|
onDelete: () => void;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { SearchServiceAccount_serviceAccounts_edges_node } from "@saleor/containers/SearchServiceAccount/types/SearchServiceAccount";
|
import { SearchServiceAccount_search_edges_node } from "@saleor/containers/SearchServiceAccount/types/SearchServiceAccount";
|
||||||
import { WebhookDetails_webhook } from "./types/WebhookDetails";
|
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: SearchServiceAccount_serviceAccounts_edges_node[] = [
|
export const services: SearchServiceAccount_search_edges_node[] = [
|
||||||
{
|
{
|
||||||
__typename: "ServiceAccount",
|
__typename: "ServiceAccount",
|
||||||
id: "Jzx123sEt==",
|
id: "Jzx123sEt==",
|
||||||
|
|
|
@ -83,7 +83,7 @@ export const WebhooksCreate: React.StatelessComponent<
|
||||||
)}
|
)}
|
||||||
fetchServiceAccounts={searchServiceAccount}
|
fetchServiceAccounts={searchServiceAccount}
|
||||||
services={maybe(() =>
|
services={maybe(() =>
|
||||||
searchServiceAccountOpt.data.serviceAccounts.edges.map(
|
searchServiceAccountOpt.data.search.edges.map(
|
||||||
edge => edge.node
|
edge => edge.node
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -116,7 +116,7 @@ export const WebhooksDetails: React.FC<WebhooksDetailsProps> = ({
|
||||||
webhook={maybe(() => webhookDetails.data.webhook)}
|
webhook={maybe(() => webhookDetails.data.webhook)}
|
||||||
fetchServiceAccounts={searchServiceAccount}
|
fetchServiceAccounts={searchServiceAccount}
|
||||||
services={maybe(() =>
|
services={maybe(() =>
|
||||||
searchServiceAccountOpt.data.serviceAccounts.edges.map(
|
searchServiceAccountOpt.data.search.edges.map(
|
||||||
edge => edge.node
|
edge => edge.node
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in a new issue