Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
<ht-table
#table
name="accessGroupsAgentsTable"
dataType="access-groups-agents"
[columnLabels]="columnLabels"
[dataSource]="dataSource"
[tableColumns]="tableColumns"
[isSelectable]="true"
[contextMenuService]="contextMenuService"
[isFilterable]="isFilterable"
[filterFn]="filter"
[isPageable]="true"
(exportActionClicked)="exportActionClicked($event)"
(bulkActionClicked)="bulkActionClicked($event)"
(rowActionClicked)="rowActionClicked($event)"
/>
<ht-table #table name="accessGroupsAgentsTable" dataType="access-groups-agents" [columnLabels]="columnLabels"
[dataSource]="dataSource" [tableColumns]="tableColumns" [isSelectable]="true"
[contextMenuService]="contextMenuService" [isFilterable]="isFilterable" [filterFn]="filter" [isPageable]="true"
[isDetailPage]="true" (exportActionClicked)="exportActionClicked($event)"
(bulkActionClicked)="bulkActionClicked($event)" (rowActionClicked)="rowActionClicked($event)" />
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
<ht-table
#table
name="accessGroupsUsersTable"
dataType="access-groups-users"
[columnLabels]="columnLabels"
[dataSource]="dataSource"
[tableColumns]="tableColumns"
[isSelectable]="true"
[contextMenuService]="contextMenuService"
[isFilterable]="isFilterable"
[filterFn]="filter"
[isPageable]="true"
(exportActionClicked)="exportActionClicked($event)"
(bulkActionClicked)="bulkActionClicked($event)"
(rowActionClicked)="rowActionClicked($event)"
/>
<ht-table #table name="accessGroupsUsersTable" dataType="access-groups-users" [columnLabels]="columnLabels"
[dataSource]="dataSource" [tableColumns]="tableColumns" [isSelectable]="true"
[contextMenuService]="contextMenuService" [isFilterable]="isFilterable" [filterFn]="filter" [isPageable]="true"
[isDetailPage]="true" (exportActionClicked)="exportActionClicked($event)"
(bulkActionClicked)="bulkActionClicked($event)" (rowActionClicked)="rowActionClicked($event)" />
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
<ht-table
#table
name="accessPermissionGroupsUserTable"
dataType="access-permission-groups-user"
[columnLabels]="columnLabels"
[dataSource]="dataSource"
[tableColumns]="tableColumns"
[isSelectable]="true"
[isFilterable]="isFilterable"
[filterFn]="filter"
[isPageable]="true"
(editableCheckbox)="onCheckboxChange($event)"
(exportActionClicked)="exportActionClicked($event)"
/>
<ht-table #table name="accessPermissionGroupsUserTable" dataType="access-permission-groups-user"
[columnLabels]="columnLabels" [dataSource]="dataSource" [tableColumns]="tableColumns" [isSelectable]="true"
[isFilterable]="isFilterable" [filterFn]="filter" [isPageable]="true" [isDetailPage]="true"
(editableCheckbox)="onCheckboxChange($event)" (exportActionClicked)="exportActionClicked($event)" />
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
<ht-table
#table
name="accessPermissionGroupsUsersTable"
dataType="access-permission-groups-users"
[columnLabels]="columnLabels"
[dataSource]="dataSource"
[tableColumns]="tableColumns"
[isSelectable]="true"
[isFilterable]="isFilterable"
[filterFn]="filter"
[isPageable]="true"
(exportActionClicked)="exportActionClicked($event)"
/>
<ht-table #table name="accessPermissionGroupsUsersTable" dataType="access-permission-groups-users"
[columnLabels]="columnLabels" [dataSource]="dataSource" [tableColumns]="tableColumns" [isSelectable]="true"
[isFilterable]="isFilterable" [filterFn]="filter" [isDetailPage]="true" [isPageable]="true"
(exportActionClicked)="exportActionClicked($event)" />
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
<ht-table
#table
name="agentErrorTable"
[columnLabels]="columnLabels"
dataType="agents-errors"
[dataSource]="dataSource"
[tableColumns]="tableColumns"
[contextMenuService]="contextMenuService"
[isSelectable]="isSelectable"
[isPageable]="true"
[isFilterable]="isFilterable"
(bulkActionClicked)="bulkActionClicked($event)"
(rowActionClicked)="rowActionClicked($event)"
(exportActionClicked)="exportActionClicked($event)"
(selectedFilterColumnChanged)="selectedFilterColumn = $event"
(backendSqlFilter)="handleBackendSqlFilter($event)"
/>
<ht-table #table name="agentErrorTable" [columnLabels]="columnLabels" dataType="agents-errors" [dataSource]="dataSource"
[tableColumns]="tableColumns" [contextMenuService]="contextMenuService" [isSelectable]="isSelectable"
[isPageable]="true" [isFilterable]="isFilterable" [isDetailPage]="true"
(bulkActionClicked)="bulkActionClicked($event)" (rowActionClicked)="rowActionClicked($event)"
(exportActionClicked)="exportActionClicked($event)" (selectedFilterColumnChanged)="selectedFilterColumn = $event"
(backendSqlFilter)="handleBackendSqlFilter($event)" />
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
<ht-table
#table
name="chunksTable"
[columnLabels]="columnLabels"
dataType="chunks"
[dataSource]="dataSource"
[tableColumns]="tableColumns"
[contextMenuService]="contextMenuService"
[isFilterable]="isFilterable"
(rowActionClicked)="rowActionClicked($event)"
[isPageable]="true"
(selectedFilterColumnChanged)="selectedFilterColumn = $event"
(backendSqlFilter)="handleBackendSqlFilter($event)"
/>
<ht-table #table name="chunksTable" [columnLabels]="columnLabels" dataType="chunks" [dataSource]="dataSource"
[tableColumns]="tableColumns" [contextMenuService]="contextMenuService" [isFilterable]="isFilterable"
[isDetailPage]="dataSource.isDetail" (rowActionClicked)="rowActionClicked($event)" [isPageable]="true"
(selectedFilterColumnChanged)="selectedFilterColumn = $event" (backendSqlFilter)="handleBackendSqlFilter($event)" />
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
<ht-table
#table
name="filesAttackTable"
dataType="files-attack"
[columnLabels]="columnLabels"
[dataSource]="dataSource"
[tableColumns]="tableColumns"
[isFilterable]="isFilterable"
[isPageable]="true"
[isCmdTask]="cmdTask"
[isCmdLabel]="customLabel"
[isCmdPreproAttack]="cmdPrepro"
[isCmdFiles]="formData.files"
[isSelectable]="true"
[showExport]="false"
(checkboxChanged)="onCheckboxChanged($event)"
(selectedFilterColumnChanged)="selectedFilterColumn = $event"
(backendSqlFilter)="handleBackendSqlFilter($event)"
/>
<ht-table #table name="filesAttackTable" dataType="files-attack" [columnLabels]="columnLabels" [dataSource]="dataSource"
[tableColumns]="tableColumns" [isFilterable]="isFilterable" [isPageable]="true" [isCmdTask]="cmdTask"
[isCmdLabel]="customLabel" [isCmdPreproAttack]="cmdPrepro" [isCmdFiles]="formData.files" [isSelectable]="true"
[showExport]="false" [isDetailPage]="true" (checkboxChanged)="onCheckboxChanged($event)"
(selectedFilterColumnChanged)="selectedFilterColumn = $event" (backendSqlFilter)="handleBackendSqlFilter($event)" />
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
<ht-table
#table
name="hashesTable"
dataType="hashes"
[columnLabels]="columnLabels"
[dataSource]="dataSource"
[tableColumns]="tableColumns"
[isSelectable]="true"
[isFilterable]="!isFilterable"
[isPageable]="true"
(rowActionClicked)="rowActionClicked($event)"
(exportActionClicked)="exportActionClicked($event)"
(selectedFilterColumnChanged)="selectedFilterColumn = $event"
(emitCopyRowData)="receiveCopyData($event)"
(emitFullHashModal)="showTruncatedData($event)"
(backendSqlFilter)="filter($event)"
/>
<ht-table #table name="hashesTable" dataType="hashes" [columnLabels]="columnLabels" [dataSource]="dataSource"
[tableColumns]="tableColumns" [isSelectable]="true" [isFilterable]="!isFilterable" [isPageable]="true"
[isDetailPage]="true" (rowActionClicked)="rowActionClicked($event)"
(exportActionClicked)="exportActionClicked($event)" (selectedFilterColumnChanged)="selectedFilterColumn = $event"
(emitCopyRowData)="receiveCopyData($event)" (emitFullHashModal)="showTruncatedData($event)"
(backendSqlFilter)="filter($event)" />
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
<ht-table
#table
name="healthCheckAgentsTable"
dataType="health-check-agents"
[columnLabels]="columnLabels"
[dataSource]="dataSource"
[tableColumns]="tableColumns"
[isSelectable]="true"
[isFilterable]="isFilterable"
[isPageable]="true"

