TSK-1478: Move access items filter to front-end (#1354)
* TSK-1478: Move filter to front-end * TSK-1478: remove unused variable * TSK-1478: adapt requested changes * TSK-1478: remove unnecessary models * TSK-1316: Replaced local progress bars by global one TSK-1316: Replaced local progress bars by global one in workplace TSK-1316: Rework of progress-bar component TSK-1316: Renamed progress-bar component TSK-1316: Changed progress-bar mode TSK-1316: Updated tests * TSK-1412: Distribution targets MD (#1365) * TSK-1412: Refactor workbasket dual list to workbasket distribution targets list * TSK-1412: Refactor workbasket dual list to workbasket distribution targets list * TSK-1412: rework css layout to be more dynamic and resilient * TSK-1412: new list, new dialog, new action bar * TSK-1412: Refactor workbasket dual list to workbasket distribution targets list * TSK-1412: rework css layout to be more dynamic and resilient * TSK-1412: new list, new dialog, new action bar * TSK-1412: update new workbasket distribution target list to load data internally * TSK-1412: update distribution targets * TSK-1421: enable multiple selection * TSK-1412: Updated angular theme to match with taskana * TSK-1412: quick bug fixes * TSK-1412: Rework how workbasket distribution targets list behaves * TSK-1412: Update workbasket distribution target list to new design * TSK-1412: fixed filter function in distribution targets * TSK-1412: remove unused component, rename correct CSS names * TSK-1412: clean up code in workbasket distribution targets * TSK-1412: fix bugs, rename variables * TSK-1412: finalized jest tests * TSK-1412: fix all other jest tests * TSK-1412: disable devmode * TSK-1412: remove unused imports, add tooltips * TSK-1477: Update workbasket information layout (#1364) * TSK-1477: Update workbasket information layout * TSK-1477: rearrange error message for description field Co-authored-by: Chi Nguyen <c.nguyen.prog@gmail.com> * TSK-1474: Update classification details layout (#1358) Co-authored-by: Chi Nguyen <c.nguyen.prog@gmail.com> * TSK-1473: Always display classification and workbasket filter (#1357) * TSK-1473: Always display classification and workbasket filter * TSK-1473: fix jest test Co-authored-by: Chi Nguyen <c.nguyen.prog@gmail.com> * TSK-1484: Fixed bug int page size is overflow and all workbaskets are requested (#1367) Co-authored-by: Sofie Hofmann <29145005+sofie29@users.noreply.github.com> Co-authored-by: Chi Nguyen <6671583+cnguyen-de@users.noreply.github.com> Co-authored-by: Chi Nguyen <c.nguyen.prog@gmail.com>
This commit is contained in:
parent
e8f62bde7c
commit
5ac12037bc
|
@ -84,14 +84,13 @@
|
|||
</thead>
|
||||
<tbody formArrayName="accessItemsGroups">
|
||||
<tr class="access-items__authorization-expansion-panel__content"
|
||||
*ngFor="let accessItem of accessItemsGroups.controls; let index = index;"
|
||||
[formGroupName]="index.toString()">
|
||||
*ngFor="let accessItem of accessItems; let index = index;" [formGroupName]="index.toString()">
|
||||
<td></td>
|
||||
<td class="align-left">
|
||||
<label class="wrap">{{accessItem.value.workbasketKey}}</label>
|
||||
<label class="wrap">{{accessItem.workbasketKey}}</label>
|
||||
</td>
|
||||
<td class="align-left" *ngIf="(accessItemsCustomization$ | async)?.accessId.lookupField">
|
||||
<label matTooltip="{{accessItem.value.accessId}}" class="wrap">{{accessItem.value.accessName}}</label>
|
||||
<label matTooltip="{{accessItem.accessId}}" class="wrap">{{accessItem.accessName}}</label>
|
||||
</td>
|
||||
<td>
|
||||
<mat-checkbox id="checkbox-{{index}}-0" formControlName="permRead"></mat-checkbox>
|
||||
|
|
|
@ -3,11 +3,10 @@ import { Select, Store } from '@ngxs/store';
|
|||
import { FormArray, FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import { FormsValidatorService } from 'app/shared/services/forms-validator/forms-validator.service';
|
||||
import { AccessItemWorkbasket } from 'app/shared/models/access-item-workbasket';
|
||||
import { WorkbasketAccessItems } from 'app/shared/models/workbasket-access-items';
|
||||
import { Direction, Sorting } from 'app/shared/models/sorting';
|
||||
import { EngineConfigurationSelectors } from 'app/shared/store/engine-configuration-store/engine-configuration.selectors';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { RequestInProgressService } from '../../../shared/services/request-in-progress/request-in-progress.service';
|
||||
import { AccessIdDefinition } from '../../../shared/models/access-id';
|
||||
import { NotificationService } from '../../../shared/services/notifications/notification.service';
|
||||
import { AccessItemsCustomisation, CustomField, getCustomFields } from '../../../shared/models/customisation';
|
||||
|
@ -40,6 +39,7 @@ export class AccessItemsManagementComponent implements OnInit {
|
|||
['workbasket-key', 'Workbasket Key']
|
||||
]);
|
||||
sortModel: Sorting = new Sorting('access-id', Direction.DESC);
|
||||
accessItems: WorkbasketAccessItems[];
|
||||
isGroup: boolean = false;
|
||||
|
||||
@Select(EngineConfigurationSelectors.accessItemsCustomisation) accessItemsCustomization$: Observable<
|
||||
|
@ -52,7 +52,6 @@ export class AccessItemsManagementComponent implements OnInit {
|
|||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
private formsValidatorService: FormsValidatorService,
|
||||
private requestInProgressService: RequestInProgressService,
|
||||
private notificationService: NotificationService,
|
||||
private store: Store,
|
||||
public dialog: MatDialog
|
||||
|
@ -83,14 +82,7 @@ export class AccessItemsManagementComponent implements OnInit {
|
|||
searchForAccessItemsWorkbaskets() {
|
||||
this.removeFocus();
|
||||
this.store
|
||||
.dispatch(
|
||||
new GetAccessItems(
|
||||
[this.accessId, ...this.groups],
|
||||
this.accessItemsForm ? this.accessItemsForm.value.accessIdFilter : undefined,
|
||||
this.accessItemsForm ? this.accessItemsForm.value.workbasketKeyFilter : undefined,
|
||||
this.sortModel
|
||||
)
|
||||
)
|
||||
.dispatch(new GetAccessItems([this.accessId, ...this.groups], '', '', this.sortModel))
|
||||
.subscribe((state) => {
|
||||
this.setAccessItemsGroups(
|
||||
state['accessItemsManagement'].accessItemsResource
|
||||
|
@ -100,7 +92,7 @@ export class AccessItemsManagementComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
setAccessItemsGroups(accessItems: Array<AccessItemWorkbasket>) {
|
||||
setAccessItemsGroups(accessItems: Array<WorkbasketAccessItems>) {
|
||||
const AccessItemsFormGroups = accessItems.map((accessItem) => this.formBuilder.group(accessItem));
|
||||
AccessItemsFormGroups.forEach((accessItemGroup) => {
|
||||
accessItemGroup.controls.accessId.setValidators(Validators.required);
|
||||
|
@ -108,6 +100,7 @@ export class AccessItemsManagementComponent implements OnInit {
|
|||
accessItemGroup.controls[key].disable();
|
||||
});
|
||||
});
|
||||
|
||||
const AccessItemsFormArray = this.formBuilder.array(AccessItemsFormGroups);
|
||||
if (!this.accessItemsForm) {
|
||||
this.accessItemsForm = this.formBuilder.group({});
|
||||
|
@ -119,6 +112,23 @@ export class AccessItemsManagementComponent implements OnInit {
|
|||
if (!this.accessItemsForm.value.accessIdFilter) {
|
||||
this.accessItemsForm.addControl('accessIdFilter', new FormControl());
|
||||
}
|
||||
this.accessItems = accessItems;
|
||||
if (this.accessItemsForm.value.workbasketKeyFilter || this.accessItemsForm.value.accessIdFilter) {
|
||||
this.filterAccessItems();
|
||||
}
|
||||
}
|
||||
|
||||
filterAccessItems() {
|
||||
if (this.accessItemsForm.value.accessIdFilter) {
|
||||
this.accessItems = this.accessItems.filter((value) =>
|
||||
value.accessName.toLowerCase().includes(this.accessItemsForm.value.accessIdFilter)
|
||||
);
|
||||
}
|
||||
if (this.accessItemsForm.value.workbasketKeyFilter) {
|
||||
this.accessItems = this.accessItems.filter((value) =>
|
||||
value.workbasketKey.toLowerCase().includes(this.accessItemsForm.value.workbasketKeyFilter)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
revokeAccess() {
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import { Links } from './links';
|
||||
import { AccessItemWorkbasket } from './access-item-workbasket';
|
||||
|
||||
export class AccessItemWorkbasketResource {
|
||||
constructor(public accessItems: Array<AccessItemWorkbasket> = [], public _links?: Links) {}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
import { Links } from './links';
|
||||
|
||||
export class AccessItemWorkbasket {
|
||||
constructor(
|
||||
public accessItemId: string,
|
||||
public workbasketKey: string,
|
||||
public accessId: string,
|
||||
public permRead: boolean = false,
|
||||
public permOpen: boolean = false,
|
||||
public permAppend: boolean = false,
|
||||
public permTransfer: boolean = false,
|
||||
public permDistribute: boolean = false,
|
||||
public permCustom1: boolean = false,
|
||||
public permCustom2: boolean = false,
|
||||
public permCustom3: boolean = false,
|
||||
public permCustom4: boolean = false,
|
||||
public permCustom5: boolean = false,
|
||||
public permCustom6: boolean = false,
|
||||
public permCustom7: boolean = false,
|
||||
public permCustom8: boolean = false,
|
||||
public permCustom9: boolean = false,
|
||||
public permCustom10: boolean = false,
|
||||
public permCustom11: boolean = false,
|
||||
public permCustom12: boolean = false,
|
||||
public _links?: Links
|
||||
) {}
|
||||
}
|
|
@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
|
|||
import { environment } from 'environments/environment';
|
||||
import { AccessIdDefinition } from 'app/shared/models/access-id';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { AccessItemWorkbasketResource } from 'app/shared/models/access-item-workbasket-resource';
|
||||
import { WorkbasketAccessItemsRepresentation } from 'app/shared/models/workbasket-access-items-representation';
|
||||
import { TaskanaQueryParameters } from 'app/shared/util/query-parameters';
|
||||
import { Sorting } from 'app/shared/models/sorting';
|
||||
import { QueryParameters } from 'app/shared/models/query-parameters';
|
||||
|
@ -38,8 +38,8 @@ export class AccessIdsService {
|
|||
accessIdLike?: string,
|
||||
workbasketKeyLike?: string,
|
||||
sortModel: Sorting = new Sorting('workbasket-key')
|
||||
): Observable<AccessItemWorkbasketResource> {
|
||||
return this.httpClient.get<AccessItemWorkbasketResource>(
|
||||
): Observable<WorkbasketAccessItemsRepresentation> {
|
||||
return this.httpClient.get<WorkbasketAccessItemsRepresentation>(
|
||||
encodeURI(
|
||||
`${environment.taskanaRestUrl}/v1/workbasket-access-items/${TaskanaQueryParameters.getQueryParameters(
|
||||
AccessIdsService.accessIdsParameters(sortModel, accessIds, accessIdLike, workbasketKeyLike)
|
||||
|
@ -49,7 +49,7 @@ export class AccessIdsService {
|
|||
}
|
||||
|
||||
removeAccessItemsPermissions(accessId: string) {
|
||||
return this.httpClient.delete<AccessItemWorkbasketResource>(
|
||||
return this.httpClient.delete<WorkbasketAccessItemsRepresentation>(
|
||||
`${environment.taskanaRestUrl}/v1/workbasket-access-items/?access-id=${accessId}`
|
||||
);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import { take, tap } from 'rxjs/operators';
|
|||
import { AccessIdDefinition } from '../../models/access-id';
|
||||
import { NOTIFICATION_TYPES } from '../../models/notifications';
|
||||
import { NotificationService } from '../../services/notifications/notification.service';
|
||||
import { AccessItemWorkbasketResource } from '../../models/access-item-workbasket-resource';
|
||||
import { WorkbasketAccessItemsRepresentation } from '../../models/workbasket-access-items-representation';
|
||||
import { RequestInProgressService } from '../../services/request-in-progress/request-in-progress.service';
|
||||
|
||||
class InitializeStore {
|
||||
|
@ -64,7 +64,7 @@ export class AccessItemsManagementState implements NgxsAfterBootstrap {
|
|||
.pipe(
|
||||
take(1),
|
||||
tap(
|
||||
(accessItemsResource: AccessItemWorkbasketResource) => {
|
||||
(accessItemsResource: WorkbasketAccessItemsRepresentation) => {
|
||||
this.requestInProgressService.setRequestInProgress(false);
|
||||
ctx.patchState({
|
||||
accessItemsResource
|
||||
|
@ -108,7 +108,7 @@ export class AccessItemsManagementState implements NgxsAfterBootstrap {
|
|||
}
|
||||
|
||||
export interface AccessItemsManagementStateModel {
|
||||
accessItemsResource: AccessItemWorkbasketResource;
|
||||
accessItemsResource: WorkbasketAccessItemsRepresentation;
|
||||
selectedAccessId: AccessIdDefinition;
|
||||
groups: AccessIdDefinition[];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue