IO-1412 Resolve production list saving and loading.
This commit is contained in:
@@ -66,12 +66,7 @@ export function ProductionListSaveConfigButton({
|
||||
};
|
||||
const popMenu = (
|
||||
<div>
|
||||
<Form
|
||||
layout="vertical"
|
||||
form={form}
|
||||
onFinish={handleSaveConfig}
|
||||
initialValues={{ driveable: true, towin: false }}
|
||||
>
|
||||
<Form layout="vertical" form={form} onFinish={handleSaveConfig}>
|
||||
<Form.Item
|
||||
label={t("production.labels.viewname")}
|
||||
name="name"
|
||||
|
||||
@@ -55,6 +55,19 @@ export function ProductionListTable({
|
||||
if (assoc) {
|
||||
await updateDefaultProdView({
|
||||
variables: { assocId: assoc.id, view: value },
|
||||
update(cache) {
|
||||
cache.modify({
|
||||
id: cache.identify(bodyshop),
|
||||
fields: {
|
||||
associations(existingAssociations, { readField }) {
|
||||
return existingAssociations.map((a) => {
|
||||
if (a.useremail !== currentUser.email) return a;
|
||||
return { ...a, default_prod_list_view: value };
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -85,13 +98,18 @@ export function ProductionListTable({
|
||||
|
||||
setState(bodyshop.production_config[0].columns.tableState);
|
||||
};
|
||||
const assoc = bodyshop.associations.find(
|
||||
(a) => a.useremail === currentUser.email
|
||||
);
|
||||
|
||||
const defaultView = assoc && assoc.default_prod_list_view;
|
||||
return (
|
||||
<div style={{ width: "10rem" }}>
|
||||
<Select
|
||||
onSelect={handleSelect}
|
||||
placeholder={t("production.labels.selectview")}
|
||||
optionLabelProp="label"
|
||||
defaultValue={defaultView}
|
||||
>
|
||||
{bodyshop.production_config.map((config) => (
|
||||
<Select.Option key={config.name} label={config.name}>
|
||||
|
||||
@@ -32,12 +32,11 @@ export function ProductionListTable({
|
||||
}) {
|
||||
const [searchText, setSearchText] = useState("");
|
||||
|
||||
const defaultView = useMemo(() => {
|
||||
const assoc = bodyshop.associations.find(
|
||||
(a) => a.useremail === currentUser.email
|
||||
);
|
||||
return assoc && assoc.default_prod_list_view;
|
||||
}, [bodyshop.associations, currentUser.email]);
|
||||
const assoc = bodyshop.associations.find(
|
||||
(a) => a.useremail === currentUser.email
|
||||
);
|
||||
|
||||
const defaultView = assoc && assoc.default_prod_list_view;
|
||||
|
||||
const [state, setState] = useState(
|
||||
(bodyshop.production_config &&
|
||||
|
||||
Reference in New Issue
Block a user