Fixes for missing button actions
This commit is contained in:
Generated
-264
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,13 @@
|
|||||||
<div class="container m-b-20" fxLayout="row" fxLayoutGap="20px">
|
<div class="container m-b-20" fxLayout="row" fxLayoutGap="20px">
|
||||||
<h2 class="no-m">Scheduler Status: {{ schedulerData.active === true ? 'Active' : 'Inactive' }}</h2>
|
<h2 class="no-m">Scheduler Status: {{ schedulerActive ? 'Active' : 'Inactive' }}</h2>
|
||||||
<button mat-raised-button class="suspend">
|
<button mat-raised-button class="suspend" (click)="suspendScheduler()" *ngIf="schedulerActive">
|
||||||
<fa-icon icon="times-circle"></fa-icon>
|
<fa-icon icon="times-circle"></fa-icon>
|
||||||
Suspend
|
Suspend
|
||||||
</button>
|
</button>
|
||||||
|
<button mat-raised-button class="activate" (click)="activateScheduler()" *ngIf="!schedulerActive">
|
||||||
|
<fa-icon icon="times-circle"></fa-icon>
|
||||||
|
Activate
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@@ -51,7 +55,7 @@
|
|||||||
|
|
||||||
<ng-container matColumnDef="previousRunStatus">
|
<ng-container matColumnDef="previousRunStatus">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Previous Run Status </th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Previous Run Status </th>
|
||||||
<td mat-cell *matCellDef="let job">
|
<td mat-cell *matCellDef="let job" class="center">
|
||||||
<fa-icon *ngIf="job.lastRunHistory.status === 'success'" class="success" matTooltip="Successful" matTooltipPosition="right" icon="check-circle" size="lg"></fa-icon>
|
<fa-icon *ngIf="job.lastRunHistory.status === 'success'" class="success" matTooltip="Successful" matTooltipPosition="right" icon="check-circle" size="lg"></fa-icon>
|
||||||
<fa-icon *ngIf="!(job.lastRunHistory.status == 'success')" class="fail" matTooltip="Failed" matTooltipPosition="right" icon="times-circle" size="lg"></fa-icon>
|
<fa-icon *ngIf="!(job.lastRunHistory.status == 'success')" class="fail" matTooltip="Failed" matTooltipPosition="right" icon="times-circle" size="lg"></fa-icon>
|
||||||
</td>
|
</td>
|
||||||
@@ -59,7 +63,7 @@
|
|||||||
|
|
||||||
<ng-container matColumnDef="currentlyRunning">
|
<ng-container matColumnDef="currentlyRunning">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Currently Running </th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Currently Running </th>
|
||||||
<td mat-cell *matCellDef="let job">
|
<td mat-cell *matCellDef="let job" class="center">
|
||||||
<div [className]="job.currentlyRunning === true ? 'currently-running' : 'not-currently-running'">
|
<div [className]="job.currentlyRunning === true ? 'currently-running' : 'not-currently-running'">
|
||||||
<fa-icon matTooltip="{{ job.currentlyRunning === true ? 'Yes' : 'No' }}" matTooltipPosition="right" icon="circle" size="lg"></fa-icon>
|
<fa-icon matTooltip="{{ job.currentlyRunning === true ? 'Yes' : 'No' }}" matTooltipPosition="right" icon="circle" size="lg"></fa-icon>
|
||||||
</div>
|
</div>
|
||||||
@@ -68,7 +72,7 @@
|
|||||||
|
|
||||||
<ng-container matColumnDef="errorLog">
|
<ng-container matColumnDef="errorLog">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Error Log </th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Error Log </th>
|
||||||
<td mat-cell *matCellDef="let job">
|
<td mat-cell *matCellDef="let job" class="center">
|
||||||
<button mat-icon-button class="errorlog" *ngIf="!(job.lastRunHistory.status == 'success')" matTooltip="Error Log" matTooltipPosition="right" >
|
<button mat-icon-button class="errorlog" *ngIf="!(job.lastRunHistory.status == 'success')" matTooltip="Error Log" matTooltipPosition="right" >
|
||||||
<fa-icon icon="exclamation-circle" size="lg"></fa-icon>
|
<fa-icon icon="exclamation-circle" size="lg"></fa-icon>
|
||||||
</button>
|
</button>
|
||||||
@@ -80,18 +84,18 @@
|
|||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
<mat-paginator [pageSizeOptions]="[50, 100]" showFirstLastButtons></mat-paginator>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container" fxLayout="row" fxLayoutGap="20px">
|
<div class="container space-top" fxLayout="row" fxLayoutGap="20px">
|
||||||
<button mat-raised-button color="primary">
|
<button mat-raised-button color="primary" (click)="runSelectedJobs()">
|
||||||
<fa-icon icon="play"></fa-icon>
|
<fa-icon icon="play"></fa-icon>
|
||||||
Run Selected Jobs
|
Run Selected Jobs
|
||||||
</button>
|
</button>
|
||||||
<button mat-raised-button color="primary">
|
<button mat-raised-button color="primary" (click)="refresh()">
|
||||||
<fa-icon icon="sync"></fa-icon>
|
<fa-icon icon="sync"></fa-icon>
|
||||||
Refresh
|
Refresh
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -27,6 +27,15 @@ table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.suspend {
|
.suspend {
|
||||||
background: #ffa726;
|
background: #32cd32;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.activate {
|
||||||
|
background: #f44366;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.space-top {
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ import { Component, OnInit, ViewChild } from '@angular/core';
|
|||||||
import { MatPaginator } from '@angular/material/paginator';
|
import { MatPaginator } from '@angular/material/paginator';
|
||||||
import { MatSort } from '@angular/material/sort';
|
import { MatSort } from '@angular/material/sort';
|
||||||
import { MatTableDataSource } from '@angular/material/table';
|
import { MatTableDataSource } from '@angular/material/table';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
|
||||||
import { SelectionModel } from '@angular/cdk/collections';
|
import { SelectionModel } from '@angular/cdk/collections';
|
||||||
|
|
||||||
/** rxjs Imports */
|
/** rxjs Imports */
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
|
import { SystemService } from '../system.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage scheduler jobs component.
|
* Manage scheduler jobs component.
|
||||||
@@ -29,6 +29,10 @@ export class ManageSchedulerJobsComponent implements OnInit {
|
|||||||
dataSource: MatTableDataSource<any>;
|
dataSource: MatTableDataSource<any>;
|
||||||
/** Initialize Selection */
|
/** Initialize Selection */
|
||||||
selection = new SelectionModel<any>(true, []);
|
selection = new SelectionModel<any>(true, []);
|
||||||
|
/** Scheduler Status */
|
||||||
|
schedulerActive = false;
|
||||||
|
/** Jobs counter */
|
||||||
|
jobsCounter: any = 0;
|
||||||
|
|
||||||
/** Paginator for table. */
|
/** Paginator for table. */
|
||||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||||
@@ -39,12 +43,7 @@ export class ManageSchedulerJobsComponent implements OnInit {
|
|||||||
* Retrieves the scheduler jobs data from `resolve`.
|
* Retrieves the scheduler jobs data from `resolve`.
|
||||||
* @param {ActivatedRoute} route Activated Route.
|
* @param {ActivatedRoute} route Activated Route.
|
||||||
*/
|
*/
|
||||||
constructor(private route: ActivatedRoute) {
|
constructor(private systemService: SystemService) {}
|
||||||
this.route.data.subscribe((data: { jobsScheduler: any }) => {
|
|
||||||
this.jobData = data.jobsScheduler[0];
|
|
||||||
this.schedulerData = data.jobsScheduler[1];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters data in manage scheduler jobs table based on passed value.
|
* Filters data in manage scheduler jobs table based on passed value.
|
||||||
@@ -59,8 +58,7 @@ export class ManageSchedulerJobsComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
isAllSelected() {
|
isAllSelected() {
|
||||||
const numSelected = this.selection.selected.length;
|
const numSelected = this.selection.selected.length;
|
||||||
const numRows = this.dataSource.data.length;
|
return numSelected === this.jobsCounter;
|
||||||
return numSelected === numRows;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,24 +75,61 @@ export class ManageSchedulerJobsComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.setJobs();
|
this.setJobs();
|
||||||
this.dataSource.sortingDataAccessor = (item, property) => {
|
this.getScheduler();
|
||||||
switch (property) {
|
|
||||||
case 'previousRunStatus': return item.lastRunHistory.status;
|
|
||||||
case 'errorLog': return item.lastRunHistory.status;
|
|
||||||
case 'previousRunTime': return new Date(item.lastRunHistory.jobRunStartTime);
|
|
||||||
case 'nextRunTime': return new Date(item.nextRunTime);
|
|
||||||
default: return item[property];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the data source, paginator and sorter for manage scheduler jobs table.
|
* Initializes the data source, paginator and sorter for manage scheduler jobs table.
|
||||||
*/
|
*/
|
||||||
setJobs() {
|
setJobs() {
|
||||||
this.dataSource = new MatTableDataSource(this.jobData);
|
this.systemService.getJobs()
|
||||||
this.dataSource.paginator = this.paginator;
|
.subscribe((jobData: any) => {
|
||||||
this.dataSource.sort = this.sort;
|
this.dataSource = new MatTableDataSource(jobData);
|
||||||
|
this.dataSource.paginator = this.paginator;
|
||||||
|
this.dataSource.sort = this.sort;
|
||||||
|
this.jobsCounter = jobData.length;
|
||||||
|
this.selection.clear();
|
||||||
|
this.dataSource.sortingDataAccessor = (item, property) => {
|
||||||
|
switch (property) {
|
||||||
|
case 'previousRunStatus': return item.lastRunHistory.status;
|
||||||
|
case 'errorLog': return item.lastRunHistory.status;
|
||||||
|
case 'previousRunTime': return new Date(item.lastRunHistory.jobRunStartTime);
|
||||||
|
case 'nextRunTime': return new Date(item.nextRunTime);
|
||||||
|
default: return item[property];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getScheduler() {
|
||||||
|
this.systemService.getScheduler()
|
||||||
|
.subscribe((schedulerData: any) => {
|
||||||
|
this.schedulerData = schedulerData;
|
||||||
|
this.schedulerActive = this.schedulerData.active;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
suspendScheduler(): void {
|
||||||
|
this.systemService.runCommandOnScheduler('stop')
|
||||||
|
.subscribe(() => {
|
||||||
|
this.getScheduler();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
activateScheduler(): void {
|
||||||
|
this.systemService.runCommandOnScheduler('start')
|
||||||
|
.subscribe(() => {
|
||||||
|
this.getScheduler();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
runSelectedJobs(): void {
|
||||||
|
this.selection.selected.forEach((job) => {
|
||||||
|
this.systemService.runSelectedJob(job.jobId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
refresh(): void {
|
||||||
|
this.setJobs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -413,9 +413,7 @@ const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: ManageSchedulerJobsComponent,
|
component: ManageSchedulerJobsComponent,
|
||||||
resolve: {
|
resolve: {},
|
||||||
jobsScheduler: ManageSchedulerJobsResolver
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':id',
|
path: ':id',
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { Observable } from 'rxjs';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class SystemService {
|
export class SystemService {
|
||||||
|
emptyPayload: any = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {HttpClient} http Http Client to send requests.
|
* @param {HttpClient} http Http Client to send requests.
|
||||||
@@ -257,10 +258,27 @@ export class SystemService {
|
|||||||
* @param {any} Job Job to be updated.
|
* @param {any} Job Job to be updated.
|
||||||
* @returns {Observable<any>}
|
* @returns {Observable<any>}
|
||||||
*/
|
*/
|
||||||
updateScheduler(jobId: string, job: any): Observable<any> {
|
runCommandOnScheduler(command: string): Observable<any> {
|
||||||
|
return this.http.post(`/scheduler?command=` + command, this.emptyPayload);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} jobId Job ID of Job to be updated.
|
||||||
|
* @param {any} Job Job to be updated.
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
updateScheduler(jobId: string, job: any): Observable<any> {
|
||||||
return this.http.put(`/jobs/${jobId}`, job);
|
return this.http.put(`/jobs/${jobId}`, job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param jobId Job Id to be edited
|
||||||
|
* @returns {Observable<any>} Fetches Scheduler Job.
|
||||||
|
*/
|
||||||
|
runSelectedJob(jobId: string): Observable<any> {
|
||||||
|
return this.http.post(`/jobs/${jobId}?command=executeJob`, this.emptyPayload);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @param jobId Job Id to view the history.
|
* @param jobId Job Id to view the history.
|
||||||
* @returns {Observable<any>} Fetches History of the Job.
|
* @returns {Observable<any>} Fetches History of the Job.
|
||||||
|
|||||||
Reference in New Issue
Block a user