[CST-5674] Fix; enable policy and action type editing; test

This commit is contained in:
Davide Negretti
2022-05-04 11:35:54 +02:00
parent bb3cc1c619
commit 9173b9db60
2 changed files with 28 additions and 33 deletions

View File

@@ -222,8 +222,6 @@ describe('ResourcePolicyFormComponent test suite', () => {
testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>;
testComp = testFixture.componentInstance;
testComp.resourcePolicy = resourcePolicy;
fixture.detectChanges();
});
afterEach(() => {

View File

@@ -161,6 +161,7 @@ export class ResourcePolicyFormComponent implements OnInit, OnDestroy {
this.formId = this.formService.getUniqueId('resource-policy-form');
this.formModel = this.buildResourcePolicyForm();
if (this.isBeingEdited()) {
const epersonRD$ = this.ePersonService.findByHref(this.resourcePolicy._links.eperson.href, false).pipe(
getFirstSucceededRemoteData()
);
@@ -181,7 +182,10 @@ export class ResourcePolicyFormComponent implements OnInit, OnDestroy {
this.navActiveId = String(dsoRD.payload.type);
this.resourcePolicyTargetName$.next(this.getResourcePolicyTargetName());
})
);
)
} else {
}
}
/**
@@ -202,19 +206,12 @@ export class ResourcePolicyFormComponent implements OnInit, OnDestroy {
*/
private buildResourcePolicyForm(): DynamicFormControlModel[] {
const formModel: DynamicFormControlModel[] = [];
// TODO to be removed when https://github.com/DSpace/DSpace/issues/7812 will be implemented
const policyTypeConf = Object.assign({}, RESOURCE_POLICY_FORM_POLICY_TYPE_CONFIG, {
disabled: isNotEmpty(this.resourcePolicy)
});
// TODO to be removed when https://github.com/DSpace/DSpace/issues/7812 will be implemented
const actionConf = Object.assign({}, RESOURCE_POLICY_FORM_ACTION_TYPE_CONFIG, {
disabled: isNotEmpty(this.resourcePolicy)
});
formModel.push(
new DsDynamicInputModel(RESOURCE_POLICY_FORM_NAME_CONFIG),
new DsDynamicTextAreaModel(RESOURCE_POLICY_FORM_DESCRIPTION_CONFIG),
new DynamicSelectModel(policyTypeConf),
new DynamicSelectModel(actionConf)
new DynamicSelectModel(RESOURCE_POLICY_FORM_POLICY_TYPE_CONFIG),
new DynamicSelectModel(RESOURCE_POLICY_FORM_ACTION_TYPE_CONFIG)
);
const startDateModel = new DynamicDatePickerModel(