Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
Johaney-s committed Jan 24, 2023
2 parents 9da9edb + c9a5121 commit ce2b350
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ <h1 mat-dialog-title>{{'DIALOGS.ADD_ROLE.TITLE' | translate}}</h1>
[disableRouting]="true">
</perun-web-apps-vos-list>
<perun-web-apps-groups-list
[filterValue]="filterValue"
*ngIf="!loading && selectedRule?.primaryObject === 'Group'"
[groups]="groups | manageableEntities: selectedRule | unassignedRole: roles : selectedRule"
[displayedColumns]="['select', 'id', 'vo', 'name', 'description']"
[selection]="selected"
[filter]="filterValue"
[disableRouting]="true">
</perun-web-apps-groups-list>
<perun-web-apps-facilities-list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
} from '@perun-web-apps/perun/openapi';
import { SelectionModel } from '@angular/cdk/collections';
import { ToEnrichedFacilityPipe } from '@perun-web-apps/perun/pipes';
import { UntypedFormControl } from '@angular/forms';
import { ImmediateFilterComponent } from '@perun-web-apps/perun/components';

export interface AddRoleDialogData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ <h1 mat-dialog-title>{{this.attDef.namespace + ':' + this.attDef.friendlyName}}<
</ng-container>

<ng-container matColumnDef="key">
<th *matHeaderCellDef mat-header-cell mat-sort-header>
<th *matHeaderCellDef mat-header-cell>
{{'SHARED.COMPONENTS.ENTITYLESS_ATTRIBUTES_LIST.KEY' | translate}}
</th>
<td *matCellDef="let record" mat-cell>
Expand All @@ -77,7 +77,7 @@ <h1 mat-dialog-title>{{this.attDef.namespace + ':' + this.attDef.friendlyName}}<
</td>
</ng-container>
<ng-container matColumnDef="value">
<th *matHeaderCellDef mat-header-cell mat-sort-header>
<th *matHeaderCellDef mat-header-cell>
{{'SHARED.COMPONENTS.ENTITYLESS_ATTRIBUTES_LIST.VALUE' | translate}}
</th>
<td *matCellDef="let record" mat-cell>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
AfterViewInit,
ChangeDetectorRef,
Component,
EventEmitter,
Inject,
Expand Down Expand Up @@ -62,7 +63,8 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit,
@Inject(MAT_DIALOG_DATA) public data: EntitylessAttributeKeysListData,
private notificator: NotificatorService,
private translate: TranslateService,
private attributesManager: AttributesManagerService
private attributesManager: AttributesManagerService,
private cd: ChangeDetectorRef
) {}

@ViewChild(MatSort, { static: true }) set matSort(ms: MatSort) {
Expand Down Expand Up @@ -119,6 +121,7 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit,
}
this.selection.clear();
this.isAddButtonDisabled = false;
this.cd.detectChanges();
}

onRemove(): void {
Expand All @@ -135,6 +138,7 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit,
this.ngOnInit();
this.selection.clear();
this.isAddButtonDisabled = false;
this.cd.detectChanges();
}

onAdd(): void {
Expand All @@ -146,6 +150,7 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit,
this.selection.clear();
this.selection.select(rec);
this.isAddButtonDisabled = true;
this.cd.detectChanges();
}

