committed by
Abhay Chawla
parent
0229cf2515
commit
40e328ceb4
@@ -0,0 +1,49 @@
|
||||
<div class="container m-b-20" fxLayout="row" fxLayoutAlign="end" fxLayoutGap="20px">
|
||||
<button mat-raised-button color="primary">
|
||||
<fa-icon icon="plus"></fa-icon>
|
||||
Create Hook
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div fxLayout="row" fxLayoutGap="20px">
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Filter</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="name">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Hook Template </th>
|
||||
<td mat-cell *matCellDef="let hook"> {{ hook.name }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="displayName">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Hook Name </th>
|
||||
<td mat-cell *matCellDef="let hook"> {{ hook.displayName }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="isActive">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
|
||||
<td mat-cell *matCellDef="let hook">
|
||||
<div [className]="hook.isActive === true ? 'true' : 'false'">
|
||||
<fa-icon matTooltip="{{ hook.isActive === true ? 'Active' : 'Inactive' }}" matTooltipPosition="right" icon="circle" size="lg"></fa-icon>
|
||||
</div>
|
||||
</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>
|
||||
@@ -0,0 +1,15 @@
|
||||
table {
|
||||
width: 100%;
|
||||
|
||||
.select-row:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.true {
|
||||
color: #32cd32;
|
||||
}
|
||||
|
||||
.false {
|
||||
color: #f44366;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ManageHooksComponent } from './manage-hooks.component';
|
||||
|
||||
describe('ManageHooksComponent', () => {
|
||||
let component: ManageHooksComponent;
|
||||
let fixture: ComponentFixture<ManageHooksComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ManageHooksComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ManageHooksComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,65 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatTableDataSource, MatPaginator, MatSort } from '@angular/material';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { of } from 'rxjs';
|
||||
|
||||
/**
|
||||
* Manage Hooks component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-manage-hooks',
|
||||
templateUrl: './manage-hooks.component.html',
|
||||
styleUrls: ['./manage-hooks.component.scss']
|
||||
})
|
||||
export class ManageHooksComponent implements OnInit {
|
||||
|
||||
/** Hook data. */
|
||||
hookData: any;
|
||||
/** Columns to be displayed in manage hooks table. */
|
||||
displayedColumns: string[] = ['name', 'displayName', 'isActive'];
|
||||
/** Data source for manage hooks table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
/** Paginator for manage hooks table. */
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
/** Sorter for manage hooks table. */
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
/**
|
||||
* Retrieves the hooks data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe(( data: { hooks: any }) => {
|
||||
this.hookData = data.hooks;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters data in manage data tables table based on passed value.
|
||||
* @param {string} filterValue Value to filter data.
|
||||
*/
|
||||
applyFilter(filterValue: string) {
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the manage hooks table.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.setHooks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the data source, paginator and sorter for manage hooks table.
|
||||
*/
|
||||
setHooks() {
|
||||
this.dataSource = new MatTableDataSource(this.hookData);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/** Angular Imports */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Resolve } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/** Custom Services */
|
||||
import { SystemService } from '../system.service';
|
||||
|
||||
/**
|
||||
* Manage hooks data resolver.
|
||||
*/
|
||||
@Injectable()
|
||||
export class ManageHooksResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService System service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* Returns the manage hooks data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.systemService.getHooks();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,10 +11,12 @@ import { CodesComponent } from './codes/codes.component';
|
||||
import { CreateCodeComponent } from './codes/create-code/create-code.component';
|
||||
import { ExternalServicesComponent } from './external-services/external-services.component';
|
||||
import { ManageDataTablesComponent } from './manage-data-tables/manage-data-tables.component';
|
||||
import { ManageHooksComponent } from './manage-hooks/manage-hooks.component';
|
||||
|
||||
/** Custom Resolvers */
|
||||
import { CodesResolver } from './codes/codes.resolver';
|
||||
import { ManageDataTablesResolver } from './manage-data-tables/manage-data-tables.resolver';
|
||||
import { ManageHooksResolver } from './manage-hooks/manage-hooks.resolver';
|
||||
|
||||
const routes: Routes = [
|
||||
Route.withShell([
|
||||
@@ -58,6 +60,14 @@ const routes: Routes = [
|
||||
},
|
||||
data: { title: extract('Manage Data Tables'), breadcrumb: 'Manage Data Tables' },
|
||||
},
|
||||
{
|
||||
path: 'hooks',
|
||||
component: ManageHooksComponent,
|
||||
resolve: {
|
||||
hooks: ManageHooksResolver
|
||||
},
|
||||
data: { title: extract('Manage Hooks'), breadcrumb: 'Manage Hooks' },
|
||||
},
|
||||
]
|
||||
}
|
||||
])
|
||||
@@ -68,7 +78,8 @@ const routes: Routes = [
|
||||
exports: [RouterModule],
|
||||
providers: [
|
||||
CodesResolver,
|
||||
ManageDataTablesResolver
|
||||
ManageDataTablesResolver,
|
||||
ManageHooksResolver,
|
||||
]
|
||||
})
|
||||
export class SystemRoutingModule { }
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<p matLine>Define or modify Maker Checker tasks</p>
|
||||
</mat-list-item>
|
||||
|
||||
<mat-list-item>
|
||||
<mat-list-item [routerLink]="['hooks']">
|
||||
<mat-icon matListIcon>
|
||||
<fa-icon icon="anchor" size="sm"></fa-icon>
|
||||
</mat-icon>
|
||||
|
||||
@@ -11,6 +11,7 @@ import { SystemComponent } from './system.component';
|
||||
import { CreateCodeComponent } from './codes/create-code/create-code.component';
|
||||
import { ExternalServicesComponent } from './external-services/external-services.component';
|
||||
import { ManageDataTablesComponent } from './manage-data-tables/manage-data-tables.component';
|
||||
import { ManageHooksComponent } from './manage-hooks/manage-hooks.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -22,7 +23,8 @@ import { ManageDataTablesComponent } from './manage-data-tables/manage-data-tabl
|
||||
CodesComponent,
|
||||
CreateCodeComponent,
|
||||
ExternalServicesComponent,
|
||||
ManageDataTablesComponent
|
||||
ManageDataTablesComponent,
|
||||
ManageHooksComponent
|
||||
]
|
||||
})
|
||||
export class SystemModule { }
|
||||
|
||||
@@ -25,6 +25,13 @@ export class SystemService {
|
||||
return this.http.get('/datatables');
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} Hooks.
|
||||
*/
|
||||
getHooks(): Observable<any> {
|
||||
return this.http.get('/hooks');
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} Fetches Codes.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user