Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove attributes section
dominik-zeglenbb24b2382f1e
diff --git a/saleor/static/dashboard-next/attributes/components/AttributeDetails/AttributeDetails.tsx b/saleor/static/dashboard-next/attributes/components/AttributeDetails/AttributeDetails.tsxdeleted file mode 100644index 5ab59c1fab..0000000000--- a/saleor/static/dashboard-next/attributes/components/AttributeDetails/AttributeDetails.tsx+++ /dev/null@@ -1,35 +0,0 @@-import Card from "@material-ui/core/Card";-import CardContent from "@material-ui/core/CardContent";-import TextField from "@material-ui/core/TextField";-import * as React from "react";--import i18n from "../../../i18n";--interface AttributeDetailsProps {- data: {- name: string;- };- disabled: boolean;- onChange: (event: React.ChangeEvent<any>) => void;-}--const AttributeDetails: React.StatelessComponent<AttributeDetailsProps> = ({- data,- disabled,- onChange-}) => (- <Card>- <CardContent>- <TextField- disabled={disabled}- fullWidth- label={i18n.t("Name")}- name="name"- value={data.name}- onChange={onChange}- />- </CardContent>- </Card>-);-AttributeDetails.displayName = "AttributeDetails";-export default AttributeDetails;diff --git a/saleor/static/dashboard-next/attributes/components/AttributeDetails/index.ts b/saleor/static/dashboard-next/attributes/components/AttributeDetails/index.tsdeleted file mode 100644index 295325b2f6..0000000000--- a/saleor/static/dashboard-next/attributes/components/AttributeDetails/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { default } from "./AttributeDetails";-export * from "./AttributeDetails";diff --git a/saleor/static/dashboard-next/attributes/components/AttributeDetailsPage/AttributeDetailsPage.tsx b/saleor/static/dashboard-next/attributes/components/AttributeDetailsPage/AttributeDetailsPage.tsxdeleted file mode 100644index 7e3d1a8f19..0000000000--- a/saleor/static/dashboard-next/attributes/components/AttributeDetailsPage/AttributeDetailsPage.tsx+++ /dev/null@@ -1,118 +0,0 @@-import { withStyles } from "@material-ui/core/styles";-import * as React from "react";--import DialogContentText from "@material-ui/core/DialogContentText";-import ActionDialog from "../../../components/ActionDialog";-import Container from "../../../components/Container";-import Form from "../../../components/Form";-import PageHeader from "../../../components/PageHeader";-import SaveButtonBar, {- SaveButtonBarState-} from "../../../components/SaveButtonBar";-import Toggle from "../../../components/Toggle";-import i18n from "../../../i18n";-import AttributeDetails from "../AttributeDetails/AttributeDetails";-import AttributeValueList from "../AttributeValueList/AttributeValueList";--interface AttributeDetailsPageProps {- attribute?: {- id: string;- name: string;- values: Array<{- id: string;- name: string;- sortOrder: number;- slug: string;- }>;- };- disabled: boolean;- saveButtonBarState: SaveButtonBarState;- onBack: () => void;- onDelete: () => void;- onSubmit: () => void;-}--const decorate = withStyles(theme => ({- root: {- display: "grid",- gridColumnGap: theme.spacing.unit * 2 + "px",- gridTemplateColumns: "2fr 1fr"- }-}));-const AttributeDetailsPage = decorate<AttributeDetailsPageProps>(- ({- attribute,- classes,- disabled,- saveButtonBarState,- onBack,- onDelete,- onSubmit- }) => (- <Toggle>- {(openedDeleteDialog, { toggle: toggleDeleteDialog }) => (- <Form- initial={{- name: attribute && attribute.name,- values: attribute && attribute.values- }}- onSubmit={onSubmit}- key={JSON.stringify(attribute)}- >- {({ change, data, hasChanged, submit }) => (- <>- <Container width="md">- <PageHeader- title={attribute ? attribute.name : undefined}- onBack={onBack}- />- <div className={classes.root}>- <div>- <AttributeDetails- data={data}- disabled={disabled}- onChange={change}- />- <AttributeValueList- disabled={disabled}- loading={!attribute || !attribute.values}- values={data.values}- onChange={change}- />- </div>- </div>- <SaveButtonBar- onCancel={onBack}- onDelete={toggleDeleteDialog}- state={saveButtonBarState}- disabled={disabled || !hasChanged}- onSave={submit}- />- </Container>- {attribute && (- <ActionDialog- open={openedDeleteDialog}- variant="delete"- onConfirm={onDelete}- onClose={toggleDeleteDialog}- title={i18n.t("Remove attribute")}- >- <DialogContentText- dangerouslySetInnerHTML={{- __html: i18n.t(- "Are you sure you want to remove <strong>{{ name }}</strong>?",- { name: attribute.name }- )- }}- />- </ActionDialog>- )}- </>- )}- </Form>- )}- </Toggle>- )-);-AttributeDetailsPage.displayName = "AttributeDetailsPage";-export default AttributeDetailsPage;diff --git a/saleor/static/dashboard-next/attributes/components/AttributeDetailsPage/index.ts b/saleor/static/dashboard-next/attributes/components/AttributeDetailsPage/index.tsdeleted file mode 100644index cc88ccff49..0000000000--- a/saleor/static/dashboard-next/attributes/components/AttributeDetailsPage/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { default } from "./AttributeDetailsPage";-export * from "./AttributeDetailsPage";diff --git a/saleor/static/dashboard-next/attributes/components/AttributeList/AttributeList.tsx b/saleor/static/dashboard-next/attributes/components/AttributeList/AttributeList.tsxdeleted file mode 100644index 8a7032c718..0000000000--- a/saleor/static/dashboard-next/attributes/components/AttributeList/AttributeList.tsx+++ /dev/null@@ -1,116 +0,0 @@-import Card from "@material-ui/core/Card";-import { withStyles } from "@material-ui/core/styles";-import Table from "@material-ui/core/Table";-import TableBody from "@material-ui/core/TableBody";-import TableCell from "@material-ui/core/TableCell";-import TableFooter from "@material-ui/core/TableFooter";-import TableHead from "@material-ui/core/TableHead";-import TableRow from "@material-ui/core/TableRow";-import * as React from "react";--import { ListProps } from "../../..";-import Skeleton from "../../../components/Skeleton";-import TablePagination from "../../../components/TablePagination";-import i18n from "../../../i18n";-import { renderCollection } from "../../../misc";--interface AttributeListProps extends ListProps {- attributes?: Array<{- id: string;- name: string;- values: Array<{- id: string;- sortOrder: number;- name: string;- }>;- }>;-}--const decorate = withStyles(theme => ({- link: {- color: theme.palette.secondary.main,- cursor: "pointer"- }-}));-const AttributeList = decorate<AttributeListProps>(- ({- attributes,- classes,- disabled,- pageInfo,- onNextPage,- onPreviousPage,- onRowClick- }) => (- <Card>- <Table>- <TableHead>- <TableRow>- <TableCell>{i18n.t("Name", { context: "object" })}</TableCell>- <TableCell>{i18n.t("Values", { context: "object" })}</TableCell>- </TableRow>- </TableHead>- <TableFooter>- <TableRow>- <TablePagination- colSpan={2}- hasNextPage={pageInfo && !disabled ? pageInfo.hasNextPage : false}- onNextPage={onNextPage}- hasPreviousPage={- pageInfo && !disabled ? pageInfo.hasPreviousPage : false- }- onPreviousPage={onPreviousPage}- />- </TableRow>- </TableFooter>- <TableBody>- {renderCollection(- attributes,- attribute => (- <TableRow key={attribute ? attribute.id : "skeleton"}>- <TableCell>- {attribute ? (- <span- onClick={onRowClick(attribute.id)}- className={classes.link}- >- {attribute.name}- </span>- ) : (- <Skeleton />- )}- </TableCell>- <TableCell>- {attribute && attribute.values ? (- attribute.values- .sort(- (a, b) =>- a.sortOrder > b.sortOrder- ? 1- : a.sortOrder < b.sortOrder- ? -1- : 0- )- .map(v => v.name)- .join(", ")- ) : (- <Skeleton />- )}- </TableCell>- </TableRow>- ),- () => (- <TableRow>- <TableCell colSpan={2}>- {i18n.t("No attributes found")}- </TableCell>- </TableRow>- )- )}- </TableBody>- </Table>- </Card>- )-);-AttributeList.displayName = "AttributeList";-export default AttributeList;diff --git a/saleor/static/dashboard-next/attributes/components/AttributeList/index.ts b/saleor/static/dashboard-next/attributes/components/AttributeList/index.tsdeleted file mode 100644index 9b2e63fa5e..0000000000--- a/saleor/static/dashboard-next/attributes/components/AttributeList/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { default } from "./AttributeList";-export * from "./AttributeList";diff --git a/saleor/static/dashboard-next/attributes/components/AttributeListPage/AttributeListPage.tsx b/saleor/static/dashboard-next/attributes/components/AttributeListPage/AttributeListPage.tsxdeleted file mode 100644index 43c5734f53..0000000000--- a/saleor/static/dashboard-next/attributes/components/AttributeListPage/AttributeListPage.tsx+++ /dev/null@@ -1,54 +0,0 @@-import Button from "@material-ui/core/Button";-import AddIcon from "@material-ui/icons/Add";-import * as React from "react";--import { PageListProps } from "../../../";-import Container from "../../../components/Container";-import PageHeader from "../../../components/PageHeader";-import i18n from "../../../i18n";-import AttributeList from "../AttributeList/AttributeList";--interface AttributeListPageProps extends PageListProps {- attributes?: Array<{- id: string;- name: string;- values: Array<{- id: string;- sortOrder: number;- name: string;- }>;- }>;-}--const AttributeListPage: React.StatelessComponent<AttributeListPageProps> = ({- attributes,- disabled,- pageInfo,- onAdd,- onNextPage,- onPreviousPage,- onRowClick-}) => (- <Container width="md">- <PageHeader title={i18n.t("Attributes")}>- <Button- color="secondary"- variant="contained"- disabled={disabled}- onClick={onAdd}- >- {i18n.t("Add attribute")} <AddIcon />- </Button>- </PageHeader>- <AttributeList- attributes={attributes}- disabled={disabled}- pageInfo={pageInfo}- onNextPage={onNextPage}- onPreviousPage={onPreviousPage}- onRowClick={onRowClick}- />- </Container>-);-AttributeListPage.displayName = "AttributeListPage";-export default AttributeListPage;diff --git a/saleor/static/dashboard-next/attributes/components/AttributeListPage/index.ts b/saleor/static/dashboard-next/attributes/components/AttributeListPage/index.tsdeleted file mode 100644index 2633c77690..0000000000--- a/saleor/static/dashboard-next/attributes/components/AttributeListPage/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { default } from "./AttributeListPage";-export * from "./AttributeListPage";diff --git a/saleor/static/dashboard-next/attributes/components/AttributeValueList/AttributeValueList.tsx b/saleor/static/dashboard-next/attributes/components/AttributeValueList/AttributeValueList.tsxdeleted file mode 100644index 35286576d0..0000000000--- a/saleor/static/dashboard-next/attributes/components/AttributeValueList/AttributeValueList.tsx+++ /dev/null@@ -1,139 +0,0 @@-import Button from "@material-ui/core/Button";-import Card from "@material-ui/core/Card";-import IconButton from "@material-ui/core/IconButton";-import { withStyles } from "@material-ui/core/styles";-import Table from "@material-ui/core/Table";-import TableBody from "@material-ui/core/TableBody";-import TableCell from "@material-ui/core/TableCell";-import TableHead from "@material-ui/core/TableHead";-import TableRow from "@material-ui/core/TableRow";-import CloseIcon from "@material-ui/icons/Close";-import * as React from "react";-import Skeleton from "../../../components/Skeleton";--import CardTitle from "../../../components/CardTitle";-import { EditableTableCell } from "../../../components/EditableTableCell/EditableTableCell";-import i18n from "../../../i18n";-import { renderCollection } from "../../../misc";--interface AttributeValueListProps {- disabled: boolean;- loading: boolean;- values: Array<{- id: string;- name: string;- isNew?: boolean;- }>;- onChange: (event: React.ChangeEvent<any>) => void;-}--const decorate = withStyles(theme => ({- deleteIcon: {- paddingLeft: 0,- width: theme.spacing.unit * 7- },- edit: {- width: "unset"- },- root: {- marginTop: theme.spacing.unit * 2,- overflow: "visible",- [theme.breakpoints.down("md")]: {- marginTop: theme.spacing.unit- }- }-}));-const AttributeValueList = decorate<AttributeValueListProps>(- ({ classes, disabled, values, onChange }) => {- const defaultValue = i18n.t("New value");- const handleAdd = () =>- onChange({- target: {- name: "values",- value: [- ...values,- {- id: "new-" + values.length,- isNew: true,- name: defaultValue- }- ]- }- } as any);- const handleEdit = (id: string) => (name: string) =>- onChange({- target: {- name: "values",- value: values.map(v => (v.id === id ? { id, name } : v))- }- } as any);- const handleDelete = (id: string) => () =>- onChange({- target: { name: "values", value: values.filter(v => v.id !== id) }- } as any);- return (- <Card className={classes.root}>- <CardTitle- title={i18n.t("Attribute values")}- toolbar={- <Button- color="secondary"- variant="flat"- disabled={disabled}- onClick={handleAdd}- >- {i18n.t("Add value")}- </Button>- }- />- <Table>- <TableHead>- <TableRow>- <TableCell>{i18n.t("Name")}</TableCell>- <TableCell className={classes.deleteIcon} />- </TableRow>- </TableHead>- <TableBody>- {renderCollection(- values,- value => (- <TableRow key={value ? value.id : "skeleton"}>- {value ? (- <EditableTableCell- classes={{ root: classes.edit }}- focused={value.isNew}- defaultValue={defaultValue}- value={value.name}- onConfirm={handleEdit(value.id)}- />- ) : (- <TableCell>- <Skeleton />- </TableCell>- )}- <TableCell className={classes.deleteIcon}>- <IconButton- disabled={disabled}- onClick={value && handleDelete(value.id)}- >- <CloseIcon />- </IconButton>- </TableCell>- </TableRow>- ),- () => (- <TableRow>- <TableCell colSpan={2}>- {i18n.t("No attribute values found")}- </TableCell>- </TableRow>- )- )}- </TableBody>- </Table>- </Card>- );- }-);-AttributeValueList.displayName = "AttributeValueList";-export default AttributeValueList;diff --git a/saleor/static/dashboard-next/attributes/components/AttributeValueList/index.ts b/saleor/static/dashboard-next/attributes/components/AttributeValueList/index.tsdeleted file mode 100644index cd0e8a1cad..0000000000--- a/saleor/static/dashboard-next/attributes/components/AttributeValueList/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { default } from "./AttributeValueList";-export * from "./AttributeValueList";diff --git a/saleor/static/dashboard-next/attributes/fixtures.ts b/saleor/static/dashboard-next/attributes/fixtures.tsdeleted file mode 100644index 42fb9f9af4..0000000000--- a/saleor/static/dashboard-next/attributes/fixtures.ts+++ /dev/null@@ -1,164 +0,0 @@-export const attributes = [- {- id: "pta14307",- name: "generating",- slug: "generating",- sortOrder: 0,- values: [- {- id: "ptav19870",- name: "Open-source",- slug: "Open-source",- sortOrder: 0- },- {- id: "ptav2495",- name: "knowledge base",- slug: "knowledge-base",- sortOrder: 1- },- { id: "ptav23080", name: "productize", slug: "productize", sortOrder: 2 },- {- id: "ptav45069",- name: "Investment Account",- slug: "Investment-Account",- sortOrder: 3- }- ]- },- {- id: "pta62481",- name: "Buckinghamshire",- slug: "Buckinghamshire",- sortOrder: 1,- values: [- { id: "ptav17223", name: "sky blue", slug: "sky-blue", sortOrder: 0 }- ]- },- {- id: "pta40405",- name: "connecting",- slug: "connecting",- sortOrder: 2,- values: [- { id: "ptav57900", name: "Licensed", slug: "Licensed", sortOrder: 0 },- {- id: "ptav28636",- name: "secured line",- slug: "secured-line",- sortOrder: 1- },- {- id: "ptav74194",- name: "implementation",- slug: "implementation",- sortOrder: 2- }- ]- },- {- id: "pta76841",- name: "Vietnam",- slug: "Vietnam",- sortOrder: 3,- values: [- { id: "ptav58292", name: "24 hour", slug: "24-hour", sortOrder: 0 },- { id: "ptav245", name: "online", slug: "online", sortOrder: 1 },- { id: "ptav61230", name: "sexy", slug: "sexy", sortOrder: 2 },- {- id: "ptav51088",- name: "grid-enabled",- slug: "grid-enabled",- sortOrder: 3- }- ]- },- {- id: "pta93525",- name: "Product",- slug: "Product",- sortOrder: 4,- values: [- { id: "ptav98657", name: "synergize", slug: "synergize", sortOrder: 0 },- {- id: "ptav21846",- name: "object-oriented",- slug: "object-oriented",- sortOrder: 1- }- ]- },- {- id: "pta75239",- name: "core",- slug: "core",- sortOrder: 5,- values: [- { id: "ptav62330", name: "Usability", slug: "Usability", sortOrder: 0 },- { id: "ptav23358", name: "Mount", slug: "Mount", sortOrder: 1 },- { id: "ptav14914", name: "Camp", slug: "Camp", sortOrder: 2 }- ]- },- {- id: "pta83784",- name: "application",- slug: "application",- sortOrder: 6,- values: [- { id: "ptav6529", name: "SMS", slug: "SMS", sortOrder: 0 },- { id: "ptav64061", name: "Steel", slug: "Steel", sortOrder: 1 },- {- id: "ptav85272",- name: "Investment Account",- slug: "Investment-Account",- sortOrder: 2- }- ]- },- {- id: "pta87313",- name: "Berkshire",- slug: "Berkshire",- sortOrder: 7,- values: [- { id: "ptav76323", name: "Computers", slug: "Computers", sortOrder: 0 },- { id: "ptav59124", name: "Lead", slug: "Lead", sortOrder: 1 },- { id: "ptav47780", name: "Road", slug: "Road", sortOrder: 2 },- { id: "ptav71036", name: "Future", slug: "Future", sortOrder: 3 }- ]- },- {- id: "pta57076",- name: "bypass",- slug: "bypass",- sortOrder: 8,- values: [- { id: "ptav65622", name: "system", slug: "system", sortOrder: 0 },- { id: "ptav11597", name: "teal", slug: "teal", sortOrder: 1 },- { id: "ptav64722", name: "Cloned", slug: "Cloned", sortOrder: 2 },- {- id: "ptav73356",- name: "internet solution",- slug: "internet-solution",- sortOrder: 3- },- { id: "ptav5682", name: "pixel", slug: "pixel", sortOrder: 4 }- ]- },- {- id: "pta69676",- name: "web-readiness",- slug: "web-readiness",- sortOrder: 9,- values: [- { id: "ptav35769", name: "magnetic", slug: "magnetic", sortOrder: 0 },- {- id: "ptav96041",- name: "Triple-buffered",- slug: "Triple-buffered",- sortOrder: 1- },- { id: "ptav33660", name: "Berkshire", slug: "Berkshire", sortOrder: 2 }- ]- }-];diff --git a/saleor/static/dashboard-next/attributes/index.ts b/saleor/static/dashboard-next/attributes/index.tsdeleted file mode 100644index 6a77bba468..0000000000--- a/saleor/static/dashboard-next/attributes/index.ts+++ /dev/null@@ -1 +0,0 @@-export const attributesListUrl = "/attributes/";