Commit 0a3697ec authored by Alicia.DeDiosFuente's avatar Alicia.DeDiosFuente Committed by Florent Poittevin
Browse files

feat: 910 add dissemination policy into org unit form

parent eab689be
......@@ -1731,7 +1731,7 @@
"@angular/compiler": "^8.1.3",
"boxen": "^4.1.0",
"colorette": "^1.1.0",
"flat": "git://github.com/lenchvolodymyr/flat.git#ffe77ef",
"flat": "git://github.com/lenchvolodymyr/flat.git#ffe77efe8c33bc80ffb2f7a465537610dea4f611",
"gettext-parser": "^4.0.1",
"glob": "^7.1.4",
"mkdirp": "^0.5.1",
......@@ -2420,7 +2420,7 @@
},
"ansi-escapes": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
"resolved": "https://packages.dlcm.ch/repository/npm-group/ansi-escapes/-/ansi-escapes-3.2.0.tgz",
"integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==",
"dev": true
},
......@@ -5633,8 +5633,7 @@
},
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"optional": true
"bundled": true
},
"aproba": {
"version": "1.2.0",
......@@ -5652,13 +5651,11 @@
},
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"optional": true
"bundled": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -5671,18 +5668,15 @@
},
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"optional": true
"bundled": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"optional": true
"bundled": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"optional": true
"bundled": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -5785,8 +5779,7 @@
},
"inherits": {
"version": "2.0.3",
"bundled": true,
"optional": true
"bundled": true
},
"ini": {
"version": "1.3.5",
......@@ -5796,7 +5789,6 @@
"is-fullwidth-code-point": {
"version": "1.0.0",
"bundled": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -5809,20 +5801,17 @@
"minimatch": {
"version": "3.0.4",
"bundled": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"bundled": true,
"optional": true
"bundled": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -5839,7 +5828,6 @@
"mkdirp": {
"version": "0.5.1",
"bundled": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -5912,8 +5900,7 @@
},
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"optional": true
"bundled": true
},
"object-assign": {
"version": "4.1.1",
......@@ -5923,7 +5910,6 @@
"once": {
"version": "1.4.0",
"bundled": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -5999,8 +5985,7 @@
},
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"optional": true
"bundled": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -6030,7 +6015,6 @@
"string-width": {
"version": "1.0.2",
"bundled": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -6048,7 +6032,6 @@
"strip-ansi": {
"version": "3.0.1",
"bundled": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -6087,13 +6070,11 @@
},
"wrappy": {
"version": "1.0.2",
"bundled": true,
"optional": true
"bundled": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"optional": true
"bundled": true
}
}
},
......@@ -11275,9 +11256,9 @@
}
},
"solidify-frontend": {
"version": "0.2.14",
"resolved": "https://packages.dlcm.ch/repository/npm-group/solidify-frontend/-/solidify-frontend-0.2.14.tgz",
"integrity": "sha512-qS+OV+ZF9mBZRWmFXRAkFmeR3bgVzcK8Z83YG5BpQlSANeUNVMvW7TEeS1Z8qGMIMjfaHqjZ6cYhzi7U8+Avww==",
"version": "0.2.15",
"resolved": "https://packages.dlcm.ch/repository/npm-group/solidify-frontend/-/solidify-frontend-0.2.15.tgz",
"integrity": "sha512-UQJkdSl+zrJZWyQTg4tCicfdi7Ncfc2LmgXA6Lf6OleSqgp6atlz6guHYscnyqaCQ518py4ae/EsYTqV/9PvcA==",
"requires": {
"tslib": "^1.9.0"
}
......
......@@ -5,6 +5,7 @@ import {AdminLicenseState} from "@admin/license/stores/admin-license.state";
import {AdminOaiSetState} from "@admin/oai-set/stores/admin-oai-set.state";
import {AdminOAuth2ClientState} from "@admin/oauth2-client/stores/admin-oauth2-client.state";
import {AdminOrganizationalUnitState} from "@admin/orgunit/stores/admin-organizational-unit.state";
import {AdminOrganizationalUnitDisseminationPolicyState} from "@admin/orgunit/stores/dissemination-policy/admin-organizational-unit-dissemination-policy.state";
import {AdminOrganizationalUnitFundingAgencyState} from "@admin/orgunit/stores/funding-agency/admin-organizational-unit-funding-agency.state";
import {AdminOrganizationalUnitInstitutionState} from "@admin/orgunit/stores/institution/admin-organizational-unit-institution.state";
import {AdminOrganizationalUnitPersonRoleState} from "@admin/orgunit/stores/person-role/admin-organizational-unit-person-role.state";
......@@ -54,6 +55,7 @@ const presentationals = [];
AdminOrganizationalUnitState,
AdminOrganizationalUnitSubmissionPolicyState,
AdminOrganizationalUnitPreservationPolicyState,
AdminOrganizationalUnitDisseminationPolicyState,
AdminOrganizationalUnitPersonRoleState,
AdminOrganizationalUnitFundingAgencyState,
AdminOrganizationalUnitInstitutionState,
......
import {BaseRelationResourceType} from "solidify-frontend";
export interface OrganizationalUnitDisseminationPolicy extends BaseRelationResourceType {
defaultPolicy: boolean;
}
......@@ -35,6 +35,16 @@
>
</dlcm-shared-multi-select-default-value>
<dlcm-shared-multi-select-default-value [list]="listDisseminationPolicies"
[formControl]="form.get(formDefinition.disseminationPolicies)"
[formControlDefault]="form.get(formDefinition.defaultDisseminationPolicy)"
[required]="isRequired(formDefinition.disseminationPolicies)"
[labelKey]="'name'"
[valueKey]="'resId'"
[placeholder]="'admin.organizationalUnit.form.disseminationPolicy' | translate"
>
</dlcm-shared-multi-select-default-value>
<mat-form-field *ngIf="getFormControl(formDefinition.description) as fd">
<input [formControl]="fd"
[solidifyValidation]="errors"
......
......@@ -11,6 +11,7 @@ import {
Validators,
} from "@angular/forms";
import {
DisseminationPolicy,
FundingAgency,
Institution,
PreservationPolicy,
......@@ -48,6 +49,9 @@ export class AdminOrgunitFormPresentational extends SharedAbstractFormPresentati
@Input()
selectedFundingAgencies: FundingAgency[];
@Input()
selectedDisseminationPolicies: DisseminationPolicy[];
@Input()
selectedPersonRole: PersonRole[];
......@@ -60,6 +64,9 @@ export class AdminOrgunitFormPresentational extends SharedAbstractFormPresentati
@Input()
listPreservationPolicies: PreservationPolicy[];
@Input()
listDisseminationPolicies: DisseminationPolicy[];
@Input()
listFundingAgencies: FundingAgency[];
......@@ -90,8 +97,10 @@ export class AdminOrgunitFormPresentational extends SharedAbstractFormPresentati
[this.formDefinition.closingDate]: [""],
[this.formDefinition.submissionPolicies]: [[], [Validators.required, SolidifyValidator]],
[this.formDefinition.preservationPolicies]: [[], [Validators.required, SolidifyValidator]],
[this.formDefinition.disseminationPolicies]: [[], [Validators.required, SolidifyValidator]],
[this.formDefinition.defaultSubmissionPolicy]: [undefined, [Validators.required, SolidifyValidator]],
[this.formDefinition.defaultPreservationPolicy]: [undefined, [Validators.required, SolidifyValidator]],
[this.formDefinition.defaultDisseminationPolicy]: [undefined, [Validators.required, SolidifyValidator]],
[this.formDefinition.url]: ["", [SolidifyValidator]],
[this.formDefinition.personRole]: ["", [SolidifyValidator]],
[this.formDefinition.fundingAgencies]: ["", [SolidifyValidator]],
......@@ -107,8 +116,10 @@ export class AdminOrgunitFormPresentational extends SharedAbstractFormPresentati
[this.formDefinition.closingDate]: [organizationalUnit.closingDate],
[this.formDefinition.submissionPolicies]: [_.map(this.selectedSubmissionPolicies, LocalModelAttributeEnum.resId), [Validators.required, SolidifyValidator]],
[this.formDefinition.preservationPolicies]: [_.map(this.selectedPreservationPolicies, LocalModelAttributeEnum.resId), [Validators.required, SolidifyValidator]],
[this.formDefinition.disseminationPolicies]: [_.map(this.selectedDisseminationPolicies, LocalModelAttributeEnum.resId), [Validators.required, SolidifyValidator]],
[this.formDefinition.defaultSubmissionPolicy]: [(organizationalUnit.defaultSubmissionPolicy ? organizationalUnit.defaultSubmissionPolicy.resId : undefined), [Validators.required, SolidifyValidator]],
[this.formDefinition.defaultPreservationPolicy]: [(organizationalUnit.defaultPreservationPolicy ? organizationalUnit.defaultPreservationPolicy.resId : undefined), [Validators.required, SolidifyValidator]],
[this.formDefinition.defaultDisseminationPolicy]: [(organizationalUnit.defaultDisseminationPolicy ? organizationalUnit.defaultDisseminationPolicy.resId : undefined), [Validators.required, SolidifyValidator]],
[this.formDefinition.url]: [organizationalUnit.url, [SolidifyValidator]],
[this.formDefinition.personRole]: ["", [SolidifyValidator]],
[this.formDefinition.fundingAgencies]: [_.map(this.selectedFundingAgencies, LocalModelAttributeEnum.resId), [SolidifyValidator]],
......@@ -121,6 +132,7 @@ export class AdminOrgunitFormPresentational extends SharedAbstractFormPresentati
organizationalUnit.closingDate = DateUtil.convertToLocalDateDateSimple(organizationalUnit.closingDate);
organizationalUnit.defaultSubmissionPolicy = {resId: organizationalUnit[this.formDefinition.defaultSubmissionPolicy]};
organizationalUnit.defaultPreservationPolicy = {resId: organizationalUnit[this.formDefinition.defaultPreservationPolicy]};
organizationalUnit.defaultDisseminationPolicy = {resId: organizationalUnit[this.formDefinition.defaultDisseminationPolicy]};
organizationalUnit.preservationPolicies = [];
this.form.get(this.formDefinition.preservationPolicies).value.forEach(resId => {
organizationalUnit.preservationPolicies.push({resId: resId});
......@@ -129,6 +141,10 @@ export class AdminOrgunitFormPresentational extends SharedAbstractFormPresentati
this.form.get(this.formDefinition.submissionPolicies).value.forEach(resId => {
organizationalUnit.submissionPolicies.push({resId: resId});
});
organizationalUnit.disseminationPolicies = [];
this.form.get(this.formDefinition.disseminationPolicies).value.forEach(resId => {
organizationalUnit.disseminationPolicies.push({resId: resId});
});
organizationalUnit.fundingAgencies = [];
if (this.form.get(this.formDefinition.fundingAgencies).value !== "") {
this.form.get(this.formDefinition.fundingAgencies).value.forEach(resId => {
......@@ -152,8 +168,10 @@ class FormComponentFormDefinition extends BaseFormDefinition {
@PropertyName() openingDate: string;
@PropertyName() submissionPolicies: string;
@PropertyName() preservationPolicies: string;
@PropertyName() disseminationPolicies: string;
@PropertyName() defaultSubmissionPolicy: string;
@PropertyName() defaultPreservationPolicy: string;
@PropertyName() defaultDisseminationPolicy: string;
@PropertyName() url: string;
@PropertyName() personRole: string;
@PropertyName() fundingAgencies: string;
......
......@@ -5,6 +5,7 @@
*ngIf="isReadyToBeDisplayedInCreateModeObs | async"
[listSubmissionPolicies]="listSubmissionPoliciesObs | async"
[listPreservationPolicies]="listPreservationPoliciesObs | async"
[listDisseminationPolicies]="listDisseminationPoliciesObs | async"
[listPerson]="listPersonObs | async"
[listRole]="listRoleObs | async"
[listInstitutions]="listInstitutionsObs | async"
......
......@@ -9,6 +9,7 @@ import {
Component,
} from "@angular/core";
import {
DisseminationPolicy,
FundingAgency,
Institution,
PreservationPolicy,
......@@ -38,6 +39,7 @@ export class AdminOrgunitCreateRoutable extends SharedAbstractCreateRoutable<Org
@Select(AdminOrganizationalUnitState.isLoadingWithDependency) isLoadingWithDependencyObs: Observable<boolean>;
@Select(AdminOrganizationalUnitState.isReadyToBeDisplayedInCreateMode) isReadyToBeDisplayedInCreateModeObs: Observable<boolean>;
@Select((state: LocalStateModel) => state.shared.shared_preservationPolicy.list) listPreservationPoliciesObs: Observable<PreservationPolicy[]>;
@Select((state: LocalStateModel) => state.shared.shared_disseminationPolicy.list) listDisseminationPoliciesObs: Observable<DisseminationPolicy[]>;
@Select((state: LocalStateModel) => state.shared.shared_person.list) listPersonObs: Observable<PersonExtended[]>;
@Select((state: LocalStateModel) => state.shared.shared_role.list) listRoleObs: Observable<Role[]>;
@Select((state: LocalStateModel) => state.shared.shared_fundingAgency.list) listFundingAgenciesObs: Observable<FundingAgency[]>;
......
......@@ -15,11 +15,13 @@
[model]="currentObs| async"
[selectedSubmissionPolicies]="selectedSubmissionPoliciesObs | async"
[selectedPreservationPolicies]="selectedPreservationPoliciesObs | async"
[selectedDisseminationPolicies]="selectedDisseminationPoliciesObs | async"
[selectedPersonRole]="selectedPersonRoleObs | async"
[selectedFundingAgencies]="selectedFundingAgenciesObs | async"
[selectedInstitutions]="selectedInstitutionsObs | async"
[listSubmissionPolicies]="listSubmissionPoliciesObs | async"
[listPreservationPolicies]="listPreservationPoliciesObs | async"
[listDisseminationPolicies]="listDisseminationPoliciesObs | async"
[listPerson]="listPersonObs | async"
[listRole]="listRoleObs | async"
[listFundingAgencies]="listFundingAgenciesObs | async"
......
......@@ -5,6 +5,7 @@ import {
AdminOrganizationalUnitState,
AdminOrganizationalUnitStateModel,
} from "@admin/orgunit/stores/admin-organizational-unit.state";
import {AdminOrgUnitDisseminationPolicyAction} from "@admin/orgunit/stores/dissemination-policy/admin-organizational-unit-dissemination-policy.action";
import {AdminOrgUnitFundingAgencyAction} from "@admin/orgunit/stores/funding-agency/admin-organizational-unit-funding-agency.action";
import {AdminOrgUnitInstitutionAction} from "@admin/orgunit/stores/institution/admin-organizational-unit-institution.action";
import {AdminOrgUnitPersonRoleAction} from "@admin/orgunit/stores/person-role/admin-organizational-unit-person-role.action";
......@@ -19,6 +20,7 @@ import {
import {MatDialog} from "@angular/material";
import {ActivatedRoute} from "@angular/router";
import {
DisseminationPolicy,
FundingAgency,
Institution,
PreservationPolicy,
......@@ -48,9 +50,11 @@ export class AdminOrgunitDetailEditRoutable extends SharedAbstractDetailEditComm
@Select(AdminOrganizationalUnitState.isReadyToBeDisplayed) isReadyToBeDisplayedObs: Observable<boolean>;
selectedSubmissionPoliciesObs: Observable<SubmissionPolicy[]> = MemoizedUtil.selected(this._store, AdminOrganizationalUnitSubmissionPolicyState);
@Select((state: LocalStateModel) => state.admin.admin_organizationalUnit.admin_organizationalUnit_preservationPolicy.selected) selectedPreservationPoliciesObs: Observable<PreservationPolicy[]>;
@Select((state: LocalStateModel) => state.admin.admin_organizationalUnit.admin_organizationalUnit_disseminationPolicy.selected) selectedDisseminationPoliciesObs: Observable<DisseminationPolicy[]>;
@Select((state: LocalStateModel) => state.admin.admin_organizationalUnit.admin_organizationalUnit_fundingAgency.selected) selectedFundingAgenciesObs: Observable<FundingAgency[]>;
@Select((state: LocalStateModel) => state.shared.shared_submissionPolicy.list) listSubmissionPoliciesObs: Observable<SubmissionPolicy[]>;
@Select((state: LocalStateModel) => state.shared.shared_preservationPolicy.list) listPreservationPoliciesObs: Observable<PreservationPolicy[]>;
@Select((state: LocalStateModel) => state.shared.shared_disseminationPolicy.list) listDisseminationPoliciesObs: Observable<DisseminationPolicy[]>;
@Select((state: LocalStateModel) => state.shared.shared_person.list) listPersonObs: Observable<PersonExtended[]>;
@Select((state: LocalStateModel) => state.shared.shared_role.list) listRoleObs: Observable<Role[]>;
@Select((state: LocalStateModel) => state.shared.shared_fundingAgency.list) listFundingAgenciesObs: Observable<FundingAgency[]>;
......@@ -71,6 +75,7 @@ export class AdminOrgunitDetailEditRoutable extends SharedAbstractDetailEditComm
getSubResourceWithParentId(id: string): void {
this._store.dispatch(new AdminOrgUnitSubmissionPolicyAction.GetAll(id));
this._store.dispatch(new AdminOrgUnitPreservationPolicyAction.GetAll(id));
this._store.dispatch(new AdminOrgUnitDisseminationPolicyAction.GetAll(id));
this._store.dispatch(new AdminOrgUnitPersonRoleAction.GetAll(id));
this._store.dispatch(new AdminOrgUnitFundingAgencyAction.GetAll(id));
this._store.dispatch(new AdminOrgUnitInstitutionAction.GetAll(id));
......
......@@ -2,6 +2,11 @@ import {
AdminOrgUnitAction,
adminOrgUnitActionNameSpace,
} from "@admin/orgunit/stores/admin-organizational-unit.action";
import {AdminOrgUnitDisseminationPolicyAction} from "@admin/orgunit/stores/dissemination-policy/admin-organizational-unit-dissemination-policy.action";
import {
AdminOrganizationalUnitDisseminationPolicyState,
AdminOrganizationalUnitDisseminationPolicyStateModel,
} from "@admin/orgunit/stores/dissemination-policy/admin-organizational-unit-dissemination-policy.state";
import {AdminOrgUnitFundingAgencyAction} from "@admin/orgunit/stores/funding-agency/admin-organizational-unit-funding-agency.action";
import {
AdminOrganizationalUnitFundingAgencyState,
......@@ -41,6 +46,7 @@ import {
import {AdminResourceApiEnum} from "@shared/enums/api.enum";
import {LocalStateEnum} from "@shared/enums/local-state.enum";
import {RoutesEnum} from "@shared/enums/routes.enum";
import {SharedDisseminationPolicyAction} from "@shared/stores/dissemination-policy/shared-dissemination-policy.action";
import {SharedFundingAgencyAction} from "@shared/stores/funding-agency/shared-funding-agency.action";
import {SharedInstitutionAction} from "@shared/stores/institution/shared-institution.action";
import {SharedPersonAction} from "@shared/stores/person/shared-person.action";
......@@ -70,6 +76,7 @@ import {
export interface AdminOrganizationalUnitStateModel extends ResourceStateModel<OrganizationalUnitExtended> {
admin_organizationalUnit_submissionPolicy: AdminOrganizationalUnitSubmissionPolicyStateModel;
admin_organizationalUnit_preservationPolicy: AdminOrganizationalUnitPreservationPolicyStateModel;
admin_organizationalUnit_disseminationPolicy: AdminOrganizationalUnitDisseminationPolicyStateModel;
admin_organizationalUnit_personRole: AdminOrganizationalUnitPersonRoleStateModel;
admin_organizationalUnit_fundingAgency: AdminOrganizationalUnitFundingAgencyStateModel;
admin_organizationalUnit_institution: AdminOrganizationalUnitInstitutionStateModel;
......@@ -81,6 +88,7 @@ export interface AdminOrganizationalUnitStateModel extends ResourceStateModel<Or
...defaultResourceStateInitValue(),
admin_organizationalUnit_submissionPolicy: {...defaultRelation2TiersStateInitValue()},
admin_organizationalUnit_preservationPolicy: {...defaultRelation2TiersStateInitValue()},
admin_organizationalUnit_disseminationPolicy: {...defaultRelation2TiersStateInitValue()},
admin_organizationalUnit_personRole: {...defaultRelation3TiersStateInitValue()},
admin_organizationalUnit_fundingAgency: {...defaultAssociationStateInitValue()},
admin_organizationalUnit_institution: {...defaultAssociationStateInitValue()},
......@@ -88,6 +96,7 @@ export interface AdminOrganizationalUnitStateModel extends ResourceStateModel<Or
children: [
AdminOrganizationalUnitSubmissionPolicyState,
AdminOrganizationalUnitPreservationPolicyState,
AdminOrganizationalUnitDisseminationPolicyState,
AdminOrganizationalUnitPersonRoleState,
AdminOrganizationalUnitFundingAgencyState,
AdminOrganizationalUnitInstitutionState,
......@@ -124,6 +133,7 @@ export class AdminOrganizationalUnitState extends ResourceState<AdminOrganizatio
return this.isLoading(state)
|| StoreUtil.isLoadingState(state.admin_organizationalUnit_submissionPolicy)
|| StoreUtil.isLoadingState(state.admin_organizationalUnit_preservationPolicy)
|| StoreUtil.isLoadingState(state.admin_organizationalUnit_disseminationPolicy)
|| StoreUtil.isLoadingState(state.admin_organizationalUnit_personRole)
|| StoreUtil.isLoadingState(state.admin_organizationalUnit_fundingAgency)
|| StoreUtil.isLoadingState(state.admin_organizationalUnit_institution);
......@@ -143,6 +153,7 @@ export class AdminOrganizationalUnitState extends ResourceState<AdminOrganizatio
&& !isNullOrUndefined(state.current)
&& !isNullOrUndefined(state.admin_organizationalUnit_personRole.selected)
&& !isNullOrUndefined(state.admin_organizationalUnit_preservationPolicy.selected)
&& !isNullOrUndefined(state.admin_organizationalUnit_disseminationPolicy.selected)
&& !isNullOrUndefined(state.admin_organizationalUnit_submissionPolicy.selected)
&& !isNullOrUndefined(state.admin_organizationalUnit_fundingAgency.selected)
&& !isNullOrUndefined(state.admin_organizationalUnit_institution.selected);
......@@ -174,6 +185,13 @@ export class AdminOrganizationalUnitState extends ResourceState<AdminOrganizatio
this.actions$.pipe(ofActionCompleted(SharedSubmissionPolicyAction.GetAllFail)),
],
},
{
action: new SharedDisseminationPolicyAction.GetAll(),
subActionCompletions: [
this.actions$.pipe(ofActionCompleted(SharedDisseminationPolicyAction.GetAllSuccess)),
this.actions$.pipe(ofActionCompleted(SharedDisseminationPolicyAction.GetAllFail)),
],
},
{
action: new SharedPersonAction.GetAll(),
subActionCompletions: [
......@@ -258,6 +276,10 @@ export class AdminOrganizationalUnitState extends ResourceState<AdminOrganizatio
const newDefaultSubmissionPolicyId = action.modelFormControlEvent.model.defaultSubmissionPolicy.resId;
const newSubmissionPoliciesIds = action.modelFormControlEvent.model.submissionPolicies.map(p => p.resId);
let oldDefaultDisseminationPolicyId = undefined;
const newDefaultDisseminationPolicyId = action.modelFormControlEvent.model.defaultDisseminationPolicy.resId;
const newDisseminationPoliciesIds = action.modelFormControlEvent.model.disseminationPolicies.map(p => p.resId);
const newFundingAgencyIds = action.modelFormControlEvent.model.fundingAgencies.map(p => p.resId);
const newInstitutionsIds = action.modelFormControlEvent.model.institutions.map(p => p.resId);
......@@ -265,6 +287,7 @@ export class AdminOrganizationalUnitState extends ResourceState<AdminOrganizatio
if (!isNullOrUndefined(ctx.getState().current)) {
oldDefaultPreservationPolicyId = ObjectUtil.getValue(ctx.getState().current.defaultPreservationPolicy, ModelAttributeEnum.resId) as string;
oldDefaultSubmissionPolicyId = ObjectUtil.getValue(ctx.getState().current.defaultSubmissionPolicy, ModelAttributeEnum.resId) as string;
oldDefaultDisseminationPolicyId = ObjectUtil.getValue(ctx.getState().current.defaultDisseminationPolicy, ModelAttributeEnum.resId) as string;
}
const newPersonRole = action.modelFormControlEvent.formControl.get("personRole").value;
......@@ -283,6 +306,13 @@ export class AdminOrganizationalUnitState extends ResourceState<AdminOrganizatio
this.actions$.pipe(ofActionCompleted(AdminOrgUnitSubmissionPolicyAction.UpdateFail)),
],
},
{
action: new AdminOrgUnitDisseminationPolicyAction.Update(orgUnitId, newDisseminationPoliciesIds, oldDefaultDisseminationPolicyId, newDefaultDisseminationPolicyId),
subActionCompletions: [
this.actions$.pipe(ofActionCompleted(AdminOrgUnitDisseminationPolicyAction.UpdateSuccess)),
this.actions$.pipe(ofActionCompleted(AdminOrgUnitDisseminationPolicyAction.UpdateFail)),
],
},
{
action: new AdminOrgUnitPersonRoleAction.Update(orgUnitId, newPersonRole),
subActionCompletions: [
......
import {OrganizationalUnitDisseminationPolicy} from "@admin/models/organizational-unit-dissemination-policy.model";
import {
DisseminationPolicy,
} from "@app/generated-api";
import {LocalStateEnum} from "@shared/enums/local-state.enum";
import {
Relation2TiersAction,
Relation2TiersNameSpace,
TypeDefaultAction,
} from "solidify-frontend";
const state = LocalStateEnum.admin_organizationalUnit_disseminationPolicy;
export namespace AdminOrgUnitDisseminationPolicyAction {
@TypeDefaultAction(state)
export class GetAll extends Relation2TiersAction.GetAll {
}
@TypeDefaultAction(state)
export class GetAllSuccess extends Relation2TiersAction.GetAllSuccess<DisseminationPolicy> {
}
@TypeDefaultAction(state)
export class GetAllFail extends Relation2TiersAction.GetAllFail {
}
@TypeDefaultAction(state)
export class GetById extends Relation2TiersAction.GetById {
}
@TypeDefaultAction(state)
export class GetByIdSuccess extends Relation2TiersAction.GetByIdSuccess<DisseminationPolicy> {
}
@TypeDefaultAction(state)
export class GetByIdFail extends Relation2TiersAction.GetByIdFail {
}
@TypeDefaultAction(state)
export class Update extends Relation2TiersAction.Update {
constructor(public parentId: string, public newResId: string[], public oldDefaultResId: string, public newDefaultResId: string) {
super(parentId, newResId);
}
}
@TypeDefaultAction(state)
export class UpdateSuccess extends Relation2TiersAction.UpdateSuccess {
}
@TypeDefaultAction(state)
export class UpdateFail extends Relation2TiersAction.UpdateFail {
}
@TypeDefaultAction(state)
export class UpdateRelation extends Relation2TiersAction.UpdateRelation<OrganizationalUnitDisseminationPolicy> {
}
@TypeDefaultAction(state)
export class UpdateRelationSuccess extends Relation2TiersAction.UpdateRelationSuccess<OrganizationalUnitDisseminationPolicy> {
}
@TypeDefaultAction(state)
export class UpdateRelationFail extends Relation2TiersAction.UpdateRelationFail<OrganizationalUnitDisseminationPolicy> {
}
@TypeDefaultAction(state)
export class Create extends Relation2TiersAction.Create {
}
@TypeDefaultAction(state)
export class CreateSuccess extends Relation2TiersAction.CreateSuccess {
}
@TypeDefaultAction(state)
export class CreateFail extends Relation2TiersAction.CreateFail {
}