(exportActionClicked)="exportActionClicked($event)"
/>
<ht-table #table name="healthCheckAgentsTable" dataType="health-check-agents" [isDetailPage]="true"
[columnLabels]="columnLabels" [dataSource]="dataSource" [tableColumns]="tableColumns" [isSelectable]="true"
[isFilterable]="isFilterable" [isPageable]="true" (exportActionClicked)="exportActionClicked($event)" />
51 changes: 31 additions & 20 deletions src/app/core/_components/tables/ht-table/ht-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@
@Input() dataType: DataType;

/** Function used to filter table data. */
@Input() filterFn: (item: any, filterValue: string) => boolean;

Check failure on line 121 in src/app/core/_components/tables/ht-table/ht-table.component.ts

View workflow job for this annotation

GitHub Actions / Lint & Prettier Check

Unexpected any. Specify a different type

/** The data source for the table. */
@Input() dataSource: BaseDataSource<any>;

Check failure on line 124 in src/app/core/_components/tables/ht-table/ht-table.component.ts

View workflow job for this annotation

GitHub Actions / Lint & Prettier Check

Unexpected any. Specify a different type

/** Flag to enable or disable pagination. */
@Input() isPageable = false;
Expand All @@ -132,6 +132,9 @@
/** 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;

Expand Down Expand Up @@ -183,19 +186,19 @@
@Input() supportsAutoRefresh = false;

/** Flag to color a table row */
@Input() rowClass: (row: any) => string;

