diff --git a/angular.json b/angular.json index be73f7ccc..aa28539e6 100644 --- a/angular.json +++ b/angular.json @@ -1593,5 +1593,8 @@ }, "tags": [] } + }, + "cli": { + "analytics": false } } diff --git a/apps/admin-gui-e2e/cypress.config.ts b/apps/admin-gui-e2e/cypress.config.ts index f7c13f457..be860ec5e 100644 --- a/apps/admin-gui-e2e/cypress.config.ts +++ b/apps/admin-gui-e2e/cypress.config.ts @@ -22,7 +22,12 @@ export default defineConfig({ BA_PASSWORD_FACILITY_MANAGER: 'test', BA_USERNAME_RESOURCE_MANAGER: 'resourceManager', BA_PASSWORD_RESOURCE_MANAGER: 'test', - BA_PASSWORD_TOP_GROUP_CREATOR: 'topGroupCreator', + BA_USERNAME_TOP_GROUP_CREATOR: 'topGroupCreator', + BA_PASSWORD_TOP_GROUP_CREATOR: 'test', + BA_USERNAME_RESOURCE_SELF_SERVICE: 'resourceSelfService', + BA_PASSWORD_RESOURCE_SELF_SERVICE: 'test', + BA_USERNAME_TRUSTED_FACILITY_ADMIN: 'trustedFacilityAdmin', + BA_PASSWORD_TRUSTED_FACILITY_ADMIN: 'test', }, specPattern: 'src/e2e/**/*.cy.{js,jsx,ts,tsx}', supportFile: false, diff --git a/apps/admin-gui-e2e/src/e2e/resource-self-service-perun_admin.cy.js b/apps/admin-gui-e2e/src/e2e/resource-self-service-perun_admin.cy.js new file mode 100644 index 000000000..29aa4dd3e --- /dev/null +++ b/apps/admin-gui-e2e/src/e2e/resource-self-service-perun_admin.cy.js @@ -0,0 +1,97 @@ +/// + +context('Actions', () => { + const dbVoName = 'test-e2e-vo-from-db-6'; + const dbResourceName = 'test-e2e-resource-from-db-4'; + + const dbGroupToAssign = 'test-e2e-group-from-db-9'; + const dbGroupToRemove = 'test-e2e-group-from-db-8'; + const dbGroupToActivate = 'test-e2e-group-from-db-7'; + const dbGroupToDeactivate = 'test-e2e-group-from-db-6'; + + + before(() => { + if (Cypress.env('BA_USERNAME_RESOURCE_SELF_SERVICE')) { + sessionStorage.setItem('baPrincipal', '{"name": "resourceSelfService"}'); + sessionStorage.setItem('basicUsername', Cypress.env('BA_USERNAME_RESOURCE_SELF_SERVICE')); + sessionStorage.setItem('basicPassword', Cypress.env('BA_PASSWORD_RESOURCE_SELF_SERVICE')); + cy.visit('service-access'); + } + }); + + beforeEach(() => { + cy.visit('organizations') + .get(`[data-cy=${dbVoName}]`) + .click() + .get('[data-cy=resources]') + .click() + .get('[data-cy=resource-list]') + .click() + .get(`[data-cy=${dbResourceName}]`) + .click() + .get('[data-cy=assigned-groups]') + .click(); + }); + + it('test assign group to resource', () => { + cy.get('[data-cy=add-group-button]') + .click() + .get(`[data-cy=${dbGroupToAssign}-checkbox]`) + .click() + .get('[data-cy=next-button]') + .click() + .intercept('**/resourcesManager/getGroupAssignments**') + .as('getGroupAssignments') + .get('[data-cy=assign-button]') + .click() + .wait('@getGroupAssignments') + + // assert that group was added + .get(`[data-cy=${dbGroupToAssign}-checkbox]`) + .should('exist'); + }); + + it('test remove group from resource', () => { + cy.get(`[data-cy=${dbGroupToRemove}-checkbox]`) + .click() + .get('[data-cy=remove-group-button]') + .click() + .intercept('**/resourcesManager/getGroupAssignments**') + .as('getGroupAssignments') + .get('[data-cy=delete-button]') + .click() + .wait('@getGroupAssignments') + + // assert that group was removed + .get(`[data-cy=${dbGroupToRemove}-checkbox]`) + .should('not.exist'); + }); + + it('test activate group resource assignment', () => { + cy.get(`[data-cy=${dbGroupToActivate}-inactive]`) + .click() + .intercept('**/resourcesManager/activateGroupResourceAssignment**') + .as('activateGroupResourceAssignment') + .get('[data-cy=change-status-button]') + .click() + .wait('@activateGroupResourceAssignment') + + // assert that group is active + .get(`[data-cy=${dbGroupToActivate}-active]`) + .should('exist'); + }); + + it('test deactivate group resource assignment', () => { + cy.get(`[data-cy=${dbGroupToDeactivate}-active]`) + .click() + .intercept('**/resourcesManager/deactivateGroupResourceAssignment**') + .as('deactivateGroupResourceAssignment') + .get('[data-cy=change-status-button]') + .click() + .wait('@deactivateGroupResourceAssignment') + + // assert that group is inactive + .get(`[data-cy=${dbGroupToDeactivate}-inactive]`) + .should('exist'); + }); +}); diff --git a/apps/admin-gui-e2e/src/e2e/top-group-creator-perun_admin.cy.js b/apps/admin-gui-e2e/src/e2e/top-group-creator-perun_admin.cy.js index 2aba20b52..4c0a152db 100644 --- a/apps/admin-gui-e2e/src/e2e/top-group-creator-perun_admin.cy.js +++ b/apps/admin-gui-e2e/src/e2e/top-group-creator-perun_admin.cy.js @@ -3,9 +3,9 @@ context('Actions', () => { const groupName = 'test'; before(() => { - if (Cypress.env('BA_PASSWORD_TOP_GROUP_CREATOR')) { + if (Cypress.env('BA_USERNAME_TOP_GROUP_CREATOR')) { sessionStorage.setItem('baPrincipal', '{"name": "topGroupCreator"}'); - sessionStorage.setItem('basicUsername', Cypress.env('BA_PASSWORD_TOP_GROUP_CREATOR')); + sessionStorage.setItem('basicUsername', Cypress.env('BA_USERNAME_TOP_GROUP_CREATOR')); sessionStorage.setItem('basicPassword', Cypress.env('BA_PASSWORD_TOP_GROUP_CREATOR')); cy.visit('service-access'); } diff --git a/apps/admin-gui-e2e/src/e2e/trusted-facility-admin-perun_admin.cy.js b/apps/admin-gui-e2e/src/e2e/trusted-facility-admin-perun_admin.cy.js new file mode 100644 index 000000000..50d922ddd --- /dev/null +++ b/apps/admin-gui-e2e/src/e2e/trusted-facility-admin-perun_admin.cy.js @@ -0,0 +1,272 @@ +context('Actions', () => { + const dbVoName = 'test-e2e-vo-from-db-5'; + const dbResourceName = 'test-e2e-resource-from-db-3'; + + const dbGroupToAssign = 'test-e2e-group-from-db-3'; + const dbGroupToRemove = 'test-e2e-group-from-db-4'; + const dbGroupToActivate = 'test-e2e-group-from-db-4'; + const dbGroupToDeactivate = 'test-e2e-group-from-db-5'; + const dbUserToAssignRoles = 'test7'; + const dbUserToRemoveRoles = 'test8'; + + before(() => { + if (Cypress.env('BA_USERNAME_TRUSTED_FACILITY_ADMIN')) { + sessionStorage.setItem('baPrincipal', '{"name": "trustedFacilityAdmin"}'); + sessionStorage.setItem('basicUsername', Cypress.env('BA_USERNAME_TRUSTED_FACILITY_ADMIN')); + sessionStorage.setItem('basicPassword', Cypress.env('BA_PASSWORD_TRUSTED_FACILITY_ADMIN')); + cy.visit('service-access'); + } + }); + + beforeEach(() => { + cy.visit('organizations') + .get(`[data-cy=${dbVoName}]`) + .click() + .get('[data-cy=resources]') + .click() + .get('[data-cy=resource-list]') + .click() + .get(`[data-cy=${dbResourceName}]`) + .click() + }) + + it( 'test assign group to resource', () => { + + cy.intercept('**/groupsManager/getAllGroups**').as('getAllGroups') + .get('[data-cy=assigned-groups]') + .click() + .get('[data-cy=add-group-button]') + .click() + .wait('@getAllGroups') + .get(`[data-cy=${dbGroupToAssign}-checkbox]`) + .click() + .get('[data-cy=next-button]') + .click() + .intercept('**/resourcesManager/getGroupAssignments**').as('getGroupAssignments') + .get('[data-cy=assign-button]') + .click() + .wait('@getGroupAssignments') + + // assert that group was added + .get(`[data-cy=${dbGroupToAssign}-checkbox]`) + .should('exist') + + }) + + it('test activate group assignment', () => { + + cy.get('[data-cy=assigned-groups]') + .click() + .get(`[data-cy=${dbGroupToActivate}-inactive]`) + .click() + .get('[data-cy=change-status-button]') + .click() + .intercept('**/resourcesManager/getGroupAssignments**').as('getGroupAssignments') + .wait('@getGroupAssignments') + + // assert that group was activated + .get(`[data-cy=${dbGroupToActivate}-active]`) + .should('exist') + + }) + + + it( 'test remove group from resource', () => { + + cy.get('[data-cy=assigned-groups]') + .click() + .get(`[data-cy=${dbGroupToRemove}-checkbox]`) + .click() + .get('[data-cy=remove-group-button]') + .click() + .intercept('**/resourcesManager/getGroupAssignments**').as('getGroupAssignments') + .get('[data-cy=delete-button]') + .click() + .wait('@getGroupAssignments') + + // assert that group was removed + .get(`[data-cy=${dbGroupToRemove}-checkbox]`) + .should('not.exist') + }) + + it('test deactivate group assignment', () => { + + cy.get('[data-cy=assigned-groups]') + .click() + .get(`[data-cy=${dbGroupToDeactivate}-active]`) + .click() + .get('[data-cy=change-status-button]') + .click() + .intercept('**/resourcesManager/getGroupAssignments**').as('getGroupAssignments') + .wait('@getGroupAssignments') + + // assert that group was deactivated + .get(`[data-cy=${dbGroupToDeactivate}-inactive]`) + .should('exist') + + }) + + it('test add resource manager', () => { + + cy.get('[data-cy=advanced-settings]') + .click() + .get('[data-cy=managers]') + .click() + .get('[data-cy=add-manager-button]') + .click() + .get('[data-cy=search-manager-input]') + .type(`${dbUserToAssignRoles}`) + .get('[data-cy=search-manager-button]') + .click() + .get(`[data-cy=${dbUserToAssignRoles}-checkbox]`) + .click() + .intercept('**/authzResolver/getRichAdmins**').as('getRichAdmins') + .get('[data-cy=add-manager-button-dialog]') + .click() + .wait('@getRichAdmins') + + // assert that manager was added + .get(`[data-cy=${dbUserToAssignRoles}-checkbox]`) + .should('exist') + }) + + it('test add resource observer', () => { + + cy.get('[data-cy=advanced-settings]') + .click() + .get('[data-cy=managers]') + .click() + .get('[data-cy=role-filter]') + .click() + .get('[data-cy=resourceobserver]') + .click() + .get('[data-cy=add-manager-button]') + .click() + .get('[data-cy=search-manager-input]') + .type(`${dbUserToAssignRoles}`) + .get('[data-cy=search-manager-button]') + .click() + .get(`[data-cy=${dbUserToAssignRoles}-checkbox]`) + .click() + .intercept('**/authzResolver/getRichAdmins**').as('getRichAdmins') + .get('[data-cy=add-manager-button-dialog]') + .click() + .wait('@getRichAdmins') + + // assert that manager was added + .get(`[data-cy=${dbUserToAssignRoles}-checkbox]`) + .should('exist') + }) + + it('test add resource self service', () => { + + cy.get('[data-cy=advanced-settings]') + .click() + .get('[data-cy=managers]') + .click() + .get('[data-cy=role-filter]') + .click() + .get('[data-cy=resourceselfservice]') + .click() + .get('[data-cy=add-manager-button]') + .click() + .get('[data-cy=search-manager-input]') + .type(`${dbUserToAssignRoles}`) + .get('[data-cy=search-manager-button]') + .click() + .get(`[data-cy=${dbUserToAssignRoles}-checkbox]`) + .click() + .intercept('**/authzResolver/getRichAdmins**').as('getRichAdmins') + .get('[data-cy=add-manager-button-dialog]') + .click() + .wait('@getRichAdmins') + + // assert that manager was added + .get(`[data-cy=${dbUserToAssignRoles}-checkbox]`) + .should('exist') + }) + + it('test remove resource manager', () => { + + cy.get('[data-cy=advanced-settings]') + .click() + .get('[data-cy=managers]') + .click() + .get(`[data-cy=${dbUserToRemoveRoles}-checkbox]`) + .click() + .get('[data-cy=remove-manager-button]') + .click() + .intercept('**/authzResolver/getRichAdmins**').as('getRichAdmins') + .get('[data-cy=remove-manager-button-dialog]') + .click() + .wait('@getRichAdmins') + + // assert that manager was removed + .get(`[data-cy=${dbUserToRemoveRoles}-checkbox]`) + .should('not.exist') + }) + + it('test remove resource observer', () => { + + cy.get('[data-cy=advanced-settings]') + .click() + .get('[data-cy=managers]') + .click() + .get('[data-cy=role-filter]') + .click() + .get('[data-cy=resourceobserver]') + .click() + .get(`[data-cy=${dbUserToRemoveRoles}-checkbox]`) + .click() + .get('[data-cy=remove-manager-button]') + .click() + .intercept('**/authzResolver/getRichAdmins**').as('getRichAdmins') + .get('[data-cy=remove-manager-button-dialog]') + .click() + .wait('@getRichAdmins') + .get('[data-cy=role-filter]') + .click() + .get('[data-cy=resourceobserver]') + .click() + .intercept('**/authzResolver/getRichAdmins**').as('getRichAdmins') + .wait('@getRichAdmins') + + // assert that manager was removed + .get(`[data-cy=${dbUserToRemoveRoles}-checkbox]`) + .should('not.exist') + }) + + it('test remove resource self service', () => { + + cy.get('[data-cy=advanced-settings]') + .click() + .get('[data-cy=managers]') + .click() + .get('[data-cy=role-filter]') + .click() + .get('[data-cy=resourceselfservice]') + .click() + .get(`[data-cy=${dbUserToRemoveRoles}-checkbox]`) + .click() + .get('[data-cy=remove-manager-button]') + .click() + .intercept('**/authzResolver/getRichAdmins**').as('getRichAdmins') + .get('[data-cy=remove-manager-button-dialog]') + .click() + .wait('@getRichAdmins') + .get('[data-cy=role-filter]') + .click() + .get('[data-cy=resourceselfservice]') + .click() + .intercept('**/authzResolver/getRichAdmins**').as('getRichAdmins') + .wait('@getRichAdmins') + + + // assert that manager was removed + .get(`[data-cy=${dbUserToRemoveRoles}-checkbox]`) + .should('not.exist') + }) + + + +}) diff --git a/apps/admin-gui/src/app/shared/components/attr-def-list/attr-def-list.component.html b/apps/admin-gui/src/app/shared/components/attr-def-list/attr-def-list.component.html index c79d3e258..43a493f1c 100644 --- a/apps/admin-gui/src/app/shared/components/attr-def-list/attr-def-list.component.html +++ b/apps/admin-gui/src/app/shared/components/attr-def-list/attr-def-list.component.html @@ -1,6 +1,7 @@
diff --git a/apps/admin-gui/src/app/shared/components/attr-def-list/attr-def-list.component.ts b/apps/admin-gui/src/app/shared/components/attr-def-list/attr-def-list.component.ts index 0471a7456..902b6391b 100644 --- a/apps/admin-gui/src/app/shared/components/attr-def-list/attr-def-list.component.ts +++ b/apps/admin-gui/src/app/shared/components/attr-def-list/attr-def-list.component.ts @@ -115,7 +115,7 @@ export class AttrDefListComponent implements OnChanges, AfterViewInit { this.dataSource.paginator = this.child.paginator; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -126,6 +126,21 @@ export class AttrDefListComponent implements OnChanges, AfterViewInit { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + AttrDefListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.filter = this.filterValue; diff --git a/apps/admin-gui/src/app/shared/components/audit-messages-list/audit-messages-list.component.html b/apps/admin-gui/src/app/shared/components/audit-messages-list/audit-messages-list.component.html index 9e3a264c9..39cdb84e4 100644 --- a/apps/admin-gui/src/app/shared/components/audit-messages-list/audit-messages-list.component.html +++ b/apps/admin-gui/src/app/shared/components/audit-messages-list/audit-messages-list.component.html @@ -2,10 +2,11 @@ [hidden]="this.dataSource.allObjectCount === 0 && (dataSource.loading$ | async) === false" class="card mt-2"> + [tableId]="tableId" + [allowExportAll]="false">
diff --git a/apps/admin-gui/src/app/shared/components/audit-messages-list/audit-messages-list.component.ts b/apps/admin-gui/src/app/shared/components/audit-messages-list/audit-messages-list.component.ts index 47363ee3e..831de7d83 100644 --- a/apps/admin-gui/src/app/shared/components/audit-messages-list/audit-messages-list.component.ts +++ b/apps/admin-gui/src/app/shared/components/audit-messages-list/audit-messages-list.component.ts @@ -115,7 +115,7 @@ export class AuditMessagesListComponent implements OnInit, OnChanges, AfterViewI this.dialog.open(AuditMessageDetailDialogComponent, config); } - exportData(format: string): void { + exportDisplayedData(format: string): void { downloadData( getDataForExport( this.dataSource.getData(), diff --git a/apps/admin-gui/src/app/shared/components/blacklist-list/blacklist-list.component.html b/apps/admin-gui/src/app/shared/components/blacklist-list/blacklist-list.component.html index dd30b0f79..ebbc05e68 100644 --- a/apps/admin-gui/src/app/shared/components/blacklist-list/blacklist-list.component.html +++ b/apps/admin-gui/src/app/shared/components/blacklist-list/blacklist-list.component.html @@ -2,7 +2,8 @@ [hidden]="dataSource.filteredData.length === 0 || bansOnFacilitiesWithUsers.length === 0" class="card mt-3"> diff --git a/apps/admin-gui/src/app/shared/components/blacklist-list/blacklist-list.component.ts b/apps/admin-gui/src/app/shared/components/blacklist-list/blacklist-list.component.ts index 93a7af9fe..f7648a1f0 100644 --- a/apps/admin-gui/src/app/shared/components/blacklist-list/blacklist-list.component.ts +++ b/apps/admin-gui/src/app/shared/components/blacklist-list/blacklist-list.component.ts @@ -63,7 +63,7 @@ export class BlacklistListComponent implements AfterViewInit, OnChanges { this.dataSource.filter = this.filterValue; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -74,6 +74,21 @@ export class BlacklistListComponent implements AfterViewInit, OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + BlacklistListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.filterPredicate = (data: [BanOnFacility, User], filter: string): boolean => diff --git a/apps/admin-gui/src/app/shared/components/consent-hubs-list/consent-hubs-list.component.html b/apps/admin-gui/src/app/shared/components/consent-hubs-list/consent-hubs-list.component.html index 8f5e1d37b..40494ca0c 100644 --- a/apps/admin-gui/src/app/shared/components/consent-hubs-list/consent-hubs-list.component.html +++ b/apps/admin-gui/src/app/shared/components/consent-hubs-list/consent-hubs-list.component.html @@ -1,6 +1,7 @@
diff --git a/apps/admin-gui/src/app/shared/components/consent-hubs-list/consent-hubs-list.component.ts b/apps/admin-gui/src/app/shared/components/consent-hubs-list/consent-hubs-list.component.ts index 395ac8e10..8a2bc03b3 100644 --- a/apps/admin-gui/src/app/shared/components/consent-hubs-list/consent-hubs-list.component.ts +++ b/apps/admin-gui/src/app/shared/components/consent-hubs-list/consent-hubs-list.component.ts @@ -71,7 +71,7 @@ export class ConsentHubsListComponent implements OnChanges { this.setDataSource(); } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -82,6 +82,21 @@ export class ConsentHubsListComponent implements OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + ConsentHubsListComponent.getDataForColumn + ), + format + ); + } + /** Whether the number of selected elements matches the total number of rows. */ isAllSelected(): boolean { return this.tableCheckbox.isAllSelected( diff --git a/apps/admin-gui/src/app/shared/components/destination-list/destination-list.component.html b/apps/admin-gui/src/app/shared/components/destination-list/destination-list.component.html index 80f7981e2..517ad4503 100644 --- a/apps/admin-gui/src/app/shared/components/destination-list/destination-list.component.html +++ b/apps/admin-gui/src/app/shared/components/destination-list/destination-list.component.html @@ -1,6 +1,7 @@
diff --git a/apps/admin-gui/src/app/shared/components/destination-list/destination-list.component.ts b/apps/admin-gui/src/app/shared/components/destination-list/destination-list.component.ts index bfbc93b10..a6fdaf9ce 100644 --- a/apps/admin-gui/src/app/shared/components/destination-list/destination-list.component.ts +++ b/apps/admin-gui/src/app/shared/components/destination-list/destination-list.component.ts @@ -73,7 +73,7 @@ export class DestinationListComponent implements AfterViewInit, OnChanges { this.dataSource.filter = this.filterValue.toLowerCase(); } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -84,6 +84,21 @@ export class DestinationListComponent implements AfterViewInit, OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + DestinationListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.sort = this.sort; diff --git a/apps/admin-gui/src/app/shared/components/ext-sources-list/ext-sources-list.component.html b/apps/admin-gui/src/app/shared/components/ext-sources-list/ext-sources-list.component.html index 53e4cc3a2..53be55041 100644 --- a/apps/admin-gui/src/app/shared/components/ext-sources-list/ext-sources-list.component.html +++ b/apps/admin-gui/src/app/shared/components/ext-sources-list/ext-sources-list.component.html @@ -1,6 +1,7 @@
diff --git a/apps/admin-gui/src/app/shared/components/ext-sources-list/ext-sources-list.component.ts b/apps/admin-gui/src/app/shared/components/ext-sources-list/ext-sources-list.component.ts index 2bf469eae..73c0c4218 100644 --- a/apps/admin-gui/src/app/shared/components/ext-sources-list/ext-sources-list.component.ts +++ b/apps/admin-gui/src/app/shared/components/ext-sources-list/ext-sources-list.component.ts @@ -67,7 +67,7 @@ export class ExtSourcesListComponent implements AfterViewInit, OnChanges { this.setDataSource(); } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -78,6 +78,21 @@ export class ExtSourcesListComponent implements AfterViewInit, OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + ExtSourcesListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.filterPredicate = (data: UserExtSource, filter: string): boolean => diff --git a/apps/admin-gui/src/app/shared/components/hosts-list/hosts-list.component.html b/apps/admin-gui/src/app/shared/components/hosts-list/hosts-list.component.html index 4eaa00c96..6fd36160e 100644 --- a/apps/admin-gui/src/app/shared/components/hosts-list/hosts-list.component.html +++ b/apps/admin-gui/src/app/shared/components/hosts-list/hosts-list.component.html @@ -1,6 +1,7 @@
diff --git a/apps/admin-gui/src/app/shared/components/hosts-list/hosts-list.component.ts b/apps/admin-gui/src/app/shared/components/hosts-list/hosts-list.component.ts index 762ccefc1..a0de79ce5 100644 --- a/apps/admin-gui/src/app/shared/components/hosts-list/hosts-list.component.ts +++ b/apps/admin-gui/src/app/shared/components/hosts-list/hosts-list.component.ts @@ -65,7 +65,7 @@ export class HostsListComponent implements AfterViewInit, OnChanges { this.dataSource.filter = this.filterValue; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -76,6 +76,21 @@ export class HostsListComponent implements AfterViewInit, OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + HostsListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.sort = this.sort; diff --git a/apps/admin-gui/src/app/shared/components/managers-page/managers-page.component.html b/apps/admin-gui/src/app/shared/components/managers-page/managers-page.component.html index d6118f4c2..b1dbb9e0a 100644 --- a/apps/admin-gui/src/app/shared/components/managers-page/managers-page.component.html +++ b/apps/admin-gui/src/app/shared/components/managers-page/managers-page.component.html @@ -32,10 +32,11 @@

{{'SHARED.COMPONENTS.MANAGERS_PAGE.REMOVE' | translate}} - + {{'SHARED.COMPONENTS.MANAGERS_PAGE.SELECT_ROLE' | translate}} {{role | displayedRole}} diff --git a/apps/admin-gui/src/app/shared/components/members-candidates-list/members-candidates-list.component.ts b/apps/admin-gui/src/app/shared/components/members-candidates-list/members-candidates-list.component.ts index a6c09ebfa..4f0b7acd2 100644 --- a/apps/admin-gui/src/app/shared/components/members-candidates-list/members-candidates-list.component.ts +++ b/apps/admin-gui/src/app/shared/components/members-candidates-list/members-candidates-list.component.ts @@ -131,7 +131,7 @@ export class MembersCandidatesListComponent implements OnChanges, AfterViewInit } } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -142,6 +142,21 @@ export class MembersCandidatesListComponent implements OnChanges, AfterViewInit ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + this.getExportDataForColumnFun + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.sort = this.sort; diff --git a/apps/admin-gui/src/app/shared/components/resources-tags-list/resources-tags-list.component.html b/apps/admin-gui/src/app/shared/components/resources-tags-list/resources-tags-list.component.html index 50b06f2b7..f9cbd7bb2 100644 --- a/apps/admin-gui/src/app/shared/components/resources-tags-list/resources-tags-list.component.html +++ b/apps/admin-gui/src/app/shared/components/resources-tags-list/resources-tags-list.component.html @@ -2,7 +2,8 @@ [hidden]="resourceTags.length === 0 || dataSource.filteredData.length === 0" class="card mt-2 "> diff --git a/apps/admin-gui/src/app/shared/components/resources-tags-list/resources-tags-list.component.ts b/apps/admin-gui/src/app/shared/components/resources-tags-list/resources-tags-list.component.ts index a0b2b5162..8d593b7a5 100644 --- a/apps/admin-gui/src/app/shared/components/resources-tags-list/resources-tags-list.component.ts +++ b/apps/admin-gui/src/app/shared/components/resources-tags-list/resources-tags-list.component.ts @@ -75,7 +75,7 @@ export class ResourcesTagsListComponent implements OnChanges, AfterViewInit { this.dataSource.paginator = this.child.paginator; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -86,6 +86,21 @@ export class ResourcesTagsListComponent implements OnChanges, AfterViewInit { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + ResourcesTagsListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.filterPredicate = (data: ResourceTag, filter: string): boolean => diff --git a/apps/admin-gui/src/app/shared/components/security-teams-list/security-teams-list.component.html b/apps/admin-gui/src/app/shared/components/security-teams-list/security-teams-list.component.html index 52ce42823..b8f26a8be 100644 --- a/apps/admin-gui/src/app/shared/components/security-teams-list/security-teams-list.component.html +++ b/apps/admin-gui/src/app/shared/components/security-teams-list/security-teams-list.component.html @@ -2,7 +2,8 @@ [hidden]="dataSource.filteredData.length === 0 || securityTeams.length === 0" class="card mt-3"> diff --git a/apps/admin-gui/src/app/shared/components/security-teams-list/security-teams-list.component.ts b/apps/admin-gui/src/app/shared/components/security-teams-list/security-teams-list.component.ts index e7e38b7e0..0697e1cec 100644 --- a/apps/admin-gui/src/app/shared/components/security-teams-list/security-teams-list.component.ts +++ b/apps/admin-gui/src/app/shared/components/security-teams-list/security-teams-list.component.ts @@ -63,7 +63,7 @@ export class SecurityTeamsListComponent implements AfterViewInit, OnChanges { this.dataSource.filter = this.filterValue; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -74,6 +74,21 @@ export class SecurityTeamsListComponent implements AfterViewInit, OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + SecurityTeamsListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.filterPredicate = (data: SecurityTeam, filter: string): boolean => diff --git a/apps/admin-gui/src/app/shared/components/services-list/services-list.component.html b/apps/admin-gui/src/app/shared/components/services-list/services-list.component.html index 6accdb960..f2a266880 100644 --- a/apps/admin-gui/src/app/shared/components/services-list/services-list.component.html +++ b/apps/admin-gui/src/app/shared/components/services-list/services-list.component.html @@ -2,7 +2,8 @@ [hidden]="this.services === undefined || this.services.length === 0 || this.dataSource.filteredData.length === 0" class="card mt-3"> diff --git a/apps/admin-gui/src/app/shared/components/services-list/services-list.component.ts b/apps/admin-gui/src/app/shared/components/services-list/services-list.component.ts index 514805af6..75c3ee24d 100644 --- a/apps/admin-gui/src/app/shared/components/services-list/services-list.component.ts +++ b/apps/admin-gui/src/app/shared/components/services-list/services-list.component.ts @@ -81,12 +81,27 @@ export class ServicesListComponent implements AfterViewInit, OnChanges { }); } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, this.displayedColumns, - ServicesListComponent.getDataForColumn as (data: Service, column: string) => string + ServicesListComponent.getDataForColumn + ), + format + ); + } + + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + ServicesListComponent.getDataForColumn ), format ); diff --git a/apps/admin-gui/src/app/shared/components/sponsored-members-list/sponsored-members-list.component.html b/apps/admin-gui/src/app/shared/components/sponsored-members-list/sponsored-members-list.component.html index 562495312..454a4e7ca 100644 --- a/apps/admin-gui/src/app/shared/components/sponsored-members-list/sponsored-members-list.component.html +++ b/apps/admin-gui/src/app/shared/components/sponsored-members-list/sponsored-members-list.component.html @@ -2,7 +2,8 @@ [hidden]="dataSource.filteredData.length === 0 || sponsoredMembers.length === 0" class="card mt-3"> diff --git a/apps/admin-gui/src/app/shared/components/sponsored-members-list/sponsored-members-list.component.ts b/apps/admin-gui/src/app/shared/components/sponsored-members-list/sponsored-members-list.component.ts index 0d371b356..e51290665 100644 --- a/apps/admin-gui/src/app/shared/components/sponsored-members-list/sponsored-members-list.component.ts +++ b/apps/admin-gui/src/app/shared/components/sponsored-members-list/sponsored-members-list.component.ts @@ -101,7 +101,7 @@ export class SponsoredMembersListComponent implements OnChanges { this.routingStrategy = this.disableRouting; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -112,6 +112,21 @@ export class SponsoredMembersListComponent implements OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + SponsoredMembersListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (!this.dataSource) { this.dataSource = new MatTableDataSource(); diff --git a/apps/admin-gui/src/app/shared/components/users-list/users-list.component.html b/apps/admin-gui/src/app/shared/components/users-list/users-list.component.html index 250b1ed5d..2e50ac1bb 100644 --- a/apps/admin-gui/src/app/shared/components/users-list/users-list.component.html +++ b/apps/admin-gui/src/app/shared/components/users-list/users-list.component.html @@ -2,7 +2,8 @@ [hidden]="this.users.length === 0 || !dataSource || dataSource.filteredData.length === 0" class="card mt-2"> diff --git a/apps/admin-gui/src/app/shared/components/users-list/users-list.component.ts b/apps/admin-gui/src/app/shared/components/users-list/users-list.component.ts index 14fb83733..cbb204cda 100644 --- a/apps/admin-gui/src/app/shared/components/users-list/users-list.component.ts +++ b/apps/admin-gui/src/app/shared/components/users-list/users-list.component.ts @@ -103,7 +103,7 @@ export class UsersListComponent implements OnChanges { } } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -114,6 +114,21 @@ export class UsersListComponent implements OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + UsersListComponent.getExportDataForColumn + ), + format + ); + } + setDataSource(): void { if (!this.dataSource) { this.dataSource = new MatTableDataSource(); diff --git a/apps/admin-gui/src/app/vos/components/application-list-details/application-list-details.component.html b/apps/admin-gui/src/app/vos/components/application-list-details/application-list-details.component.html index 19e89aa3d..da52ebc30 100644 --- a/apps/admin-gui/src/app/vos/components/application-list-details/application-list-details.component.html +++ b/apps/admin-gui/src/app/vos/components/application-list-details/application-list-details.component.html @@ -3,7 +3,8 @@ [hidden]="this.table.length === 0 || (dataSource ? dataSource.filteredData.length === 0 : false)" class="card mt-2 w-100"> diff --git a/apps/admin-gui/src/app/vos/components/application-list-details/application-list-details.component.ts b/apps/admin-gui/src/app/vos/components/application-list-details/application-list-details.component.ts index d68b85699..f0e4c3c8e 100644 --- a/apps/admin-gui/src/app/vos/components/application-list-details/application-list-details.component.ts +++ b/apps/admin-gui/src/app/vos/components/application-list-details/application-list-details.component.ts @@ -121,7 +121,7 @@ export class ApplicationListDetailsComponent implements OnChanges { } } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -135,6 +135,24 @@ export class ApplicationListDetailsComponent implements OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + this.getExportDataForColumn.bind(ApplicationListDetailsComponent) as ( + data: Record, + column: string + ) => string + ), + format + ); + } + getApplicationsData(index: number): void { if (this.applications.length === index) { this.initialize(); diff --git a/apps/admin-gui/src/app/vos/components/applications-dynamic-list/applications-dynamic-list.component.html b/apps/admin-gui/src/app/vos/components/applications-dynamic-list/applications-dynamic-list.component.html index 58fae5b81..2bc26cde6 100644 --- a/apps/admin-gui/src/app/vos/components/applications-dynamic-list/applications-dynamic-list.component.html +++ b/apps/admin-gui/src/app/vos/components/applications-dynamic-list/applications-dynamic-list.component.html @@ -1,6 +1,7 @@
diff --git a/apps/admin-gui/src/app/vos/components/applications-dynamic-list/applications-dynamic-list.component.ts b/apps/admin-gui/src/app/vos/components/applications-dynamic-list/applications-dynamic-list.component.ts index 62a5e24f6..45059042a 100644 --- a/apps/admin-gui/src/app/vos/components/applications-dynamic-list/applications-dynamic-list.component.ts +++ b/apps/admin-gui/src/app/vos/components/applications-dynamic-list/applications-dynamic-list.component.ts @@ -12,6 +12,7 @@ import { import { downloadData, getDataForExport, + getDefaultDialogConfig, parseFullName, TABLE_ITEMS_COUNT_OPTIONS, TableWrapperComponent, @@ -26,6 +27,8 @@ import { merge } from 'rxjs'; import { tap } from 'rxjs/operators'; import { TableConfigService } from '@perun-web-apps/config/table-config'; import { formatDate } from '@angular/common'; +import { MatDialog } from '@angular/material/dialog'; +import { ExportDataDialogComponent } from '@perun-web-apps/perun/dialogs'; @Component({ selector: 'app-applications-dynamic-list', @@ -82,7 +85,8 @@ export class ApplicationsDynamicListComponent implements OnInit, OnChanges, Afte constructor( private authResolver: GuiAuthResolver, private tableConfigService: TableConfigService, - private dynamicPaginatingService: DynamicPaginatingService + private dynamicPaginatingService: DynamicPaginatingService, + private dialog: MatDialog ) {} ngAfterViewInit(): void { @@ -158,7 +162,7 @@ export class ApplicationsDynamicListComponent implements OnInit, OnChanges, Afte ); } - exportData(format: string): void { + exportDisplayedData(format: string): void { downloadData( getDataForExport( this.dataSource.getData(), @@ -169,6 +173,41 @@ export class ApplicationsDynamicListComponent implements OnInit, OnChanges, Afte ); } + exportAllData(format: string): void { + const sortDirection = this.sort.direction === 'asc' ? 'ASCENDING' : 'DESCENDING'; + + const config = getDefaultDialogConfig(); + config.width = '300px'; + const exportLoading = this.dialog.open(ExportDataDialogComponent, config); + + this.dataSource + .getAllApplications( + this.child.paginator.length, + sortDirection, + this.getSortDataColumn(), + this.searchString, + this.includeGroupApps, + this.states, + this.dateToString(this.dateFrom), + this.dateToString(this.dateTo), + this.member?.userId ?? null, + this.group?.id ?? null, + this.getVoId(), + true + ) + .subscribe((response) => { + exportLoading.close(); + downloadData( + getDataForExport( + response, + this.displayedColumns, + this.getExportDataForColumn.bind(this) as (data: Application, column: string) => string + ), + format + ); + }); + } + selectApplication(application: Application): (string | number)[] { if (!this.disableRouting) { if (this.group) { diff --git a/apps/admin-gui/src/app/vos/components/applications-list/applications-list.component.html b/apps/admin-gui/src/app/vos/components/applications-list/applications-list.component.html index c861b367c..4d98f7f65 100644 --- a/apps/admin-gui/src/app/vos/components/applications-list/applications-list.component.html +++ b/apps/admin-gui/src/app/vos/components/applications-list/applications-list.component.html @@ -2,7 +2,8 @@ [hidden]="this.applications.length === 0 || !dataSource || dataSource.filteredData.length === 0" class="card mt-2"> diff --git a/apps/admin-gui/src/app/vos/components/applications-list/applications-list.component.ts b/apps/admin-gui/src/app/vos/components/applications-list/applications-list.component.ts index 4013bd6a9..d85853087 100644 --- a/apps/admin-gui/src/app/vos/components/applications-list/applications-list.component.ts +++ b/apps/admin-gui/src/app/vos/components/applications-list/applications-list.component.ts @@ -125,15 +125,27 @@ export class ApplicationsListComponent implements OnChanges, AfterViewInit { this.setDataSource(); } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, this.displayedColumns, - ApplicationsListComponent.getDataForColumn.bind(this) as ( - data: Application, - column: string - ) => string + ApplicationsListComponent.getDataForColumn + ), + format + ); + } + + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + ApplicationsListComponent.getDataForColumn ), format ); diff --git a/apps/admin-gui/src/assets/i18n/en.json b/apps/admin-gui/src/assets/i18n/en.json index a7ebb424f..b7b4dd923 100644 --- a/apps/admin-gui/src/assets/i18n/en.json +++ b/apps/admin-gui/src/assets/i18n/en.json @@ -2772,7 +2772,10 @@ "TITLE": "The requested user (by Id or external identity) doesn't exist." }, "TABLE_OPTIONS": { - "EXPORT_TO_FILE": "Export to file" + "EXPORT_TO_FILE": "Export to file", + "ALL_DATA": "All data", + "DISPLAYED_DATA": "Displayed data", + "EXPORT_LOADING": "Exporting data..." }, "NOTIFICATOR": { "NOTIFICATION": { diff --git a/apps/publications/src/app/components/authors-list/authors-list.component.html b/apps/publications/src/app/components/authors-list/authors-list.component.html index 24e8af3c9..e1547a63a 100644 --- a/apps/publications/src/app/components/authors-list/authors-list.component.html +++ b/apps/publications/src/app/components/authors-list/authors-list.component.html @@ -1,6 +1,7 @@
diff --git a/apps/publications/src/app/components/authors-list/authors-list.component.ts b/apps/publications/src/app/components/authors-list/authors-list.component.ts index 0587224e8..1099dd399 100644 --- a/apps/publications/src/app/components/authors-list/authors-list.component.ts +++ b/apps/publications/src/app/components/authors-list/authors-list.component.ts @@ -118,7 +118,7 @@ export class AuthorsListComponent implements AfterViewInit, OnChanges { this.dataSource.paginator = this.child.paginator; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -129,6 +129,21 @@ export class AuthorsListComponent implements AfterViewInit, OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + AuthorsListComponent.getExportDataForColumn + ), + format + ); + } + parseAttribute(data: Author, nameOfAttribute: string): string { let attribute = ''; if (data.attributes) { diff --git a/apps/publications/src/app/components/categories-list/categories-list.component.html b/apps/publications/src/app/components/categories-list/categories-list.component.html index 382d0173c..ee53d421b 100644 --- a/apps/publications/src/app/components/categories-list/categories-list.component.html +++ b/apps/publications/src/app/components/categories-list/categories-list.component.html @@ -1,6 +1,7 @@
diff --git a/apps/publications/src/app/components/categories-list/categories-list.component.ts b/apps/publications/src/app/components/categories-list/categories-list.component.ts index 971afcb43..7b53f73a7 100644 --- a/apps/publications/src/app/components/categories-list/categories-list.component.ts +++ b/apps/publications/src/app/components/categories-list/categories-list.component.ts @@ -73,7 +73,7 @@ export class CategoriesListComponent implements AfterViewInit, OnChanges { this.dataSource.filter = this.filterValue; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -84,6 +84,21 @@ export class CategoriesListComponent implements AfterViewInit, OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + CategoriesListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.filterPredicate = (data: Category, filter: string): boolean => diff --git a/apps/publications/src/app/components/publication-systems-list/publication-systems-list.component.html b/apps/publications/src/app/components/publication-systems-list/publication-systems-list.component.html index c7e4f7baa..4b9482f68 100644 --- a/apps/publications/src/app/components/publication-systems-list/publication-systems-list.component.html +++ b/apps/publications/src/app/components/publication-systems-list/publication-systems-list.component.html @@ -2,7 +2,8 @@ [hidden]="dataSource.filteredData.length === 0 || publicationSystems.length === 0" class="card mt-3"> diff --git a/apps/publications/src/app/components/publication-systems-list/publication-systems-list.component.ts b/apps/publications/src/app/components/publication-systems-list/publication-systems-list.component.ts index dc3525731..7e0abe860 100644 --- a/apps/publications/src/app/components/publication-systems-list/publication-systems-list.component.ts +++ b/apps/publications/src/app/components/publication-systems-list/publication-systems-list.component.ts @@ -54,7 +54,7 @@ export class PublicationSystemsListComponent implements AfterViewInit, OnChanges this.dataSource.filter = this.filterValue; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -65,6 +65,21 @@ export class PublicationSystemsListComponent implements AfterViewInit, OnChanges ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + PublicationSystemsListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.filterPredicate = (data: PublicationSystem, filter: string): boolean => diff --git a/apps/publications/src/app/components/publications-list/publications-list.component.html b/apps/publications/src/app/components/publications-list/publications-list.component.html index 64c6651fd..c5a80078a 100644 --- a/apps/publications/src/app/components/publications-list/publications-list.component.html +++ b/apps/publications/src/app/components/publications-list/publications-list.component.html @@ -1,6 +1,7 @@
diff --git a/apps/publications/src/app/components/publications-list/publications-list.component.ts b/apps/publications/src/app/components/publications-list/publications-list.component.ts index 85f3680ac..0f2efafa4 100644 --- a/apps/publications/src/app/components/publications-list/publications-list.component.ts +++ b/apps/publications/src/app/components/publications-list/publications-list.component.ts @@ -124,7 +124,7 @@ export class PublicationsListComponent implements OnChanges, AfterViewInit { this.dataSource.paginator = this.child.paginator; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -135,6 +135,21 @@ export class PublicationsListComponent implements OnChanges, AfterViewInit { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + PublicationsListComponent.getDataForColumn + ), + format + ); + } + /** Whether the number of selected elements matches the total number of rows. */ isAllSelected(): boolean { return this.tableCheckbox.isAllSelected( diff --git a/apps/publications/src/app/components/thanks-list/thanks-list.component.html b/apps/publications/src/app/components/thanks-list/thanks-list.component.html index bbb73142b..5ccbf1592 100644 --- a/apps/publications/src/app/components/thanks-list/thanks-list.component.html +++ b/apps/publications/src/app/components/thanks-list/thanks-list.component.html @@ -1,6 +1,7 @@
diff --git a/apps/publications/src/app/components/thanks-list/thanks-list.component.ts b/apps/publications/src/app/components/thanks-list/thanks-list.component.ts index f9163a941..1c66e4e45 100644 --- a/apps/publications/src/app/components/thanks-list/thanks-list.component.ts +++ b/apps/publications/src/app/components/thanks-list/thanks-list.component.ts @@ -67,7 +67,7 @@ export class ThanksListComponent implements AfterViewInit, OnChanges { ); } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -78,6 +78,21 @@ export class ThanksListComponent implements AfterViewInit, OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + ThanksListComponent.getDataForColumn + ), + format + ); + } + masterToggle(): void { this.tableCheckbox.masterToggle( this.isAllSelected(), diff --git a/apps/user-profile/src/app/components/membership-list/membership-list.component.html b/apps/user-profile/src/app/components/membership-list/membership-list.component.html index aa03dd1ef..8b27e0d43 100644 --- a/apps/user-profile/src/app/components/membership-list/membership-list.component.html +++ b/apps/user-profile/src/app/components/membership-list/membership-list.component.html @@ -1,6 +1,7 @@
diff --git a/apps/user-profile/src/app/components/membership-list/membership-list.component.ts b/apps/user-profile/src/app/components/membership-list/membership-list.component.ts index afa6ac6c6..c9301f58b 100644 --- a/apps/user-profile/src/app/components/membership-list/membership-list.component.ts +++ b/apps/user-profile/src/app/components/membership-list/membership-list.component.ts @@ -77,7 +77,7 @@ export class MembershipListComponent implements OnChanges, AfterViewInit { this.setDataSource(); } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -88,6 +88,21 @@ export class MembershipListComponent implements OnChanges, AfterViewInit { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + MembershipListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.filterPredicate = (data: Membership, filter: string): boolean => diff --git a/apps/user-profile/src/app/components/string-list/string-list.component.html b/apps/user-profile/src/app/components/string-list/string-list.component.html index f4568194b..9b2880c78 100644 --- a/apps/user-profile/src/app/components/string-list/string-list.component.html +++ b/apps/user-profile/src/app/components/string-list/string-list.component.html @@ -1,6 +1,7 @@
diff --git a/apps/user-profile/src/app/components/string-list/string-list.component.ts b/apps/user-profile/src/app/components/string-list/string-list.component.ts index fcd58369b..f999a2339 100644 --- a/apps/user-profile/src/app/components/string-list/string-list.component.ts +++ b/apps/user-profile/src/app/components/string-list/string-list.component.ts @@ -29,7 +29,7 @@ export class StringListComponent implements OnChanges, AfterViewInit { this.setDataSource(); } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -40,6 +40,20 @@ export class StringListComponent implements OnChanges, AfterViewInit { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + StringListComponent.getExportDataForColumn + ), + format + ); + } setDataSource(): void { if (this.dataSource) { this.dataSource.sort = this.sort; diff --git a/libs/perun/components/src/lib/attributes-list/attributes-list.component.html b/libs/perun/components/src/lib/attributes-list/attributes-list.component.html index 82b1c329c..eb86c0d12 100644 --- a/libs/perun/components/src/lib/attributes-list/attributes-list.component.html +++ b/libs/perun/components/src/lib/attributes-list/attributes-list.component.html @@ -1,6 +1,7 @@
diff --git a/libs/perun/components/src/lib/attributes-list/attributes-list.component.ts b/libs/perun/components/src/lib/attributes-list/attributes-list.component.ts index 69d325d17..cde077a96 100644 --- a/libs/perun/components/src/lib/attributes-list/attributes-list.component.ts +++ b/libs/perun/components/src/lib/attributes-list/attributes-list.component.ts @@ -85,7 +85,7 @@ export class AttributesListComponent implements OnChanges, AfterViewInit { this.dataSource.paginator = this.child.paginator; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -96,6 +96,21 @@ export class AttributesListComponent implements OnChanges, AfterViewInit { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + AttributesListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { this.displayedColumns = this.displayedColumns.filter((x) => !this.hiddenColumns.includes(x)); if (this.dataSource) { diff --git a/libs/perun/components/src/lib/consents-list/consents-list.component.html b/libs/perun/components/src/lib/consents-list/consents-list.component.html index 2f8cc894c..461383109 100644 --- a/libs/perun/components/src/lib/consents-list/consents-list.component.html +++ b/libs/perun/components/src/lib/consents-list/consents-list.component.html @@ -1,6 +1,7 @@
diff --git a/libs/perun/components/src/lib/consents-list/consents-list.component.ts b/libs/perun/components/src/lib/consents-list/consents-list.component.ts index e0ecd55fb..7e0cec5c9 100644 --- a/libs/perun/components/src/lib/consents-list/consents-list.component.ts +++ b/libs/perun/components/src/lib/consents-list/consents-list.component.ts @@ -75,7 +75,7 @@ export class ConsentsListComponent implements AfterViewInit, OnChanges { this.dataSource.paginator = this.child.paginator; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -86,6 +86,21 @@ export class ConsentsListComponent implements AfterViewInit, OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + ConsentsListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.filterPredicate = (data: Consent, filter: string): boolean => diff --git a/libs/perun/components/src/lib/facilities-list/facilities-list.component.html b/libs/perun/components/src/lib/facilities-list/facilities-list.component.html index 1787dece3..ae5fded32 100644 --- a/libs/perun/components/src/lib/facilities-list/facilities-list.component.html +++ b/libs/perun/components/src/lib/facilities-list/facilities-list.component.html @@ -2,7 +2,8 @@ class="card mt-3" [hidden]="!dataSource || dataSource.filteredData.length === 0 || facilities.length === 0"> diff --git a/libs/perun/components/src/lib/facilities-list/facilities-list.component.ts b/libs/perun/components/src/lib/facilities-list/facilities-list.component.ts index fdac5eeb0..a01266053 100644 --- a/libs/perun/components/src/lib/facilities-list/facilities-list.component.ts +++ b/libs/perun/components/src/lib/facilities-list/facilities-list.component.ts @@ -87,7 +87,7 @@ export class FacilitiesListComponent implements OnChanges { this.setDataSource(); } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -98,6 +98,21 @@ export class FacilitiesListComponent implements OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + this.getDataForColumnFun + ), + format + ); + } + setDataSource(): void { if (!this.dataSource) { this.dataSource = new MatTableDataSource(); diff --git a/libs/perun/components/src/lib/group-resource-status/group-resource-status.component.html b/libs/perun/components/src/lib/group-resource-status/group-resource-status.component.html index 4db3e066e..bcce571a2 100644 --- a/libs/perun/components/src/lib/group-resource-status/group-resource-status.component.html +++ b/libs/perun/components/src/lib/group-resource-status/group-resource-status.component.html @@ -3,14 +3,16 @@ (click)="changeStatus()" *ngIf="status === 'ACTIVE'" matTooltip="{{'SHARED_LIB.PERUN.COMPONENTS.GROUP_RESOURCE_STATUS.ACTIVE' | translate}}" - matTooltipPosition="above"> + matTooltipPosition="above" + attr.data-cy="{{groupName}}-active"> check_circle_outline + matTooltipPosition="above" + attr.data-cy="{{groupName}}-inactive"> block @@ -99,6 +100,7 @@ (statusChange)="refreshTable.emit()" [theme]="'resource-theme'" [groupId]="group.id" + [groupName]="group.name" [resourceId]="resourceId" [failureCause]="group.failureCause" [status]="group.status"> diff --git a/libs/perun/components/src/lib/groups-list/groups-list.component.ts b/libs/perun/components/src/lib/groups-list/groups-list.component.ts index 24af32513..3361c0041 100644 --- a/libs/perun/components/src/lib/groups-list/groups-list.component.ts +++ b/libs/perun/components/src/lib/groups-list/groups-list.component.ts @@ -199,7 +199,7 @@ export class GroupsListComponent implements AfterViewInit, OnChanges { return false; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -210,6 +210,21 @@ export class GroupsListComponent implements AfterViewInit, OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + this.getDataForColumnFun + ), + format + ); + } + setDataSource(): void { if (!this.dataSource) { this.dataSource = new MatTableDataSource(); diff --git a/libs/perun/components/src/lib/members-dynamic-list/members-dynamic-list.component.html b/libs/perun/components/src/lib/members-dynamic-list/members-dynamic-list.component.html index 1eb765d82..b42b1f2f9 100644 --- a/libs/perun/components/src/lib/members-dynamic-list/members-dynamic-list.component.html +++ b/libs/perun/components/src/lib/members-dynamic-list/members-dynamic-list.component.html @@ -2,7 +2,8 @@ [hidden]="this.dataSource.allObjectCount === 0 && (dataSource.loading$ | async) === false" class="card mt-2"> diff --git a/libs/perun/components/src/lib/members-dynamic-list/members-dynamic-list.component.ts b/libs/perun/components/src/lib/members-dynamic-list/members-dynamic-list.component.ts index f4cd0331f..4ce385f29 100644 --- a/libs/perun/components/src/lib/members-dynamic-list/members-dynamic-list.component.ts +++ b/libs/perun/components/src/lib/members-dynamic-list/members-dynamic-list.component.ts @@ -12,6 +12,7 @@ import { ChangeMemberStatusDialogComponent, ChangeVoExpirationDialogComponent, MemberTreeViewDialogComponent, + ExportDataDialogComponent, } from '@perun-web-apps/perun/dialogs'; import { DynamicDataSource, @@ -257,7 +258,7 @@ export class MembersDynamicListComponent implements AfterViewInit, OnInit, OnCha ); } - exportData(format: string): void { + exportDisplayedData(format: string): void { downloadData( getDataForExport( this.dataSource.getData(), @@ -268,6 +269,39 @@ export class MembersDynamicListComponent implements AfterViewInit, OnInit, OnCha ); } + exportAllData(format: string): void { + const sortDirection = this.sort.direction === 'asc' ? 'ASCENDING' : 'DESCENDING'; + const sortColumn = this.sort.active === 'fullName' ? 'NAME' : 'ID'; + + const config = getDefaultDialogConfig(); + config.width = '300px'; + const exportLoading = this.dialog.open(ExportDataDialogComponent, config); + + this.dataSource + .getAllMembers( + this.voId, + this.attrNames, + sortDirection, + this.child.paginator.length, + sortColumn, + this.selectedStatuses, + this.searchString, + this.groupId, + this.selectedGroupStatuses + ) + .subscribe((response) => { + exportLoading.close(); + downloadData( + getDataForExport( + response, + this.displayedColumns, + MembersDynamicListComponent.getExportDataForColumn + ), + format + ); + }); + } + viewMemberGroupTree(event: Event, member: RichMember): void { event.stopPropagation(); const config = getDefaultDialogConfig(); diff --git a/libs/perun/components/src/lib/members-list/members-list.component.html b/libs/perun/components/src/lib/members-list/members-list.component.html index 8ce119752..40a110f41 100644 --- a/libs/perun/components/src/lib/members-list/members-list.component.html +++ b/libs/perun/components/src/lib/members-list/members-list.component.html @@ -2,7 +2,8 @@ [hidden]="this.members.length === 0 || !dataSource || dataSource.filteredData.length === 0" class="card mt-2"> diff --git a/libs/perun/components/src/lib/members-list/members-list.component.ts b/libs/perun/components/src/lib/members-list/members-list.component.ts index e66442caf..0f2c1171a 100644 --- a/libs/perun/components/src/lib/members-list/members-list.component.ts +++ b/libs/perun/components/src/lib/members-list/members-list.component.ts @@ -156,7 +156,22 @@ export class MembersListComponent implements OnChanges, AfterViewInit { return MembersListComponent.getSortDataForColumn(data, column, this.showGroupStatuses); }; - exportData(format: string): void { + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + this.getExportDataForColumnFun + ), + format + ); + } + + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, diff --git a/libs/perun/components/src/lib/owners-list/owners-list.component.html b/libs/perun/components/src/lib/owners-list/owners-list.component.html index ae7b11449..04fd829ae 100644 --- a/libs/perun/components/src/lib/owners-list/owners-list.component.html +++ b/libs/perun/components/src/lib/owners-list/owners-list.component.html @@ -1,6 +1,7 @@
diff --git a/libs/perun/components/src/lib/owners-list/owners-list.component.ts b/libs/perun/components/src/lib/owners-list/owners-list.component.ts index 593af5e8d..14dc186b1 100644 --- a/libs/perun/components/src/lib/owners-list/owners-list.component.ts +++ b/libs/perun/components/src/lib/owners-list/owners-list.component.ts @@ -56,7 +56,7 @@ export class OwnersListComponent implements OnChanges, AfterViewInit { this.setDataSource(); } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -67,6 +67,21 @@ export class OwnersListComponent implements OnChanges, AfterViewInit { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + OwnersListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.filterPredicate = (data: Owner, filter: string): boolean => diff --git a/libs/perun/components/src/lib/resources-list/resources-list.component.html b/libs/perun/components/src/lib/resources-list/resources-list.component.html index 4f5c18bcd..10ebf77c4 100644 --- a/libs/perun/components/src/lib/resources-list/resources-list.component.html +++ b/libs/perun/components/src/lib/resources-list/resources-list.component.html @@ -1,6 +1,7 @@
diff --git a/libs/perun/components/src/lib/resources-list/resources-list.component.ts b/libs/perun/components/src/lib/resources-list/resources-list.component.ts index 07c37cbd3..98f8ccd85 100644 --- a/libs/perun/components/src/lib/resources-list/resources-list.component.ts +++ b/libs/perun/components/src/lib/resources-list/resources-list.component.ts @@ -124,7 +124,7 @@ export class ResourcesListComponent implements OnInit, OnChanges { this.setAuth(); } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -135,6 +135,21 @@ export class ResourcesListComponent implements OnInit, OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + this.getDataForColumnFun + ), + format + ); + } + setDataSource(): void { if (!this.dataSource) { this.dataSource = new MatTableDataSource(); diff --git a/libs/perun/components/src/lib/services-status-list/services-status-list.component.html b/libs/perun/components/src/lib/services-status-list/services-status-list.component.html index b5c177b68..90e5daf07 100644 --- a/libs/perun/components/src/lib/services-status-list/services-status-list.component.html +++ b/libs/perun/components/src/lib/services-status-list/services-status-list.component.html @@ -2,7 +2,8 @@ [hidden]="dataSource.filteredData.length === 0 || servicesStatus.length === 0" class="card mt-3"> diff --git a/libs/perun/components/src/lib/services-status-list/services-status-list.component.ts b/libs/perun/components/src/lib/services-status-list/services-status-list.component.ts index 7124da97c..a62032500 100644 --- a/libs/perun/components/src/lib/services-status-list/services-status-list.component.ts +++ b/libs/perun/components/src/lib/services-status-list/services-status-list.component.ts @@ -142,7 +142,7 @@ export class ServicesStatusListComponent implements OnChanges, AfterViewInit { this.dataSource.filter = this.filterValue; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -153,6 +153,21 @@ export class ServicesStatusListComponent implements OnChanges, AfterViewInit { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + ServicesStatusListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.filterPredicate = (data: ServiceState, filter: string): boolean => diff --git a/libs/perun/components/src/lib/task-results-list/task-results-list.component.html b/libs/perun/components/src/lib/task-results-list/task-results-list.component.html index 5f11d6c26..35df25d67 100644 --- a/libs/perun/components/src/lib/task-results-list/task-results-list.component.html +++ b/libs/perun/components/src/lib/task-results-list/task-results-list.component.html @@ -1,6 +1,7 @@
diff --git a/libs/perun/components/src/lib/task-results-list/task-results-list.component.ts b/libs/perun/components/src/lib/task-results-list/task-results-list.component.ts index f96723129..b3cbe159f 100644 --- a/libs/perun/components/src/lib/task-results-list/task-results-list.component.ts +++ b/libs/perun/components/src/lib/task-results-list/task-results-list.component.ts @@ -108,7 +108,7 @@ export class TaskResultsListComponent implements AfterViewInit, OnChanges { this.dataSource.filter = this.filterValue; } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -119,6 +119,21 @@ export class TaskResultsListComponent implements AfterViewInit, OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + TaskResultsListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.sort = this.sort; diff --git a/libs/perun/components/src/lib/user-ext-sources-list/user-ext-sources-list.component.html b/libs/perun/components/src/lib/user-ext-sources-list/user-ext-sources-list.component.html index 3e6d066d1..c45d998d8 100644 --- a/libs/perun/components/src/lib/user-ext-sources-list/user-ext-sources-list.component.html +++ b/libs/perun/components/src/lib/user-ext-sources-list/user-ext-sources-list.component.html @@ -2,7 +2,8 @@ [hidden]="userExtSources.length === 0 || dataSource.filteredData.length === 0" class="card mt-3"> diff --git a/libs/perun/components/src/lib/user-ext-sources-list/user-ext-sources-list.component.ts b/libs/perun/components/src/lib/user-ext-sources-list/user-ext-sources-list.component.ts index 44a6be420..4cccd2aa5 100644 --- a/libs/perun/components/src/lib/user-ext-sources-list/user-ext-sources-list.component.ts +++ b/libs/perun/components/src/lib/user-ext-sources-list/user-ext-sources-list.component.ts @@ -85,7 +85,7 @@ export class UserExtSourcesListComponent implements OnInit, OnChanges { this.setDataSource(); } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -96,6 +96,21 @@ export class UserExtSourcesListComponent implements OnInit, OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + UserExtSourcesListComponent.getDataForColumn + ), + format + ); + } + setDataSource(): void { if (this.dataSource) { this.dataSource.filterPredicate = (data: RichUserExtSource, filter: string): boolean => diff --git a/libs/perun/components/src/lib/users-dynamic-list/users-dynamic-list.component.html b/libs/perun/components/src/lib/users-dynamic-list/users-dynamic-list.component.html index 6436d9a5b..d683af47c 100644 --- a/libs/perun/components/src/lib/users-dynamic-list/users-dynamic-list.component.html +++ b/libs/perun/components/src/lib/users-dynamic-list/users-dynamic-list.component.html @@ -2,7 +2,8 @@ [hidden]="this.dataSource.allObjectCount === 0 && (dataSource.loading$ | async) === false" class="card mt-2"> diff --git a/libs/perun/components/src/lib/users-dynamic-list/users-dynamic-list.component.ts b/libs/perun/components/src/lib/users-dynamic-list/users-dynamic-list.component.ts index 2b66c3bf6..663d049ec 100644 --- a/libs/perun/components/src/lib/users-dynamic-list/users-dynamic-list.component.ts +++ b/libs/perun/components/src/lib/users-dynamic-list/users-dynamic-list.component.ts @@ -4,6 +4,7 @@ import { SelectionModel } from '@angular/cdk/collections'; import { downloadData, getDataForExport, + getDefaultDialogConfig, parseFullName, parseLogins, parseUserEmail, @@ -21,6 +22,8 @@ import { import { merge } from 'rxjs'; import { tap } from 'rxjs/operators'; import { TableConfigService } from '@perun-web-apps/config/table-config'; +import { MatDialog } from '@angular/material/dialog'; +import { ExportDataDialogComponent } from '@perun-web-apps/perun/dialogs'; @Component({ selector: 'perun-web-apps-users-dynamic-list', @@ -59,7 +62,8 @@ export class UsersDynamicListComponent implements OnInit, OnChanges, AfterViewIn private authResolver: GuiAuthResolver, private tableCheckbox: TableCheckbox, private tableConfigService: TableConfigService, - private dynamicPaginatingService: DynamicPaginatingService + private dynamicPaginatingService: DynamicPaginatingService, + private dialog: MatDialog ) {} static getExportDataForColumn(data: RichUser, column: string): string { @@ -164,7 +168,7 @@ export class UsersDynamicListComponent implements OnInit, OnChanges, AfterViewIn ); } - exportData(format: string): void { + exportDisplayedData(format: string): void { downloadData( getDataForExport( this.dataSource.getData(), @@ -174,4 +178,39 @@ export class UsersDynamicListComponent implements OnInit, OnChanges, AfterViewIn format ); } + + exportAllData(format: string): void { + const sortDirection = this.sort.direction === 'asc' ? 'ASCENDING' : 'DESCENDING'; + const sortColumn = this.sort.active === 'name' ? 'NAME' : 'ID'; + + const config = getDefaultDialogConfig(); + config.width = '300px'; + const exportLoading = this.dialog.open(ExportDataDialogComponent, config); + + this.dataSource + .getAllUsers( + this.attrNames, + sortDirection, + this.child.paginator.length, + sortColumn, + this.searchString, + this.withoutVo, + this.facilityId, + this.voId, + this.resourceId, + this.serviceId, + this.onlyAllowed + ) + .subscribe((response) => { + exportLoading.close(); + downloadData( + getDataForExport( + response, + this.displayedColumns, + UsersDynamicListComponent.getExportDataForColumn + ), + format + ); + }); + } } diff --git a/libs/perun/components/src/lib/vos-list/vos-list.component.html b/libs/perun/components/src/lib/vos-list/vos-list.component.html index 34dca08ba..2a7553b23 100644 --- a/libs/perun/components/src/lib/vos-list/vos-list.component.html +++ b/libs/perun/components/src/lib/vos-list/vos-list.component.html @@ -1,6 +1,7 @@
diff --git a/libs/perun/components/src/lib/vos-list/vos-list.component.ts b/libs/perun/components/src/lib/vos-list/vos-list.component.ts index 7c9533080..030aa96c5 100644 --- a/libs/perun/components/src/lib/vos-list/vos-list.component.ts +++ b/libs/perun/components/src/lib/vos-list/vos-list.component.ts @@ -76,7 +76,7 @@ export class VosListComponent implements OnChanges { this.setDataSource(); } - exportData(format: string): void { + exportAllData(format: string): void { downloadData( getDataForExport( this.dataSource.filteredData, @@ -87,6 +87,21 @@ export class VosListComponent implements OnChanges { ); } + exportDisplayedData(format: string): void { + const start = this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize; + const end = start + this.dataSource.paginator.pageSize; + downloadData( + getDataForExport( + this.dataSource + .sortData(this.dataSource.filteredData, this.dataSource.sort) + .slice(start, end), + this.displayedColumns, + this.getDataForColumnFun + ), + format + ); + } + setDataSource(): void { if (!this.dataSource) { this.dataSource = new MatTableDataSource(); diff --git a/libs/perun/dialogs/src/index.ts b/libs/perun/dialogs/src/index.ts index eb3acf643..4c838d627 100644 --- a/libs/perun/dialogs/src/index.ts +++ b/libs/perun/dialogs/src/index.ts @@ -21,3 +21,4 @@ export * from './lib/universal-confirmation-dialog/universal-confirmation-dialog export * from './lib/change-group-resource-assigment-dialog/change-group-resource-assigment-dialog.component'; export * from './lib/delete-entity-dialog/delete-entity-dialog.component'; export * from './lib/anonymize-user-dialog/anonymize-user-dialog.component'; +export * from './lib/exporting-data-dialog/export-data-dialog.component'; diff --git a/libs/perun/dialogs/src/lib/change-group-resource-assigment-dialog/change-group-resource-assigment-dialog.component.html b/libs/perun/dialogs/src/lib/change-group-resource-assigment-dialog/change-group-resource-assigment-dialog.component.html index c3b6e95ca..7be7d43ce 100644 --- a/libs/perun/dialogs/src/lib/change-group-resource-assigment-dialog/change-group-resource-assigment-dialog.component.html +++ b/libs/perun/dialogs/src/lib/change-group-resource-assigment-dialog/change-group-resource-assigment-dialog.component.html @@ -62,7 +62,12 @@

-

diff --git a/libs/perun/dialogs/src/lib/exporting-data-dialog/export-data-dialog.component.html b/libs/perun/dialogs/src/lib/exporting-data-dialog/export-data-dialog.component.html new file mode 100644 index 000000000..450206a91 --- /dev/null +++ b/libs/perun/dialogs/src/lib/exporting-data-dialog/export-data-dialog.component.html @@ -0,0 +1,8 @@ +
+

+ {{'SHARED_LIB.PERUN.COMPONENTS.TABLE_OPTIONS.EXPORT_LOADING' | translate}} +

+
+ +
+
diff --git a/libs/perun/dialogs/src/lib/exporting-data-dialog/export-data-dialog.component.scss b/libs/perun/dialogs/src/lib/exporting-data-dialog/export-data-dialog.component.scss new file mode 100644 index 000000000..51f5e2b6d --- /dev/null +++ b/libs/perun/dialogs/src/lib/exporting-data-dialog/export-data-dialog.component.scss @@ -0,0 +1,6 @@ +.loading-container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} diff --git a/libs/perun/dialogs/src/lib/exporting-data-dialog/export-data-dialog.component.ts b/libs/perun/dialogs/src/lib/exporting-data-dialog/export-data-dialog.component.ts new file mode 100644 index 000000000..ed5fbee14 --- /dev/null +++ b/libs/perun/dialogs/src/lib/exporting-data-dialog/export-data-dialog.component.ts @@ -0,0 +1,15 @@ +import { Component } from '@angular/core'; +import { MatDialogRef } from '@angular/material/dialog'; + +@Component({ + selector: 'perun-web-apps-export-data-dialog', + templateUrl: './export-data-dialog.component.html', + styleUrls: ['./export-data-dialog.component.scss'], +}) +export class ExportDataDialogComponent { + constructor(private dialogRef: MatDialogRef) {} + + close(): void { + this.dialogRef.close(); + } +} diff --git a/libs/perun/dialogs/src/lib/perun-dialogs.module.ts b/libs/perun/dialogs/src/lib/perun-dialogs.module.ts index 2cff2c477..092c00820 100644 --- a/libs/perun/dialogs/src/lib/perun-dialogs.module.ts +++ b/libs/perun/dialogs/src/lib/perun-dialogs.module.ts @@ -42,6 +42,7 @@ import { PerunNamespacePasswordFormModule } from '@perun-web-apps/perun/namespac import { AnonymizeUserDialogComponent } from './anonymize-user-dialog/anonymize-user-dialog.component'; import { DeleteEntityDialogComponent } from './delete-entity-dialog/delete-entity-dialog.component'; import { UiMaterialModule } from '@perun-web-apps/ui/material'; +import { ExportDataDialogComponent } from './exporting-data-dialog/export-data-dialog.component'; @NgModule({ imports: [ @@ -91,6 +92,7 @@ import { UiMaterialModule } from '@perun-web-apps/ui/material'; ChangePasswordDialogComponent, AnonymizeUserDialogComponent, DeleteEntityDialogComponent, + ExportDataDialogComponent, ], exports: [ ChangeExpirationDialogComponent, @@ -112,6 +114,7 @@ import { UiMaterialModule } from '@perun-web-apps/ui/material'; ChangePasswordDialogComponent, AnonymizeUserDialogComponent, DeleteEntityDialogComponent, + ExportDataDialogComponent, ], }) export class PerunDialogsModule {} diff --git a/libs/perun/services/src/lib/dynamicDataSource.ts b/libs/perun/services/src/lib/dynamicDataSource.ts index 076a13aac..cf0318ebd 100644 --- a/libs/perun/services/src/lib/dynamicDataSource.ts +++ b/libs/perun/services/src/lib/dynamicDataSource.ts @@ -10,13 +10,14 @@ import { PaginatedRichApplications, PaginatedRichMembers, PaginatedRichUsers, + RichApplication, RichMember, RichUser, SortingOrder, UsersOrderColumn, VoMemberStatuses, } from '@perun-web-apps/perun/openapi'; -import { BehaviorSubject, Observable, of } from 'rxjs'; +import { BehaviorSubject, forkJoin, Observable, of } from 'rxjs'; import { catchError, finalize } from 'rxjs/operators'; import { DynamicPaginatingService } from './dynamic-paginating.service'; import { GuiAuthResolver } from './gui-auth-resolver.service'; @@ -25,6 +26,7 @@ export class DynamicDataSource implements DataSource { loading$: Observable; allObjectCount = 0; routeAuth = true; + step = 10000; private latestQueryTime: number; private dataSubject = new BehaviorSubject([]); private loadingSubject = new BehaviorSubject(false); @@ -84,6 +86,48 @@ export class DynamicDataSource implements DataSource { }); } + getAllMembers( + voId: number, + attrNames: string[], + sortOrder: SortingOrder, + totalCount: number, + sortColumn: MembersOrderColumn, + statuses: VoMemberStatuses[], + searchString?: string, + groupId?: number, + groupStatuses?: MemberGroupStatus[] + ): Observable { + return new Observable((subscriber) => { + const requests = []; + for (let pageNumber = 0; pageNumber < Math.ceil(totalCount / this.step); pageNumber++) { + requests.push( + this.dynamicPaginatingService.getMembers( + voId, + attrNames, + sortOrder, + pageNumber, + this.step, + sortColumn, + statuses, + searchString, + groupId, + groupStatuses + ) + ); + } + forkJoin(requests).subscribe({ + next: (results) => { + const mergedData = [].concat( + ...results.map((result) => (result as PaginatedRichMembers).data) + ); + subscriber.next(mergedData as RichMember[]); + subscriber.complete(); + }, + error: (error) => subscriber.error(error), + }); + }); + } + loadUsers( attrNames: string[], pageSize: number, @@ -130,6 +174,52 @@ export class DynamicDataSource implements DataSource { }); } + getAllUsers( + attrNames: string[], + order: SortingOrder, + totalCount: number, + sortColumn: UsersOrderColumn, + searchString: string, + withoutVo: boolean, + facilityId: number, + voId: number, + resourceId: number, + serviceId: number, + onlyAllowed: boolean + ): Observable { + return new Observable((subscriber) => { + const requests = []; + for (let pageNumber = 0; pageNumber < Math.ceil(totalCount / this.step); pageNumber++) { + requests.push( + this.dynamicPaginatingService.getUsers( + attrNames, + order, + pageNumber, + this.step, + sortColumn, + searchString, + withoutVo, + facilityId, + voId, + resourceId, + serviceId, + onlyAllowed + ) + ); + } + forkJoin(requests).subscribe({ + next: (results) => { + const mergedData = [].concat( + ...results.map((result) => (result as PaginatedRichUsers).data) + ); + subscriber.next(mergedData as RichUser[]); + subscriber.complete(); + }, + error: (error) => subscriber.error(error), + }); + }); + } + loadAuditMessages(pageSize: number, pageIndex: number, sortOrder: SortingOrder): void { this.loadingSubject.next(true); this.latestQueryTime = Date.now(); @@ -150,6 +240,27 @@ export class DynamicDataSource implements DataSource { }); } + getAllAuditMessages(totalCount: number, sortOrder: SortingOrder): Observable { + return new Observable((subscriber) => { + const requests = []; + for (let pageNumber = 0; pageNumber < Math.ceil(totalCount / this.step); pageNumber++) { + requests.push( + this.dynamicPaginatingService.getAuditMessages(sortOrder, pageNumber, this.step) + ); + } + forkJoin(requests).subscribe({ + next: (results) => { + const mergedData = [].concat( + ...results.map((result) => (result as PaginatedAuditMessages).data) + ); + subscriber.next(mergedData as AuditMessage[]); + subscriber.complete(); + }, + error: (error) => subscriber.error(error), + }); + }); + } + loadApplications( pageSize: number, pageIndex: number, @@ -212,6 +323,54 @@ export class DynamicDataSource implements DataSource { }); } + getAllApplications( + totalCount: number, + sortOrder: SortingOrder, + sortColumn: ApplicationsOrderColumn, + searchString: string, + includeGroupApps: boolean, + states: AppState[], + dateFrom: string, + dateTo: string, + userId: number, + groupId: number, + voId: number, + details?: boolean + ): Observable { + return new Observable((subscriber) => { + const requests = []; + for (let pageNumber = 0; pageNumber < Math.ceil(totalCount / this.step); pageNumber++) { + requests.push( + this.dynamicPaginatingService.getApplications( + this.step, + pageNumber, + sortOrder, + sortColumn, + includeGroupApps, + searchString, + states, + dateFrom, + dateTo, + userId, + voId, + groupId, + details ?? false + ) + ); + } + forkJoin(requests).subscribe({ + next: (results) => { + const mergedData = [].concat( + ...results.map((result) => (result as PaginatedRichApplications).data) + ); + subscriber.next(mergedData as RichApplication[]); + subscriber.complete(); + }, + error: (error) => subscriber.error(error), + }); + }); + } + connect(): Observable { return this.dataSubject.asObservable(); } diff --git a/libs/perun/utils/src/lib/table-options/table-options.component.html b/libs/perun/utils/src/lib/table-options/table-options.component.html index 1ffadcbd2..c02c31523 100644 --- a/libs/perun/utils/src/lib/table-options/table-options.component.html +++ b/libs/perun/utils/src/lib/table-options/table-options.component.html @@ -10,6 +10,15 @@ - + + + + + +
diff --git a/libs/perun/utils/src/lib/table-options/table-options.component.ts b/libs/perun/utils/src/lib/table-options/table-options.component.ts index ee7613b40..41aca1559 100644 --- a/libs/perun/utils/src/lib/table-options/table-options.component.ts +++ b/libs/perun/utils/src/lib/table-options/table-options.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Output } from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; @Component({ selector: 'perun-web-apps-table-options', @@ -6,5 +6,7 @@ import { Component, EventEmitter, Output } from '@angular/core'; styleUrls: ['./table-options.component.scss'], }) export class TableOptionsComponent { - @Output() exportData = new EventEmitter(); + @Input() allowExportAll: boolean; + @Output() exportDisplayedData = new EventEmitter(); + @Output() exportAllData = new EventEmitter(); } diff --git a/libs/perun/utils/src/lib/table-wrapper/table-wrapper.component.html b/libs/perun/utils/src/lib/table-wrapper/table-wrapper.component.html index 38b562d2b..30c150160 100644 --- a/libs/perun/utils/src/lib/table-wrapper/table-wrapper.component.html +++ b/libs/perun/utils/src/lib/table-wrapper/table-wrapper.component.html @@ -7,7 +7,9 @@ [pageSize]="pageSize">
@@ -23,7 +25,9 @@ [pageSize]="paginator.pageSize">
diff --git a/libs/perun/utils/src/lib/table-wrapper/table-wrapper.component.ts b/libs/perun/utils/src/lib/table-wrapper/table-wrapper.component.ts index c9a340bf4..22d50e51e 100644 --- a/libs/perun/utils/src/lib/table-wrapper/table-wrapper.component.ts +++ b/libs/perun/utils/src/lib/table-wrapper/table-wrapper.component.ts @@ -13,7 +13,9 @@ export class TableWrapperComponent implements OnInit { @Input() pageSizeOptions = TABLE_ITEMS_COUNT_OPTIONS; @Input() dataLength = 0; @Input() tableId: string; - @Output() exportData = new EventEmitter(); + @Input() allowExportAll = true; + @Output() exportDisplayedData = new EventEmitter(); + @Output() exportAllData = new EventEmitter(); pageSize = 5; paginator: MatPaginator; diff --git a/package-lock.json b/package-lock.json index bbb054880..447333f85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "d3-shape": "^3.1.0", "eslint-plugin-unused-imports": "^2.0.0", "file-saver": "^2.0.5", - "moment-timezone": "^0.5.34", + "moment-timezone": "^0.5.35", "ng2-charts": "^3.0.8", "ngx-mat-select-search": "^4.2.1", "ngx-scrollbar": "^10.0.0", @@ -20212,9 +20212,9 @@ } }, "node_modules/moment-timezone": { - "version": "0.5.34", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.34.tgz", - "integrity": "sha512-3zAEHh2hKUs3EXLESx/wsgw6IQdusOT8Bxm3D9UrHPQR7zlMmzwybC8zHEM1tQ4LJwP7fcxrWr8tuBg05fFCbg==", + "version": "0.5.35", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.35.tgz", + "integrity": "sha512-cY/pBOEXepQvlgli06ttCTKcIf8cD1nmNwOKQQAdHBqYApQSpAqotBMX0RJZNgMp6i0PlZuf1mFtnlyEkwyvFw==", "dependencies": { "moment": ">= 2.9.0" }, @@ -44452,9 +44452,9 @@ "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" }, "moment-timezone": { - "version": "0.5.34", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.34.tgz", - "integrity": "sha512-3zAEHh2hKUs3EXLESx/wsgw6IQdusOT8Bxm3D9UrHPQR7zlMmzwybC8zHEM1tQ4LJwP7fcxrWr8tuBg05fFCbg==", + "version": "0.5.35", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.35.tgz", + "integrity": "sha512-cY/pBOEXepQvlgli06ttCTKcIf8cD1nmNwOKQQAdHBqYApQSpAqotBMX0RJZNgMp6i0PlZuf1mFtnlyEkwyvFw==", "requires": { "moment": ">= 2.9.0" } diff --git a/package.json b/package.json index 19fbbf9db..e77e1a7b4 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "d3-shape": "^3.1.0", "eslint-plugin-unused-imports": "^2.0.0", "file-saver": "^2.0.5", - "moment-timezone": "^0.5.34", + "moment-timezone": "^0.5.35", "ng2-charts": "^3.0.8", "ngx-mat-select-search": "^4.2.1", "ngx-scrollbar": "^10.0.0",