You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by dg...@apache.org on 2020/02/19 08:51:13 UTC
[incubator-dlab] branch develop updated: [DLAB-1567]: Removed
'Refresh'/'Export' buttons from Billing if user is not admin (#608)
This is an automated email from the ASF dual-hosted git repository.
dgnatyshyn pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/develop by this push:
new 52a8af1 [DLAB-1567]: Removed 'Refresh'/'Export' buttons from Billing if user is not admin (#608)
52a8af1 is described below
commit 52a8af1b319f06f8bb45df69b00f2602a2b70664
Author: Dmytro Gnatyshyn <42...@users.noreply.github.com>
AuthorDate: Wed Feb 19 10:51:03 2020 +0200
[DLAB-1567]: Removed 'Refresh'/'Export' buttons from Billing if user is not admin (#608)
---
.../src/app/reporting/toolbar/toolbar.component.html | 2 +-
.../webapp/src/app/reporting/toolbar/toolbar.component.ts | 14 +++++++++++---
.../webapp/src/app/shared/navbar/navbar.component.ts | 4 ++--
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/services/self-service/src/main/resources/webapp/src/app/reporting/toolbar/toolbar.component.html b/services/self-service/src/main/resources/webapp/src/app/reporting/toolbar/toolbar.component.html
index 9c0b9c0..bbab2a4 100644
--- a/services/self-service/src/main/resources/webapp/src/app/reporting/toolbar/toolbar.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/reporting/toolbar/toolbar.component.html
@@ -33,7 +33,7 @@
<div id="range-picker">
<ng-daterangepicker [(ngModel)]="value" [options]="options" (ngModelChange)="onChange($event)"></ng-daterangepicker>
</div>
- <div class="action-butt">
+ <div class="action-butt" *ngIf="healthStatus && healthStatus.admin">
<button mat-raised-button class="butt" (click)="export($event)" [disabled]="!reportData?.lines.length">
<i class="material-icons">file_download</i>Export
</button>
diff --git a/services/self-service/src/main/resources/webapp/src/app/reporting/toolbar/toolbar.component.ts b/services/self-service/src/main/resources/webapp/src/app/reporting/toolbar/toolbar.component.ts
index aaa0e8d..5272e37 100644
--- a/services/self-service/src/main/resources/webapp/src/app/reporting/toolbar/toolbar.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/reporting/toolbar/toolbar.component.ts
@@ -20,6 +20,10 @@
import { Component, OnInit, AfterViewInit, Output, EventEmitter, ViewEncapsulation, ViewChild } from '@angular/core';
import { NgDateRangePickerOptions } from 'ng-daterangepicker';
import { DICTIONARY } from '../../../dictionary/global.dictionary';
+import {skip} from 'rxjs/operators';
+import {Subscription} from 'rxjs';
+import {HealthStatusService} from '../../core/services';
+import {GeneralEnvironmentStatus} from '../../administration/management/management.model';
@Component({
selector: 'dlab-toolbar',
@@ -33,6 +37,8 @@ export class ToolbarComponent implements OnInit, AfterViewInit {
reportData: any;
availablePeriodFrom: string;
availablePeriodTo: string;
+ subscriptions: Subscription = new Subscription();
+ healthStatus: GeneralEnvironmentStatus;
rangeOptions = { 'YTD': 'Year To Date', 'QTD': 'Quarter To Date', 'MTD': 'Month To Date', 'reset': 'All Period Report' };
options: NgDateRangePickerOptions;
@@ -42,7 +48,7 @@ export class ToolbarComponent implements OnInit, AfterViewInit {
@Output() exportReport: EventEmitter<{}> = new EventEmitter();
@Output() setRangeOption: EventEmitter<{}> = new EventEmitter();
- constructor() {
+ constructor(private healthStatusService: HealthStatusService) {
this.options = {
theme: 'default',
range: 'tm',
@@ -58,8 +64,10 @@ export class ToolbarComponent implements OnInit, AfterViewInit {
if (localStorage.getItem('report_period')) {
const availableRange = JSON.parse(localStorage.getItem('report_period'));
this.availablePeriodFrom = availableRange.start_date;
- this.availablePeriodTo = availableRange.end_date;
- }
+ this.availablePeriodTo = availableRange.end_date; }
+ this.subscriptions.add(this.healthStatusService.statusData.pipe(skip(1)).subscribe(result => {
+ this.healthStatus = result;
+ }));
}
ngAfterViewInit() {
diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts
index 78ddd3c..952dfd0 100644
--- a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts
@@ -38,8 +38,8 @@ import {
animateChild,
state
} from '@angular/animations';
-import {skip} from "rxjs/operators";
-import {ProgressBarService} from "../../core/services/progress-bar.service";
+import {skip} from 'rxjs/operators';
+import {ProgressBarService} from '../../core/services/progress-bar.service';
@Component({
selector: 'dlab-navbar',
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org