Check failure on line 189 in src/app/core/_components/tables/ht-table/ht-table.component.ts

View workflow job for this annotation

GitHub Actions / Lint & Prettier Check

Unexpected any. Specify a different type

/** Event emitter for when the user triggers a row action */
@Output() rowActionClicked: EventEmitter<ActionMenuEvent<any>> = new EventEmitter<ActionMenuEvent<any>>();

Check failure on line 192 in src/app/core/_components/tables/ht-table/ht-table.component.ts

View workflow job for this annotation

GitHub Actions / Lint & Prettier Check

Unexpected any. Specify a different type

Check failure on line 192 in src/app/core/_components/tables/ht-table/ht-table.component.ts

View workflow job for this annotation

GitHub Actions / Lint & Prettier Check

Unexpected any. Specify a different type

/** Event emitter for when the user triggers a bulk action */
@Output() bulkActionClicked: EventEmitter<ActionMenuEvent<any>> = new EventEmitter<ActionMenuEvent<any>>();

Check failure on line 195 in src/app/core/_components/tables/ht-table/ht-table.component.ts

View workflow job for this annotation

GitHub Actions / Lint & Prettier Check

Unexpected any. Specify a different type

Check failure on line 195 in src/app/core/_components/tables/ht-table/ht-table.component.ts

View workflow job for this annotation

GitHub Actions / Lint & Prettier Check

Unexpected any. Specify a different type

/** Event emitter for when the user triggers an export action */
@Output() exportActionClicked: EventEmitter<ActionMenuEvent<any>> = new EventEmitter<ActionMenuEvent<any>>();

Check failure on line 198 in src/app/core/_components/tables/ht-table/ht-table.component.ts

View workflow job for this annotation

GitHub Actions / Lint & Prettier Check

Unexpected any. Specify a different type

Check failure on line 198 in src/app/core/_components/tables/ht-table/ht-table.component.ts

View workflow job for this annotation

GitHub Actions / Lint & Prettier Check

Unexpected any. Specify a different type

/** Event emitter for when the user saves an editable input */
@Output() editableSaved: EventEmitter<HTTableEditable<any>> = new EventEmitter<HTTableEditable<any>>();

Check failure on line 201 in src/app/core/_components/tables/ht-table/ht-table.component.ts

View workflow job for this annotation

GitHub Actions / Lint & Prettier Check

Unexpected any. Specify a different type

/** Event emitter for when the user saves a checkbox */
@Output() editableCheckbox: EventEmitter<HTTableEditable<any>> = new EventEmitter<HTTableEditable<any>>();
Expand Down Expand Up @@ -229,11 +232,15 @@
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);
Expand All @@ -260,7 +267,6 @@
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;
Expand All @@ -276,10 +282,12 @@
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,
Expand Down Expand Up @@ -366,9 +374,11 @@
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();
}

