From 8ae58c9ef38de5776d5795dcde21ea1fc2cd7c5d Mon Sep 17 00:00:00 2001 From: George Kalampokis Date: Thu, 23 Apr 2020 10:48:14 +0300 Subject: [PATCH] Allow Organization Creator to be visible by configuration (ref #255) --- .../core/services/configuration/configuration.service.ts | 6 ++++++ .../ui/dmp/editor/general-tab/general-tab.component.html | 2 +- .../ui/dmp/editor/general-tab/general-tab.component.ts | 8 +++++++- dmp-frontend/src/assets/config/config.json | 3 ++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dmp-frontend/src/app/core/services/configuration/configuration.service.ts b/dmp-frontend/src/app/core/services/configuration/configuration.service.ts index e95d87773..e6d544816 100644 --- a/dmp-frontend/src/app/core/services/configuration/configuration.service.ts +++ b/dmp-frontend/src/app/core/services/configuration/configuration.service.ts @@ -57,6 +57,11 @@ export class ConfigurationService extends BaseComponent { return this._guideAssets; } + private _allowOrganizationCreator: boolean; + get allowOrganizationCreator():boolean { + return this._allowOrganizationCreator; + } + public loadConfiguration(): Promise { return new Promise((r, e) => { @@ -92,6 +97,7 @@ export class ConfigurationService extends BaseComponent { this._logging = Logging.parseValue(config.logging); this._lockInterval = config.lockInterval; this._guideAssets = config.guideAssets; + this._allowOrganizationCreator = config.allowOrganizationCreator; } } diff --git a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html index 50d7d2fef..620a27cb4 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.html @@ -46,7 +46,7 @@ {{'GENERAL.VALIDATION.REQUIRED' | translate}} {{'DMP-EDITOR.FIELDS.ORGANISATIONS-HINT' | translate}} - diff --git a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts index f21ddfed9..1435dfaef 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/general-tab/general-tab.component.ts @@ -22,6 +22,7 @@ import { Observable } from 'rxjs'; import { map, takeUntil } from 'rxjs/operators'; import { AddOrganizationComponent } from '../add-organization/add-organization.component'; import { isNullOrUndefined } from 'util'; +import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; @Component({ selector: 'app-general-tab', @@ -71,7 +72,8 @@ export class GeneralTabComponent extends BaseComponent implements OnInit { private externalSourcesService: ExternalSourcesService, private _service: DmpService, private dialog: MatDialog, - private language: TranslateService + private language: TranslateService, + private configurationService: ConfigurationService ) { super(); } @@ -194,6 +196,10 @@ export class GeneralTabComponent extends BaseComponent implements OnInit { }); } + showOrganizationCreator(): boolean { + return this.configurationService.allowOrganizationCreator; + } + canAddOrganizations(): boolean { if (!isNullOrUndefined(this.formGroup.get('organizations'))) { return this.formGroup.get('organiztions').disabled; diff --git a/dmp-frontend/src/assets/config/config.json b/dmp-frontend/src/assets/config/config.json index 1c32e5676..7674363b7 100644 --- a/dmp-frontend/src/assets/config/config.json +++ b/dmp-frontend/src/assets/config/config.json @@ -49,5 +49,6 @@ "logLevels": ["debug", "info", "warning", "error"] }, "lockInterval": 60000, - "guideAssets": "assets/images/guide" + "guideAssets": "assets/images/guide", + "allowOrganizationCreator": true }