[MonitorDashboard]: Add activate-deactivate on indicator menu
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57843 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
a28d825eb0
commit
7de0e64603
|
@ -59,6 +59,14 @@ export class StakeholderService {
|
|||
}));
|
||||
}
|
||||
|
||||
toggleStatus(url: string, path: string[]): Observable<boolean> {
|
||||
return this.http.post<boolean>(url + '/' + path.join('/') + '/toggle-status', null);
|
||||
}
|
||||
|
||||
toggleAccess(url: string, path: string[]): Observable<boolean> {
|
||||
return this.http.post<boolean>(url + '/' + path.join('/') + '/toggle-access', null);
|
||||
}
|
||||
|
||||
saveElement(url: string, element: any, path: string[] = []): Observable<any> {
|
||||
path = HelperFunctions.encodeArray(path);
|
||||
return this.http.post<any>(url + ((path.length > 0)?'/':'') + path.join('/') +
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<aside id="sidebar_main">
|
||||
<div *ngIf="stakeholder" class="sidebar_main_header">
|
||||
<div *ngIf="stakeholder" class="sidebar_main_header uk-margin-remove-bottom">
|
||||
<div class="uk-padding-small">
|
||||
<img class="uk-margin-bottom" *ngIf="stakeholder.logoUrl" [src]="stakeholder.logoUrl">
|
||||
<h4 class="uk-text-bold uk-margin-remove">{{stakeholder.index_name}}</h4>
|
||||
|
|
|
@ -77,7 +77,14 @@
|
|||
<div uk-dropdown="mode: click; pos: bottom-right"
|
||||
class="uk-padding-remove-horizontal">
|
||||
<ul class="uk-nav uk-dropdown-nav">
|
||||
<li><a (click)="editChartIndicatorOpen(indicator._id)">Edit</a></li>
|
||||
<!--<li><a (click)="editChartIndicatorOpen(indicator._id)">Edit</a></li>-->
|
||||
<li><a (click)="toggleIndicatorStatus(indicator)">
|
||||
{{indicator.isActive ? 'Deactivate' : 'Activate'}}</a>
|
||||
</li>
|
||||
<!--<li><a (click)="editChartIndicatorOpen(indicator._id)">
|
||||
{{indicator.isPublic?'Unpublish':'Publish'}}</a>
|
||||
</li>-->
|
||||
<li class="uk-nav-divider"></li>
|
||||
<li><a (click)="deleteIndicatorOpen(indicator._id, 'number')">Delete</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -146,6 +153,13 @@
|
|||
class="uk-padding-remove-horizontal">
|
||||
<ul class="uk-nav uk-dropdown-nav">
|
||||
<li><a (click)="editChartIndicatorOpen(indicator._id)">Edit</a></li>
|
||||
<li><a (click)="toggleIndicatorStatus(indicator)">
|
||||
{{indicator.isActive ? 'Deactivate' : 'Activate'}}</a>
|
||||
</li>
|
||||
<!--<li><a (click)="editChartIndicatorOpen(indicator._id)">
|
||||
{{indicator.isPublic?'Unpublish':'Publish'}}</a>
|
||||
</li>-->
|
||||
<li class="uk-nav-divider"></li>
|
||||
<li><a (click)="deleteIndicatorOpen(indicator._id)">Delete</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -459,4 +459,18 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
|||
this.stakeholderService.setStakeholder(this.stakeholder);
|
||||
});
|
||||
}
|
||||
|
||||
toggleIndicatorStatus(indicator: Indicator) {
|
||||
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,
|
||||
indicator._id
|
||||
];
|
||||
this.stakeholderService.toggleStatus(this.properties.monitorServiceAPIURL, path).subscribe(status => {
|
||||
indicator.isActive = status;
|
||||
this.stakeholderService.setStakeholder(this.stakeholder);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue