[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
This commit is contained in:
Konstantinos Triantafyllou 2020-12-08 11:39:50 +00:00
parent 94424a8317
commit 2f47c6c069
2 changed files with 18 additions and 53 deletions

View File

@ -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<string, SafeResourceUrl> = new Map<string, SafeResourceUrl>([]);
@ -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 <b>successfully changed</b> 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 = [

View File

@ -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<Visibility, string> = new Map<Visibility, string> ([
["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<Visibility, string> = new Map<Visibility, string> ([
["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;
}