summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.html50
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.scss68
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.spec.ts73
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.ts65
4 files changed, 256 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.html
new file mode 100644
index 00000000..8aba64c9
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.html
@@ -0,0 +1,50 @@
+<div id="page-content" style=" width: 100%">
+
+ <div>
+ <h1 class="heading-page" id="CacheRegions">Cache Regions</h1>
+ </div>
+
+ <div style="margin-right:20px; text-align:justify; text-align-last:auto;">
+ <p>
+ These are the regions which are currently defined in the cache. 'Items' and 'Bytes' refer to the elements currently in memory (not spooled).
+ You can clear all items for a region by clicking on the Clear icon next to the desired region below. You can also <a href="admin#/jcs_admin" ng-click="clearAllFuncPopUp();">clear all regions</a>
+ which empties the entire cache.</p>
+ </div>
+
+
+
+ <mat-accordion displayMode="flat" multi class="mat-table">
+ <section matSort class="mat-header-row">
+ <span class="mat-header-cell" >Cache Name</span>
+ <span class="mat-header-cell" ># of Items</span>
+ <span class="mat-header-cell" >Bytes</span>
+ <span class="mat-header-cell" >Status</span>
+ <span class="mat-header-cell" >Memory Hits</span>
+ <span class="mat-header-cell">Aux Hits</span>
+ <span class="mat-header-cell" >Not Expired MissesFound Misses</span>
+ <span class="mat-header-cell" >Expired Misses</span>
+ <span class="mat-header-cell" >Clear?</span>
+ <span class="mat-header-cell" >Items</span>
+
+ </section>
+
+ <mat-expansion-panel *ngFor="let item of regions">
+ <mat-expansion-panel-header >
+ <span class="mat-cell"><a href="javascript:;" (click)="showRegionDetails(item.cacheName)">{{item.cacheName}}</a></span>
+ <span class="mat-cell">{{item.byteCount}}</span>
+ <span class="mat-cell">{{item.status}}</span>
+ <span class="mat-cell">{{item.hitCountRam}}</span>
+ <span class="mat-cell">{{item.hitCountAux}}</span>
+ <span class="mat-cell">{{item.missCountNotFound}}</span>
+ <span class="mat-cell">{{item.missCountExpired}}</span>
+ <span class="mat-cell">{{item.hitCountRam}}</span>
+ <span class="mat-cell">clear</span>
+ <span class="mat-cell">delete</span>
+
+ </mat-expansion-panel-header>
+ <div><pre>{{item.items | json }}</pre></div>
+ </mat-expansion-panel>
+
+ </mat-accordion>
+
+ \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.scss b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.scss
new file mode 100644
index 00000000..39ba7164
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.scss
@@ -0,0 +1,68 @@
+table {
+ width: 100%;
+}
+
+.mat-form-field {
+ font-size: 14px;
+ width: 100%;
+}
+
+td, th {
+ width: 25%;
+}
+
+
+.mat-accordion .mat-header-row {
+ padding-left: 1.5rem;
+ padding-right: 2rem;
+ border-bottom: none;
+}
+
+
+//copied from https://github.com/angular/material2/blob/master/src/lib/table/table.scss
+$mat-header-row-height: 56px;
+$mat-row-height: 48px;
+$mat-row-horizontal-padding: 24px;
+
+
+.mat-header-row {
+ min-height: $mat-header-row-height;
+}
+
+.mat-row {
+ min-height: $mat-row-height;
+}
+
+.mat-row, .mat-header-row {
+ display: flex;
+ border-bottom-width: 1px;
+ border-bottom-style: solid;
+ align-items: center;
+ padding: 0 $mat-row-horizontal-padding;
+ box-sizing: border-box;
+
+ // Workaround for https://goo.gl/pFmjJD in IE 11. Adds a pseudo
+ // element that will stretch the row the correct height. See:
+ // https://connect.microsoft.com/IE/feedback/details/802625
+ &::after {
+ display: inline-block;
+ min-height: inherit;
+ content: '';
+ }
+}
+
+:host::ng-deep .mat-cell, .mat-header-cell {
+ flex: 1;
+ overflow: hidden;
+ word-wrap: break-word;
+ font-weight: bold;
+ font-size: 14px;
+ color: #343a40;
+}
+
+.mat-expansion-panel {
+ margin: 0;
+ border-radius: 4px;
+ overflow: hidden;
+ transition: margin 225ms cubic-bezier(.4,0,.2,1),box-shadow 280ms cubic-bezier(.4,0,.2,1);
+} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.spec.ts
new file mode 100644
index 00000000..01ec7a92
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.spec.ts
@@ -0,0 +1,73 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { CacheAdminComponent } from './cache-admin.component';
+import { MatExpansionModule } from '@angular/material';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { AdminService } from '../admin.service';
+import { Observable } from 'rxjs/Observable';
+import 'rxjs/add/observable/of';
+import { CookieService } from 'ngx-cookie-service';
+import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
+import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
+import { SuccessModalComponent } from '../../modals/success-modal/success-modal.component';
+
+
+describe('CacheAdminComponent', () => {
+ let component: CacheAdminComponent;
+ let fixture: ComponentFixture<CacheAdminComponent>;
+ let adminService:AdminService;
+
+ var stubData1={"data":'{"data":"cachedRegions"}'};
+ var stubData2={"data":"stubData2"};
+
+ beforeEach(async(() => {
+
+ TestBed.configureTestingModule({
+ declarations: [
+ CacheAdminComponent,
+ SuccessModalComponent,
+ ],
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
+ imports:[
+ MatExpansionModule,
+ HttpClientTestingModule,
+ NgbModule.forRoot()
+ ],
+ providers:[CookieService,AdminService],
+ })
+ TestBed.overrideModule(BrowserDynamicTestingModule,{
+ set:{
+ entryComponents:[SuccessModalComponent]
+ }
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(CacheAdminComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ adminService=TestBed.get(AdminService);
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+
+ describe('it should test ngOnInit method',()=>{
+ it('should test ngOnInit',()=>{
+ let spy=spyOn(adminService,'getCacheRegions').and.returnValue(Observable.of(stubData1));
+ component.ngOnInit();
+ expect(spy).toHaveBeenCalled();
+ })
+ })
+
+ it('it should test showRegionDetails method',()=>{
+ let spy=spyOn(adminService,'getCacheRegionDetails').and.returnValue(Observable.of(stubData2));
+ component.showRegionDetails("string");
+ expect(spy).toHaveBeenCalled();
+ })
+
+});
+
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.ts
new file mode 100644
index 00000000..d9f5ca80
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/admin/cache-admin/cache-admin.component.ts
@@ -0,0 +1,65 @@
+import {Component, OnInit, ViewChild} from '@angular/core';
+import { AdminService } from '../admin.service';
+import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
+import { SuccessModalComponent } from 'src/app/modals/success-modal/success-modal.component';
+
+
+@Component({
+ selector: 'app-cache-admin',
+ templateUrl: './cache-admin.component.html',
+ styleUrls: ['./cache-admin.component.scss']
+})
+export class CacheAdminComponent implements OnInit {
+
+ constructor(public adminService:AdminService,private ngModal: NgbModal) {
+
+ }
+
+ response: any;
+ regions:any;
+ message;any;
+
+ ngOnInit() {
+
+ let result = this.adminService.getCacheRegions();
+ result.subscribe(data => {
+ this.response = data;
+ this.regions = JSON.parse(this.response.data);
+ });
+
+ }
+
+
+ showRegionDetails(item: any) {
+ let response;
+
+ this.adminService.getCacheRegionDetails(item).subscribe(data => {
+ response = data;
+
+
+ let message = response.data;
+ let msgParsed = JSON.stringify(message);
+
+
+
+ if(message!=null && message!=''){
+ var status = response.status;
+ var htmlstring = message.toString();
+ var htmlStrReplace = htmlstring.replace(/['"]+/g, '');
+ var htmlStrReplaceSplit = htmlStrReplace.split('\n');
+ var dataStr = htmlStrReplace.replace(/\\n/g, "\n");
+ this.message = dataStr;
+
+ }
+
+
+
+ });
+ const modalRef = this.ngModal.open(SuccessModalComponent);
+ modalRef.componentInstance.message = this.message;
+
+
+ }
+
+}
+