Skip to content

Commit

Permalink
Merge branch 'main' into feature/ux-improvements
Browse files Browse the repository at this point in the history
* main:
  fix: resource item list value (DEV-3248) (#1517)
  fix: add user by project admin (DEV-3414) (#1519)
  chore(main): release 11.7.3 (#1516)
  fix: image settings restriction note (#1518)
  • Loading branch information
irmastnt committed Mar 15, 2024
2 parents b67efc2 + a415410 commit 0c1893a
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 16 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog

## [11.7.3](https://github.com/dasch-swiss/dsp-das/compare/v11.7.2...v11.7.3) (2024-03-12)


### Bug Fixes

* image settings restriction note ([#1518](https://github.com/dasch-swiss/dsp-das/issues/1518)) ([c486dcb](https://github.com/dasch-swiss/dsp-das/commit/c486dcb944e489d0464ede2feed6323e71e60fa6))
* incoming resource gravsearch query comment field set as optional (DEV-3315) ([#1509](https://github.com/dasch-swiss/dsp-das/issues/1509)) ([4695b8b](https://github.com/dasch-swiss/dsp-das/commit/4695b8b9ac0d6a6f33589f89ed7f6eb6d6107dac))

## [11.7.2](https://github.com/dasch-swiss/dsp-das/compare/v11.7.1...v11.7.2) (2024-03-08)


Expand Down
Expand Up @@ -34,7 +34,7 @@ <h2 class="mat-headline-6">{{ 'appLabels.form.user.title.add2project' | translat
</button>

<mat-autocomplete #user="matAutocomplete" (optionSelected)="addUser($event.option.value)">
<mat-option *ngFor="let user of filteredUsers | async" [value]="user?.name">
<mat-option *ngFor="let user of filteredUsers$ | async; trackBy: trackByFn" [value]="user?.name">
{{ user?.label }}
</mat-option>
</mat-autocomplete>
Expand Down
Expand Up @@ -80,7 +80,7 @@ export class AddUserComponent implements OnInit {
/**
* filter users while typing (autocomplete)
*/
filteredUsers: Observable<AutocompleteItem[]>;
filteredUsers$: Observable<AutocompleteItem[]>;

/**
* list of usernames to prevent duplicate entries
Expand Down Expand Up @@ -156,7 +156,7 @@ export class AddUserComponent implements OnInit {
}

let i = 0;
for (const u of response.body.users) {
for (const u of response.body.users.filter(user => user.username.length > 0)) {
// if the user is already member of the project
// add the email to the list of existing
this.existingEmails.push(new RegExp(`(?:^|W)${u.email.toLowerCase()}(?:$|W)`));
Expand All @@ -169,10 +169,20 @@ export class AddUserComponent implements OnInit {
existsInProject = '* ';
}

let usernameLabel = existsInProject + u.username;
if (usernameLabel.length > 0) {
usernameLabel += ' | ';
}

let emailLabel = u.email;
if (emailLabel.length > 0) {
emailLabel += ' | ';
}

this.users[i] = {
iri: u.id,
name: u.username,
label: `${existsInProject + u.username} | ${u.email} | ${u.givenName} ${u.familyName}`,
label: `${usernameLabel} ${emailLabel} ${u.givenName} ${u.familyName}`,
};
i++;
}
Expand Down Expand Up @@ -206,7 +216,7 @@ export class AddUserComponent implements OnInit {
),
});

this.filteredUsers = this.selectUserForm.controls['username'].valueChanges.pipe(
this.filteredUsers$ = this.selectUserForm.controls['username'].valueChanges.pipe(
startWith(''),
map(user => (user.length >= 2 ? this.filter(this.users, user) : []))
);
Expand Down Expand Up @@ -321,4 +331,6 @@ export class AddUserComponent implements OnInit {
ev.preventDefault();
this.selectUserForm.controls['username'].reset('');
}

trackByFn = (index: number, item: AutocompleteItem) => `${index}-${item.label}`;
}
Expand Up @@ -4,7 +4,7 @@
<div *ngIf="isCurrentProjectAdminOrSysAdmin$ | async" class="content large middle">
<!-- add user to the project -->
<app-add-user
*ngIf="(project$ | async)?.status && ((isSysAdmin$ | async) === true)"
*ngIf="(project$ | async)?.status && ((isCurrentProjectAdminOrSysAdmin$ | async) === true)"
[projectUuid]="projectUuid"
(refreshParent)="refresh()"
#addUserComponent></app-add-user>
Expand Down
Expand Up @@ -2,6 +2,7 @@
<dasch-swiss-app-progress-indicator *ngIf="isProjectsLoading$ | async"></dasch-swiss-app-progress-indicator>
<div class="content large middle" *ngIf="(isProjectsLoading$ | async) === false">
<div>
<p>{{ 'appLabels.form.project.imageSettings.restrictions' | translate }}</p>
<div>
<div class="mb-2">
<mat-radio-group class="radio-group" [(ngModel)]="imageSettings" [ngModelOptions]="{standalone: true}">
Expand Down
12 changes: 8 additions & 4 deletions apps/dsp-app/src/app/user/user-form/user-form.component.ts
Expand Up @@ -9,7 +9,7 @@ import {
Output,
} from '@angular/core';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
import { ApiResponseError, Constants, ReadUser, StringLiteral, UpdateUserRequest, User } from '@dasch-swiss/dsp-js';
import { Constants, ReadUser, StringLiteral, UpdateUserRequest, User } from '@dasch-swiss/dsp-js';
import { UserApiService } from '@dasch-swiss/vre/shared/app-api';
import { ProjectService } from '@dasch-swiss/vre/shared/app-helper-services';
import { NotificationService } from '@dasch-swiss/vre/shared/app-notification';
Expand All @@ -20,8 +20,8 @@ import {
SetUserAction,
UserSelectors,
} from '@dasch-swiss/vre/shared/app-state';
import { Actions, ofActionSuccessful, Select, Store } from '@ngxs/store';
import { combineLatest, Observable } from 'rxjs';
import { Actions, Select, Store, ofActionSuccessful } from '@ngxs/store';
import { Observable, combineLatest } from 'rxjs';
import { take, tap } from 'rxjs/operators';
import { AppGlobal } from '../../app-global';
import { existingNamesValidator } from '../../main/directive/existing-name/existing-names.validator';
Expand Down Expand Up @@ -354,7 +354,11 @@ export class UserFormComponent implements OnInit, OnChanges {
combineLatest([this._actions$.pipe(ofActionSuccessful(CreateUserAction)), this.allUsers$])
.pipe(take(1))
.subscribe(([loadUsersAction, allUsers]) => {
this.user = allUsers.find(user => user.username === loadUsersAction.userData.username);
this.user = allUsers.find(
user =>
user.familyName === loadUsersAction.userData.familyName &&
user.givenName === loadUsersAction.userData.givenName
);
this.buildForm(this.user);
if (this.projectUuid) {
// if a projectUuid exists, add the user to the project
Expand Down
@@ -1,4 +1,14 @@
import { ChangeDetectorRef, Component, Inject, Input, OnChanges, OnDestroy, OnInit, ViewChild } from '@angular/core';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
Inject,
Input,
OnChanges,
OnDestroy,
OnInit,
ViewChild,
} from '@angular/core';
import { FormBuilder } from '@angular/forms';
import { MatMenuTrigger } from '@angular/material/menu';
import {
Expand All @@ -13,6 +23,7 @@ import { DspApiConnectionToken } from '@dasch-swiss/vre/shared/app-config';
import { BaseValueDirective } from '../../../../main/directive/base-value.directive';

@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'app-list-value',
templateUrl: './list-value.component.html',
styleUrls: ['./list-value.component.scss'],
Expand Down Expand Up @@ -64,6 +75,7 @@ export class ListValueComponent extends BaseValueDirective implements OnInit, On
const trimmedRootNodeIRI = rootNodeIri.substring(7, rootNodeIri.length - 1);
this._dspApiConnection.v2.list.getList(trimmedRootNodeIRI).subscribe((response: ListNodeV2) => {
this.listRootNode = response;
this._cd.markForCheck();
});
}
} else {
Expand Down
3 changes: 2 additions & 1 deletion apps/dsp-app/src/assets/i18n/de.json
Expand Up @@ -118,7 +118,8 @@
"percentageValue": "Prozentwert",
"percentage": "Prozentsatz",
"updateConfirmation": "Sie haben die Projektbildeinstellungen erfolgreich aktualisiert.",
"info": "Um die Größe Ihres Bildes zu begrenzen, geben Sie entweder einen Prozentsatz oder eine absolute Pixelbreite ein. Sie können nicht für beide Optionen Werte angeben."
"info": "Um die Größe Ihres Bildes zu begrenzen, geben Sie entweder einen Prozentsatz oder eine absolute Pixelbreite ein. Sie können nicht für beide Optionen Werte angeben.",
"restrictions": "Bildeinstellungen können nur auf die Ressourcen angewendet werden, für die eingeschränkte Ansichtsberechtigungen festgelegt sind."
}
},
"member": {
Expand Down
3 changes: 2 additions & 1 deletion apps/dsp-app/src/assets/i18n/en.json
Expand Up @@ -147,7 +147,8 @@
"percentageValue": "Percentage value",
"percentage": "Percentage",
"updateConfirmation": "You have successfully updated the project image settings.",
"info": "To limit the size of your image, input either a percentage or an absolute pixel width. You cannot provide values for both options."
"info": "To limit the size of your image, input either a percentage or an absolute pixel width. You cannot provide values for both options.",
"restrictions": "Image settings can only be applied for the resources which have the restricted view permissions set."
}
},
"member": {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "dsp-app",
"version": "11.7.2",
"version": "11.7.3",
"repository": {
"type": "git",
"url": "https://github.com/dasch-swiss/dsp-app.git"
Expand Down

0 comments on commit 0c1893a

Please sign in to comment.