mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
#1174 Refresh the report list after edit report title
This commit is contained in:
parent
a12c370cc7
commit
8bfa71bc48
@ -92,10 +92,17 @@
|
||||
<div class="page-content">
|
||||
<div class="mdl-grid">
|
||||
<div class="mdl-cell mdl-cell--4-col task-column mdl-shadow--2dp">
|
||||
<analytics-report-list (reportClick)="onReportClick($event)"></analytics-report-list>
|
||||
<analytics-report-list
|
||||
(reportClick)="onReportClick($event)"
|
||||
#analyticsreportlist >
|
||||
</analytics-report-list>
|
||||
</div>
|
||||
<div class="mdl-cell mdl-cell--8-col task-column mdl-shadow--2dp">
|
||||
<activiti-analytics [appId]="appId" *ngIf="report" [reportId]="report.id"></activiti-analytics>
|
||||
<activiti-analytics *ngIf="report"
|
||||
[appId]="appId"
|
||||
[reportId]="report.id"
|
||||
(editReport)="onEditReport($event)">
|
||||
</activiti-analytics>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -30,6 +30,7 @@ import {
|
||||
ActivitiStartProcessInstance,
|
||||
ProcessInstance
|
||||
} from 'ng2-activiti-processlist';
|
||||
import { AnalyticsReportListComponent } from 'ng2-activiti-analytics';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Subscription } from 'rxjs/Rx';
|
||||
import {
|
||||
@ -75,6 +76,9 @@ export class ActivitiDemoComponent implements AfterViewInit {
|
||||
@ViewChild(ActivitiStartProcessInstance)
|
||||
activitiStartProcess: ActivitiStartProcessInstance;
|
||||
|
||||
@ViewChild(AnalyticsReportListComponent)
|
||||
analyticsreportlist: AnalyticsReportListComponent;
|
||||
|
||||
@Input()
|
||||
appId: number;
|
||||
|
||||
@ -183,6 +187,10 @@ export class ActivitiDemoComponent implements AfterViewInit {
|
||||
this.currentProcessInstanceId = processInstanceId;
|
||||
}
|
||||
|
||||
onEditReport(name: string) {
|
||||
this.analyticsreportlist.reload();
|
||||
}
|
||||
|
||||
navigateStartProcess() {
|
||||
this.currentProcessInstanceId = currentProcessIdNew;
|
||||
}
|
||||
|
@ -57,13 +57,21 @@ export class AnalyticsReportListComponent implements OnInit {
|
||||
this.reports.push(report);
|
||||
});
|
||||
|
||||
this.getReportListByAppId();
|
||||
this.getReportList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the report list by app id
|
||||
* Reload the component
|
||||
*/
|
||||
getReportListByAppId() {
|
||||
reload() {
|
||||
this.reset();
|
||||
this.getReportList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the report list
|
||||
*/
|
||||
getReportList() {
|
||||
this.analyticsService.getReportList().subscribe(
|
||||
(res: ReportParametersModel[]) => {
|
||||
if (res && res.length === 0) {
|
||||
@ -108,6 +116,15 @@ export class AnalyticsReportListComponent implements OnInit {
|
||||
return this.reports === undefined || (this.reports && this.reports.length === 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the list
|
||||
*/
|
||||
private reset() {
|
||||
if (!this.isReportsEmpty()) {
|
||||
this.reports = [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the current report
|
||||
* @param report
|
||||
|
@ -23,5 +23,5 @@
|
||||
}
|
||||
|
||||
.large {
|
||||
font-size: 44px;
|
||||
font-size: x-large;
|
||||
}
|
||||
|
@ -47,6 +47,9 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges {
|
||||
@Output()
|
||||
onError = new EventEmitter();
|
||||
|
||||
@Output()
|
||||
onEdit = new EventEmitter();
|
||||
|
||||
@Output()
|
||||
onFormValueChanged = new EventEmitter();
|
||||
|
||||
@ -224,6 +227,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges {
|
||||
this.reportParamsSub = this.analyticsService.updateReport(this.reportParameters.id, this.reportParameters.name).subscribe(
|
||||
(res: ReportParametersModel) => {
|
||||
this.editDisable();
|
||||
this.onEdit.emit(this.reportParameters.name);
|
||||
},
|
||||
(err: any) => {
|
||||
console.log(err);
|
||||
|
@ -1,6 +1,9 @@
|
||||
<div class="col-md-6">
|
||||
<analytics-report-parameters [appId]="appId" [reportId]="reportId"
|
||||
(onFormValueChanged)="reset()" (onSuccess)="showReport($event)"></analytics-report-parameters>
|
||||
(onFormValueChanged)="reset()"
|
||||
(onSuccess)="showReport($event)"
|
||||
(onEdit)="onEditReport($event)">
|
||||
</analytics-report-parameters>
|
||||
|
||||
<div *ngIf="reports">
|
||||
<div *ngFor="let report of reports">
|
||||
|
@ -41,6 +41,9 @@ export class AnalyticsComponent implements OnChanges {
|
||||
@Output()
|
||||
onSuccess = new EventEmitter();
|
||||
|
||||
@Output()
|
||||
editReport = new EventEmitter();
|
||||
|
||||
@Output()
|
||||
onError = new EventEmitter();
|
||||
|
||||
@ -108,7 +111,7 @@ export class AnalyticsComponent implements OnChanges {
|
||||
report.datasets = clone.datasets;
|
||||
}
|
||||
|
||||
public editReport(report: Chart) {
|
||||
console.log(report);
|
||||
public onEditReport(name: string) {
|
||||
this.editReport.emit(name);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user