Merged in feature/IO-2985-Production-List-View-Null-Handling (pull request #1818)
IO-2985-Production-List-View-Null-Handling - Handle Null md_production_config
This commit is contained in:
@@ -185,7 +185,7 @@ function ProductionBoardKanbanComponent({ data, bodyshop, refetch, insertAuditTr
|
|||||||
const cardSettings = useMemo(() => {
|
const cardSettings = useMemo(() => {
|
||||||
const kanbanSettings = associationSettings?.kanban_settings;
|
const kanbanSettings = associationSettings?.kanban_settings;
|
||||||
return mergeWithDefaults(kanbanSettings);
|
return mergeWithDefaults(kanbanSettings);
|
||||||
}, [associationSettings]);
|
}, [associationSettings?.kanban_settings]);
|
||||||
|
|
||||||
const handleSettingsChange = () => {
|
const handleSettingsChange = () => {
|
||||||
setFilter(defaultFilters);
|
setFilter(defaultFilters);
|
||||||
|
|||||||
@@ -457,41 +457,42 @@ export function ProductionListConfigManager({
|
|||||||
value={activeView}
|
value={activeView}
|
||||||
disabled={open || isAddingNewProfile} // Disable the Select box when the popover is open or adding a new profile
|
disabled={open || isAddingNewProfile} // Disable the Select box when the popover is open or adding a new profile
|
||||||
>
|
>
|
||||||
{bodyshop.production_config
|
{bodyshop?.production_config &&
|
||||||
.slice()
|
bodyshop.production_config
|
||||||
.sort((a, b) =>
|
.slice()
|
||||||
a.name === t("production.constants.main_profile")
|
.sort((a, b) =>
|
||||||
? -1
|
a.name === t("production.constants.main_profile")
|
||||||
: b.name === t("production.constants.main_profile")
|
? -1
|
||||||
? 1
|
: b.name === t("production.constants.main_profile")
|
||||||
: 0
|
? 1
|
||||||
) //
|
: 0
|
||||||
.map((config) => (
|
) //
|
||||||
<Select.Option key={config.name} label={config.name}>
|
.map((config) => (
|
||||||
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
|
<Select.Option key={config.name} label={config.name}>
|
||||||
<span
|
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
|
||||||
style={{
|
<span
|
||||||
flex: 1,
|
style={{
|
||||||
maxWidth: "80%",
|
flex: 1,
|
||||||
marginRight: "1rem",
|
maxWidth: "80%",
|
||||||
textOverflow: "ellipsis"
|
marginRight: "1rem",
|
||||||
}}
|
textOverflow: "ellipsis"
|
||||||
>
|
}}
|
||||||
{config.name}
|
|
||||||
</span>
|
|
||||||
{config.name !== t("production.constants.main_profile") && (
|
|
||||||
<Popconfirm
|
|
||||||
placement="right"
|
|
||||||
title={t("general.labels.areyousure")}
|
|
||||||
onConfirm={() => handleTrash(config.name)}
|
|
||||||
onCancel={(e) => e.stopPropagation()}
|
|
||||||
>
|
>
|
||||||
<DeleteOutlined onClick={(e) => e.stopPropagation()} />
|
{config.name}
|
||||||
</Popconfirm>
|
</span>
|
||||||
)}
|
{config.name !== t("production.constants.main_profile") && (
|
||||||
</div>
|
<Popconfirm
|
||||||
</Select.Option>
|
placement="right"
|
||||||
))}
|
title={t("general.labels.areyousure")}
|
||||||
|
onConfirm={() => handleTrash(config.name)}
|
||||||
|
onCancel={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<DeleteOutlined onClick={(e) => e.stopPropagation()} />
|
||||||
|
</Popconfirm>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</Select.Option>
|
||||||
|
))}
|
||||||
<Select.Option key="add_new" label={t("production.labels.addnewprofile")}>
|
<Select.Option key="add_new" label={t("production.labels.addnewprofile")}>
|
||||||
<div style={{ display: "flex", alignItems: "center" }}>
|
<div style={{ display: "flex", alignItems: "center" }}>
|
||||||
<PlusOutlined style={{ marginRight: "0.5rem" }} />
|
<PlusOutlined style={{ marginRight: "0.5rem" }} />
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ export function ProductionListTable({ loading, data, refetch, bodyshop, technici
|
|||||||
|
|
||||||
const initialColumnsRef = useRef(
|
const initialColumnsRef = useRef(
|
||||||
(initialStateRef.current &&
|
(initialStateRef.current &&
|
||||||
bodyshop.production_config
|
bodyshop?.production_config
|
||||||
.find((p) => p.name === defaultView)
|
?.find((p) => p.name === defaultView)
|
||||||
?.columns.columnKeys.map((k) => {
|
?.columns.columnKeys.map((k) => {
|
||||||
return {
|
return {
|
||||||
...ProductionListColumns({
|
...ProductionListColumns({
|
||||||
@@ -76,8 +76,8 @@ export function ProductionListTable({ loading, data, refetch, bodyshop, technici
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const matchingColumnConfig = useMemo(() => {
|
const matchingColumnConfig = useMemo(() => {
|
||||||
return bodyshop.production_config.find((p) => p.name === defaultView);
|
return bodyshop?.production_config?.find((p) => p.name === defaultView);
|
||||||
}, [bodyshop.production_config, defaultView]);
|
}, [bodyshop.production_config]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const newColumns =
|
const newColumns =
|
||||||
|
|||||||
Reference in New Issue
Block a user