diff options
Diffstat (limited to 'client/src/app/core/rest/rest-table.ts')
-rw-r--r-- | client/src/app/core/rest/rest-table.ts | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/client/src/app/core/rest/rest-table.ts b/client/src/app/core/rest/rest-table.ts index ec5646b5d..707110d7f 100644 --- a/client/src/app/core/rest/rest-table.ts +++ b/client/src/app/core/rest/rest-table.ts | |||
@@ -7,7 +7,7 @@ import { RestPagination } from './rest-pagination' | |||
7 | 7 | ||
8 | const debugLogger = debug('peertube:tables:RestTable') | 8 | const debugLogger = debug('peertube:tables:RestTable') |
9 | 9 | ||
10 | export abstract class RestTable { | 10 | export abstract class RestTable <T = unknown> { |
11 | 11 | ||
12 | abstract totalRecords: number | 12 | abstract totalRecords: number |
13 | abstract sort: SortMeta | 13 | abstract sort: SortMeta |
@@ -17,6 +17,8 @@ export abstract class RestTable { | |||
17 | rowsPerPage = this.rowsPerPageOptions[0] | 17 | rowsPerPage = this.rowsPerPageOptions[0] |
18 | expandedRows = {} | 18 | expandedRows = {} |
19 | 19 | ||
20 | selectedRows: T[] = [] | ||
21 | |||
20 | search: string | 22 | search: string |
21 | 23 | ||
22 | protected route: ActivatedRoute | 24 | protected route: ActivatedRoute |
@@ -75,7 +77,17 @@ export abstract class RestTable { | |||
75 | this.reloadData() | 77 | this.reloadData() |
76 | } | 78 | } |
77 | 79 | ||
78 | protected abstract reloadData (): void | 80 | isInSelectionMode () { |
81 | return this.selectedRows.length !== 0 | ||
82 | } | ||
83 | |||
84 | protected abstract reloadDataInternal (): void | ||
85 | |||
86 | protected reloadData () { | ||
87 | this.selectedRows = [] | ||
88 | |||
89 | this.reloadDataInternal() | ||
90 | } | ||
79 | 91 | ||
80 | private getSortLocalStorageKey () { | 92 | private getSortLocalStorageKey () { |
81 | return 'rest-table-sort-' + this.getIdentifier() | 93 | return 'rest-table-sort-' + this.getIdentifier() |