@@ -616,7 +616,8 @@ const routes: Routes = [
|
||||
ManageTaxGroupTemplateResolver,
|
||||
EditTaxGroupResolver,
|
||||
ProductsMixTemplateResolver,
|
||||
FixedDepositProductAndTemplateResolver
|
||||
FixedDepositProductAndTemplateResolver,
|
||||
FloatingRatesResolver
|
||||
]
|
||||
})
|
||||
export class ProductsRoutingModule { }
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<h1 mat-dialog-title> Error Log </h1>
|
||||
|
||||
<div mat-dialog-content>
|
||||
|
||||
<p> {{ data }}</p>
|
||||
|
||||
</div>
|
||||
|
||||
<mat-dialog-actions align="left">
|
||||
<button mat-raised-button mat-dialog-close>Cancel</button>
|
||||
</mat-dialog-actions>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ErrorDialogComponent } from './error-dialog.component';
|
||||
|
||||
describe('ErrorDialogComponent', () => {
|
||||
let component: ErrorDialogComponent;
|
||||
let fixture: ComponentFixture<ErrorDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ErrorDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ErrorDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
/** Angular Imports. */
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-error-dialog',
|
||||
templateUrl: './error-dialog.component.html',
|
||||
styleUrls: ['./error-dialog.component.scss']
|
||||
})
|
||||
export class ErrorDialogComponent {
|
||||
|
||||
/**
|
||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||
* @param {any} data Provides any data.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<ErrorDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import { KeyboardShortcutsDialogComponent } from './keyboard-shortcuts-dialog/ke
|
||||
/** Custom Modules */
|
||||
import { IconsModule } from './icons.module';
|
||||
import { MaterialModule } from './material.module';
|
||||
import { ErrorDialogComponent } from './error-dialog/error-dialog.component';
|
||||
|
||||
/**
|
||||
* Shared Module
|
||||
@@ -47,7 +48,8 @@ import { MaterialModule } from './material.module';
|
||||
EnableDialogComponent,
|
||||
DisableDialogComponent,
|
||||
ConfirmationDialogComponent,
|
||||
KeyboardShortcutsDialogComponent
|
||||
KeyboardShortcutsDialogComponent,
|
||||
ErrorDialogComponent
|
||||
],
|
||||
exports: [
|
||||
FileUploadComponent,
|
||||
@@ -58,7 +60,8 @@ import { MaterialModule } from './material.module';
|
||||
IconsModule,
|
||||
MaterialModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule
|
||||
ReactiveFormsModule,
|
||||
ErrorDialogComponent
|
||||
]
|
||||
})
|
||||
export class SharedModule { }
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
<div class="container">
|
||||
|
||||
<div fxLayout="row" fxLayoutGap="20px">
|
||||
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Filter By Version</mat-label>
|
||||
<input matInput (keyup)="applyFilter($event.target.value)">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="mat-elevation-z8">
|
||||
|
||||
<table mat-table [dataSource]="dataSource" matSort>
|
||||
|
||||
<ng-container matColumnDef="version" >
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Version </th>
|
||||
<td mat-cell *matCellDef="let jobHistoryData"> {{ jobHistoryData.version }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="run_start_time">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Run Start Time </th>
|
||||
<td mat-cell *matCellDef="let jobHistoryData"> {{ jobHistoryData.jobRunStartTime }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="status">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
|
||||
<td mat-cell *matCellDef="let jobHistoryData">
|
||||
<fa-icon *ngIf="jobHistoryData.status === 'success'" class="success" matTooltip="Successful" matTooltipPosition="right" icon="check-circle" size="lg"></fa-icon>
|
||||
<fa-icon *ngIf="!(jobHistoryData.status == 'success')" class="fail" matTooltip="Failed" matTooltipPosition="right" icon="times-circle" size="lg"></fa-icon>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="run_type">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Run Type </th>
|
||||
<td mat-cell *matCellDef="let jobHistoryData">{{ jobHistoryData.triggerType }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="error_log">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Error Log </th>
|
||||
<td mat-cell *matCellDef="let jobHistoryData">
|
||||
<button mat-icon-button class="errorlog" *ngIf="!(jobHistoryData.status == 'success')" matTooltip="Error Log" matTooltipPosition="right" (click)="openError(jobHistoryData.version)">
|
||||
<fa-icon icon="exclamation-circle" size="lg"></fa-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="select-row"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
table {
|
||||
width: 100%;
|
||||
|
||||
.select-row:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.success {
|
||||
color: #32cd32;
|
||||
}
|
||||
|
||||
.fail {
|
||||
color: #f44366;
|
||||
}
|
||||
|
||||
.currently-running {
|
||||
color: #32cd32;
|
||||
}
|
||||
|
||||
.not-currently-running {
|
||||
color: #f44366;
|
||||
}
|
||||
|
||||
.errorlog {
|
||||
color: #ffa726;
|
||||
}
|
||||
|
||||
.suspend {
|
||||
background: #ffa726;
|
||||
color: #ffffff;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ViewHistorySchedulerJobComponent } from './view-history-scheduler-job.component';
|
||||
|
||||
describe('ViewHistorySchedulerJobComponent', () => {
|
||||
let component: ViewHistorySchedulerJobComponent;
|
||||
let fixture: ComponentFixture<ViewHistorySchedulerJobComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewHistorySchedulerJobComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ViewHistorySchedulerJobComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
/** Angular Imports. */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ErrorDialogComponent } from 'app/shared/error-dialog/error-dialog.component';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-view-history-scheduler-job',
|
||||
templateUrl: './view-history-scheduler-job.component.html',
|
||||
styleUrls: ['./view-history-scheduler-job.component.scss']
|
||||
})
|
||||
export class ViewHistorySchedulerJobComponent implements OnInit {
|
||||
|
||||
/** Job History data. */
|
||||
jobHistoryData: any;
|
||||
/** Columns to be displayed in Scheduler Job History. */
|
||||
displayedColumns: string[] = ['version', 'run_start_time', 'status', 'run_type', 'error_log'];
|
||||
/** Data source for Scheduler Job History table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
/** Paginator for Scheduler Job History table. */
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
/** Sorter for Scheduler Job History table. */
|
||||
@ViewChild(MatSort, { static: true }) sort: MatSort;
|
||||
|
||||
/**
|
||||
* Retrieves the scheduler Job History data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private dialog: MatDialog,
|
||||
private router: Router ) {
|
||||
this.route.data.subscribe(( data: { jobsSchedulerHistory: any }) => {
|
||||
this.jobHistoryData = data.jobsSchedulerHistory;
|
||||
console.log(this.jobHistoryData);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters data in scheduler Job History table based on passed value.
|
||||
* @param {string} filterValue Value to filter data.
|
||||
*/
|
||||
applyFilter(filterValue: string) {
|
||||
const filterObject = [{
|
||||
id: 'version',
|
||||
value: filterValue
|
||||
}];
|
||||
this.dataSource.filter = JSON.stringify(filterObject);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.setJobHistory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the data source, paginator and sorter for scheduler Job History table.
|
||||
*/
|
||||
setJobHistory() {
|
||||
this.dataSource = new MatTableDataSource(this.jobHistoryData.pageItems);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
/** Search By Version */
|
||||
this.dataSource.filterPredicate =
|
||||
(data: any, filtersJson: string) => {
|
||||
const matchFilter: any[] = [];
|
||||
const filters = JSON.parse(filtersJson);
|
||||
filters.forEach((filter: any) => {
|
||||
const val = data[filter.id] === null ? '' : data[filter.id];
|
||||
if (filter.value !== '') {
|
||||
matchFilter.push(val === parseInt(filter.value, 10));
|
||||
} else if (filter.value === '') {
|
||||
matchFilter.push(val.toString().toLowerCase().includes(filter.value.toLowerCase()));
|
||||
}
|
||||
});
|
||||
return matchFilter.every(Boolean);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Open Error Dialog.
|
||||
* @param version version Id.
|
||||
*/
|
||||
openError(version: any) {
|
||||
const openErrorLogDialog = this.dialog.open(ErrorDialogComponent, {
|
||||
width: '400px',
|
||||
data: this.jobHistoryData.pageItems.filter( (data: any) => data.version === version )[0].jobRunErrorLog
|
||||
});
|
||||
openErrorLogDialog.afterClosed().subscribe((response: any) => {
|
||||
this.router.navigate(['']);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/** Angular Imports */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { Observable, forkJoin } from 'rxjs';
|
||||
|
||||
/** Custom Services */
|
||||
import { SystemService } from '../../system.service';
|
||||
|
||||
/**
|
||||
* View History Scheduler Jobs data resolver.
|
||||
*/
|
||||
@Injectable()
|
||||
export class ViewHistorySchedulerJobsResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* Returns the Scheduler Jobs History data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const jobId = route.paramMap.get('id');
|
||||
return this.systemService.getHistoryScheduler(jobId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -83,6 +83,8 @@ import { ViewRoleResolver } from './roles-and-permissions/view-role/view-role.re
|
||||
import { EntityToEntityMappingResolver } from './entity-to-entity-mapping/entity-to-entity-mapping.resolver';
|
||||
import { ConfigureMakerCheckerTasksComponent } from './configure-maker-checker-tasks/configure-maker-checker-tasks.component';
|
||||
import { MakerCheckerTasksResolver } from './configure-maker-checker-tasks/configure-maker-checker-tasks.resolver';
|
||||
import { ViewHistorySchedulerJobComponent } from './manage-scheduler-jobs/view-history-scheduler-job/view-history-scheduler-job.component';
|
||||
import { ViewHistorySchedulerJobsResolver } from './manage-scheduler-jobs/view-history-scheduler-job/view-history-scheduler-job.resolver';
|
||||
|
||||
const routes: Routes = [
|
||||
Route.withShell([
|
||||
@@ -418,6 +420,14 @@ const routes: Routes = [
|
||||
resolve: {
|
||||
jobSelected: ManageSchedulerJobResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'viewhistory',
|
||||
component: ViewHistorySchedulerJobComponent,
|
||||
data: { title: extract('Scheduler Job History'), breadcrumb: 'View History' },
|
||||
resolve: {
|
||||
jobsSchedulerHistory: ViewHistorySchedulerJobsResolver
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -589,7 +599,8 @@ const routes: Routes = [
|
||||
ManageSchedulerJobResolver,
|
||||
ViewRoleResolver,
|
||||
EntityToEntityMappingResolver,
|
||||
MakerCheckerTasksResolver
|
||||
MakerCheckerTasksResolver,
|
||||
ViewHistorySchedulerJobsResolver
|
||||
]
|
||||
})
|
||||
export class SystemRoutingModule { }
|
||||
|
||||
@@ -44,10 +44,11 @@ import { CreateReportComponent } from './manage-reports/create-report/create-rep
|
||||
import { EditReportComponent } from './manage-reports/edit-report/edit-report.component';
|
||||
import { AuditTrailsComponent } from './audit-trails/audit-trails.component';
|
||||
import { ViewAuditComponent } from './audit-trails/view-audit/view-audit.component';
|
||||
import { ColumnDialogComponent } from './manage-data-tables/column-dialog/column-dialog.component';
|
||||
import { ViewHistorySchedulerJobComponent } from './manage-scheduler-jobs/view-history-scheduler-job/view-history-scheduler-job.component';
|
||||
import { EditHookComponent } from './manage-hooks/edit-hook/edit-hook.component';
|
||||
import { ViewHookComponent } from './manage-hooks/view-hook/view-hook.component';
|
||||
import { CreateHookComponent } from './manage-hooks/create-hook/create-hook.component';
|
||||
import { ColumnDialogComponent } from './manage-data-tables/column-dialog/column-dialog.component';
|
||||
import { ViewRoleComponent } from './roles-and-permissions/view-role/view-role.component';
|
||||
import { EditRoleComponent } from './roles-and-permissions/edit-role/edit-role.component';
|
||||
import { EntityToEntityMappingComponent } from './entity-to-entity-mapping/entity-to-entity-mapping.component';
|
||||
@@ -114,7 +115,9 @@ import { ConfigureMakerCheckerTasksComponent } from './configure-maker-checker-t
|
||||
EditRoleComponent,
|
||||
EntityToEntityMappingComponent,
|
||||
ConfigureMakerCheckerTasksComponent,
|
||||
CreateSurveyComponent
|
||||
]
|
||||
CreateSurveyComponent,
|
||||
EditSchedulerJobComponent,
|
||||
ViewHistorySchedulerJobComponent
|
||||
],
|
||||
})
|
||||
export class SystemModule { }
|
||||
|
||||
@@ -252,6 +252,14 @@ export class SystemService {
|
||||
return this.http.put(`/jobs/${jobId}`, job);
|
||||
}
|
||||
|
||||
/*
|
||||
* @param jobId Job Id to view the history.
|
||||
* @returns {Observable<any>} Fetches History of the Job.
|
||||
*/
|
||||
getHistoryScheduler(jobId: string): Observable<any> {
|
||||
return this.http.get(`/jobs/${jobId}/runhistory`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {any} code Code to be created.
|
||||
* @returns {Observable<any>}
|
||||
|
||||
Reference in New Issue
Block a user