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