Client: Added some missing columns in table

Also configured the default columns to show
This commit is contained in:
Donkie
2023-07-14 12:05:05 +02:00
parent 14e758ea23
commit bfb63cbfdc
5 changed files with 65 additions and 2 deletions

View File

@@ -55,6 +55,8 @@
"filament": "Filament", "filament": "Filament",
"used_weight": "Used Weight", "used_weight": "Used Weight",
"remaining_weight": "Remaining Weight", "remaining_weight": "Remaining Weight",
"used_length": "Used Length",
"remaining_length": "Remaining Length",
"location": "Location", "location": "Location",
"lot_nr": "Lot Nr", "lot_nr": "Lot Nr",
"first_used": "First Used", "first_used": "First Used",

View File

@@ -55,6 +55,8 @@
"filament": "Filament", "filament": "Filament",
"used_weight": "Använd vikt", "used_weight": "Använd vikt",
"remaining_weight": "Återstående vikt", "remaining_weight": "Återstående vikt",
"used_length": "Använd längd",
"remaining_length": "Återstående längd",
"location": "Plats", "location": "Plats",
"lot_nr": "Batchnummer", "lot_nr": "Batchnummer",
"first_used": "Användes först", "first_used": "Användes först",

View File

@@ -83,11 +83,20 @@ export const FilamentList: React.FC<IResourceComponentsProps> = () => {
"weight", "weight",
"spool_weight", "spool_weight",
"article_number", "article_number",
"settings_extruder_temp",
"settings_bed_temp",
"registered", "registered",
"comment", "comment",
]; ];
const defaultColumns = allColumns.filter(
(column_id) =>
["registered", "density", "diameter", "spool_weight"].indexOf(
column_id
) === -1
);
const [showColumns, setShowColumns] = React.useState<string[]>( const [showColumns, setShowColumns] = React.useState<string[]>(
initialState.showColumns ?? allColumns initialState.showColumns ?? defaultColumns
); );
// Type the sorters and filters // Type the sorters and filters
@@ -249,6 +258,22 @@ export const FilamentList: React.FC<IResourceComponentsProps> = () => {
dataSource, dataSource,
tableState, 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({ {DateColumn({
id: "registered", id: "registered",
i18ncat: "filament", i18ncat: "filament",

View File

@@ -77,14 +77,23 @@ export const SpoolList: React.FC<IResourceComponentsProps> = () => {
"filament_name", "filament_name",
"used_weight", "used_weight",
"remaining_weight", "remaining_weight",
"used_length",
"remaining_length",
"location", "location",
"lot_nr", "lot_nr",
"first_used", "first_used",
"last_used", "last_used",
"registered",
"comment", "comment",
]; ];
const defaultColumns = allColumns.filter(
(column_id) =>
["registered", "used_length", "remaining_length", "lot_nr"].indexOf(
column_id
) === -1
);
const [showColumns, setShowColumns] = React.useState<string[]>( const [showColumns, setShowColumns] = React.useState<string[]>(
initialState.showColumns ?? allColumns initialState.showColumns ?? defaultColumns
); );
// Type the sorters and filters // Type the sorters and filters
@@ -208,6 +217,23 @@ export const SpoolList: React.FC<IResourceComponentsProps> = () => {
dataSource, dataSource,
tableState, 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({ {FilteredColumn({
id: "location", id: "location",
i18ncat: "spool", i18ncat: "spool",
@@ -232,6 +258,12 @@ export const SpoolList: React.FC<IResourceComponentsProps> = () => {
dataSource, dataSource,
tableState, tableState,
})} })}
{DateColumn({
id: "registered",
i18ncat: "spool",
dataSource,
tableState,
})}
{SortedColumn({ {SortedColumn({
id: "comment", id: "comment",
i18ncat: "spool", i18ncat: "spool",

View File

@@ -8,6 +8,8 @@ export interface ISpool {
filament: IFilament; filament: IFilament;
remaining_weight?: number; remaining_weight?: number;
used_weight: number; used_weight: number;
remaining_length?: number;
used_length: number;
location?: string; location?: string;
lot_nr?: string; lot_nr?: string;
comment?: string; comment?: string;