Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 1.11-maintenance
  • 2.0-maintenance
  • 2.1-maintenance
  • 2.2-maintenance
  • 3.0-maintenance
  • DG-add-institutions-pres-space-orgunit-1432
  • DG/deposit__submission_dialog_dethreatening
  • DLCM-1510_refcator_cypress_tests
  • DLCM-2579_Change_wording_for_user_guide_in_French
  • HCA-PreviewDisseminationPolicy
  • adf-1341-contributor-actions
  • adf-1725-fill-requested-params-in-notifications
  • adf-1821-dip-message
  • adf-1823-research-areas-labels
  • adf-2258-logos-open-new-tab
  • adf-2425-upload-signed-dua-in-notification
  • adf-2480-tooltip-in-dua-logo
  • adf-2765-notification-approved
  • adf-archive-detail-grid-display
  • adf-contributor-tooltip
  • adf-delete-completed-enum-value-for-orders
  • adf-deposit-last-selection
  • adf-fix-institution
  • adf-metadata-type-form
  • bugfix-datepicker-change-locale
  • dlcm-2192-research-domain-not-saved-in_orgunit
  • dlcm-2499_Update_dua_type_to_data_use_policy_and_use_correct_enum
  • dlcm-2629_update_project_role_not_reflected
  • dlcm-2790_allow_root_to_change_preservation_policy
  • e2e-cypress-io-test
  • fpo/1809_allow_to_have_space_in_keyword
  • fpo/1914_clean_lib
  • fpo/2380_allow_manager_of_institution_to_edit_institution
  • fpo/2742_use-pnpm
  • fpo/William-ngxs-class-instead-of-interface
  • fpo/add-inline-option-for-thumbnail
  • fpo/add_server_solidify
  • fpo/allow_admin_to_create_achive_acl
  • fpo/api_enum_refactor
  • fpo/backup/1960_avoid_call_on_contributor_avatar_when_missing_and_display_contributor_avatar
  • fpo/citations_in_archive
  • fpo/display_org_unit_logo_on_archive_detail
  • fpo/draft/2109_see_if_possible_to_log_where_ngxs_aciton_is_displatched_to_better_debugging
  • fpo/draft/watch_on_html_and_css_file_from_solidify
  • fpo/enable_ssr
  • fpo/migrate_to_angular_15
  • fpo/optimise_perf_ssr
  • fpo/refacto_use_button_upload_file_everywhere
  • fpo/rename_resource_logo_into_resource_file
  • fpo/run_tour_not_first_time_cookie
  • fpo/sequential_upload
  • fpo/share_ssr_cache_between_root_and_home
  • fpo/solidify-2
  • fpo/ssr-worker
  • fpo/test
  • fpo/test-hook
  • fpo/use-vite
  • fpo/use_new_component_on_solidify
  • fpo/wip/remove_base_href
  • hbo-asciidoc
  • hbo-docker-agent
  • hbo-docker-agent-4.0.0
  • hbo-docker-test
  • hbo-test-docker-image
  • master
  • new-worker
  • rodn-2674-sort-by-issued-date
  • rodn-package-lock-linux
  • rodn-rename-research-domain-labels
  • rodn-solidify-index-update
  • rodn-wip-job-line-links
  • wa/All_Libraries_Upgrade
  • wa/Libraries_Upgrade
  • before-angular-11-12
  • dlcm-1.0.0
  • dlcm-1.10.0
  • dlcm-1.11.0
  • dlcm-1.12.0-rc1
  • dlcm-1.5.0
  • dlcm-1.6.0
  • dlcm-1.7.0
  • dlcm-1.8.0
  • dlcm-1.9.0
  • dlcm-2.0.0
  • dlcm-2.0.0-RC1
  • dlcm-2.0.0-RC2
  • dlcm-2.0.0-RC3
  • dlcm-2.0.1
  • dlcm-2.0.2
  • dlcm-2.0.3
  • dlcm-2.0.4
  • dlcm-2.0.5
  • dlcm-2.0.6
  • dlcm-2.0.7
  • dlcm-2.1.0
  • dlcm-2.1.0-RC1
  • dlcm-2.1.0-RC2
  • dlcm-2.1.0-RC3
  • dlcm-2.1.0-alpha1
  • dlcm-2.1.0-alpha2
  • dlcm-2.1.0-beta1
  • dlcm-2.1.1
  • dlcm-2.1.10
  • dlcm-2.1.11
  • dlcm-2.1.12
  • dlcm-2.1.13
  • dlcm-2.1.2
  • dlcm-2.1.3
  • dlcm-2.1.4
  • dlcm-2.1.5
  • dlcm-2.1.6
  • dlcm-2.1.7
  • dlcm-2.1.8
  • dlcm-2.1.9
  • dlcm-2.2.0
  • dlcm-2.2.0-RC1
  • dlcm-2.2.0-alpha1
  • dlcm-2.2.0-alpha2
  • dlcm-2.2.0-beta1
  • dlcm-2.2.0-beta2
  • dlcm-2.2.1
  • dlcm-2.2.10
  • dlcm-2.2.2
  • dlcm-2.2.3
  • dlcm-2.2.4
  • dlcm-2.2.5
  • dlcm-2.2.6
  • dlcm-2.2.7
  • dlcm-2.2.8
  • dlcm-2.2.9
  • dlcm-2.8.0-RC1
  • dlcm-2.8.0-beta1
  • dlcm-2.8.0-beta2
  • dlcm-3.0.0
  • dlcm-3.0.0-RC1
  • dlcm-3.0.0-RC2
  • dlcm-3.0.0-RC3
  • dlcm-3.0.0-beta1
  • dlcm-3.0.1
  • dlcm-3.0.2
  • dlcm-3.1.0
  • dlcm-3.1.0-RC1
  • dlcm-test-1
  • hbo-1.8.0
  • v0.0.0
145 results

Target

Select target project
  • dlcm/ui/dlcm-portal
