mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge branch 'w2p-117573_remove-observable-function-calls-from-template-7.6' into w2p-117573_remove-observable-function-calls_contribute-main
# Conflicts: # src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html # src/app/access-control/group-registry/group-form/group-form.component.ts
This commit is contained in:
@@ -75,7 +75,9 @@
|
||||
{{ dsoNameService.getName(group) }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="align-middle">{{ dsoNameService.getName(undefined) }}</td>
|
||||
<td class="align-middle">
|
||||
{{ dsoNameService.getName((group.object | async)?.payload) }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@@ -38,9 +38,7 @@ import {
|
||||
} from 'rxjs';
|
||||
import {
|
||||
debounceTime,
|
||||
filter,
|
||||
map,
|
||||
startWith,
|
||||
switchMap,
|
||||
take,
|
||||
} from 'rxjs/operators';
|
||||
@@ -72,7 +70,6 @@ import { AlertType } from '../../../shared/alert/alert-type';
|
||||
import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component';
|
||||
import { ContextHelpDirective } from '../../../shared/context-help.directive';
|
||||
import {
|
||||
hasNoValue,
|
||||
hasValue,
|
||||
hasValueOperator,
|
||||
isNotEmpty,
|
||||
@@ -219,11 +216,16 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
this.activeGroupLinkedDSO$ = this.getActiveGroupLinkedDSO();
|
||||
this.linkedEditRolesRoute$ = this.getLinkedEditRolesRoute();
|
||||
this.canEdit$ = this.activeGroupLinkedDSO$.pipe(
|
||||
filter((dso: DSpaceObject) => hasNoValue(dso)),
|
||||
switchMap(() => this.activeGroup$),
|
||||
switchMap((dso: DSpaceObject) => {
|
||||
if (hasValue(dso)) {
|
||||
return [false];
|
||||
} else {
|
||||
return this.activeGroup$.pipe(
|
||||
hasValueOperator(),
|
||||
switchMap((group: Group) => this.authorizationService.isAuthorized(FeatureID.CanDelete, group.self)),
|
||||
startWith(false),
|
||||
);
|
||||
}
|
||||
}),
|
||||
);
|
||||
this.initialisePage();
|
||||
}
|
||||
@@ -271,34 +273,39 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
observableCombineLatest([
|
||||
this.activeGroup$,
|
||||
this.canEdit$,
|
||||
this.activeGroupLinkedDSO$.pipe(take(1)),
|
||||
this.activeGroupLinkedDSO$,
|
||||
]).subscribe(([activeGroup, canEdit, linkedObject]) => {
|
||||
|
||||
if (activeGroup != null) {
|
||||
|
||||
// Disable group name exists validator
|
||||
this.formGroup.controls.groupName.clearAsyncValidators();
|
||||
if (linkedObject?.name) {
|
||||
|
||||
if (isNotEmpty(linkedObject?.name)) {
|
||||
if (!this.formGroup.controls.groupCommunity) {
|
||||
this.formBuilderService.insertFormGroupControl(1, this.formGroup, this.formModel, groupCommunityModel);
|
||||
this.groupDescription = this.formGroup.get('groupCommunity');
|
||||
}
|
||||
this.formGroup.patchValue({
|
||||
groupName: activeGroup.name,
|
||||
groupCommunity: linkedObject?.name ?? '',
|
||||
groupDescription: activeGroup.firstMetadataValue('dc.description'),
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.formModel = [
|
||||
groupNameModel,
|
||||
groupDescriptionModel,
|
||||
];
|
||||
this.formGroup.patchValue({
|
||||
groupName: activeGroup.name,
|
||||
groupDescription: activeGroup.firstMetadataValue('dc.description'),
|
||||
});
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (!canEdit || activeGroup.permanent) {
|
||||
this.formGroup.disable();
|
||||
} else {
|
||||
this.formGroup.enable();
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
}),
|
||||
);
|
||||
@@ -527,6 +534,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
*/
|
||||
getLinkedEditRolesRoute(): Observable<string> {
|
||||
return this.activeGroupLinkedDSO$.pipe(
|
||||
hasValueOperator(),
|
||||
map((dso: DSpaceObject) => {
|
||||
switch ((dso as any).type) {
|
||||
case Community.type.value:
|
||||
|
Reference in New Issue
Block a user