[Monitor Dashboard | Trunk]: Add toggle methods on stakeholders. Add section title but it does not work.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57970 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Konstantinos Triantafyllou 2020-01-10 15:49:26 +00:00
parent 753cee99bf
commit 54f03f4c98
4 changed files with 44 additions and 4 deletions

View File

@ -56,8 +56,14 @@
<ul class="uk-nav uk-dropdown-nav">
<li><a (click)="$event.stopPropagation();editStakeholder(stakeholder, true);hide(element);$event.preventDefault()">Edit</a>
</li>
<li><a
(click)="$event.stopPropagation();deleteStakeholderOpen(stakeholder);hide(element);$event.preventDefault()">Delete</a>
<li><a (click)="$event.stopPropagation();toggleStakeholderStatus(stakeholder);hide(element);$event.preventDefault()">
{{stakeholder.isActive ? 'Deactivate' : 'Activate'}}</a>
</li>
<li><a (click)="$event.stopPropagation();toggleStakeholderAccess(stakeholder);hide(element);$event.preventDefault()">
{{stakeholder.isPublic ? 'Unpublish' : 'Publish'}}</a>
</li>
<hr class="uk-nav-divider">
<li><a (click)="$event.stopPropagation();deleteStakeholderOpen(stakeholder);hide(element);$event.preventDefault()">Delete</a>
</li>
</ul>
</div>
@ -135,6 +141,13 @@
<li><a
(click)="$event.stopPropagation();editStakeholder(stakeholder);hide(element);$event.preventDefault()">Edit</a>
</li>
<li><a (click)="$event.stopPropagation();toggleStakeholderStatus(stakeholder);hide(element);$event.preventDefault()">
{{stakeholder.isActive ? 'Deactivate' : 'Activate'}}</a>
</li>
<li><a (click)="$event.stopPropagation();toggleStakeholderAccess(stakeholder);hide(element);$event.preventDefault()">
{{stakeholder.isPublic ? 'Unpublish' : 'Publish'}}</a>
</li>
<hr class="uk-nav-divider">
<li><a
(click)="$event.stopPropagation();deleteStakeholderOpen(stakeholder);hide(element);$event.preventDefault()">Delete</a>
</li>

View File

@ -9,6 +9,7 @@ import {FormBuilder, FormGroup, Validators} from "@angular/forms";
import {AlertModal} from "../openaireLibrary/utils/modal/alert";
import {StakeholderCreator} from "../utils/entities/stakeholderCreator";
import {Option} from "../openaireLibrary/dashboard/sharedComponents/input/input.component";
import {Title} from "@angular/platform-browser";
declare var UIkit;
@ -53,6 +54,7 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
constructor(private stakeholderService: StakeholderService,
private propertiesService: EnvironmentSpecificService,
private title: Title,
private fb: FormBuilder) {
}
@ -61,6 +63,7 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
this.propertiesService.loadEnvironment()
.then(properties => {
this.properties = properties;
this.title.setTitle('Manage Stakeholders');
let data = zip(
this.stakeholderService.getDefaultStakeholders(this.properties.monitorServiceAPIURL),
this.stakeholderService.getStakeholders(this.properties.monitorServiceAPIURL)
@ -266,4 +269,22 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
}
});
}
toggleStakeholderStatus(stakeholder: Stakeholder) {
let path = [
stakeholder._id
];
this.stakeholderService.toggleStatus(this.properties.monitorServiceAPIURL, path).subscribe(isActive => {
stakeholder.isActive = isActive;
});
}
toggleStakeholderAccess(stakeholder: Stakeholder) {
let path = [
stakeholder._id
];
this.stakeholderService.toggleAccess(this.properties.monitorServiceAPIURL, path).subscribe(isPublic => {
stakeholder.isPublic = isPublic;
});
}
}

View File

@ -146,8 +146,13 @@
<button class="md-btn md-btn-mini"><i class="material-icons">clear</i></button>
</div>
</div>
<div class="uk-width-1-1 disable-sortable uk-sortable-nodrag">
<h4>{{chart.title}}</h4>
<div class="uk-form-row uk-width-1-1 uk-grid-medium uk-flex uk-flex-middle disable-sortable uk-sortable-nodrag" uk-grid>
<div dashboard-input class="uk-width-2-3 uk-width-1-3@m" [formInput]="null" label="Add a section title"></div>
<div class="uk-width-expand">
<button class="md-btn md-btn-small md-btn-primary">
Save
</button>
</div>
</div>
<ng-template ngFor [ngForOf]="chart.indicators" let-indicator let-j="index">
<div *ngIf="indicator" [id]="indicator._id"

View File

@ -34,6 +34,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
public preview: string;
public indicatorUtils: IndicatorUtils = new IndicatorUtils();
public indicatorFb: FormGroup;
public sectionFbs: FormArray;
/**
* Editable indicator
*/