1 result
Select Git revision
  • 1.11-maintenance
  • 2.0-maintenance
  • 2.1-maintenance
  • 2.2-maintenance
  • 3.0-maintenance
  • DG-add-institutions-pres-space-orgunit-1432
  • DG/deposit__submission_dialog_dethreatening
  • DLCM-1510_refcator_cypress_tests
  • DLCM-2579_Change_wording_for_user_guide_in_French
  • HCA-PreviewDisseminationPolicy
  • adf-1341-contributor-actions
  • adf-1725-fill-requested-params-in-notifications
  • adf-1821-dip-message
  • adf-1823-research-areas-labels
  • adf-2258-logos-open-new-tab
  • adf-2425-upload-signed-dua-in-notification
  • adf-2480-tooltip-in-dua-logo
  • adf-2765-notification-approved
  • adf-archive-detail-grid-display
  • adf-contributor-tooltip
  • adf-delete-completed-enum-value-for-orders
  • adf-deposit-last-selection
  • adf-fix-institution
  • adf-metadata-type-form
  • bugfix-datepicker-change-locale
  • dlcm-2192-research-domain-not-saved-in_orgunit
  • dlcm-2499_Update_dua_type_to_data_use_policy_and_use_correct_enum
  • dlcm-2629_update_project_role_not_reflected
  • dlcm-2790_allow_root_to_change_preservation_policy
  • e2e-cypress-io-test
  • fpo/1809_allow_to_have_space_in_keyword
  • fpo/1914_clean_lib
  • fpo/2380_allow_manager_of_institution_to_edit_institution
  • fpo/2742_use-pnpm
  • fpo/William-ngxs-class-instead-of-interface
  • fpo/add-inline-option-for-thumbnail
  • fpo/add_server_solidify
  • fpo/allow_admin_to_create_achive_acl
  • fpo/api_enum_refactor
  • fpo/backup/1960_avoid_call_on_contributor_avatar_when_missing_and_display_contributor_avatar
  • fpo/citations_in_archive
  • fpo/display_org_unit_logo_on_archive_detail
  • fpo/draft/2109_see_if_possible_to_log_where_ngxs_aciton_is_displatched_to_better_debugging
  • fpo/draft/watch_on_html_and_css_file_from_solidify
  • fpo/enable_ssr
  • fpo/migrate_to_angular_15
  • fpo/optimise_perf_ssr
  • fpo/refacto_use_button_upload_file_everywhere
  • fpo/rename_resource_logo_into_resource_file
  • fpo/run_tour_not_first_time_cookie
  • fpo/sequential_upload
  • fpo/share_ssr_cache_between_root_and_home
  • fpo/solidify-2
  • fpo/ssr-worker
  • fpo/test
  • fpo/test-hook
  • fpo/use-vite
  • fpo/use_new_component_on_solidify
  • fpo/wip/remove_base_href
  • hbo-asciidoc
  • hbo-docker-agent
  • hbo-docker-agent-4.0.0
  • hbo-docker-test
  • hbo-test-docker-image
  • master
  • new-worker
  • rodn-2674-sort-by-issued-date
  • rodn-package-lock-linux
  • rodn-rename-research-domain-labels
  • rodn-solidify-index-update
  • rodn-wip-job-line-links
  • wa/All_Libraries_Upgrade
  • wa/Libraries_Upgrade
  • before-angular-11-12
  • dlcm-1.0.0
  • dlcm-1.10.0
  • dlcm-1.11.0
  • dlcm-1.12.0-rc1
  • dlcm-1.5.0
  • dlcm-1.6.0
  • dlcm-1.7.0
  • dlcm-1.8.0
  • dlcm-1.9.0
  • dlcm-2.0.0
  • dlcm-2.0.0-RC1
  • dlcm-2.0.0-RC2
  • dlcm-2.0.0-RC3
  • dlcm-2.0.1
  • dlcm-2.0.2
  • dlcm-2.0.3
  • dlcm-2.0.4
  • dlcm-2.0.5
  • dlcm-2.0.6
  • dlcm-2.0.7
  • dlcm-2.1.0
  • dlcm-2.1.0-RC1
  • dlcm-2.1.0-RC2
  • dlcm-2.1.0-RC3
  • dlcm-2.1.0-alpha1
  • dlcm-2.1.0-alpha2
  • dlcm-2.1.0-beta1
  • dlcm-2.1.1
  • dlcm-2.1.10
  • dlcm-2.1.11
  • dlcm-2.1.12
  • dlcm-2.1.13
  • dlcm-2.1.2
  • dlcm-2.1.3
  • dlcm-2.1.4
  • dlcm-2.1.5
  • dlcm-2.1.6
  • dlcm-2.1.7
  • dlcm-2.1.8
  • dlcm-2.1.9
  • dlcm-2.2.0
  • dlcm-2.2.0-RC1
  • dlcm-2.2.0-alpha1
  • dlcm-2.2.0-alpha2
  • dlcm-2.2.0-beta1
  • dlcm-2.2.0-beta2
  • dlcm-2.2.1
  • dlcm-2.2.10
  • dlcm-2.2.2
  • dlcm-2.2.3
  • dlcm-2.2.4
  • dlcm-2.2.5
  • dlcm-2.2.6
  • dlcm-2.2.7
  • dlcm-2.2.8
  • dlcm-2.2.9
  • dlcm-2.8.0-RC1
  • dlcm-2.8.0-beta1
  • dlcm-2.8.0-beta2
  • dlcm-3.0.0
  • dlcm-3.0.0-RC1
  • dlcm-3.0.0-RC2
  • dlcm-3.0.0-RC3
  • dlcm-3.0.0-beta1
  • dlcm-3.0.1
  • dlcm-3.0.2
  • dlcm-3.1.0
  • dlcm-3.1.0-RC1
  • dlcm-test-1
  • hbo-1.8.0
  • v0.0.0
