From 2f47c6c06952561152c02dc9416bc477f46102cd Mon Sep 17 00:00:00 2001 From: Konstantinos Triantafyllou Date: Tue, 8 Dec 2020 11:39:50 +0000 Subject: [PATCH] [Monitor Dashboard | Trunk]: Fix create stakeholder bug git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@60095 d315682c-612b-4755-9ff5-7f18f6832af3 --- src/app/topic/indicators.component.ts | 32 ---------------------- src/app/utils/indicator-utils.ts | 39 +++++++++++++-------------- 2 files changed, 18 insertions(+), 53 deletions(-) diff --git a/src/app/topic/indicators.component.ts b/src/app/topic/indicators.component.ts index 47e6ced..1611ee4 100644 --- a/src/app/topic/indicators.component.ts +++ b/src/app/topic/indicators.component.ts @@ -73,10 +73,6 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV */ @Input() public filters: FormGroup; - /** - * Toggles - */ - // public grid: boolean = true; public editing: boolean = false; /** Safe Urls*/ public safeUrls: Map = new Map([]); @@ -958,34 +954,6 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV })); } - /*toggleIndicatorAccess(sectionId: string, indicator: Indicator) { - this.editing = true; - let path = [ - this.stakeholder._id, - this.stakeholder.topics[this.topicIndex]._id, - this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex]._id, - this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id, - sectionId, - indicator._id - ]; - this.stakeholderService.toggleAccess(this.properties.monitorServiceAPIURL, path).subscribe(visibility => { - indicator.visibility = visibility; - UIkit.notification('Indicator has been successfully changed to ' + (visibility?'public':'private'), { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); - this.editing = false; - }, error => { - UIkit.notification(error.error.message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); - this.editing = false; - }); - }*/ - saveSection(section: Section, index: number, type: IndicatorType = "chart") { this.editing = true; let path = [ diff --git a/src/app/utils/indicator-utils.ts b/src/app/utils/indicator-utils.ts index 9d40c6b..78a643b 100644 --- a/src/app/utils/indicator-utils.ts +++ b/src/app/utils/indicator-utils.ts @@ -10,6 +10,7 @@ import { import {AbstractControl, ValidatorFn, Validators} from "@angular/forms"; import {Option} from "../openaireLibrary/sharedComponents/input/input.component"; import {Session} from "../openaireLibrary/login/utils/helper.class"; +import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class"; export class StakeholderUtils { statuses: Option[] = [ @@ -24,6 +25,20 @@ export class StakeholderUtils { {value: 'project', label: 'Project'}, {value: 'organization', label: 'Organization'} ]; + + visibility: Option[] = [ + {icon: 'world', value: "PUBLIC", label: 'Public'}, + {icon: 'lock', value: "RESTRICTED", label: 'Restricted'}, + {icon: 'users', value: "PRIVATE", label: 'Private'}, + ]; + + + visibilityIcon: Map = new Map ([ + ["PUBLIC", 'earth'], + ["PRIVATE", 'lock'], + ["RESTRICTED", 'group'] + ]); + getTypesByUserRoles(user, id:string = null):Option[]{ let types = []; for(let type of this.types){ @@ -33,27 +48,9 @@ export class StakeholderUtils { } return types; } - visibility: Option[] = [ - {icon: 'world', value: "PUBLIC", label: 'Public'}, - {icon: 'lock', value: "RESTRICTED", label: 'Restricted'}, - {icon: 'users', value: "PRIVATE", label: 'Private'}, - ]; - - isActive: Option[] = [ - {icon: 'brightness_1', iconClass: '', value: true, label: 'Active'}, - {icon: 'brightness_1', value: false, label: 'Inactive'}, - ]; - - visibilityIcon: Map = new Map ([ - ["PUBLIC", 'earth'], - ["PRIVATE", 'lock'], - ["RESTRICTED", 'group'] - ]); - - isActiveIcon: string = 'brightness_1'; - + public createFunderFromDefaultProfile(funder: Stakeholder, defaultTopics: Topic[]): Stakeholder { - funder.topics = defaultTopics; + funder.topics = HelperFunctions.copy(defaultTopics); for (let topic of funder.topics) { // console.log('id:' + topic._id); topic.defaultId = topic._id; @@ -132,7 +129,7 @@ export class StakeholderUtils { category.subCategories = subTokeep; } } - console.log (funder) + //console.log (funder); return funder; }