From bfb63cbfdc0e3124fdc82cb4bb2fd19afb4a9d26 Mon Sep 17 00:00:00 2001 From: Donkie Date: Fri, 14 Jul 2023 12:05:05 +0200 Subject: [PATCH] Client: Added some missing columns in table Also configured the default columns to show --- client/public/locales/en/common.json | 2 ++ client/public/locales/sv/common.json | 2 ++ client/src/pages/filaments/list.tsx | 27 +++++++++++++++++++++- client/src/pages/spools/list.tsx | 34 +++++++++++++++++++++++++++- client/src/pages/spools/model.tsx | 2 ++ 5 files changed, 65 insertions(+), 2 deletions(-) diff --git a/client/public/locales/en/common.json b/client/public/locales/en/common.json index 5bcc5a7..ff9c0ef 100644 --- a/client/public/locales/en/common.json +++ b/client/public/locales/en/common.json @@ -55,6 +55,8 @@ "filament": "Filament", "used_weight": "Used Weight", "remaining_weight": "Remaining Weight", + "used_length": "Used Length", + "remaining_length": "Remaining Length", "location": "Location", "lot_nr": "Lot Nr", "first_used": "First Used", diff --git a/client/public/locales/sv/common.json b/client/public/locales/sv/common.json index 31e76ae..6c47923 100644 --- a/client/public/locales/sv/common.json +++ b/client/public/locales/sv/common.json @@ -55,6 +55,8 @@ "filament": "Filament", "used_weight": "Använd vikt", "remaining_weight": "Återstående vikt", + "used_length": "Använd längd", + "remaining_length": "Återstående längd", "location": "Plats", "lot_nr": "Batchnummer", "first_used": "Användes först", diff --git a/client/src/pages/filaments/list.tsx b/client/src/pages/filaments/list.tsx index c220422..26ce76e 100644 --- a/client/src/pages/filaments/list.tsx +++ b/client/src/pages/filaments/list.tsx @@ -83,11 +83,20 @@ export const FilamentList: React.FC = () => { "weight", "spool_weight", "article_number", + "settings_extruder_temp", + "settings_bed_temp", "registered", "comment", ]; + const defaultColumns = allColumns.filter( + (column_id) => + ["registered", "density", "diameter", "spool_weight"].indexOf( + column_id + ) === -1 + ); + const [showColumns, setShowColumns] = React.useState( - initialState.showColumns ?? allColumns + initialState.showColumns ?? defaultColumns ); // Type the sorters and filters @@ -249,6 +258,22 @@ export const FilamentList: React.FC = () => { dataSource, tableState, })} + {NumberColumn({ + id: "settings_extruder_temp", + i18ncat: "filament", + unit: "°C", + decimals: 0, + dataSource, + tableState, + })} + {NumberColumn({ + id: "settings_bed_temp", + i18ncat: "filament", + unit: "°C", + decimals: 0, + dataSource, + tableState, + })} {DateColumn({ id: "registered", i18ncat: "filament", diff --git a/client/src/pages/spools/list.tsx b/client/src/pages/spools/list.tsx index da5f869..d1c8a2b 100644 --- a/client/src/pages/spools/list.tsx +++ b/client/src/pages/spools/list.tsx @@ -77,14 +77,23 @@ export const SpoolList: React.FC = () => { "filament_name", "used_weight", "remaining_weight", + "used_length", + "remaining_length", "location", "lot_nr", "first_used", "last_used", + "registered", "comment", ]; + const defaultColumns = allColumns.filter( + (column_id) => + ["registered", "used_length", "remaining_length", "lot_nr"].indexOf( + column_id + ) === -1 + ); const [showColumns, setShowColumns] = React.useState( - initialState.showColumns ?? allColumns + initialState.showColumns ?? defaultColumns ); // Type the sorters and filters @@ -208,6 +217,23 @@ export const SpoolList: React.FC = () => { dataSource, tableState, })} + {NumberColumn({ + id: "used_length", + i18ncat: "spool", + unit: "mm", + decimals: 0, + dataSource, + tableState, + })} + {NumberColumn({ + id: "remaining_length", + i18ncat: "spool", + unit: "mm", + decimals: 0, + defaultText: t("unknown"), + dataSource, + tableState, + })} {FilteredColumn({ id: "location", i18ncat: "spool", @@ -232,6 +258,12 @@ export const SpoolList: React.FC = () => { dataSource, tableState, })} + {DateColumn({ + id: "registered", + i18ncat: "spool", + dataSource, + tableState, + })} {SortedColumn({ id: "comment", i18ncat: "spool", diff --git a/client/src/pages/spools/model.tsx b/client/src/pages/spools/model.tsx index b2cfa29..6cc9845 100644 --- a/client/src/pages/spools/model.tsx +++ b/client/src/pages/spools/model.tsx @@ -8,6 +8,8 @@ export interface ISpool { filament: IFilament; remaining_weight?: number; used_weight: number; + remaining_length?: number; + used_length: number; location?: string; lot_nr?: string; comment?: string;