diff --git a/src/app/core/_components/tables/access-groups-agents-table/access-groups-agents-table.component.html b/src/app/core/_components/tables/access-groups-agents-table/access-groups-agents-table.component.html index 10617bb1..12386ef3 100644 --- a/src/app/core/_components/tables/access-groups-agents-table/access-groups-agents-table.component.html +++ b/src/app/core/_components/tables/access-groups-agents-table/access-groups-agents-table.component.html @@ -1,16 +1,5 @@ - + \ No newline at end of file diff --git a/src/app/core/_components/tables/access-groups-users-table/access-groups-users-table.component.html b/src/app/core/_components/tables/access-groups-users-table/access-groups-users-table.component.html index fd72ced6..a6233e01 100644 --- a/src/app/core/_components/tables/access-groups-users-table/access-groups-users-table.component.html +++ b/src/app/core/_components/tables/access-groups-users-table/access-groups-users-table.component.html @@ -1,16 +1,5 @@ - + \ No newline at end of file diff --git a/src/app/core/_components/tables/access-permission-groups-user-table/access-permission-groups-user-table.component.html b/src/app/core/_components/tables/access-permission-groups-user-table/access-permission-groups-user-table.component.html index e4593c97..01744864 100644 --- a/src/app/core/_components/tables/access-permission-groups-user-table/access-permission-groups-user-table.component.html +++ b/src/app/core/_components/tables/access-permission-groups-user-table/access-permission-groups-user-table.component.html @@ -1,14 +1,4 @@ - + \ No newline at end of file diff --git a/src/app/core/_components/tables/access-permission-groups-users-table/access-permission-groups-users-table.component.html b/src/app/core/_components/tables/access-permission-groups-users-table/access-permission-groups-users-table.component.html index d586e4d1..8ceec9ed 100644 --- a/src/app/core/_components/tables/access-permission-groups-users-table/access-permission-groups-users-table.component.html +++ b/src/app/core/_components/tables/access-permission-groups-users-table/access-permission-groups-users-table.component.html @@ -1,13 +1,4 @@ - + \ No newline at end of file diff --git a/src/app/core/_components/tables/agent-error-table/agent-error-table.component.html b/src/app/core/_components/tables/agent-error-table/agent-error-table.component.html index 027ebe8c..602d247f 100644 --- a/src/app/core/_components/tables/agent-error-table/agent-error-table.component.html +++ b/src/app/core/_components/tables/agent-error-table/agent-error-table.component.html @@ -1,17 +1,6 @@ - + \ No newline at end of file diff --git a/src/app/core/_components/tables/chunks-table/chunks-table.component.html b/src/app/core/_components/tables/chunks-table/chunks-table.component.html index 59f46b51..4a338310 100644 --- a/src/app/core/_components/tables/chunks-table/chunks-table.component.html +++ b/src/app/core/_components/tables/chunks-table/chunks-table.component.html @@ -1,14 +1,4 @@ - + \ No newline at end of file diff --git a/src/app/core/_components/tables/files-attack-table/files-attack-table.component.html b/src/app/core/_components/tables/files-attack-table/files-attack-table.component.html index ac7d12a5..0b3f866e 100644 --- a/src/app/core/_components/tables/files-attack-table/files-attack-table.component.html +++ b/src/app/core/_components/tables/files-attack-table/files-attack-table.component.html @@ -1,19 +1,5 @@ - + \ No newline at end of file diff --git a/src/app/core/_components/tables/hashes-table/hashes-table.component.html b/src/app/core/_components/tables/hashes-table/hashes-table.component.html index 4a303075..f3a22621 100644 --- a/src/app/core/_components/tables/hashes-table/hashes-table.component.html +++ b/src/app/core/_components/tables/hashes-table/hashes-table.component.html @@ -1,17 +1,6 @@ - + \ No newline at end of file diff --git a/src/app/core/_components/tables/health-check-agents-table/health-check-agents-table.component.html b/src/app/core/_components/tables/health-check-agents-table/health-check-agents-table.component.html index fa3d65a3..cec3d88a 100644 --- a/src/app/core/_components/tables/health-check-agents-table/health-check-agents-table.component.html +++ b/src/app/core/_components/tables/health-check-agents-table/health-check-agents-table.component.html @@ -1,13 +1,3 @@ - + \ No newline at end of file diff --git a/src/app/core/_components/tables/ht-table/ht-table.component.ts b/src/app/core/_components/tables/ht-table/ht-table.component.ts index 0687eefb..468fa5a8 100644 --- a/src/app/core/_components/tables/ht-table/ht-table.component.ts +++ b/src/app/core/_components/tables/ht-table/ht-table.component.ts @@ -132,6 +132,9 @@ export class HTTableComponent implements OnInit, AfterViewInit, OnDestroy { /** Flag to enable or disable selectable rows. */ @Input() isSelectable = false; + /**Flag to signal if it's a detail page, since detail pages do not keep state. */ + @Input() isDetailPage = false; + /** Flag to enable or disable cmd task attack checkbox. */ @Input() isCmdTask = false; @@ -229,11 +232,15 @@ export class HTTableComponent implements OnInit, AfterViewInit, OnDestroy { ngOnInit(): void { this.uiSettings = new UISettingsUtilityClass(this.storage); const displayedColumns = this.uiSettings.getTableSettings(this.name); - this.defaultPageSize = this.uiSettings['uiConfig']['tableSettings'][this.name]['page']; - this.defaultStartPage = this.uiSettings['uiConfig']['tableSettings'][this.name]['start']; - this.defaultBeforePage = this.uiSettings['uiConfig']['tableSettings'][this.name]['before']; - this.defaultIndex = this.uiSettings['uiConfig']['tableSettings'][this.name]['index']; - this.defaultTotalItems = this.uiSettings['uiConfig']['tableSettings'][this.name]['totalItems']; + const tableSettings = this.uiSettings['uiConfig']['tableSettings'][this.name]; + + if (!this.isDetailPage) { + this.defaultPageSize = tableSettings['page']; + this.defaultStartPage = tableSettings['start']; + this.defaultBeforePage = tableSettings['before']; + this.defaultIndex = tableSettings['index']; + this.defaultTotalItems = tableSettings['totalItems']; + } if (Array.isArray(displayedColumns)) { this.setDisplayedColumns(displayedColumns); @@ -260,7 +267,6 @@ export class HTTableComponent implements OnInit, AfterViewInit, OnDestroy { if (this.isPageable) { this.dataSource.paginator = this.matPaginator; // Get saved Pagesize from local storage, otherwise use default value - // Get saved Pagesize from local storage, otherwise use default value this.dataSource.pageSize = this.defaultPageSize; // Get saved start page this.dataSource.pageAfter = this.defaultStartPage; @@ -276,10 +282,12 @@ export class HTTableComponent implements OnInit, AfterViewInit, OnDestroy { this.dataSource.totalItems = this.defaultTotalItems; } - // Search item - this.dataSource.filter = this.uiSettings['uiConfig']['tableSettings'][this.name]['search']; // Sorted header arrow and sorting initialization this.dataSource.sortingColumn = this.uiSettings['uiConfig']['tableSettings'][this.name]['order']; + if (!this.isDetailPage) { + // Search item + this.dataSource.filter = this.uiSettings['uiConfig']['tableSettings'][this.name]['search']; + } if (this.dataSource.sortingColumn) { this.matSort.sort({ id: this.dataSource.sortingColumn.id, @@ -366,9 +374,11 @@ export class HTTableComponent implements OnInit, AfterViewInit, OnDestroy { direction: this.dataSource.sort['_direction'] }; this.dataSource.sortingColumn = sorting; - this.uiSettings.updateTableSettings(this.name, { - order: sorting - }); + if (!this.isDetailPage) { + this.uiSettings.updateTableSettings(this.name, { + order: sorting + }); + } this.dataSource.reload(); } @@ -588,15 +598,16 @@ export class HTTableComponent implements OnInit, AfterViewInit, OnDestroy { // } } - this.uiSettings.updateTableSettings(this.name, { - // start: pageAfter, // Store the new page index - // before: pageBefore, // Store the new page before - start: pageAfter, - before: pageBefore, - page: event.pageSize, // Store the new page size - index: index, //store the new table index - totalItems: this.dataSource.totalItems - }); + // only store table settings in local storage when it is not a detail page + if (!this.isDetailPage) { + this.uiSettings.updateTableSettings(this.name, { + start: pageAfter, + before: pageBefore, + page: event.pageSize, // Store the new page size + index: index, //store the new table index + totalItems: this.dataSource.totalItems + }); + } // Update pagination configuration in the data source this.dataSource.setPaginationConfig(event.pageSize, this.dataSource.totalItems, pageAfter, pageBefore, index); diff --git a/src/app/core/_components/tables/pretasks-table/pretasks-table.component.html b/src/app/core/_components/tables/pretasks-table/pretasks-table.component.html index 8cbc15fc..5d0e7928 100644 --- a/src/app/core/_components/tables/pretasks-table/pretasks-table.component.html +++ b/src/app/core/_components/tables/pretasks-table/pretasks-table.component.html @@ -1,18 +1,6 @@ - + \ No newline at end of file diff --git a/src/app/core/_components/tables/pretasks-table/pretasks-table.component.ts b/src/app/core/_components/tables/pretasks-table/pretasks-table.component.ts index 6ac19ede..614c2e46 100644 --- a/src/app/core/_components/tables/pretasks-table/pretasks-table.component.ts +++ b/src/app/core/_components/tables/pretasks-table/pretasks-table.component.ts @@ -49,6 +49,7 @@ declare let defaultOptions: AttackOptions; }) export class PretasksTableComponent extends BaseTableComponent implements OnInit, OnDestroy { private _supertTaskId: number; + isDetail = false; // Input property to specify a supertask ID for filtering pretasks. @Input() @@ -81,6 +82,7 @@ export class PretasksTableComponent extends BaseTableComponent implements OnInit this.dataSource = new PreTasksDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); if (this.supertTaskId) { + this.isDetail = true; this.dataSource.setSuperTaskId(this.supertTaskId); } this.contextMenuService = new PreTaskContextMenuService(this.permissionService).addContextMenu(); diff --git a/src/app/core/_components/tables/search-hash-table/search-hash-table.component.html b/src/app/core/_components/tables/search-hash-table/search-hash-table.component.html index 5446075c..33a9a726 100644 --- a/src/app/core/_components/tables/search-hash-table/search-hash-table.component.html +++ b/src/app/core/_components/tables/search-hash-table/search-hash-table.component.html @@ -1,14 +1,4 @@ - + \ No newline at end of file diff --git a/src/app/core/_components/tables/super-hashlist-hashlist-table/super-hashlist-hashlist-table.component.html b/src/app/core/_components/tables/super-hashlist-hashlist-table/super-hashlist-hashlist-table.component.html index 95ffa486..27df9505 100644 --- a/src/app/core/_components/tables/super-hashlist-hashlist-table/super-hashlist-hashlist-table.component.html +++ b/src/app/core/_components/tables/super-hashlist-hashlist-table/super-hashlist-hashlist-table.component.html @@ -2,4 +2,4 @@ (rowActionClicked)="rowActionClicked($event)" (selectedFilterColumnChanged)="selectedFilterColumn = $event" [columnLabels]="columnLabels" [contextMenuService]="contextMenuService" [dataSource]="dataSource" [filterFn]="filter.bind(this)" [isArchived]="isArchived" [isFilterable]="true" [isPageable]="false" - [isSelectable]="true" [name]="name" [tableColumns]="tableColumns" dataType="hashlists" /> \ No newline at end of file + [isSelectable]="true" [name]="name" [tableColumns]="tableColumns" dataType="hashlists" [isDetailPage]="true" /> \ No newline at end of file diff --git a/src/app/core/_components/tables/supertasks-pretasks-table/supertasks-pretasks-table.component.html b/src/app/core/_components/tables/supertasks-pretasks-table/supertasks-pretasks-table.component.html index e2c66367..f4227d08 100644 --- a/src/app/core/_components/tables/supertasks-pretasks-table/supertasks-pretasks-table.component.html +++ b/src/app/core/_components/tables/supertasks-pretasks-table/supertasks-pretasks-table.component.html @@ -1,17 +1,5 @@ - + \ No newline at end of file diff --git a/src/app/core/_components/tables/tasks-agents-table/tasks-agents-table.component.html b/src/app/core/_components/tables/tasks-agents-table/tasks-agents-table.component.html index 4f40ac7b..db170703 100644 --- a/src/app/core/_components/tables/tasks-agents-table/tasks-agents-table.component.html +++ b/src/app/core/_components/tables/tasks-agents-table/tasks-agents-table.component.html @@ -1,5 +1,6 @@ \ No newline at end of file + [isPageable]="false" [isDetailPage]="true" (bulkActionClicked)="bulkActionClicked($event)" + (rowActionClicked)="rowActionClicked($event)" (exportActionClicked)="exportActionClicked($event)" + (selectedFilterColumnChanged)="selectedFilterColumn = $event" /> \ No newline at end of file diff --git a/src/app/core/_components/tables/tasks-files-table/tasks-files-table.component.html b/src/app/core/_components/tables/tasks-files-table/tasks-files-table.component.html index ffdbb845..0cc44675 100644 --- a/src/app/core/_components/tables/tasks-files-table/tasks-files-table.component.html +++ b/src/app/core/_components/tables/tasks-files-table/tasks-files-table.component.html @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/src/app/core/_datasources/chunks.datasource.ts b/src/app/core/_datasources/chunks.datasource.ts index d7292748..7318fbab 100644 --- a/src/app/core/_datasources/chunks.datasource.ts +++ b/src/app/core/_datasources/chunks.datasource.ts @@ -12,9 +12,11 @@ import { BaseDataSource } from '@datasources/base.datasource'; export class ChunksDataSource extends BaseDataSource { private _agentId = 0; private _currentFilter: Filter = null; + isDetail = false; setAgentId(agentId: number): void { this._agentId = agentId; + this.isDetail = true; } loadAll(query?: Filter): void { diff --git a/src/app/core/_datasources/files.datasource.ts b/src/app/core/_datasources/files.datasource.ts index 48aada20..a085b76e 100644 --- a/src/app/core/_datasources/files.datasource.ts +++ b/src/app/core/_datasources/files.datasource.ts @@ -25,6 +25,7 @@ export class FilesDataSource extends BaseDataSource { private editIndex?: number; private editType?: number; private _currentFilter: Filter = null; + isDetail = false; /** * Set file type * @param fileType diff --git a/src/app/core/_models/config-ui.model.ts b/src/app/core/_models/config-ui.model.ts index 0e397707..063ff1b8 100644 --- a/src/app/core/_models/config-ui.model.ts +++ b/src/app/core/_models/config-ui.model.ts @@ -355,6 +355,60 @@ export const uiConfigDefault: UIConfig = { }, search: '' }, + filesWordlistTable: { + start: undefined, + page: 25, + columns: [ + FilesTableCol.ID, + FilesTableCol.NAME, + FilesTableCol.SIZE, + FilesTableCol.LINE_COUNT, + FilesTableCol.ACCESS_GROUP + ], + order: { + id: FilesTableCol.ID, + dataKey: '', + isSortable: true, + direction: 'asc' + }, + search: '' + }, + filesRuleTable: { + start: undefined, + page: 25, + columns: [ + FilesTableCol.ID, + FilesTableCol.NAME, + FilesTableCol.SIZE, + FilesTableCol.LINE_COUNT, + FilesTableCol.ACCESS_GROUP + ], + order: { + id: FilesTableCol.ID, + dataKey: '', + isSortable: true, + direction: 'asc' + }, + search: '' + }, + filesOtherTable: { + start: undefined, + page: 25, + columns: [ + FilesTableCol.ID, + FilesTableCol.NAME, + FilesTableCol.SIZE, + FilesTableCol.LINE_COUNT, + FilesTableCol.ACCESS_GROUP + ], + order: { + id: FilesTableCol.ID, + dataKey: '', + isSortable: true, + direction: 'asc' + }, + search: '' + }, filesTableInPreTasks: { start: 0, page: 25, diff --git a/src/app/files/files.component.html b/src/app/files/files.component.html index 5cff8477..fbf0d306 100644 --- a/src/app/files/files.component.html +++ b/src/app/files/files.component.html @@ -1,29 +1,17 @@ - + - + - + - - + + \ No newline at end of file diff --git a/src/app/files/files.component.ts b/src/app/files/files.component.ts index b8f566ad..1d4bfd1d 100644 --- a/src/app/files/files.component.ts +++ b/src/app/files/files.component.ts @@ -1,17 +1,19 @@ import { Component, OnInit } from '@angular/core'; - import { ActivatedRoute } from '@angular/router'; -import { AutoTitleService } from '../core/_services/shared/autotitle.service'; -import { FileType } from '../core/_models/file.model'; + +import { FileType } from '@models/file.model'; + +import { AutoTitleService } from '@services/shared/autotitle.service'; @Component({ - selector: 'app-files', - templateUrl: './files.component.html', - standalone: false + selector: 'app-files', + templateUrl: './files.component.html', + standalone: false }) export class FilesComponent implements OnInit { fileType: FileType = 0; FileType = FileType; + name = 'filesTable'; constructor( private route: ActivatedRoute, @@ -22,6 +24,17 @@ export class FilesComponent implements OnInit { ngOnInit(): void { this.loadFiles(); + switch (this.fileType) { + case 0: + this.name = 'filesWordlistTable'; + break; + case 1: + this.name = 'filesRuleTable'; + break; + case 2: + this.name = 'filesOtherTable'; + break; + } } loadFiles() {