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

@@ -83,11 +83,20 @@ export const FilamentList: React.FC<IResourceComponentsProps> = () => {
"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<string[]>(
initialState.showColumns ?? allColumns
initialState.showColumns ?? defaultColumns
);
// Type the sorters and filters
@@ -249,6 +258,22 @@ export const FilamentList: React.FC<IResourceComponentsProps> = () => {
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",

View File

@@ -77,14 +77,23 @@ export const SpoolList: React.FC<IResourceComponentsProps> = () => {
"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<string[]>(
initialState.showColumns ?? allColumns
initialState.showColumns ?? defaultColumns
);
// Type the sorters and filters
@@ -208,6 +217,23 @@ export const SpoolList: React.FC<IResourceComponentsProps> = () => {
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<IResourceComponentsProps> = () => {
dataSource,
tableState,
})}
{DateColumn({
id: "registered",
i18ncat: "spool",
dataSource,
tableState,
})}
{SortedColumn({
id: "comment",
i18ncat: "spool",

View File

@@ -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;