Add availableInGrid field
This commit is contained in:
parent
19379c4cfa
commit
8fdf89c66f
12 changed files with 30 additions and 3 deletions
|
@ -37,6 +37,7 @@ export interface AttributePageProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AttributePageFormData {
|
export interface AttributePageFormData {
|
||||||
|
availableInGrid: boolean;
|
||||||
filterableInDashboard: boolean;
|
filterableInDashboard: boolean;
|
||||||
inputType: AttributeInputTypeEnum;
|
inputType: AttributeInputTypeEnum;
|
||||||
filterableInStorefront: boolean;
|
filterableInStorefront: boolean;
|
||||||
|
@ -64,6 +65,7 @@ const AttributePage: React.FC<AttributePageProps> = ({
|
||||||
const initialForm: AttributePageFormData =
|
const initialForm: AttributePageFormData =
|
||||||
attribute === null
|
attribute === null
|
||||||
? {
|
? {
|
||||||
|
availableInGrid: true,
|
||||||
filterableInDashboard: true,
|
filterableInDashboard: true,
|
||||||
filterableInStorefront: true,
|
filterableInStorefront: true,
|
||||||
inputType: AttributeInputTypeEnum.DROPDOWN,
|
inputType: AttributeInputTypeEnum.DROPDOWN,
|
||||||
|
@ -74,6 +76,7 @@ const AttributePage: React.FC<AttributePageProps> = ({
|
||||||
visibleInStorefront: true
|
visibleInStorefront: true
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
|
availableInGrid: maybe(() => attribute.availableInGrid, true),
|
||||||
filterableInDashboard: maybe(
|
filterableInDashboard: maybe(
|
||||||
() => attribute.filterableInDashboard,
|
() => attribute.filterableInDashboard,
|
||||||
true
|
true
|
||||||
|
|
|
@ -105,6 +105,21 @@ const AttributeProperties: React.FC<AttributePropertiesProps> = ({
|
||||||
}
|
}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
/>
|
/>
|
||||||
|
<FormSpacer />
|
||||||
|
<ControlledSwitch
|
||||||
|
name={"availableInGrid" as keyof AttributePageFormData}
|
||||||
|
checked={data.availableInGrid}
|
||||||
|
disabled={disabled}
|
||||||
|
label={i18n.t("Add to Column Options")}
|
||||||
|
secondLabel={
|
||||||
|
<Typography variant="caption">
|
||||||
|
{i18n.t(
|
||||||
|
"If enable this attribute can be used as a column in product table."
|
||||||
|
)}
|
||||||
|
</Typography>
|
||||||
|
}
|
||||||
|
onChange={onChange}
|
||||||
|
/>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,10 +2,12 @@ import {
|
||||||
AttributeInputTypeEnum,
|
AttributeInputTypeEnum,
|
||||||
AttributeValueType
|
AttributeValueType
|
||||||
} from "@saleor/types/globalTypes";
|
} from "@saleor/types/globalTypes";
|
||||||
|
import { AttributeDetailsFragment } from "./types/AttributeDetailsFragment";
|
||||||
import { AttributeList_attributes_edges_node } from "./types/AttributeList";
|
import { AttributeList_attributes_edges_node } from "./types/AttributeList";
|
||||||
|
|
||||||
export const attribute = {
|
export const attribute: AttributeDetailsFragment = {
|
||||||
__typename: "Attribute" as "Attribute",
|
__typename: "Attribute" as "Attribute",
|
||||||
|
availableInGrid: true,
|
||||||
filterableInDashboard: false,
|
filterableInDashboard: false,
|
||||||
filterableInStorefront: true,
|
filterableInStorefront: true,
|
||||||
id: "UHJvZHVjdEF0dHJpYnV0ZTo5",
|
id: "UHJvZHVjdEF0dHJpYnV0ZTo5",
|
||||||
|
@ -20,7 +22,6 @@ export const attribute = {
|
||||||
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI0",
|
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI0",
|
||||||
name: "John Doe",
|
name: "John Doe",
|
||||||
slug: "john-doe",
|
slug: "john-doe",
|
||||||
sortOrder: 0,
|
|
||||||
type: AttributeValueType.STRING,
|
type: AttributeValueType.STRING,
|
||||||
value: ""
|
value: ""
|
||||||
},
|
},
|
||||||
|
@ -29,7 +30,6 @@ export const attribute = {
|
||||||
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI1",
|
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI1",
|
||||||
name: "Milionare Pirate",
|
name: "Milionare Pirate",
|
||||||
slug: "milionare-pirate",
|
slug: "milionare-pirate",
|
||||||
sortOrder: 1,
|
|
||||||
type: AttributeValueType.STRING,
|
type: AttributeValueType.STRING,
|
||||||
value: ""
|
value: ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ export const attributeDetailsFragment = gql`
|
||||||
${attributeFragment}
|
${attributeFragment}
|
||||||
fragment AttributeDetailsFragment on Attribute {
|
fragment AttributeDetailsFragment on Attribute {
|
||||||
...AttributeFragment
|
...AttributeFragment
|
||||||
|
availableInGrid
|
||||||
inputType
|
inputType
|
||||||
storefrontSearchPosition
|
storefrontSearchPosition
|
||||||
valueRequired
|
valueRequired
|
||||||
|
|
|
@ -31,6 +31,7 @@ export interface AttributeCreate_attributeCreate_attribute {
|
||||||
visibleInStorefront: boolean;
|
visibleInStorefront: boolean;
|
||||||
filterableInDashboard: boolean;
|
filterableInDashboard: boolean;
|
||||||
filterableInStorefront: boolean;
|
filterableInStorefront: boolean;
|
||||||
|
availableInGrid: boolean;
|
||||||
inputType: AttributeInputTypeEnum | null;
|
inputType: AttributeInputTypeEnum | null;
|
||||||
storefrontSearchPosition: number;
|
storefrontSearchPosition: number;
|
||||||
valueRequired: boolean;
|
valueRequired: boolean;
|
||||||
|
|
|
@ -25,6 +25,7 @@ export interface AttributeDetails_attribute {
|
||||||
visibleInStorefront: boolean;
|
visibleInStorefront: boolean;
|
||||||
filterableInDashboard: boolean;
|
filterableInDashboard: boolean;
|
||||||
filterableInStorefront: boolean;
|
filterableInStorefront: boolean;
|
||||||
|
availableInGrid: boolean;
|
||||||
inputType: AttributeInputTypeEnum | null;
|
inputType: AttributeInputTypeEnum | null;
|
||||||
storefrontSearchPosition: number;
|
storefrontSearchPosition: number;
|
||||||
valueRequired: boolean;
|
valueRequired: boolean;
|
||||||
|
|
|
@ -25,6 +25,7 @@ export interface AttributeDetailsFragment {
|
||||||
visibleInStorefront: boolean;
|
visibleInStorefront: boolean;
|
||||||
filterableInDashboard: boolean;
|
filterableInDashboard: boolean;
|
||||||
filterableInStorefront: boolean;
|
filterableInStorefront: boolean;
|
||||||
|
availableInGrid: boolean;
|
||||||
inputType: AttributeInputTypeEnum | null;
|
inputType: AttributeInputTypeEnum | null;
|
||||||
storefrontSearchPosition: number;
|
storefrontSearchPosition: number;
|
||||||
valueRequired: boolean;
|
valueRequired: boolean;
|
||||||
|
|
|
@ -31,6 +31,7 @@ export interface AttributeUpdate_attributeUpdate_attribute {
|
||||||
visibleInStorefront: boolean;
|
visibleInStorefront: boolean;
|
||||||
filterableInDashboard: boolean;
|
filterableInDashboard: boolean;
|
||||||
filterableInStorefront: boolean;
|
filterableInStorefront: boolean;
|
||||||
|
availableInGrid: boolean;
|
||||||
inputType: AttributeInputTypeEnum | null;
|
inputType: AttributeInputTypeEnum | null;
|
||||||
storefrontSearchPosition: number;
|
storefrontSearchPosition: number;
|
||||||
valueRequired: boolean;
|
valueRequired: boolean;
|
||||||
|
|
|
@ -31,6 +31,7 @@ export interface AttributeValueCreate_attributeValueCreate_attribute {
|
||||||
visibleInStorefront: boolean;
|
visibleInStorefront: boolean;
|
||||||
filterableInDashboard: boolean;
|
filterableInDashboard: boolean;
|
||||||
filterableInStorefront: boolean;
|
filterableInStorefront: boolean;
|
||||||
|
availableInGrid: boolean;
|
||||||
inputType: AttributeInputTypeEnum | null;
|
inputType: AttributeInputTypeEnum | null;
|
||||||
storefrontSearchPosition: number;
|
storefrontSearchPosition: number;
|
||||||
valueRequired: boolean;
|
valueRequired: boolean;
|
||||||
|
|
|
@ -31,6 +31,7 @@ export interface AttributeValueDelete_attributeValueDelete_attribute {
|
||||||
visibleInStorefront: boolean;
|
visibleInStorefront: boolean;
|
||||||
filterableInDashboard: boolean;
|
filterableInDashboard: boolean;
|
||||||
filterableInStorefront: boolean;
|
filterableInStorefront: boolean;
|
||||||
|
availableInGrid: boolean;
|
||||||
inputType: AttributeInputTypeEnum | null;
|
inputType: AttributeInputTypeEnum | null;
|
||||||
storefrontSearchPosition: number;
|
storefrontSearchPosition: number;
|
||||||
valueRequired: boolean;
|
valueRequired: boolean;
|
||||||
|
|
|
@ -31,6 +31,7 @@ export interface AttributeValueUpdate_attributeValueUpdate_attribute {
|
||||||
visibleInStorefront: boolean;
|
visibleInStorefront: boolean;
|
||||||
filterableInDashboard: boolean;
|
filterableInDashboard: boolean;
|
||||||
filterableInStorefront: boolean;
|
filterableInStorefront: boolean;
|
||||||
|
availableInGrid: boolean;
|
||||||
inputType: AttributeInputTypeEnum | null;
|
inputType: AttributeInputTypeEnum | null;
|
||||||
storefrontSearchPosition: number;
|
storefrontSearchPosition: number;
|
||||||
valueRequired: boolean;
|
valueRequired: boolean;
|
||||||
|
|
|
@ -161,6 +161,7 @@ export enum PermissionEnum {
|
||||||
MANAGE_MENUS = "MANAGE_MENUS",
|
MANAGE_MENUS = "MANAGE_MENUS",
|
||||||
MANAGE_ORDERS = "MANAGE_ORDERS",
|
MANAGE_ORDERS = "MANAGE_ORDERS",
|
||||||
MANAGE_PAGES = "MANAGE_PAGES",
|
MANAGE_PAGES = "MANAGE_PAGES",
|
||||||
|
MANAGE_PLUGINS = "MANAGE_PLUGINS",
|
||||||
MANAGE_PRODUCTS = "MANAGE_PRODUCTS",
|
MANAGE_PRODUCTS = "MANAGE_PRODUCTS",
|
||||||
MANAGE_SETTINGS = "MANAGE_SETTINGS",
|
MANAGE_SETTINGS = "MANAGE_SETTINGS",
|
||||||
MANAGE_SHIPPING = "MANAGE_SHIPPING",
|
MANAGE_SHIPPING = "MANAGE_SHIPPING",
|
||||||
|
|
Loading…
Reference in a new issue