Skip to content

Commit e46655c

Browse files
authored
Merge pull request #1519 from rocket-admin/backend_table_settings_rework
fix columns_view in table settings
2 parents 726dc56 + 1916a49 commit e46655c

File tree

6 files changed

+1044
-645
lines changed

6 files changed

+1044
-645
lines changed

backend/src/entities/table-settings/application/data-structures/create-table-settings.ds.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,7 @@ export class CreateTableSettingsDs {
7777

7878
@ApiProperty({ required: false })
7979
ordering_field?: string;
80+
81+
@ApiProperty({ isArray: true, type: 'string', required: false })
82+
columns_view?: Array<string>;
8083
}

backend/src/entities/table-settings/common-table-settings/dto/create-table-settings.dto.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ import { CustomFieldsEntity } from '../../../custom-field/custom-fields.entity.j
22
import { TableWidgetEntity } from '../../../widget/table-widget.entity.js';
33

44
export class CreateTableSettingsDto {
5-
connection_id: string;
6-
table_name: string;
7-
display_name: string;
8-
search_fields: string[];
9-
excluded_fields: string[];
10-
identification_fields: string[];
11-
identity_column;
12-
readonly_fields: string[];
13-
sortable_by: string[];
14-
autocomplete_columns: string[];
15-
custom_fields?: CustomFieldsEntity[];
16-
table_widgets?: TableWidgetEntity[];
5+
connection_id: string;
6+
table_name: string;
7+
display_name: string;
8+
search_fields: string[];
9+
excluded_fields: string[];
10+
identification_fields: string[];
11+
identity_column;
12+
readonly_fields: string[];
13+
sortable_by: string[];
14+
autocomplete_columns: string[];
15+
custom_fields?: CustomFieldsEntity[];
16+
table_widgets?: TableWidgetEntity[];
17+
columns_view?: string[];
1718
}

backend/src/entities/table-settings/common-table-settings/table-settings.controller.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export class TableSettingsController {
118118
@Body('list_fields') list_fields: string[],
119119
@Body('ordering') ordering: string,
120120
@Body('ordering_field') ordering_field: string,
121+
@Body('columns_view') columns_view: string[],
121122
@UserId() userId: string,
122123
@MasterPassword() masterPwd: string,
123124
): Promise<FoundTableSettingsDs> {
@@ -147,6 +148,7 @@ export class TableSettingsController {
147148
list_fields: list_fields,
148149
ordering: ordering,
149150
ordering_field: ordering_field,
151+
columns_view: columns_view,
150152
};
151153

152154
const errors = this.validateParameters(inputData);
@@ -195,6 +197,7 @@ export class TableSettingsController {
195197
@Body('list_fields') list_fields: string[],
196198
@Body('ordering') ordering: string,
197199
@Body('ordering_field') ordering_field: string,
200+
@Body('columns_view') columns_view: string[],
198201
@UserId() userId: string,
199202
@MasterPassword() masterPwd: string,
200203
): Promise<FoundTableSettingsDs> {
@@ -223,6 +226,7 @@ export class TableSettingsController {
223226
list_per_page,
224227
ordering,
225228
ordering_field,
229+
columns_view,
226230
};
227231

228232
const errors = this.validateParameters(inputData);

backend/src/entities/table-settings/common-table-settings/utils/build-new-table-settings-entity.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export function buildNewTableSettingsEntity(
3232
list_fields,
3333
ordering,
3434
ordering_field,
35+
columns_view,
3536
} = settings;
3637
newSettings.connection_id = connection;
3738
newSettings.display_name = display_name;
@@ -57,5 +58,6 @@ export function buildNewTableSettingsEntity(
5758
newSettings.list_fields = list_fields;
5859
newSettings.ordering = ordering as QueryOrderingEnum;
5960
newSettings.ordering_field = ordering_field;
61+
newSettings.columns_view = columns_view;
6062
return newSettings;
6163
}

0 commit comments

Comments
 (0)