onCancel(): void {
Expand Down Expand Up @@ -185,5 +190,6 @@ export class EntitylessAttributeKeysListComponent implements OnChanges, OnInit,
this.child = children.first;
this.dataSource.paginator = this.child.paginator;
});
this.setDataSource();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
})
export class AttributeCriticalOperationsTogglesComponent {
@Input() readOperation = false;
@Input() writeOperation = false;
@Input() writeOperation = true;
@Output() readOperationChanged: EventEmitter<boolean> = new EventEmitter<boolean>();
@Output() writeOperationChanged: EventEmitter<boolean> = new EventEmitter<boolean>();
}
54 changes: 2 additions & 52 deletions libs/perun/components/src/lib/groups-list/groups-list.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import {
Component,
EventEmitter,
HostListener,
Input,
OnChanges,
Output,
ViewChild,
} from '@angular/core';
import { Component, EventEmitter, HostListener, Input, Output, ViewChild } from '@angular/core';
import {
ChangeGroupExpirationDialogComponent,
EditFacilityResourceGroupVoDialogComponent,
Expand All @@ -17,7 +9,6 @@ import {
Group,
Member,
PaginatedRichGroups,
Vo,
VosManagerService,
} from '@perun-web-apps/perun/openapi';
import { GuiAuthResolver, TableCheckbox } from '@perun-web-apps/perun/services';
Expand Down Expand Up @@ -51,10 +42,9 @@ import { GroupUtilsService } from '@perun-web-apps/perun/services';
styleUrls: ['./groups-list.component.scss'],
providers: [DisableGroupSelectPipe],
})
export class GroupsListComponent implements OnChanges {
export class GroupsListComponent {
@Input() theme = 'group-theme';
@Input() selection = new SelectionModel<GroupWithStatus>(true, []);
@Input() filterValue: string;
@Input() disableMembers: boolean;
@Input() disableGroups: boolean;
@Input() groupsToDisableCheckbox: Set<number> = new Set<number>();
Expand Down Expand Up @@ -151,13 +141,6 @@ export class GroupsListComponent implements OnChanges {
return this.groupUtils.getSortDataForColumn(data, column, this.voNames, this.recentIds);
};

ngOnChanges(): void {
if (!this.authResolver.isPerunAdminOrObserver()) {
this.displayedColumns = this.displayedColumns.filter((column) => column !== 'id');
}
this.setDataSource();
}

exportAllData(format: string): void {
if (isDynamicDataSource(this.dataSource)) {
this.downloadAll.emit({ format: format, length: this.dataSource.paginator.length });
Expand Down Expand Up @@ -299,39 +282,6 @@ export class GroupsListComponent implements OnChanges {
);
};

setDataSource(): void {
if (!this.dataSource) {
this.dataSource = new MatTableDataSource<GroupWithStatus>();
this.dataSource.sort = this.sort;
this.dataSource.paginator = this.tableWrapper.paginator;
this.dataSource.filterPredicate = (data: Vo, filter: string): boolean =>
customDataSourceFilterPredicate(
data,
filter,
this.displayedColumns,
this.getDataForColumnFun
);
this.dataSource.sortData = (data: GroupWithStatus[], sort: MatSort): GroupWithStatus[] =>
customDataSourceSort(data, sort, this.getDataForColumnFun);
}
this.dataSource.filter = this.filterValue;

// if groups not loaded yet, skip
if (!this.groups) {
return;
}

const paginated = this.isPaginated(this.groups);
if (isDynamicDataSource(this.dataSource) || paginated) {
this.dataSource.data = (this.groups as PaginatedRichGroups).data;
(this.dataSource as DynamicDataSource<GroupWithStatus>).count = (
this.groups as PaginatedRichGroups
).totalCount;
} else if (!isDynamicDataSource(this.dataSource) && !paginated) {
this.dataSource.data = this.groups as GroupWithStatus[];
}
}

private dataSourceInit(groups: GroupWithStatus[] | PaginatedRichGroups): void {
const paginated = this.isPaginated(groups);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { Component, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ReportIssueDialogComponent } from '../report-issue-dialog/report-issue-dialog.component';
import { AuthService, InitAuthService, StoreService } from '@perun-web-apps/perun/services';
import { StoreService } from '@perun-web-apps/perun/services';
import { getDefaultDialogConfig } from '@perun-web-apps/perun/utils';
import { TranslateService } from '@ngx-translate/core';
import { UtilsService } from '@perun-web-apps/perun/openapi';
Expand All @@ -30,7 +30,7 @@ export class PerunFooterComponent implements OnInit {
githubBackendRepository: string = this.storeService.getProperty('footer').github_backend_releases;
bgColor: string = this.storeService.getProperty('theme').footer_bg_color;
version = '';
backendVersion = '';
backendVersion = 'N/A';
guiVersion = '';
language = 'en';
columnContentHeight = 0;
Expand All @@ -39,9 +39,7 @@ export class PerunFooterComponent implements OnInit {
private storeService: StoreService,
private translateService: TranslateService,
private utilsService: UtilsService,
private dialog: MatDialog,
private authService: AuthService,
private initAuthService: InitAuthService
private dialog: MatDialog
) {}

ngOnInit(): void {
Expand All @@ -54,7 +52,10 @@ export class PerunFooterComponent implements OnInit {
this.guiVersion = require('../../../../../../package.json').version as string;

this.utilsService.getPerunRPCVersion(true).subscribe((val) => {
this.backendVersion = val.match('\\bVersion:\\s*([^,\\s]+)')[1];
const match = val.match('\\bVersion:\\s*([^,\\s]+)');
if (match !== null) {
this.backendVersion = match[1];
}
});

this.footerColumns = this.storeService.getProperty('footer').columns;
Expand Down
5 changes: 4 additions & 1 deletion libs/perun/services/src/lib/table-checkbox.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export class TableCheckbox {
}
this.pageIterator = 0;

dataSource.sortData(dataSource.filteredData, sort).forEach((row: T) => {
const data = sort
? dataSource.sortData(dataSource.filteredData, sort)
: dataSource.filteredData;
data.forEach((row: T) => {
if (
this.pageStart <= this.pageIterator &&
this.pageIterator < this.pageEnd &&
Expand Down

0 comments on commit ce2b350

Please sign in to comment.