diff --git a/src/app/core/_components/tables/access-groups-agents-table/access-groups-agents-table.component.ts b/src/app/core/_components/tables/access-groups-agents-table/access-groups-agents-table.component.ts index 9e1bd765..c061e2bc 100644 --- a/src/app/core/_components/tables/access-groups-agents-table/access-groups-agents-table.component.ts +++ b/src/app/core/_components/tables/access-groups-agents-table/access-groups-agents-table.component.ts @@ -36,7 +36,7 @@ export class AccessGroupsAgentsTableComponent extends BaseTableComponent impleme ngOnInit(): void { this.setColumnLabels(AccessGroupsAgentsTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new AccessGroupsExpandDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new AccessGroupsExpandDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); if (this.accessgroupId) { this.dataSource.setAccessGroupId(this.accessgroupId); diff --git a/src/app/core/_components/tables/access-groups-table/access-groups-table.component.ts b/src/app/core/_components/tables/access-groups-table/access-groups-table.component.ts index 4cc7efa7..f6972ccb 100644 --- a/src/app/core/_components/tables/access-groups-table/access-groups-table.component.ts +++ b/src/app/core/_components/tables/access-groups-table/access-groups-table.component.ts @@ -34,7 +34,7 @@ export class AccessGroupsTableComponent extends BaseTableComponent implements On ngOnInit(): void { this.setColumnLabels(AccessGroupsTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new AccessGroupsDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new AccessGroupsDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.contextMenuService = new AccessGroupsContextMenuService(this.permissionService).addContextMenu(); this.dataSource.loadAll(); diff --git a/src/app/core/_components/tables/access-groups-users-table/access-groups-users-table.component.ts b/src/app/core/_components/tables/access-groups-users-table/access-groups-users-table.component.ts index 0558fe59..c7f94222 100644 --- a/src/app/core/_components/tables/access-groups-users-table/access-groups-users-table.component.ts +++ b/src/app/core/_components/tables/access-groups-users-table/access-groups-users-table.component.ts @@ -40,7 +40,7 @@ export class AccessGroupsUserTableComponent extends BaseTableComponent implement ngOnInit(): void { this.setColumnLabels(AccessGroupsUsersTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new AccessGroupsExpandDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new AccessGroupsExpandDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); if (this.accessgroupId) { this.dataSource.setAccessGroupId(this.accessgroupId); diff --git a/src/app/core/_components/tables/access-permission-groups-user-table/access-permission-groups-user-table.component.ts b/src/app/core/_components/tables/access-permission-groups-user-table/access-permission-groups-user-table.component.ts index 716239f5..b2d30e00 100644 --- a/src/app/core/_components/tables/access-permission-groups-user-table/access-permission-groups-user-table.component.ts +++ b/src/app/core/_components/tables/access-permission-groups-user-table/access-permission-groups-user-table.component.ts @@ -34,7 +34,7 @@ export class AccessPermissionGroupsUserTableComponent extends BaseTableComponent ngOnInit(): void { this.setColumnLabels(AccessPermissionGroupsUserTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new AccessPermissionGroupsExpandDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new AccessPermissionGroupsExpandDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); if (this.accesspermgroupId) { this.dataSource.setAccessPermGroupId(this.accesspermgroupId); diff --git a/src/app/core/_components/tables/access-permission-groups-users-table/access-permission-groups-users-table.component.ts b/src/app/core/_components/tables/access-permission-groups-users-table/access-permission-groups-users-table.component.ts index 0a8c1157..3781b59e 100644 --- a/src/app/core/_components/tables/access-permission-groups-users-table/access-permission-groups-users-table.component.ts +++ b/src/app/core/_components/tables/access-permission-groups-users-table/access-permission-groups-users-table.component.ts @@ -32,7 +32,7 @@ export class AccessPermissionGroupsUsersTableComponent extends BaseTableComponen ngOnInit(): void { this.setColumnLabels(AccessPermissionGroupsUsersTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new AccessPermissionGroupsExpandDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new AccessPermissionGroupsExpandDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); if (this.accesspermgroupId) { this.dataSource.setAccessPermGroupId(this.accesspermgroupId); diff --git a/src/app/core/_components/tables/agent-binaries-table/agent-binaries-table.component.ts b/src/app/core/_components/tables/agent-binaries-table/agent-binaries-table.component.ts index a2118f78..0e943965 100644 --- a/src/app/core/_components/tables/agent-binaries-table/agent-binaries-table.component.ts +++ b/src/app/core/_components/tables/agent-binaries-table/agent-binaries-table.component.ts @@ -37,7 +37,7 @@ export class AgentBinariesTableComponent extends BaseTableComponent implements O ngOnInit(): void { this.setColumnLabels(AgentBinariesTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new AgentBinariesDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new AgentBinariesDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.contextMenuService = new AgentBinariesMenuServiceContextMenuService(this.permissionService).addContextMenu(); this.dataSource.loadAll(); diff --git a/src/app/core/_components/tables/agent-error-table/agent-error-table.component.ts b/src/app/core/_components/tables/agent-error-table/agent-error-table.component.ts index 88092776..76ab0840 100644 --- a/src/app/core/_components/tables/agent-error-table/agent-error-table.component.ts +++ b/src/app/core/_components/tables/agent-error-table/agent-error-table.component.ts @@ -40,7 +40,7 @@ export class AgentErrorTableComponent extends BaseTableComponent implements OnIn ngOnInit(): void { this.setColumnLabels(AgentErrorTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new AgentErrorDatasource(this.cdr, this.gs, this.uiService); + this.dataSource = new AgentErrorDatasource(this.injector); this.dataSource.setColumns(this.tableColumns); if (this.agentId) { diff --git a/src/app/core/_components/tables/agents-status-table/agents-status-table.component.ts b/src/app/core/_components/tables/agents-status-table/agents-status-table.component.ts index c9fa07a6..d88aa057 100644 --- a/src/app/core/_components/tables/agents-status-table/agents-status-table.component.ts +++ b/src/app/core/_components/tables/agents-status-table/agents-status-table.component.ts @@ -52,7 +52,7 @@ export class AgentsStatusTableComponent extends BaseTableComponent implements On ngOnInit(): void { this.setColumnLabels(AgentsStatusTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new AgentsDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new AgentsDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.contextMenuService = new AgentMenuService(this.permissionService).addContextMenu(); this.dataSource.reload(); diff --git a/src/app/core/_components/tables/agents-table/agents-table.component.ts b/src/app/core/_components/tables/agents-table/agents-table.component.ts index e305a240..4bf4a9cb 100644 --- a/src/app/core/_components/tables/agents-table/agents-table.component.ts +++ b/src/app/core/_components/tables/agents-table/agents-table.component.ts @@ -56,7 +56,7 @@ export class AgentsTableComponent extends BaseTableComponent implements OnInit, ngOnInit(): void { this.setColumnLabels(AgentsTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new AgentsDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new AgentsDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); if (this.taskId) { this.dataSource.setTaskId(this.taskId); diff --git a/src/app/core/_components/tables/base-table/base-table.component.ts b/src/app/core/_components/tables/base-table/base-table.component.ts index 1dfcf5d4..cb0a1b3f 100644 --- a/src/app/core/_components/tables/base-table/base-table.component.ts +++ b/src/app/core/_components/tables/base-table/base-table.component.ts @@ -2,7 +2,7 @@ import { faKey, faShieldHalved } from '@fortawesome/free-solid-svg-icons'; import { Observable, Subscription, of } from 'rxjs'; import { Clipboard } from '@angular/cdk/clipboard'; -import { ChangeDetectorRef, Component, Input, ViewChild } from '@angular/core'; +import { ChangeDetectorRef, Component, Injector, Input, ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; import { Router } from '@angular/router'; @@ -57,6 +57,7 @@ export class BaseTableComponent { protected contextMenuService: ContextMenuService; constructor( + protected injector: Injector, protected gs: GlobalService, protected cs: ConfigService, public clipboard: Clipboard, diff --git a/src/app/core/_components/tables/chunks-table/chunks-table.component.ts b/src/app/core/_components/tables/chunks-table/chunks-table.component.ts index 13579c74..bee193ff 100644 --- a/src/app/core/_components/tables/chunks-table/chunks-table.component.ts +++ b/src/app/core/_components/tables/chunks-table/chunks-table.component.ts @@ -32,7 +32,7 @@ export class ChunksTableComponent extends BaseTableComponent implements OnInit { ngOnInit(): void { this.setColumnLabels(ChunksTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new ChunksDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new ChunksDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); if (this.agentId) { this.dataSource.setAgentId(this.agentId); diff --git a/src/app/core/_components/tables/crackers-table/crackers-table.component.ts b/src/app/core/_components/tables/crackers-table/crackers-table.component.ts index 83c36738..0ced0861 100644 --- a/src/app/core/_components/tables/crackers-table/crackers-table.component.ts +++ b/src/app/core/_components/tables/crackers-table/crackers-table.component.ts @@ -31,7 +31,7 @@ export class CrackersTableComponent extends BaseTableComponent implements OnInit ngOnInit(): void { this.setColumnLabels(CrackersTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new CrackersDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new CrackersDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.contextMenuService = new CrackersContextMenuService(this.permissionService).addContextMenu(); this.dataSource.loadAll(); diff --git a/src/app/core/_components/tables/cracks-table/cracks-table.component.ts b/src/app/core/_components/tables/cracks-table/cracks-table.component.ts index 8d2d013f..81184aae 100644 --- a/src/app/core/_components/tables/cracks-table/cracks-table.component.ts +++ b/src/app/core/_components/tables/cracks-table/cracks-table.component.ts @@ -28,7 +28,7 @@ export class CracksTableComponent extends BaseTableComponent implements OnInit, ngOnInit(): void { this.setColumnLabels(CracksTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new CracksDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new CracksDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.dataSource.loadAll().then(() => {}); } diff --git a/src/app/core/_components/tables/files-attack-table/files-attack-table.component.ts b/src/app/core/_components/tables/files-attack-table/files-attack-table.component.ts index 24c0b904..d06f3fed 100644 --- a/src/app/core/_components/tables/files-attack-table/files-attack-table.component.ts +++ b/src/app/core/_components/tables/files-attack-table/files-attack-table.component.ts @@ -36,7 +36,7 @@ export class FilesAttackTableComponent extends BaseTableComponent implements OnI ngOnInit(): void { this.setColumnLabels(FilesAttackTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new FilesDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new FilesDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.dataSource.setFileType(this.fileType); this.dataSource.loadAll(); diff --git a/src/app/core/_components/tables/files-table/files-table.component.ts b/src/app/core/_components/tables/files-table/files-table.component.ts index 1c7f67ce..4c903906 100644 --- a/src/app/core/_components/tables/files-table/files-table.component.ts +++ b/src/app/core/_components/tables/files-table/files-table.component.ts @@ -61,7 +61,7 @@ export class FilesTableComponent extends BaseTableComponent implements OnInit, O if (this.name !== 'filesTableInPreTasks') { this.contextMenuService = new FilesContextMenuService(this.permissionService).addContextMenu(); } - this.dataSource = new FilesDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new FilesDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.dataSource.setFileType(this.fileType); if (this.editIndex) { diff --git a/src/app/core/_components/tables/hashes-table/hashes-table.component.ts b/src/app/core/_components/tables/hashes-table/hashes-table.component.ts index e29541c7..da24e651 100644 --- a/src/app/core/_components/tables/hashes-table/hashes-table.component.ts +++ b/src/app/core/_components/tables/hashes-table/hashes-table.component.ts @@ -28,7 +28,7 @@ export class HashesTableComponent extends BaseTableComponent implements OnInit, ngOnInit(): void { this.setColumnLabels(HashesTableColColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new HashesDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new HashesDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); if (this.id) { this.dataSource.setId(this.id); diff --git a/src/app/core/_components/tables/hashlists-table/hashlists-table.component.ts b/src/app/core/_components/tables/hashlists-table/hashlists-table.component.ts index af067a2d..60eb90ec 100644 --- a/src/app/core/_components/tables/hashlists-table/hashlists-table.component.ts +++ b/src/app/core/_components/tables/hashlists-table/hashlists-table.component.ts @@ -37,7 +37,7 @@ export class HashlistsTableComponent extends BaseTableComponent implements OnIni ngOnInit(): void { this.setColumnLabels(HashlistsTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new HashlistsDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new HashlistsDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.dataSource.setIsArchived(this.isArchived); this.contextMenuService = new HashListContextMenuService(this.permissionService).addContextMenu(); diff --git a/src/app/core/_components/tables/hashtypes-table/hashtypes-table.component.ts b/src/app/core/_components/tables/hashtypes-table/hashtypes-table.component.ts index 76369659..2a105922 100644 --- a/src/app/core/_components/tables/hashtypes-table/hashtypes-table.component.ts +++ b/src/app/core/_components/tables/hashtypes-table/hashtypes-table.component.ts @@ -34,7 +34,7 @@ export class HashtypesTableComponent extends BaseTableComponent implements OnIni ngOnInit(): void { this.setColumnLabels(HashtypesTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new HashtypesDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new HashtypesDataSource(this.injector); this.contextMenuService = new HashTypesContextMenuService(this.permissionService).addContextMenu(); this.dataSource.setColumns(this.tableColumns); } diff --git a/src/app/core/_components/tables/health-check-agents-table/health-check-agents-table.component.ts b/src/app/core/_components/tables/health-check-agents-table/health-check-agents-table.component.ts index a7463adf..3a9b5e53 100644 --- a/src/app/core/_components/tables/health-check-agents-table/health-check-agents-table.component.ts +++ b/src/app/core/_components/tables/health-check-agents-table/health-check-agents-table.component.ts @@ -31,7 +31,7 @@ export class HealthCheckAgentsTableComponent extends BaseTableComponent implemen ngOnInit(): void { this.setColumnLabels(HealthCheckAgentsTableColColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new HealthCheckAgentsDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new HealthCheckAgentsDataSource(this.injector); if (this.healthCheckId) { this.dataSource.setHealthCheckId(this.healthCheckId); } diff --git a/src/app/core/_components/tables/health-checks-table/health-checks-table.component.ts b/src/app/core/_components/tables/health-checks-table/health-checks-table.component.ts index 967a8999..b838b6a4 100644 --- a/src/app/core/_components/tables/health-checks-table/health-checks-table.component.ts +++ b/src/app/core/_components/tables/health-checks-table/health-checks-table.component.ts @@ -38,7 +38,7 @@ export class HealthChecksTableComponent extends BaseTableComponent implements On ngOnInit(): void { this.setColumnLabels(HealthChecksTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new HealthChecksDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new HealthChecksDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.contextMenuService = new HealthCheckContextMenuService(this.permissionService).addContextMenu(); this.dataSource.loadAll(); diff --git a/src/app/core/_components/tables/logs-table/logs-table.component.ts b/src/app/core/_components/tables/logs-table/logs-table.component.ts index d8094371..70fe003e 100644 --- a/src/app/core/_components/tables/logs-table/logs-table.component.ts +++ b/src/app/core/_components/tables/logs-table/logs-table.component.ts @@ -23,7 +23,7 @@ export class LogsTableComponent extends BaseTableComponent implements OnInit, On ngOnInit(): void { this.setColumnLabels(LogsTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new LogsDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new LogsDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.dataSource.loadAll(); } diff --git a/src/app/core/_components/tables/notifications-table/notifications-table.component.ts b/src/app/core/_components/tables/notifications-table/notifications-table.component.ts index ca3344a9..9cba48f4 100644 --- a/src/app/core/_components/tables/notifications-table/notifications-table.component.ts +++ b/src/app/core/_components/tables/notifications-table/notifications-table.component.ts @@ -36,7 +36,7 @@ export class NotificationsTableComponent extends BaseTableComponent implements O ngOnInit(): void { this.setColumnLabels(NotificationsTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new NotificationsDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new NotificationsDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.contextMenuService = new NotificationsContextMenuService(this.permissionService).addContextMenu(); this.dataSource.loadAll(); diff --git a/src/app/core/_components/tables/permissions-table/permissions-table.component.ts b/src/app/core/_components/tables/permissions-table/permissions-table.component.ts index 76477544..aeb16741 100644 --- a/src/app/core/_components/tables/permissions-table/permissions-table.component.ts +++ b/src/app/core/_components/tables/permissions-table/permissions-table.component.ts @@ -34,7 +34,7 @@ export class PermissionsTableComponent extends BaseTableComponent implements OnI ngOnInit(): void { this.setColumnLabels(PermissionsTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new PermissionsDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new PermissionsDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.contextMenuService = new PermissionsContextMenuService(this.permissionService).addContextMenu(); this.dataSource.loadAll(); diff --git a/src/app/core/_components/tables/preprocessors-table/preprocessors-table.component.ts b/src/app/core/_components/tables/preprocessors-table/preprocessors-table.component.ts index abf96baf..9ed09dee 100644 --- a/src/app/core/_components/tables/preprocessors-table/preprocessors-table.component.ts +++ b/src/app/core/_components/tables/preprocessors-table/preprocessors-table.component.ts @@ -33,7 +33,7 @@ export class PreprocessorsTableComponent extends BaseTableComponent implements O ngOnInit(): void { this.setColumnLabels(PreprocessorsTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new PreprocessorsDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new PreprocessorsDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.contextMenuService = new PreProContextMenuService(this.permissionService).addContextMenu(); this.dataSource.loadAll(); 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 cfd7f0eb..25ca9bd4 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 @@ -62,7 +62,7 @@ export class PretasksTableComponent extends BaseTableComponent implements OnInit ngOnInit(): void { this.setColumnLabels(PretasksTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new PreTasksDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new PreTasksDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); if (this.supertTaskId) { this.dataSource.setSuperTaskId(this.supertTaskId); diff --git a/src/app/core/_components/tables/search-hash-table/search-hash-table.component.ts b/src/app/core/_components/tables/search-hash-table/search-hash-table.component.ts index 64255ee7..13886e14 100644 --- a/src/app/core/_components/tables/search-hash-table/search-hash-table.component.ts +++ b/src/app/core/_components/tables/search-hash-table/search-hash-table.component.ts @@ -29,7 +29,7 @@ export class SearchHashTableComponent extends BaseTableComponent implements OnIn ngOnInit(): void { this.setColumnLabels(SearchHashTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new SearchHashDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new SearchHashDataSource(this.injector); if (this.search) { this.dataSource.setSearch(this.search); } diff --git a/src/app/core/_components/tables/super-hashlists-table/super-hashlists-table.component.ts b/src/app/core/_components/tables/super-hashlists-table/super-hashlists-table.component.ts index 3e8bd991..4748a697 100644 --- a/src/app/core/_components/tables/super-hashlists-table/super-hashlists-table.component.ts +++ b/src/app/core/_components/tables/super-hashlists-table/super-hashlists-table.component.ts @@ -35,7 +35,7 @@ export class SuperHashlistsTableComponent extends BaseTableComponent implements ngOnInit(): void { this.setColumnLabels(SuperHashlistsTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new SuperHashlistsDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new SuperHashlistsDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.dataSource.setIsArchived(this.isArchived); this.contextMenuService = new SuperHashListContextMenuService(this.permissionService).addContextMenu(); diff --git a/src/app/core/_components/tables/supertasks-pretasks-table/supertasks-pretasks-table.component.ts b/src/app/core/_components/tables/supertasks-pretasks-table/supertasks-pretasks-table.component.ts index cb6ba969..92ca3ee3 100644 --- a/src/app/core/_components/tables/supertasks-pretasks-table/supertasks-pretasks-table.component.ts +++ b/src/app/core/_components/tables/supertasks-pretasks-table/supertasks-pretasks-table.component.ts @@ -36,7 +36,7 @@ export class SuperTasksPretasksTableComponent extends BaseTableComponent impleme ngOnInit(): void { this.setColumnLabels(SupertasksPretasksTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new SuperTasksPretasksDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new SuperTasksPretasksDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); if (this.supertaskId) { this.dataSource.setSuperTaskId(this.supertaskId); diff --git a/src/app/core/_components/tables/supertasks-table/supertasks-table.component.ts b/src/app/core/_components/tables/supertasks-table/supertasks-table.component.ts index f44331b8..d9241840 100644 --- a/src/app/core/_components/tables/supertasks-table/supertasks-table.component.ts +++ b/src/app/core/_components/tables/supertasks-table/supertasks-table.component.ts @@ -36,7 +36,7 @@ export class SuperTasksTableComponent extends BaseTableComponent implements OnIn ngOnInit(): void { this.setColumnLabels(SupertasksTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new SuperTasksDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new SuperTasksDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.contextMenuService = new SuperTaskContextMenuService(this.permissionService).addContextMenu(); this.dataSource.loadAll(); diff --git a/src/app/core/_components/tables/tasks-chunks-table/tasks-chunks-table.component.ts b/src/app/core/_components/tables/tasks-chunks-table/tasks-chunks-table.component.ts index 244b0261..206ee3ba 100644 --- a/src/app/core/_components/tables/tasks-chunks-table/tasks-chunks-table.component.ts +++ b/src/app/core/_components/tables/tasks-chunks-table/tasks-chunks-table.component.ts @@ -45,7 +45,7 @@ export class TasksChunksTableComponent extends BaseTableComponent implements OnI ngOnInit(): void { this.setColumnLabels(TasksChunksTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new TasksChunksDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new TasksChunksDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.contextMenuService = new ChunkContextMenuService(this.permissionService).addContextMenu(); // Do NOT load yet diff --git a/src/app/core/_components/tables/tasks-supertasks-table/tasks-supertasks-table.component.ts b/src/app/core/_components/tables/tasks-supertasks-table/tasks-supertasks-table.component.ts index 9c114a9e..dafeb81d 100644 --- a/src/app/core/_components/tables/tasks-supertasks-table/tasks-supertasks-table.component.ts +++ b/src/app/core/_components/tables/tasks-supertasks-table/tasks-supertasks-table.component.ts @@ -40,7 +40,7 @@ export class TasksSupertasksTableComponent extends BaseTableComponent implements ngOnInit(): void { this.setColumnLabels(TasksSupertasksDataSourceTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new TasksSupertasksDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new TasksSupertasksDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); if (this.supertaskId) { this.dataSource.setSuperTaskId(this.supertaskId); diff --git a/src/app/core/_components/tables/tasks-table/tasks-table.component.ts b/src/app/core/_components/tables/tasks-table/tasks-table.component.ts index 1a11fe7e..ea1ac71f 100644 --- a/src/app/core/_components/tables/tasks-table/tasks-table.component.ts +++ b/src/app/core/_components/tables/tasks-table/tasks-table.component.ts @@ -64,7 +64,7 @@ export class TasksTableComponent extends BaseTableComponent implements OnInit, O ngOnInit(): void { this.setColumnLabels(TaskTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new TasksDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new TasksDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.dataSource.setIsArchived(this.isArchived); this.contextMenuService = new TaskContextMenuService(this.permissionService).addContextMenu(); diff --git a/src/app/core/_components/tables/users-table/users-table.component.ts b/src/app/core/_components/tables/users-table/users-table.component.ts index 97e52869..3da2b405 100644 --- a/src/app/core/_components/tables/users-table/users-table.component.ts +++ b/src/app/core/_components/tables/users-table/users-table.component.ts @@ -37,7 +37,7 @@ export class UsersTableComponent extends BaseTableComponent implements OnInit, O ngOnInit(): void { this.setColumnLabels(UsersTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new UsersDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new UsersDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.contextMenuService = new UsersContextMenuService(this.permissionService).addContextMenu(); this.dataSource.loadAll(); diff --git a/src/app/core/_components/tables/vouchers-table/vouchers-table.component.ts b/src/app/core/_components/tables/vouchers-table/vouchers-table.component.ts index 06d299fa..e4724534 100644 --- a/src/app/core/_components/tables/vouchers-table/vouchers-table.component.ts +++ b/src/app/core/_components/tables/vouchers-table/vouchers-table.component.ts @@ -32,7 +32,7 @@ export class VouchersTableComponent extends BaseTableComponent implements OnInit ngOnInit(): void { this.setColumnLabels(VouchersTableColumnLabel); this.tableColumns = this.getColumns(); - this.dataSource = new VouchersDataSource(this.cdr, this.gs, this.uiService); + this.dataSource = new VouchersDataSource(this.injector); this.dataSource.setColumns(this.tableColumns); this.contextMenuService = new VoucherContextMenuService(this.permissionService).addContextMenu(); this.dataSource.loadAll(); diff --git a/src/app/core/_datasources/agents.datasource.ts b/src/app/core/_datasources/agents.datasource.ts index ad10f82e..9917f959 100644 --- a/src/app/core/_datasources/agents.datasource.ts +++ b/src/app/core/_datasources/agents.datasource.ts @@ -1,21 +1,24 @@ -import { ChunkState, chunkStates } from '@src/app/core/_constants/chunks.config'; /** * Contains data source for agents resource * @module */ import { catchError, finalize, firstValueFrom, of } from 'rxjs'; -import { BaseDataSource } from '@datasources/base.datasource'; -import { FilterType } from '@models/request-params.model'; -import { IParamBuilder } from '@services/params/builder-types.service'; -import { JAgent } from '@models/agent.model'; import { JAgentAssignment } from '@models/agent-assignment.model'; +import { JAgent } from '@models/agent.model'; import { JChunk } from '@models/chunk.model'; +import { FilterType } from '@models/request-params.model'; +import { ResponseWrapper } from '@models/response.model'; import { JUser } from '@models/user.model'; + import { JsonAPISerializer } from '@services/api/serializer-service'; -import { RequestParamBuilder } from '@services/params/builder-implementation.service'; -import { ResponseWrapper } from '@models/response.model'; import { SERV } from '@services/main.config'; +import { RequestParamBuilder } from '@services/params/builder-implementation.service'; +import { IParamBuilder } from '@services/params/builder-types.service'; + +import { BaseDataSource } from '@datasources/base.datasource'; + +import { ChunkState, chunkStates } from '@src/app/core/_constants/chunks.config'; export class AgentsDataSource extends BaseDataSource { private chunktime = this.uiService.getUIsettings('chunktime').value; @@ -75,15 +78,9 @@ export class AgentsDataSource extends BaseDataSource { } }); } - const length = response.meta.page.total_elements; + const length = response.meta.page.total_elements; - this.setPaginationConfig( - this.pageSize, - length, - this.pageAfter, - this.pageBefore, - this.index - ); + this.setPaginationConfig(this.pageSize, length, this.pageAfter, this.pageBefore, this.index); this.setData(agents); }); } @@ -147,13 +144,7 @@ export class AgentsDataSource extends BaseDataSource { const length = response.meta.page.total_elements; - this.setPaginationConfig( - this.pageSize, - length, - this.pageAfter, - this.pageBefore, - this.index - ); + this.setPaginationConfig(this.pageSize, length, this.pageAfter, this.pageBefore, this.index); this.setData(agents); } }); diff --git a/src/app/core/_datasources/base.datasource.ts b/src/app/core/_datasources/base.datasource.ts index c93c0892..090e80a8 100644 --- a/src/app/core/_datasources/base.datasource.ts +++ b/src/app/core/_datasources/base.datasource.ts @@ -1,7 +1,7 @@ import { BehaviorSubject, Observable, Subscription } from 'rxjs'; import { CollectionViewer, DataSource, SelectionModel } from '@angular/cdk/collections'; -import { ChangeDetectorRef } from '@angular/core'; +import { ChangeDetectorRef, Injectable, Injector } from '@angular/core'; import { MatPaginator } from '@angular/material/paginator'; import { MatSort, SortDirection } from '@angular/material/sort'; @@ -9,6 +9,7 @@ import { ChunkData, JChunk } from '@models/chunk.model'; import { JsonAPISerializer } from '@services/api/serializer-service'; import { GlobalService } from '@services/main.service'; +import { PermissionService } from '@services/permission/permission.service'; import { UIConfigService } from '@services/shared/storage.service'; import { HTTableColumn } from '@components/tables/ht-table/ht-table.models'; @@ -23,6 +24,7 @@ import { environment } from '@src/environments/environment'; * @template T - The type of data that the data source holds. * @template P - The type of paginator, extending MatTableDataSourcePaginator. */ +@Injectable() export abstract class BaseDataSource implements DataSource { public pageSize = 10; public currentPage = 0; @@ -75,11 +77,16 @@ export abstract class BaseDataSource i private readonly chunkTime: number = 600; - constructor( - protected cdr: ChangeDetectorRef, - protected service: GlobalService, - protected uiService: UIConfigService - ) { + protected cdr: ChangeDetectorRef; + protected service: GlobalService; + protected uiService: UIConfigService; + protected permissionService: PermissionService; + + constructor(protected injector: Injector) { + this.cdr = injector.get(ChangeDetectorRef); + this.service = injector.get(GlobalService); + this.uiService = injector.get(UIConfigService); + this.permissionService = injector.get(PermissionService); this.serializer = new JsonAPISerializer(); const chunktimeSetting: string = this.uiService.getUIsettings('chunktime').value; if (chunktimeSetting) {