Expand Down Expand Up @@ -588,15 +598,16 @@
// }
}

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);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
<ht-table
#table
[name]="name"
dataType="pretasks"
[columnLabels]="columnLabels"
[dataSource]="dataSource"
[tableColumns]="tableColumns"
[isSelectable]="true"
[contextMenuService]="contextMenuService"
[isFilterable]="isFilterable"
[isPageable]="true"
(editableSaved)="editableSaved($event)"
(bulkActionClicked)="bulkActionClicked($event)"
(rowActionClicked)="rowActionClicked($event)"
(exportActionClicked)="exportActionClicked($event)"
(backendSqlFilter)="handleBackendSqlFilter($event)"
(selectedFilterColumnChanged)="selectedFilterColumn = $event"
/>
<ht-table #table [name]="name" dataType="pretasks" [columnLabels]="columnLabels" [dataSource]="dataSource"
[tableColumns]="tableColumns" [isSelectable]="true" [contextMenuService]="contextMenuService"
[isFilterable]="isFilterable" [isPageable]="true" [isDetailPage]="isDetail" (editableSaved)="editableSaved($event)"
(bulkActionClicked)="bulkActionClicked($event)" (rowActionClicked)="rowActionClicked($event)"
(exportActionClicked)="exportActionClicked($event)" (backendSqlFilter)="handleBackendSqlFilter($event)"
(selectedFilterColumnChanged)="selectedFilterColumn = $event" />
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
<ht-table
#table
name="searchHashTable"
dataType="search-hash"
[columnLabels]="columnLabels"
[dataSource]="dataSource"
[tableColumns]="tableColumns"
[isSelectable]="true"
[isFilterable]="!isFilterable"
[isPageable]="false"
(exportActionClicked)="exportActionClicked($event)"
(selectedFilterColumnChanged)="selectedFilterColumn = $event"
(backendSqlFilter)="filter($event)"
/>
<ht-table #table name="searchHashTable" dataType="search-hash" [columnLabels]="columnLabels" [dataSource]="dataSource"
[tableColumns]="tableColumns" [isSelectable]="true" [isFilterable]="!isFilterable" [isPageable]="false"
[isDetailPage]="true" (exportActionClicked)="exportActionClicked($event)"
(selectedFilterColumnChanged)="selectedFilterColumn = $event" (backendSqlFilter)="filter($event)" />
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
[isSelectable]="true" [name]="name" [tableColumns]="tableColumns" dataType="hashlists" [isDetailPage]="true" />
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
<ht-table
#table
name="supertasksPretasksTable"
dataType="pretasks"
[columnLabels]="columnLabels"
[dataSource]="dataSource"
[tableColumns]="tableColumns"
[isSelectable]="true"
[contextMenuService]="contextMenuService"
[isFilterable]="isFilterable"
[filterFn]="filter"
[isPageable]="true"
(bulkActionClicked)="bulkActionClicked($event)"
(rowActionClicked)="rowActionClicked($event)"
(exportActionClicked)="exportActionClicked($event)"
(editableSaved)="editableSaved($event)"
/>
<ht-table #table name="supertasksPretasksTable" dataType="pretasks" [columnLabels]="columnLabels"
[dataSource]="dataSource" [tableColumns]="tableColumns" [isSelectable]="true"
[contextMenuService]="contextMenuService" [isFilterable]="isFilterable" [filterFn]="filter" [isDetailPage]="true"
[isPageable]="true" (bulkActionClicked)="bulkActionClicked($event)" (rowActionClicked)="rowActionClicked($event)"
(exportActionClicked)="exportActionClicked($event)" (editableSaved)="editableSaved($event)" />
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<ht-table #table [name]="name" [columnLabels]="columnLabels" [dataType]="datatype" [dataSource]="dataSource"
[tableColumns]="tableColumns" [isSelectable]="isSelectable" [isFilterable]="isFilterable"
[contextMenuService]="contextMenuService" [filterFn]="filter.bind(this)" (editableSaved)="editableSaved($event)"
[isPageable]="false" (bulkActionClicked)="bulkActionClicked($event)" (rowActionClicked)="rowActionClicked($event)"
(exportActionClicked)="exportActionClicked($event)" (selectedFilterColumnChanged)="selectedFilterColumn = $event" />
[isPageable]="false" [isDetailPage]="true" (bulkActionClicked)="bulkActionClicked($event)"
(rowActionClicked)="rowActionClicked($event)" (exportActionClicked)="exportActionClicked($event)"
(selectedFilterColumnChanged)="selectedFilterColumn = $event" />
Loading