summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.ts')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.ts170
1 files changed, 134 insertions, 36 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.ts
index 42984f3e..6e44a698 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run.service.ts
@@ -1,47 +1,145 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
-import { Observable } from 'rxjs';
+import { Observable, throwError } from 'rxjs';
+import { retry, catchError } from 'rxjs/operators';
import { environment } from '../../../../../../environments/environment';
+import { HtmlParser } from '@angular/compiler';
@Injectable({
- providedIn: 'root'
+ providedIn: 'root'
})
export class RunService {
- finalArr : any;
- finalResponseArr : any;
+ finalArr: any;
+ finalResponseArr: any;
- constructor(private _http : HttpClient) {
+ constructor(private _http: HttpClient) {
+
+
+ }
+
+ getReportData(reportId: string): Observable<any> {
+ return this._http.get(environment.baseUrl + 'raptor.htm?action=report.run.container&c_master=' + reportId + '&refresh=Y');
+ }
+
+ getReportDataWithFormFields(queryString: string, reportId: string): Observable<any> {
+ return this._http.get(environment.baseUrl + 'raptor.htm?action=report.run.container&c_master=' + reportId + queryString + '&refresh=Y&display_content=Y&r_page=0');
+ }
+
+ getReportDataWithPageNo(reportId: string, pageNo: string): Observable<any> {
+ if (!pageNo || pageNo === null) {
+ pageNo = '0';
+ }
+ return this._http.get(environment.baseUrl + 'raptor.htm?action=report.run.container&c_master='
+ + reportId + '&refresh=Ydisplay_content=Y&r_page=' + pageNo);
+ }
+
+ getReportDataWithFormFieldsWithPageNo(queryString: string, reportId: string, pageNo: string): Observable<any> {
+ if (!pageNo || pageNo === null) {
+ pageNo = '0';
+ }
+ return this._http.get(environment.baseUrl + 'raptor.htm?action=report.run.container&c_master='
+ + reportId + queryString + '&refresh=Y&display_content=Y&r_page=' + pageNo);
+ }
+
+ getDefinitionPageDetails(IncomingReportId: number): Observable<any> {
+ return this._http.get(environment.baseUrl + 'report/wizard/retrieve_def_tab_wise_data/' + IncomingReportId, { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) });
+ }
+
+ refreshFormFields(reportId: string, queryString: string): Observable<any> {
+ return this._http.get(environment.baseUrl + 'raptor.htm?action=report.formfields.run.container&c_master=' + reportId + queryString);
+ }
+
+ getFormFieldGroupsData(reportId: string): Observable<any> {
+ return this._http.get(environment.baseUrl + 'report/wizard/get_formfield_groups_data/' + reportId);
+ }
+
+ downloadReportExcel(reportId: string): Observable<Blob> {
+ return this._http.get(environment.baseUrl + 'raptor.htm?c_master=' + reportId + '&r_action=report.download.excel.session&page_dowload=true', { responseType: 'blob' });
+ }
+
+ downloadReport(reportId: string, type: string): Observable<Blob> {
+ if (type === 'xlsx') {
+ return this._http.get(environment.baseUrl + 'raptor.htm?c_master=' + reportId + '&r_action=report.download.excel.session&page_download=false', { responseType: 'blob' });
+ } else if (type === 'pdf') {
+ return this._http.get(environment.baseUrl + 'raptor.htm?c_master=' + reportId + '&r_action=report.download.pdf.session&page_download=false', { responseType: 'blob' });
+ }
+ }
+
+ downloadSinglePageReport(reportId: string, type: string): Observable<Blob> {
+ return this._http.get(environment.baseUrl + 'raptor.htm?c_master=' + reportId + '&r_action=report.download.excel.session&page_download=true', { responseType: 'blob' });
+
+ }
+
+
+ getDashboardReportFormFields(reportId: string): Observable<any> {
+ return this._http.get(environment.baseUrl + 'raptor/dashboard/run/' + reportId);
+ }
+
+ runDashboardReport(reportId: string, queryString: string) {
+ return this._http.get(environment.baseUrl + 'raptor.htm?action=report.run.container&c_master=' + reportId + queryString + '&refresh=Y&display_content=Y&r_page=0', { responseType: 'text' });
+ }
+
+ downloadDashboardReportExcel(reportId: string): Observable<Blob> {
+ return this._http.get(environment.baseUrl + 'raptor.htm?c_master=' + reportId + '&r_action=report.download.excel.session', { responseType: 'blob' });
+ }
+
+ proceedWithLoad(object: Object) {
+ const headers = new HttpHeaders({
+ 'Content-Type': 'application/json'
+ });
+ return this._http.post(environment.baseUrl + 'proceed-with-load', object, { headers });
+ }
+
+ onDeleteFromUploadedReport(object: Object): Observable<any> {
+ const headers = new HttpHeaders({
+ 'Content-Type': 'application/json'
+ });
+ return this._http.post(environment.baseUrl + "delete-upload", object, { headers });
+ }
+ onResubmitUnplannedLTEUploadedReport(object: Object): Observable<any> {
+ const headers = new HttpHeaders({
+ 'Content-Type': 'application/json'
+ });
+ return this._http.post(environment.baseUrl + "resubmit-unplanned-lte-upload", object, { headers })
+ .pipe(retry(1),
+ catchError(this.handleError)
+ );
+ }
+
+ onAutomaticUploadedReport(): Observable<any> {
+ const headers = new HttpHeaders({
+ 'Content-Type': 'application/json'
+ });
+ return this._http.post(environment.baseUrl + 'automated-upload?'+'parentReportId=25633'+'&templateName=SUPER_E911_4G',{headers})
+ .pipe(
+ retry(1),
+ catchError(this.handleError)
+ );
+
+ }
+ onSubmitApproved(object:Object):Observable<any>{
+ const headers = new HttpHeaders({
+ 'Content-Type': 'application/json'
+ });
+
+ return this._http.post(environment.baseUrl + 'submit-approval',object,{headers})
+ .pipe(
+ retry(1),
+ catchError(this.handleError)
+ );
+ }
- }
-
- getReportData(reportId : string) : Observable<any>
- {
- return this._http.get(environment.baseUrl + "raptor.htm?action=report.run.container&c_master="+reportId+"&refresh=Y");
- }
-
- getReportDataWithFormFields(queryString : string, reportId : string) : Observable<any>
- {
- return this._http.get(environment.baseUrl + "raptor.htm?action=report.run.container&c_master="+reportId+queryString+"&refresh=Y&display_content=Y&r_page=0");
- }
-
- getDefinitionPageDetails(IncomingReportId : number): Observable <any>
- {
- return this._http.get(environment.baseUrl + "report/wizard/retrieve_def_tab_wise_data/" + IncomingReportId, { headers: new HttpHeaders({'Content-Type': 'application/json'})});
- }
-
- refreshFormFields(reportId : string, queryString : string ) : Observable<any>
- {
- return this._http.get(environment.baseUrl + "raptor.htm?action=report.formfields.run.container&c_master=" + reportId + queryString);
- }
-
- getFormFieldGroupsData(reportId : string) : Observable<any>
- {
- return this._http.get(environment.baseUrl + "report/wizard/get_formfield_groups_data/" + reportId);
- }
-
- downloadReportExcel(reportId : string) : Observable<Blob>
- {
- return this._http.get(environment.baseUrl + "raptor.htm?c_master="+reportId+"&r_action=report.download.excel.session", { responseType: 'blob' });
- }
+ handleError(error) {
+ let errorMessage = '';
+ if (error.error instanceof ErrorEvent) {
+ // client-side error
+ errorMessage = `Error: ${error.error.message}`;
+ } else {
+ // server-side error
+ errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`;
+ }
+ window.alert(errorMessage);
+ return throwError(errorMessage);
+ }
}