mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#1174 Add update report endpoint
This commit is contained in:
@@ -1,7 +1,18 @@
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div *ngIf="reportParameters">
|
<div *ngIf="reportParameters">
|
||||||
<form [formGroup]="reportForm" novalidate>
|
<form [formGroup]="reportForm" novalidate>
|
||||||
<h4>{{reportParameters.name}}</h4>
|
<div *ngIf="isEditable">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="mdl-textfield__input"
|
||||||
|
id="reportName"
|
||||||
|
data-automation-id="reportName"
|
||||||
|
[value]="reportParameters.name"
|
||||||
|
(input)="reportParameters.name=$event.target.value"
|
||||||
|
(blur)="editTitle($event)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<h4 *ngIf="!isEditable" (click)="editEnable()">{{reportParameters.name}}</h4>
|
||||||
<div *ngFor="let field of reportParameters.definition.parameters">
|
<div *ngFor="let field of reportParameters.definition.parameters">
|
||||||
<div [ngSwitch]="field.type">
|
<div [ngSwitch]="field.type">
|
||||||
<div *ngSwitchCase="'integer'">
|
<div *ngSwitchCase="'integer'">
|
||||||
|
@@ -63,6 +63,7 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges {
|
|||||||
private dropDownSub;
|
private dropDownSub;
|
||||||
private reportParamsSub;
|
private reportParamsSub;
|
||||||
private paramOpts;
|
private paramOpts;
|
||||||
|
private isEditable: boolean = false;
|
||||||
|
|
||||||
constructor(private translate: AlfrescoTranslationService,
|
constructor(private translate: AlfrescoTranslationService,
|
||||||
private analyticsService: AnalyticsService,
|
private analyticsService: AnalyticsService,
|
||||||
@@ -210,4 +211,24 @@ export class AnalyticsReportParametersComponent implements OnInit, OnChanges {
|
|||||||
this.reportParamsSub.unsubscribe();
|
this.reportParamsSub.unsubscribe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public editEnable() {
|
||||||
|
this.isEditable = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public editDisable() {
|
||||||
|
this.isEditable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public editTitle() {
|
||||||
|
this.reportParamsSub = this.analyticsService.updateReport(this.reportParameters.id, this.reportParameters.name).subscribe(
|
||||||
|
(res: ReportParametersModel) => {
|
||||||
|
this.editDisable();
|
||||||
|
},
|
||||||
|
(err: any) => {
|
||||||
|
console.log(err);
|
||||||
|
this.onError.emit(err);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ export class AnalyticsComponent implements OnChanges {
|
|||||||
|
|
||||||
reportParamQuery = new ReportQuery();
|
reportParamQuery = new ReportQuery();
|
||||||
|
|
||||||
reports: any[];
|
reports: Chart[];
|
||||||
|
|
||||||
public barChartOptions: any = {
|
public barChartOptions: any = {
|
||||||
responsive: true,
|
responsive: true,
|
||||||
@@ -107,4 +107,8 @@ export class AnalyticsComponent implements OnChanges {
|
|||||||
let clone = JSON.parse(JSON.stringify(report));
|
let clone = JSON.parse(JSON.stringify(report));
|
||||||
report.datasets = clone.datasets;
|
report.datasets = clone.datasets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public editReport(report: Chart) {
|
||||||
|
console.log(report);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -178,6 +178,13 @@ export class AnalyticsService {
|
|||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateReport(reportId: number, name: string): Observable<any> {
|
||||||
|
return Observable.fromPromise(this.apiService.getInstance().activiti.reportApi.updateReport(reportId, name))
|
||||||
|
.map((res: any) => {
|
||||||
|
console.log('upload');
|
||||||
|
}).catch(this.handleError);
|
||||||
|
}
|
||||||
|
|
||||||
private handleError(error: Response) {
|
private handleError(error: Response) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return Observable.throw(error.json().error || 'Server error');
|
return Observable.throw(error.json().error || 'Server error');
|
||||||
|
Reference in New Issue
Block a user