145 results
Show changes
Commits on Source (6)
Showing
with 482 additions and 104 deletions
......@@ -46,6 +46,7 @@
"express": "4.15.2",
"file-saver": "2.0.5",
"hash-wasm": "4.9.0",
"jsme": "2017.2.26",
"jsmol": "1.1.0",
"markdown-it": "13.0.1",
"moment": "2.29.4",
......@@ -60,7 +61,7 @@
"normalize.css": "8.0.1",
"patch-package": "6.4.7",
"rxjs": "7.5.7",
"solidify-frontend": "4.8.3",
"solidify-frontend": "4.8.6",
"sync-pom-version-to-package": "1.6.1",
"tiff.js": "1.0.0",
"tslib": "2.4.0",
......@@ -18003,6 +18004,12 @@
"node": ">=4"
}
},
"node_modules/jsme": {
"version": "2017.2.26",
"resolved": "https://nexus.unige.ch/repository/npm-all/jsme/-/jsme-2017.2.26.tgz",
"integrity": "sha512-5i9wZHnwI1aJ31Y3q3Is3CoehZe+YU8x8BUV/bZPDNRUQ47GaezWRhHPjMelqGfRRitgLMI/jEGCyuczFjSjBA==",
"license": "SEE LICENSE IN license.txt"
},
"node_modules/jsmol": {
"version": "1.1.0",
"resolved": "https://nexus.unige.ch/repository/npm-all/jsmol/-/jsmol-1.1.0.tgz",
......@@ -26140,9 +26147,9 @@
}
},
"node_modules/solidify-frontend": {
"version": "4.8.3",
"resolved": "https://nexus.unige.ch/repository/npm-all/solidify-frontend/-/solidify-frontend-4.8.3.tgz",
"integrity": "sha512-1Jp8FOtGNgv/j5uCiti24HKRpjnR8qKS4ea7/5bnvjwVj9GFDm1XqMi3wGyeUIpYv27BHGj/cnYsRGgj2bmnrw==",
"version": "4.8.6",
"resolved": "https://nexus.unige.ch/repository/npm-all/solidify-frontend/-/solidify-frontend-4.8.6.tgz",
"integrity": "sha512-uViZxzwguuYrD6uVco1LwvXHzitn+Mhn6Qcf1EtmmbiwgzWw+dVLaThg3IjgIMASmPs/1K7hnL7CD4AqzjpBag==",
"license": "GPL-2.0-or-later",
"dependencies": {
"tslib": "^2.3.0"
......@@ -42029,6 +42036,11 @@
"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
"dev": true
},
"jsme": {
"version": "2017.2.26",
"resolved": "https://nexus.unige.ch/repository/npm-all/jsme/-/jsme-2017.2.26.tgz",
"integrity": "sha512-5i9wZHnwI1aJ31Y3q3Is3CoehZe+YU8x8BUV/bZPDNRUQ47GaezWRhHPjMelqGfRRitgLMI/jEGCyuczFjSjBA=="
},
"jsmol": {
"version": "1.1.0",
"resolved": "https://nexus.unige.ch/repository/npm-all/jsmol/-/jsmol-1.1.0.tgz",
......@@ -47739,9 +47751,9 @@
}
},
"solidify-frontend": {
"version": "4.8.3",
"resolved": "https://nexus.unige.ch/repository/npm-all/solidify-frontend/-/solidify-frontend-4.8.3.tgz",
"integrity": "sha512-1Jp8FOtGNgv/j5uCiti24HKRpjnR8qKS4ea7/5bnvjwVj9GFDm1XqMi3wGyeUIpYv27BHGj/cnYsRGgj2bmnrw==",
"version": "4.8.6",
"resolved": "https://nexus.unige.ch/repository/npm-all/solidify-frontend/-/solidify-frontend-4.8.6.tgz",
"integrity": "sha512-uViZxzwguuYrD6uVco1LwvXHzitn+Mhn6Qcf1EtmmbiwgzWw+dVLaThg3IjgIMASmPs/1K7hnL7CD4AqzjpBag==",
"requires": {
"@elastic/apm-rum-angular": "2.1.7",
"docx-preview": "0.1.13",
......@@ -104,6 +104,7 @@
"express": "4.15.2",
"file-saver": "2.0.5",
"hash-wasm": "4.9.0",
"jsme": "2017.2.26",
"jsmol": "1.1.0",
"markdown-it": "13.0.1",
"moment": "2.29.4",
......@@ -118,7 +119,7 @@
"normalize.css": "8.0.1",
"patch-package": "6.4.7",
"rxjs": "7.5.7",
"solidify-frontend": "4.8.3",
"solidify-frontend": "4.8.6",
"sync-pom-version-to-package": "1.6.1",
"tiff.js": "1.0.0",
"tslib": "2.4.0",
......
......@@ -37,16 +37,24 @@ import {depositDataFileMetadataTypeActionNameSpace} from "@deposit/stores/data-f
import {DepositDataFileMetadataTypeState} from "@deposit/stores/data-file/metadata-type/deposit-data-file-metadata-type.state";
import {Enums} from "@enums";
import {MetadataType} from "@models";
import {Store} from "@ngxs/store";
import {SharedAbstractDialog} from "@shared/components/dialogs/shared-abstract/shared-abstract.dialog";
import {tap} from "rxjs/operators";
import {SharedDataCategoryAction} from "@shared/stores/data-category/shared-data-category.action";
import {SharedDataCategoryState} from "@shared/stores/data-category/shared-data-category.state";
import {Observable} from "rxjs";
import {
distinctUntilChanged,
tap,
} from "rxjs/operators";
import {
FormValidationHelper,
MemoizedUtil,
PropertyName,
ResourceNameSpace,
} from "solidify-frontend";
@Directive()
export abstract class AbstractDepositFileUploadDialog<TData, UResult> extends SharedAbstractDialog<TData, UResult> implements OnInit {
export abstract class AbstractDepositFileUploadDialog<TData extends AbstractDepositFileUploadDialogData, UResult> extends SharedAbstractDialog<TData, UResult> implements OnInit {
form: FormGroup;
formDefinition: AbstractDepositFileUploadFormComponentFormDefinition = new AbstractDepositFileUploadFormComponentFormDefinition();
......@@ -66,21 +74,49 @@ export abstract class AbstractDepositFileUploadDialog<TData, UResult> extends Sh
depositDataFileMetadataTypeActionNameSpace: ResourceNameSpace = depositDataFileMetadataTypeActionNameSpace;
depositDataFileMetadataTypeState: typeof DepositDataFileMetadataTypeState = DepositDataFileMetadataTypeState;
listDataCategoriesObs: Observable<string[]> = MemoizedUtil.select(this._store, SharedDataCategoryState, state => state.listDataCategories);
listDataTypesObs: Observable<string[]> = MemoizedUtil.select(this._store, SharedDataCategoryState, state => state.listDataTypes);
get enumsDataFile(): typeof Enums.DataFile.DataCategoryAndType {
return Enums.DataFile.DataCategoryAndType;
}
get defaultDataCategoryType(): Enums.DataFile.DataCategoryAndType.DataCategoryEnum {
return Enums.DataFile.DataCategoryAndType.DataCategoryEnum.PRIMARY;
}
get defaultDataType(): Enums.DataFile.DataCategoryAndType.DataTypeEnum {
return Enums.DataFile.DataCategoryAndType.DataTypeEnum.REFERENCE;
}
constructor(protected readonly _dialogRef: MatDialogRef<AbstractDepositFileUploadDialog<TData, UResult>>,
protected readonly _fb: FormBuilder,
protected readonly _data: TData,
protected readonly _store: Store,
) {
super(_dialogRef, _data);
}
ngOnInit(): void {
super.ngOnInit();
this._store.dispatch(new SharedDataCategoryAction.GetAllDataCategories());
const defaultDataCategory = this._data.dataCategoryEnum ?? this.defaultDataCategoryType;
const defaultDataType = this._data.dataTypeEnum ?? this.defaultDataType;
this.form = this._fb.group({
[this.formDefinition.dataCategory]: [Enums.DataFile.DataCategoryAndType.DataCategoryEnum.PRIMARY, [Validators.required]],
[this.formDefinition.dataType]: [Enums.DataFile.DataCategoryAndType.DataTypeEnum.REFERENCE, [Validators.required]],
[this.formDefinition.dataCategory]: [undefined, [Validators.required]],
[this.formDefinition.dataType]: [undefined, [Validators.required]],
[this.formDefinition.metadataType]: [""],
});
this.subscribe(this.form.get(this.formDefinition.dataCategory).valueChanges.pipe(
distinctUntilChanged(),
tap(dataCategory => {
this._store.dispatch(new SharedDataCategoryAction.GetAllDataTypesByCategory(dataCategory));
}),
));
this.subscribe(this.form.get(this.formDefinition.dataType).valueChanges.pipe(
tap(value => {
const metadataFormControl = this.form.get(this.formDefinition.metadataType);
......@@ -92,6 +128,9 @@ export abstract class AbstractDepositFileUploadDialog<TData, UResult> extends Sh
metadataFormControl.updateValueAndValidity();
}),
));
this.form.get(this.formDefinition.dataCategory).setValue(defaultDataCategory);
this.form.get(this.formDefinition.dataType).setValue(defaultDataType);
}
get formValidationHelper(): typeof FormValidationHelper {
......@@ -106,10 +145,6 @@ export abstract class AbstractDepositFileUploadDialog<TData, UResult> extends Sh
abstract onSubmit(): void;
getDataCategory(): Enums.DataFile.DataCategoryAndType.DataCategoryEnum {
return this.form.get(this.formDefinition.dataCategory).value;
}
abstract delete(file: File, index?: number): void;
}
......@@ -118,3 +153,8 @@ export class AbstractDepositFileUploadFormComponentFormDefinition extends BaseFo
@PropertyName() dataType: string;
@PropertyName() metadataType: string;
}
export interface AbstractDepositFileUploadDialogData {
dataCategoryEnum?: Enums.DataFile.DataCategoryAndType.DataCategoryEnum;
dataTypeEnum?: Enums.DataFile.DataCategoryAndType.DataTypeEnum;
}
......@@ -8,14 +8,14 @@
[class.mat-form-field-invalid]="formValidationHelper.displayInvalidWhenRequired(fd, displayEmptyRequiredFieldInError)"
solidifyTooltipOnEllipsis
>
<mat-label>{{labelTranslateEnum.dataCategory | translate }}</mat-label>
<mat-label>{{labelTranslateEnum.dataCategory | translate}}</mat-label>
<mat-select [formControl]="fd">
<mat-option (click)="selectCategory()"
*ngFor="let dataCategory of enumsDataCategoryAndType.DataCategoryEnumTranslate"
[value]="dataCategory.key"
*ngFor="let dataCategory of (listDataCategoriesObs | async)"
[value]="dataCategory"
solidifyTooltipOnEllipsis
>
{{dataCategory.value | translate}}
{{enumUtil.getLabel(enumsDataCategoryAndType.DataCategoryEnumTranslate, dataCategory) | translate}}
</mat-option>
</mat-select>
</mat-form-field>
......@@ -24,11 +24,11 @@
[class.mat-form-field-invalid]="formValidationHelper.displayInvalidWhenRequired(fd, displayEmptyRequiredFieldInError)"
solidifyTooltipOnEllipsis
>
<mat-label>{{labelTranslateEnum.dataType | translate }}</mat-label>
<mat-label>{{labelTranslateEnum.dataType | translate}}</mat-label>
<mat-select [formControl]="fd">
<mat-option #matOption
(click)="selectDataType()"
*ngFor="let dataType of enumsDataCategoryAndType.getDataTypeForDataCategory(getDataCategory())"
*ngFor="let dataType of (listDataTypesObs | async)"
[value]="dataType"
solidifyTooltipOnEllipsis
>
......
......@@ -23,6 +23,7 @@
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
Inject,
OnInit,
......@@ -52,12 +53,18 @@ import {
} from "@ngxs/store";
import {SharedAbstractDialog} from "@shared/components/dialogs/shared-abstract/shared-abstract.dialog";
import {BaseFormDefinition} from "@shared/models/base-form-definition.model";
import {SharedDataCategoryAction} from "@shared/stores/data-category/shared-data-category.action";
import {SharedDataCategoryState} from "@shared/stores/data-category/shared-data-category.state";
import {Observable} from "rxjs";
import {tap} from "rxjs/operators";
import {
distinctUntilChanged,
tap,
} from "rxjs/operators";
import {
EnumUtil,
FormValidationHelper,
isNonEmptyString,
isNotNullNorUndefinedNorWhiteString,
isNullOrUndefined,
MemoizedUtil,
PropertyName,
......@@ -83,9 +90,8 @@ export class DepositFileChangeDataCategoryDialog extends SharedAbstractDialog<De
depositDataFileMetadataTypeActionNameSpace: ResourceNameSpace = depositDataFileMetadataTypeActionNameSpace;
depositDataFileMetadataTypeState: typeof DepositDataFileMetadataTypeState = DepositDataFileMetadataTypeState;
get enumsDataFile(): typeof Enums.DataFile {
return Enums.DataFile;
}
listDataCategoriesObs: Observable<string[]> = MemoizedUtil.select(this._store, SharedDataCategoryState, state => state.listDataCategories);
listDataTypesObs: Observable<string[]> = MemoizedUtil.select(this._store, SharedDataCategoryState, state => state.listDataTypes);
get enumsDataCategoryAndType(): typeof Enums.DataFile.DataCategoryAndType {
return Enums.DataFile.DataCategoryAndType;
......@@ -109,29 +115,55 @@ export class DepositFileChangeDataCategoryDialog extends SharedAbstractDialog<De
private readonly _actions$: Actions,
protected readonly _dialogRef: MatDialogRef<DepositFileChangeDataCategoryDialog>,
@Inject(MAT_DIALOG_DATA) public readonly data: DepositFileChangeDataCategoryDialogData,
private readonly _fb: FormBuilder) {
private readonly _fb: FormBuilder,
private readonly _changeDetector: ChangeDetectorRef,
) {
super(_dialogRef, data);
}
ngOnInit(): void {
super.ngOnInit();
this._store.dispatch(new SharedDataCategoryAction.GetAllDataCategories());
this.form = this._fb.group({
[this.formDefinition.dataCategory]: [this.data.depositDataFile.dataCategory, [Validators.required, SolidifyValidator]],
[this.formDefinition.dataType]: [this.data.depositDataFile.dataType, [Validators.required, SolidifyValidator]],
[this.formDefinition.metadataType]: [isNullOrUndefined(this.data.depositDataFile.metadataType) ? "" : this.data.depositDataFile.metadataType.resId],
[this.formDefinition.dataCategory]: [undefined, [Validators.required, SolidifyValidator]],
[this.formDefinition.dataType]: [undefined, [Validators.required, SolidifyValidator]],
[this.formDefinition.metadataType]: [this.data.depositDataFile.metadataType?.resId, [
...(isNotNullNorUndefinedNorWhiteString(this.data.depositDataFile.metadataType?.resId) ? [Validators.required] : []),
SolidifyValidator]],
});
this.subscribe(this.form.get(this.formDefinition.dataCategory).valueChanges.pipe(
distinctUntilChanged(),
tap(dataCategory => {
this._getDataTypesByCategory(dataCategory);
}),
));
this.subscribe(this.form.get(this.formDefinition.dataType).valueChanges.pipe(
tap(value => {
const metadataFormControl = this.form.get(this.formDefinition.metadataType);
if (value === Enums.DataFile.DataCategoryAndType.DataTypeEnum.CUSTOM_METADATA) {
metadataFormControl.setValidators([Validators.required]);
metadataFormControl.setValidators([Validators.required, SolidifyValidator]);
} else {
metadataFormControl.setValidators([]);
metadataFormControl.setValidators([SolidifyValidator]);
}
metadataFormControl.updateValueAndValidity();
}),
));
this.form.get(this.formDefinition.dataCategory).setValue(this.data.depositDataFile.dataCategory);
this.form.get(this.formDefinition.dataType).setValue(this.data.depositDataFile.dataType);
}
private _getDataTypesByCategory(category: string): void {
this.subscribe(StoreUtil.dispatchActionAndWaitForSubActionCompletion(this._store, this._actions$,
new SharedDataCategoryAction.GetAllDataTypesByCategory(category),
SharedDataCategoryAction.GetAllDataTypesByCategorySuccess,
result => {
this._changeDetector.detectChanges();
}));
}
onSubmit(): void {
......@@ -161,10 +193,6 @@ export class DepositFileChangeDataCategoryDialog extends SharedAbstractDialog<De
return FormValidationHelper.getFormControl(this.form, key);
}
getDataCategory(): Enums.DataFile.DataCategoryAndType.DataCategoryEnum {
return this.form.get(this.formDefinition.dataCategory).value;
}
selectCategory(): void {
this.isFormValid = false;
}
......
......@@ -7,14 +7,15 @@
>
<mat-label>{{labelTranslateEnum.dataCategory | translate }}</mat-label>
<mat-select [disabled]="data?.dataCategoryEnum | isNotNullNorUndefined"
[solidifyDataTest]="dataTestEnum.depositDataCategory"
[formControl]="fd"
>
<mat-option (click)="selectCategory()"
*ngFor="let dataCategory of enumsDataCategoryAndType.DataCategoryEnumTranslate"
[value]="dataCategory.key"
*ngFor="let dataCategory of (listDataCategoriesObs | async)"
[value]="dataCategory"
solidifyTooltipOnEllipsis
>
{{dataCategory.value | translate}}
{{enumUtil.getLabel(enumsDataFile.DataCategoryEnumTranslate, dataCategory) | translate}}
</mat-option>
</mat-select>
</mat-form-field>
......@@ -24,13 +25,16 @@
solidifyTooltipOnEllipsis
>
<mat-label>{{labelTranslateEnum.dataType | translate }}</mat-label>
<mat-select [formControl]="fd">
<mat-select [disabled]="data?.dataCategoryEnum | isNotNullNorUndefined"
[solidifyDataTest]="dataTestEnum.depositDataType"
[formControl]="fd"
>
<mat-option (click)="selectDataType()"
*ngFor="let dataType of enumsDataCategoryAndType.getDataTypeForDataCategory(getDataCategory())"
*ngFor="let dataType of (listDataTypesObs | async)"
[value]="dataType"
solidifyTooltipOnEllipsis
>
{{enumUtil.getLabel(enumsDataCategoryAndType.DataTypeEnumTranslate, dataType) | translate}}
{{enumUtil.getLabel(enumsDataFile.DataTypeEnumTranslate, dataType) | translate}}
</mat-option>
</mat-select>
</mat-form-field>
......
......@@ -34,9 +34,12 @@ import {
MAT_DIALOG_DATA,
MatDialogRef,
} from "@angular/material/dialog";
import {AbstractDepositFileUploadDialog} from "@deposit/components/dialogs/abstract-deposit-file-upload/abstract-deposit-file-upload.dialog";
import {
AbstractDepositFileUploadDialog,
AbstractDepositFileUploadDialogData,
} from "@deposit/components/dialogs/abstract-deposit-file-upload/abstract-deposit-file-upload.dialog";
import {DlcmFileUploadWrapper} from "@deposit/models/dlcm-file-upload-wrapper.model";
import {Enums} from "@enums";
import {Store} from "@ngxs/store";
import {
EnumUtil,
HTMLInputEvent,
......@@ -57,31 +60,15 @@ export class DepositFileUploadArchiveDialog extends AbstractDepositFileUploadDia
@ViewChild("fileInput")
fileInput: ElementRef;
get enumsDataFile(): typeof Enums.DataFile {
return Enums.DataFile;
}
get enumsDataCategoryAndType(): typeof Enums.DataFile.DataCategoryAndType {
return Enums.DataFile.DataCategoryAndType;
}
get enumUtil(): typeof EnumUtil {
return EnumUtil;
}
constructor(protected readonly _dialogRef: MatDialogRef<DepositFileUploadArchiveDialog>,
protected readonly _fb: FormBuilder,
@Inject(MAT_DIALOG_DATA) public readonly data: DepositFileUploadArchiveDialogData) {
super(_dialogRef, _fb, data);
}
ngOnInit(): void {
super.ngOnInit();
if (isNotNullNorUndefined(this.data.dataCategoryEnum)) {
const dataCategoryFormControl = this.form.get(this.formDefinition.dataCategory);
dataCategoryFormControl.setValue(this.data.dataCategoryEnum);
}
@Inject(MAT_DIALOG_DATA) public readonly data: DepositFileUploadArchiveDialogData,
protected readonly _store: Store) {
super(_dialogRef, _fb, data, _store);
}
onFileChange(event: HTMLInputEvent): void {
......@@ -123,6 +110,5 @@ export class DepositFileUploadArchiveDialog extends AbstractDepositFileUploadDia
}
}
export interface DepositFileUploadArchiveDialogData {
dataCategoryEnum?: Enums.DataFile.DataCategoryAndType.DataCategoryEnum;
export interface DepositFileUploadArchiveDialogData extends AbstractDepositFileUploadDialogData {
}
......@@ -21,11 +21,11 @@
[formControl]="fd"
>
<mat-option (click)="selectCategory()"
*ngFor="let dataCategory of enumsDataFile.DataCategoryEnumTranslate"
[value]="dataCategory.key"
*ngFor="let dataCategory of (listDataCategoriesObs | async)"
[value]="dataCategory"
solidifyTooltipOnEllipsis
>
{{dataCategory.value | translate}}
{{enumUtil.getLabel(enumsDataFile.DataCategoryEnumTranslate, dataCategory) | translate}}
</mat-option>
</mat-select>
</mat-form-field>
......@@ -40,7 +40,7 @@
[formControl]="fd"
>
<mat-option (click)="selectDataType()"
*ngFor="let dataType of enumsDataFile.getDataTypeForDataCategory(getDataCategory(), getFormControl(formDefinition.dataType).value)"
*ngFor="let dataType of (listDataTypesObs | async)"
[value]="dataType"
solidifyTooltipOnEllipsis
>
......
......@@ -47,12 +47,16 @@ import {
import {AppSystemPropertyState} from "@app/stores/system-property/app-system-property.state";
import {
AbstractDepositFileUploadDialog,
AbstractDepositFileUploadDialogData,
AbstractDepositFileUploadFormComponentFormDefinition,
} from "@deposit/components/dialogs/abstract-deposit-file-upload/abstract-deposit-file-upload.dialog";
import {DlcmFileUploadWrapper} from "@deposit/models/dlcm-file-upload-wrapper.model";
import {Enums} from "@enums";
import {environment} from "@environments/environment";
import {Store} from "@ngxs/store";
import {
Actions,
Store,
} from "@ngxs/store";
import {BaseFormDefinition} from "@shared/models/base-form-definition.model";
import {
crc32,
......@@ -105,10 +109,6 @@ export class DepositFileUploadDialog extends AbstractDepositFileUploadDialog<Dep
readonly CHECKSUM_LENGTH_SHA256: number = 64;
readonly CHECKSUM_LENGTH_CRC32: number = 8;
get enumsDataFile(): typeof Enums.DataFile.DataCategoryAndType {
return Enums.DataFile.DataCategoryAndType;
}
get enumUtil(): typeof EnumUtil {
return EnumUtil;
}
......@@ -125,31 +125,23 @@ export class DepositFileUploadDialog extends AbstractDepositFileUploadDialog<Dep
protected readonly _fb: FormBuilder,
@Inject(MAT_DIALOG_DATA) public readonly data: DepositFileUploadDialogData,
protected readonly _store: Store,
protected readonly _changeDetectorRef: ChangeDetectorRef) {
super(_dialogRef, _fb, data);
protected readonly _actions$: Actions,
protected readonly _changeDetector: ChangeDetectorRef) {
super(_dialogRef, _fb, data, _store);
}
ngOnInit(): void {
super.ngOnInit();
this.formArray = this._fb.array([]);
this.form.addControl(this.formDefinition.subDirectory, this._fb.control({
value: this.data.subDirectory,
disabled: isTrue(this.data.subDirectoryReadOnly),
}));
if (isNotNullNorUndefined(this.data.dataCategoryEnum)) {
const dataCategoryFormControl = this.form.get(this.formDefinition.dataCategory);
dataCategoryFormControl.setValue(this.data.dataCategoryEnum);
if (this.data.dataCategoryEnum === Enums.DataFile.DataCategoryAndType.DataCategoryEnum.SECONDARY) {
this.isFormValid = false;
}
if (isNotNullNorUndefined(this.data.dataTypeEnum)) {
const dataTypeFormControl = this.form.get(this.formDefinition.dataType);
dataTypeFormControl.setValue(this.data.dataTypeEnum);
}
if (this.data.dataCategoryEnum === Enums.DataFile.DataCategoryAndType.DataCategoryEnum.SECONDARY) {
this.isFormValid = false;
}
this.formArray = this._fb.array([]);
}
private _generateFormGroupChecksum(file: File): FormGroup {
......@@ -233,7 +225,7 @@ export class DepositFileUploadDialog extends AbstractDepositFileUploadDialog<Dep
formGroup.get(this.formDefinitionChecksum.checksumUserSha1)?.updateValueAndValidity();
formGroup.get(this.formDefinitionChecksum.checksumUserSha256)?.updateValueAndValidity();
formGroup.get(this.formDefinitionChecksum.checksumUserCrc32)?.updateValueAndValidity();
this._changeDetectorRef.detectChanges();
this._changeDetector.detectChanges();
}),
));
......@@ -388,7 +380,7 @@ export class DepositFileUploadDialog extends AbstractDepositFileUploadDialog<Dep
checksumFunction(array).then(checksum => {
formGroup.get(this._getChecksumFormDefinition(algo, Enums.DataFile.Checksum.OriginEnum.PORTAL))?.setValue(checksum);
setTimeout(() => {
this._changeDetectorRef.detectChanges();
this._changeDetector.detectChanges();
}, 0);
}).finally(() => {
formControlCounter.setValue(formControlCounter.value - 1);
......@@ -519,9 +511,7 @@ class FileWrapper {
isInError: boolean;
}
export interface DepositFileUploadDialogData {
dataCategoryEnum?: Enums.DataFile.DataCategoryAndType.DataCategoryEnum;
dataTypeEnum?: Enums.DataFile.DataCategoryAndType.DataTypeEnum;
export interface DepositFileUploadDialogData extends AbstractDepositFileUploadDialogData {
subDirectory?: string;
subDirectoryReadOnly?: boolean;
}
......@@ -40,6 +40,7 @@ import {
} from "@app/features/preservation-space/organizational-unit/stores/preservation-space-organizational-unit.state";
import {AppUserState} from "@app/stores/user/app-user.state";
import {Enums} from "@enums";
import {environment} from "@environments/environment";
import {OrganizationalUnit} from "@models";
import {TranslateService} from "@ngx-translate/core";
import {Navigate} from "@ngxs/router-plugin";
......@@ -75,6 +76,7 @@ import {
DialogUtil,
isNotNullNorUndefined,
isNullOrUndefined,
isNullOrUndefinedOrWhiteString,
LocalStorageHelper,
MARK_AS_TRANSLATABLE,
MemoizedUtil,
......@@ -82,6 +84,7 @@ import {
QueryParameters,
RouterExtensionService,
SOLIDIFY_CONSTANTS,
SsrUtil,
} from "solidify-frontend";
@Component({
......@@ -171,11 +174,15 @@ export class PreservationSpaceOrganizationalUnitListRoutable extends AbstractLis
}
requestCreationOrgUnit(): void {
this.subscribe(DialogUtil.open(this._dialog, PreservationSpaceOrganizationalUnitRequestCreationDialog, {}, {
minWidth: "500px",
}, result => {
this._sendRequestCreationOrgUnit(result);
}));
if (isNullOrUndefinedOrWhiteString(environment.externalUrlForRequestOrganizationalUnitCreation)) {
this.subscribe(DialogUtil.open(this._dialog, PreservationSpaceOrganizationalUnitRequestCreationDialog, {}, {
minWidth: "500px",
}, result => {
this._sendRequestCreationOrgUnit(result);
}));
} else {
SsrUtil.window?.open(environment.externalUrlForRequestOrganizationalUnitCreation, "_blank");
}
}
private _sendRequestCreationOrgUnit(result: OrgunitRequestCreationDialogResult): void {
......
......@@ -27,7 +27,10 @@ import {environment} from "@environments/environment";
import {AipHelper} from "@shared/features/aip/helpers/aip.helper";
import {Storage} from "@shared/models/storage.model";
import {SOLIDIFY_CONSTANTS} from "solidify-frontend";
import {ApiActionNameEnum} from "./api-action-name.enum";
import {
ApiActionNameEnum,
ApiActionNameExtendEnum,
} from "./api-action-name.enum";
export class ApiKeyword {
static PARENT_ID: string = "parentId";
......@@ -249,6 +252,10 @@ export class ApiEnum {
return ApiEnum.preingest + SEPARATOR + ApiResourceNameEnum.CONTRIBUTOR;
}
static get preIngestDepositsDataCategory(): string {
return ApiEnum.preingest + SEPARATOR + ApiResourceNameEnum.DEPOSIT + SEPARATOR + ApiActionNameExtendEnum.LIST_DATA_CATEGORY;
}
static get preIngestSubjectArea(): string {
return ApiEnum.preingest + SEPARATOR + ApiResourceNameEnum.SUBJECT_AREA;
}
......
......@@ -132,6 +132,7 @@ enum StateExtendEnum {
shared_aip_collection_statusHistory = "shared_aip_collection_statusHistory",
shared_aip_dataFile = "shared_aip_dataFile",
shared_aip_dataFile_statusHistory = "shared_aip_dataFile_statusHistory",
shared_data_category = "shared_data_category",
admin_globalBanner = "admin_globalBanner",
admin_preservationPolicy = "admin_preservationPolicy",
......
......@@ -106,6 +106,7 @@ import {SharedArchiveAclState} from "@shared/stores/archive-acl/shared-archive-a
import {SharedArchiveTypeState} from "@shared/stores/archive-type/shared-archive-type.state";
import {SharedArchiveState} from "@shared/stores/archive/shared-archive.state";
import {SharedContributorState} from "@shared/stores/contributor/shared-contributor.state";
import {SharedDataCategoryState} from "@shared/stores/data-category/shared-data-category.state";
import {SharedDepositState} from "@shared/stores/deposit/shared-deposit.state";
import {SharedDisseminationPolicyState} from "@shared/stores/dissemination-policy/shared-dissemination-policy.state";
import {SharedFundingAgencyState} from "@shared/stores/funding-agency/shared-funding-agency.state";
......@@ -259,6 +260,7 @@ const modules = [
SharedAipDataFileStatusHistoryState,
SharedArchiveState,
SharedIndexFieldAliasState,
SharedDataCategoryState,
]),
],
exports: [
......
/*-
* %%----------------------------------------------------------------------------------------------
* DLCM Technology - DLCM Portal - shared-data-category.action.ts
* SPDX-License-Identifier: GPL-2.0-or-later
* %----------------------------------------------------------------------------------------------%
* Copyright (C) 2017 - 2023 University of Geneva
* %----------------------------------------------------------------------------------------------%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* ----------------------------------------------------------------------------------------------%%
*/
import {StateEnum} from "@shared/enums/state.enum";
import {
BaseAction,
BaseSubActionFail,
BaseSubActionSuccess,
QueryParameters,
} from "solidify-frontend";
const state = StateEnum.shared_data_category;
export namespace SharedDataCategoryAction {
export class GetAllDataCategories extends BaseAction {
static readonly type: string = `[${state}] Get All Data Categories`;
constructor(public queryParameters?: QueryParameters, public keepCurrentContext: boolean = false, public cancelIncomplete: boolean = true) {
super();
}
}
export class GetAllDataCategoriesSuccess extends BaseSubActionSuccess<GetAllDataCategories> {
static readonly type: string = `[${state}] Get All Data Categories Success`;
constructor(public parentAction: GetAllDataCategories, public list: string[]) {
super(parentAction);
}
}
export class GetAllDataCategoriesFail extends BaseSubActionFail<GetAllDataCategories> {
static readonly type: string = `[${state}] Get All Data Categories Fail`;
}
export class GetAllDataTypesByCategory extends BaseAction {
static readonly type: string = `[${state}] Get All Data Types By Category`;
constructor(public dataCategory: string, public queryParameters?: QueryParameters, public keepCurrentContext: boolean = false, public cancelIncomplete: boolean = true) {
super();
}
}
export class GetAllDataTypesByCategorySuccess extends BaseSubActionSuccess<GetAllDataTypesByCategory> {
static readonly type: string = `[${state}] Get All Data Types By Category Success`;
constructor(public parentAction: GetAllDataTypesByCategory, public list: string[]) {
super(parentAction);
}
}
export class GetAllDataTypesByCategoryFail extends BaseSubActionFail<GetAllDataTypesByCategory> {
static readonly type: string = `[${state}] Get All Data Types By Category Fail`;
}
}
/*-
* %%----------------------------------------------------------------------------------------------
* DLCM Technology - DLCM Portal - shared-data-category.state.ts
* SPDX-License-Identifier: GPL-2.0-or-later
* %----------------------------------------------------------------------------------------------%
* Copyright (C) 2017 - 2023 University of Geneva
* %----------------------------------------------------------------------------------------------%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* ----------------------------------------------------------------------------------------------%%
*/
import {HttpClient} from "@angular/common/http";
import {Injectable} from "@angular/core";
import {ApiEnum} from "@app/shared/enums/api.enum";
import {Navigate} from "@ngxs/router-plugin";
import {
Action,
Actions,
Selector,
State,
StateContext,
Store,
} from "@ngxs/store";
import {ApiActionNameExtendEnum} from "@shared/enums/api-action-name.enum";
import {StateEnum} from "@shared/enums/state.enum";
import {SharedDataCategoryAction} from "@shared/stores/data-category/shared-data-category.action";
import {
Observable,
of,
pipe,
} from "rxjs";
import {
catchError,
tap,
} from "rxjs/operators";
import {
ApiService,
BasicState,
isNonEmptyArray,
isNullOrUndefinedOrEmptyArray,
MappingObject,
MappingObjectUtil,
NotificationService,
QueryParameters,
SOLIDIFY_CONSTANTS,
SolidifyHttpErrorResponseModel,
SolidifyStateError,
StoreUtil,
TransferStateService,
} from "solidify-frontend";
export interface SharedDataCategoryStateModel {
listDataCategories: string[] | undefined;
listDataTypes: string[] | undefined;
mapListDataTypesByCategory: MappingObject<string, string[]>;
isLoadingCounter: number;
queryParameters: QueryParameters;
}
@Injectable()
@State<SharedDataCategoryStateModel>({
name: StateEnum.shared_data_category,
defaults: {
listDataCategories: undefined,
listDataTypes: undefined,
mapListDataTypesByCategory: {} as MappingObject<string, string[]>,
isLoadingCounter: 0,
queryParameters: new QueryParameters(),
},
})
export class SharedDataCategoryState extends BasicState<SharedDataCategoryStateModel> {
protected get _urlResource(): string {
return ApiEnum.preIngestDepositsDataCategory;
}
constructor(private readonly _apiService: ApiService,
private readonly _store: Store,
private readonly _httpClient: HttpClient,
private readonly _notificationService: NotificationService,
private readonly _actions$: Actions,
private readonly _transferState: TransferStateService) {
super();
}
@Selector()
static isLoading(state: SharedDataCategoryStateModel): boolean {
return StoreUtil.isLoadingState(state);
}
@Action(SharedDataCategoryAction.GetAllDataCategories)
getAllDataCategories(ctx: StateContext<SharedDataCategoryStateModel>, action: SharedDataCategoryAction.GetAllDataCategories): Observable<string[]> {
const listDataCategoriesInState = ctx.getState().listDataCategories;
if (isNonEmptyArray(listDataCategoriesInState)) {
ctx.patchState({
isLoadingCounter: ctx.getState().isLoadingCounter + 1,
});
ctx.dispatch(new SharedDataCategoryAction.GetAllDataCategoriesSuccess(action, listDataCategoriesInState));
return of(listDataCategoriesInState);
}
let reset = {};
if (!action.keepCurrentContext) {
reset = {
list: undefined,
};
}
ctx.patchState({
isLoadingCounter: ctx.getState().isLoadingCounter + 1,
...reset,
});
return this._apiService.get<string[]>(this._urlResource)
.pipe(
action.cancelIncomplete ? StoreUtil.cancelUncompleted(ctx, this._actions$, [SharedDataCategoryAction.GetAllDataCategories, Navigate]) : pipe(),
tap((list: string[]) => {
ctx.dispatch(new SharedDataCategoryAction.GetAllDataCategoriesSuccess(action, list));
}),
catchError((error: SolidifyHttpErrorResponseModel) => {
ctx.dispatch(new SharedDataCategoryAction.GetAllDataCategoriesFail(action));
throw new SolidifyStateError(this, error);
}),
);
}
@Action(SharedDataCategoryAction.GetAllDataCategoriesSuccess)
getAllDataCategoriesSuccess(ctx: StateContext<SharedDataCategoryStateModel>, action: SharedDataCategoryAction.GetAllDataCategoriesSuccess): void {
ctx.patchState({
listDataCategories: action.list,
isLoadingCounter: ctx.getState().isLoadingCounter - 1,
});
}
@Action(SharedDataCategoryAction.GetAllDataCategoriesFail)
getAllDataCategoriesFail(ctx: StateContext<SharedDataCategoryStateModel>, action: SharedDataCategoryAction.GetAllDataCategoriesFail): void {
ctx.patchState({
isLoadingCounter: ctx.getState().isLoadingCounter - 1,
});
}
@Action(SharedDataCategoryAction.GetAllDataTypesByCategory)
getAllDataTypesByCategory(ctx: StateContext<SharedDataCategoryStateModel>, action: SharedDataCategoryAction.GetAllDataTypesByCategory): Observable<string[]> {
const mapListDataTypesByCategory = ctx.getState().mapListDataTypesByCategory;
const listDataTypeByCategory = MappingObjectUtil.get(mapListDataTypesByCategory, action.dataCategory);
if (isNonEmptyArray(listDataTypeByCategory)) {
ctx.patchState({
isLoadingCounter: ctx.getState().isLoadingCounter + 1,
});
ctx.dispatch(new SharedDataCategoryAction.GetAllDataTypesByCategorySuccess(action, listDataTypeByCategory));
return of(listDataTypeByCategory);
}
let reset = {};
if (!action.keepCurrentContext) {
reset = {
list: undefined,
};
}
ctx.patchState({
isLoadingCounter: ctx.getState().isLoadingCounter + 1,
...reset,
});
const baseUrl = ApiEnum.preIngestDeposits + SOLIDIFY_CONSTANTS.URL_SEPARATOR + ApiActionNameExtendEnum.LIST_DATA_TYPE + "?category=" + action.dataCategory;
return this._apiService.get<string[]>(baseUrl)
.pipe(
action.cancelIncomplete ? StoreUtil.cancelUncompleted(ctx, this._actions$, [SharedDataCategoryAction.GetAllDataCategories, Navigate]) : pipe(),
tap((list: string[]) => {
ctx.dispatch(new SharedDataCategoryAction.GetAllDataTypesByCategorySuccess(action, list));
}),
catchError((error: SolidifyHttpErrorResponseModel) => {
ctx.dispatch(new SharedDataCategoryAction.GetAllDataTypesByCategoryFail(action));
throw new SolidifyStateError(this, error);
}),
);
}
@Action(SharedDataCategoryAction.GetAllDataTypesByCategorySuccess)
getAllDataTypesByCategorySuccess(ctx: StateContext<SharedDataCategoryStateModel>, action: SharedDataCategoryAction.GetAllDataTypesByCategorySuccess): void {
const obj = {
listDataTypes: action.list,
isLoadingCounter: ctx.getState().isLoadingCounter - 1,
} as Partial<SharedDataCategoryStateModel>;
const mapListDataTypesByCategory = MappingObjectUtil.copy(ctx.getState().mapListDataTypesByCategory);
const listDataTypeByCategory = MappingObjectUtil.get(mapListDataTypesByCategory, action.parentAction.dataCategory);
if (isNullOrUndefinedOrEmptyArray(listDataTypeByCategory)) {
MappingObjectUtil.set(mapListDataTypesByCategory, action.parentAction.dataCategory, action.list);
obj.mapListDataTypesByCategory = mapListDataTypesByCategory;
}
ctx.patchState(obj);
}
@Action(SharedDataCategoryAction.GetAllDataTypesByCategoryFail)
getAllDataTypesByCategoryFail(ctx: StateContext<SharedDataCategoryStateModel>, action: SharedDataCategoryAction.GetAllDataTypesByCategoryFail): void {
ctx.patchState({
isLoadingCounter: ctx.getState().isLoadingCounter - 1,
});
}
}
......@@ -66,6 +66,10 @@ import {
SharedArchiveStateModel,
} from "@shared/stores/archive/shared-archive.state";
import {SharedContributorState} from "@shared/stores/contributor/shared-contributor.state";
import {
SharedDataCategoryState,
SharedDataCategoryStateModel,
} from "@shared/stores/data-category/shared-data-category.state";
import {
SharedDepositState,
SharedDepositStateModel,
......@@ -92,14 +96,14 @@ import {
SharedNotificationStateModel,
} from "@shared/stores/notification/shared-notification.state";
import {SharedOrderState} from "@shared/stores/order/shared-order.state";
import {
SharedSubjectAreaState,
SharedSubjectAreaStateModel,
} from "@shared/stores/subject-area/shared-subject-area.state";
import {
SharedRoleState,
SharedRoleStateModel,
} from "@shared/stores/role/shared-role.state";
import {
SharedSubjectAreaState,
SharedSubjectAreaStateModel,
} from "@shared/stores/subject-area/shared-subject-area.state";
import {SharedUserState} from "@shared/stores/user/shared-user.state";
import {
BaseStateModel,
......@@ -130,6 +134,7 @@ export interface SharedStateModel extends BaseStateModel {
[StateEnum.shared_indexFieldAlias]: SharedIndexFieldAliasStateModel;
[StateEnum.shared_oaiSet]: SharedOaiSetStateModel;
[StateEnum.shared_oaiMetadataPrefix]: SharedOaiMetadataPrefixStateModel;
[StateEnum.shared_data_category]: SharedDataCategoryStateModel;
}
@Injectable()
......@@ -157,6 +162,7 @@ export interface SharedStateModel extends BaseStateModel {
[StateEnum.shared_indexFieldAlias]: null,
[StateEnum.shared_oaiSet]: undefined,
[StateEnum.shared_oaiMetadataPrefix]: undefined,
[StateEnum.shared_data_category]: undefined,
},
children: [
SharedArchiveAclState,
......@@ -184,6 +190,7 @@ export interface SharedStateModel extends BaseStateModel {
SharedArchiveState,
SharedArchiveTypeState,
SharedIndexFieldAliasState,
SharedDataCategoryState,
],
})
export class SharedState {
......
......@@ -61,6 +61,13 @@ export interface DlcmEnvironment extends DefaultSolidifyApplicationEnvironment {
institutionUrl: string;
spdxUrl: string;
/**
* URL to the page where the user can request the creation of an organizational unit
* If undefined, the button to request the creation of an organizational unit open a modal with a form to request the creation of an organizational unit in-app (default behavior)
* If defined, the button to request the creation of an organizational unit open a new tab with the url defined
*/
externalUrlForRequestOrganizationalUnitCreation: string | undefined;
// Home
carouselUrl: string | undefined;
defaultPageSizeHomePage: number;
......
......@@ -86,6 +86,7 @@ export const defaultEnvironment: DlcmEnvironment = {
institutionUrl: "https://www.unige.ch/",
spdxUrl: "https://spdx.org/licenses/",
externalUrlForRequestOrganizationalUnitCreation: undefined,
// Home
defaultHomeViewModeTableEnum: ViewModeTableEnum.tiles,
......