Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Update Page.isVisible field

Krzysztof Bialoglowicz2cb997002ef0
diff --git a/saleor/static/dashboard-next/pages/components/PageAvailability/PageAvailability.tsx b/saleor/static/dashboard-next/pages/components/PageAvailability/PageAvailability.tsx
index 14d9360f60..6df2b32f6a 100644
--- a/saleor/static/dashboard-next/pages/components/PageAvailability/PageAvailability.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageAvailability/PageAvailability.tsx
@@ -22,7 +22,7 @@ export interface PageAvailabilityProps {
function isAvailable(data: FormData): boolean {
return (
(data.publicationDate === "" || data.publicationDate === null) &&
- data.isVisible
+ data.isPublished
);
}
@@ -41,7 +41,7 @@ const PageAvailability: React.StatelessComponent<PageAvailabilityProps> = ({
checked={isAvailable(data)}
disabled={disabled}
label={
- data.isVisible && !data.publicationDate ? (
+ data.isPublished && !data.publicationDate ? (
i18n.t("Published")
) : (
<>
@@ -59,7 +59,7 @@ const PageAvailability: React.StatelessComponent<PageAvailabilityProps> = ({
</>
)
}
- name={"isVisible" as keyof FormData}
+ name={"isPublished" as keyof FormData}
onChange={event =>
onChange(
event,
diff --git a/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx b/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx
index b014c93b1d..8c5ad49736 100644
--- a/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageDetailsPage/PageDetailsPage.tsx
@@ -25,7 +25,7 @@ import PageSlug from "../PageSlug";
export interface FormData {
content: RawDraftContentState;
- isVisible: boolean;
+ isPublished: boolean;
publicationDate: string;
seoDescription: string;
seoTitle: string;
@@ -57,7 +57,7 @@ const PageDetailsPage: React.StatelessComponent<PageDetailsPageProps> = ({
() => JSON.parse(page.contentJson),
convertToRaw(ContentState.createFromText(""))
),
- isVisible: maybe(() => page.isVisible, false),
+ isPublished: maybe(() => page.isPublished, false),
publicationDate: maybe(() => page.publicationDate, ""),
seoDescription: maybe(() => page.seoDescription || "", ""),
seoTitle: maybe(() => page.seoTitle || "", ""),
diff --git a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
index c930e3c1dc..a4bb4a23db 100644
--- a/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
+++ b/saleor/static/dashboard-next/pages/components/PageList/PageList.tsx
@@ -122,11 +122,11 @@ const PageList = withStyles(styles, { name: "PageList" })(
() => (
<StatusLabel
label={
- page.isVisible
+ page.isPublished
? i18n.t("Published")
: i18n.t("Not Published")
}
- status={page.isVisible ? "success" : "error"}
+ status={page.isPublished ? "success" : "error"}
/>
),
<Skeleton />
diff --git a/saleor/static/dashboard-next/pages/fixtures.ts b/saleor/static/dashboard-next/pages/fixtures.ts
index 37e72cb8fd..86739b16c7 100644
--- a/saleor/static/dashboard-next/pages/fixtures.ts
+++ b/saleor/static/dashboard-next/pages/fixtures.ts
@@ -6,28 +6,28 @@ export const pageList: PageList_pages_edges_node[] = [
{
__typename: "Page",
id: "Jzx123sEt==",
- isVisible: true,
+ isPublished: true,
slug: "about",
title: "About"
},
{
__typename: "Page",
id: "Jzx123sEx==",
- isVisible: false,
+ isPublished: false,
slug: "about",
title: "About"
},
{
__typename: "Page",
id: "Jzx123sEu==",
- isVisible: true,
+ isPublished: true,
slug: "about",
title: "About"
},
{
__typename: "Page",
id: "Jzx123sEm==",
- isVisible: true,
+ isPublished: true,
slug: "about",
title: "About"
}
@@ -36,7 +36,7 @@ export const page: PageDetails_page = {
__typename: "Page",
contentJson: JSON.stringify(content),
id: "Kzx152sEm==",
- isVisible: false,
+ isPublished: false,
publicationDate: "",
seoDescription: "About",
seoTitle: "About",
diff --git a/saleor/static/dashboard-next/pages/queries.ts b/saleor/static/dashboard-next/pages/queries.ts
index e66b434f4b..8990a6267c 100644
--- a/saleor/static/dashboard-next/pages/queries.ts
+++ b/saleor/static/dashboard-next/pages/queries.ts
@@ -9,7 +9,7 @@ export const pageFragment = gql`
id
title
slug
- isVisible
+ isPublished
}
`;
diff --git a/saleor/static/dashboard-next/pages/types/PageCreate.ts b/saleor/static/dashboard-next/pages/types/PageCreate.ts
index 95da055a3e..b873677611 100644
--- a/saleor/static/dashboard-next/pages/types/PageCreate.ts
+++ b/saleor/static/dashboard-next/pages/types/PageCreate.ts
@@ -19,7 +19,7 @@ export interface PageCreate_pageCreate_page {
id: string;
title: string;
slug: string;
- isVisible: boolean | null;
+ isPublished: boolean;
contentJson: any;
seoTitle: string | null;
seoDescription: string | null;
diff --git a/saleor/static/dashboard-next/pages/types/PageDetails.ts b/saleor/static/dashboard-next/pages/types/PageDetails.ts
index a923787298..ffc94dd3ac 100644
--- a/saleor/static/dashboard-next/pages/types/PageDetails.ts
+++ b/saleor/static/dashboard-next/pages/types/PageDetails.ts
@@ -11,7 +11,7 @@ export interface PageDetails_page {
id: string;
title: string;
slug: string;
- isVisible: boolean | null;
+ isPublished: boolean;
contentJson: any;
seoTitle: string | null;
seoDescription: string | null;
diff --git a/saleor/static/dashboard-next/pages/types/PageDetailsFragment.ts b/saleor/static/dashboard-next/pages/types/PageDetailsFragment.ts
index db48fc1418..1b1e48c924 100644
--- a/saleor/static/dashboard-next/pages/types/PageDetailsFragment.ts
+++ b/saleor/static/dashboard-next/pages/types/PageDetailsFragment.ts
@@ -11,7 +11,7 @@ export interface PageDetailsFragment {
id: string;
title: string;
slug: string;
- isVisible: boolean | null;
+ isPublished: boolean;
contentJson: any;
seoTitle: string | null;
seoDescription: string | null;
diff --git a/saleor/static/dashboard-next/pages/types/PageFragment.ts b/saleor/static/dashboard-next/pages/types/PageFragment.ts
index 32eaa5a8fe..c10ca71124 100644
--- a/saleor/static/dashboard-next/pages/types/PageFragment.ts
+++ b/saleor/static/dashboard-next/pages/types/PageFragment.ts
@@ -11,5 +11,5 @@ export interface PageFragment {
id: string;
title: string;
slug: string;
- isVisible: boolean | null;
+ isPublished: boolean;
}
diff --git a/saleor/static/dashboard-next/pages/types/PageList.ts b/saleor/static/dashboard-next/pages/types/PageList.ts
index d9f7841e62..df8718b7bd 100644
--- a/saleor/static/dashboard-next/pages/types/PageList.ts
+++ b/saleor/static/dashboard-next/pages/types/PageList.ts
@@ -11,7 +11,7 @@ export interface PageList_pages_edges_node {
id: string;
title: string;
slug: string;
- isVisible: boolean | null;
+ isPublished: boolean;
}
export interface PageList_pages_edges {
diff --git a/saleor/static/dashboard-next/pages/types/PageUpdate.ts b/saleor/static/dashboard-next/pages/types/PageUpdate.ts
index 8bad60ecc6..853a0a34ca 100644
--- a/saleor/static/dashboard-next/pages/types/PageUpdate.ts
+++ b/saleor/static/dashboard-next/pages/types/PageUpdate.ts
@@ -19,7 +19,7 @@ export interface PageUpdate_pageUpdate_page {
id: string;
title: string;
slug: string;
- isVisible: boolean | null;
+ isPublished: boolean;
contentJson: any;
seoTitle: string | null;
seoDescription: string | null;
diff --git a/saleor/static/dashboard-next/pages/views/PageCreate.tsx b/saleor/static/dashboard-next/pages/views/PageCreate.tsx
index 74fadfacb4..dc3507ec68 100644
--- a/saleor/static/dashboard-next/pages/views/PageCreate.tsx
+++ b/saleor/static/dashboard-next/pages/views/PageCreate.tsx
@@ -53,12 +53,12 @@ export const PageCreate: React.StatelessComponent<PageCreateProps> = () => {
variables: {
input: {
contentJson: JSON.stringify(formData.content),
- isPublished: formData.isVisible
+ isPublished: formData.isPublished
? true
: formData.publicationDate === ""
? false
: true,
- publicationDate: formData.isVisible
+ publicationDate: formData.isPublished
? null
: formData.publicationDate === ""
? null
diff --git a/saleor/static/dashboard-next/pages/views/PageDetails.tsx b/saleor/static/dashboard-next/pages/views/PageDetails.tsx
index a9827e6a1b..cc5625733a 100644
--- a/saleor/static/dashboard-next/pages/views/PageDetails.tsx
+++ b/saleor/static/dashboard-next/pages/views/PageDetails.tsx
@@ -21,12 +21,12 @@ export interface PageDetailsProps {
const createPageInput = (data: FormData): PageInput => ({
contentJson: JSON.stringify(data.content),
- isPublished: data.isVisible
+ isPublished: data.isPublished
? true
: data.publicationDate === "" || data.publicationDate === null
? false
: true,
- publicationDate: data.isVisible
+ publicationDate: data.isPublished
? null
: data.publicationDate === ""
? null
diff --git a/saleor/static/dashboard-next/storybook/stories/pages/PageDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/pages/PageDetailsPage.tsx
index f21c0ab88d..eba481ff70 100644
--- a/saleor/static/dashboard-next/storybook/stories/pages/PageDetailsPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/pages/PageDetailsPage.tsx
@@ -33,7 +33,7 @@ storiesOf("Views / Pages / Page details", module)
"slug",
"content",
"publicationDate",
- "isVisible",
+ "isPublished",
"seoDescription",
"seoTitle"
] as Array<keyof FormData>).map(formError)}