]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Rename cephfs component to 'cephfs-detail'
authorTiago Melo <tmelo@suse.com>
Wed, 9 May 2018 17:24:03 +0000 (18:24 +0100)
committerTiago Melo <tmelo@suse.com>
Thu, 31 May 2018 21:50:43 +0000 (22:50 +0100)
Signed-off-by: Tiago Melo <tmelo@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.html [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.scss [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-list/cephfs-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs/cephfs.component.html [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs/cephfs.component.scss [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs/cephfs.component.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs/cephfs.component.ts [deleted file]

diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.html
new file mode 100644 (file)
index 0000000..f561170
--- /dev/null
@@ -0,0 +1,60 @@
+<tabset *ngIf="selectedItem">
+  <tab i18n-heading
+       heading="Details">
+    <div class="row">
+      <div class="col-sm-6">
+        <fieldset>
+          <legend i18n>Ranks</legend>
+
+          <cd-table [data]="ranks.data"
+                    [columns]="ranks.columns"
+                    (fetchData)="refresh()"
+                    [toolHeader]="false">
+          </cd-table>
+        </fieldset>
+
+        <cd-table-key-value [data]="standbys">
+        </cd-table-key-value>
+      </div>
+
+      <div class="col-sm-6">
+        <fieldset>
+          <legend i18n>Pools</legend>
+
+          <cd-table [data]="pools.data"
+                    [columns]="pools.columns"
+                    [toolHeader]="false">
+          </cd-table>
+
+        </fieldset>
+      </div>
+    </div>
+
+    <div class="row"
+         *ngFor="let mdsCounter of objectValues(mdsCounters); trackBy: trackByFn">
+      <div class="cold-md-12">
+        <cd-cephfs-chart [mdsCounter]="mdsCounter"></cd-cephfs-chart>
+      </div>
+    </div>
+
+    <!-- templates -->
+    <ng-template #poolUsageTpl
+                 let-row="row">
+      <cd-usage-bar [totalBytes]="row.size"
+                    [usedBytes]="row.used"></cd-usage-bar>
+    </ng-template>
+
+    <ng-template #activityTmpl
+                 let-row="row"
+                 let-value="value">
+      {{ row.state === 'standby-replay' ? 'Evts' : 'Reqs' }}: {{ value | dimless }} /s
+    </ng-template>
+  </tab>
+  <tab i18n-heading
+       heading="Clients: {{ clientCount }}"
+       (select)="clientsSelect=true"
+       (deselect)="clientsSelect=false">
+    <cd-clients [id]="id"
+                *ngIf="clientsSelect"></cd-clients>
+  </tab>
+</tabset>
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.scss
new file mode 100644 (file)
index 0000000..d82829a
--- /dev/null
@@ -0,0 +1,3 @@
+.progress {
+  margin-bottom: 0px;
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts
new file mode 100644 (file)
index 0000000..f1d19b4
--- /dev/null
@@ -0,0 +1,66 @@
+import { Component, Input } from '@angular/core';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { RouterTestingModule } from '@angular/router/testing';
+
+import { ChartsModule } from 'ng2-charts/ng2-charts';
+import { BsDropdownModule, ProgressbarModule, TabsModule } from 'ngx-bootstrap';
+import { Observable } from 'rxjs/Observable';
+
+import { CephfsService } from '../../../shared/api/cephfs.service';
+import { SharedModule } from '../../../shared/shared.module';
+import { CephfsChartComponent } from '../cephfs-chart/cephfs-chart.component';
+import { ClientsComponent } from '../clients/clients.component';
+import { CephfsDetailComponent } from './cephfs-detail.component';
+
+@Component({ selector: 'cd-cephfs-chart', template: '' })
+class CephfsChartStubComponent {
+  @Input() mdsCounter: any;
+}
+
+@Component({ selector: 'cd-clients', template: '' })
+class ClientsStubComponent {
+  @Input() mdsCounter: any;
+}
+
+describe('CephfsDetailComponent', () => {
+  let component: CephfsDetailComponent;
+  let fixture: ComponentFixture<CephfsDetailComponent>;
+
+  const fakeFilesystemService = {
+    getCephfs: (id) => {
+      return Observable.create((observer) => {
+        return () => console.log('disposed');
+      });
+    },
+    getMdsCounters: (id) => {
+      return Observable.create((observer) => {
+        return () => console.log('disposed');
+      });
+    }
+  };
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      imports: [
+        SharedModule,
+        ChartsModule,
+        RouterTestingModule,
+        BsDropdownModule.forRoot(),
+        ProgressbarModule.forRoot(),
+        TabsModule.forRoot()
+      ],
+      declarations: [CephfsDetailComponent, CephfsChartStubComponent, ClientsStubComponent],
+      providers: [{ provide: CephfsService, useValue: fakeFilesystemService }]
+    }).compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(CephfsDetailComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts
new file mode 100644 (file)
index 0000000..3782610
--- /dev/null
@@ -0,0 +1,129 @@
+import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
+
+import * as _ from 'lodash';
+
+import { CephfsService } from '../../../shared/api/cephfs.service';
+import { CdTableSelection } from '../../../shared/models/cd-table-selection';
+import { DimlessBinaryPipe } from '../../../shared/pipes/dimless-binary.pipe';
+import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
+
+@Component({
+  selector: 'cd-cephfs-detail',
+  templateUrl: './cephfs-detail.component.html',
+  styleUrls: ['./cephfs-detail.component.scss']
+})
+export class CephfsDetailComponent implements OnChanges, OnInit {
+  @ViewChild('poolUsageTpl') poolUsageTpl: TemplateRef<any>;
+  @ViewChild('activityTmpl') activityTmpl: TemplateRef<any>;
+
+  @Input() selection: CdTableSelection;
+
+  selectedItem: any;
+
+  id: number;
+  name: string;
+  ranks: any;
+  pools: any;
+  standbys = [];
+  clientCount: number;
+  mdsCounters = {};
+
+  objectValues = Object.values;
+  clientsSelect = false;
+
+  constructor(
+    private cephfsService: CephfsService,
+    private dimlessBinary: DimlessBinaryPipe,
+    private dimless: DimlessPipe
+  ) {}
+
+  ngOnChanges() {
+    if (this.selection.hasSelection) {
+      this.selectedItem = this.selection.first();
+
+      if (this.id !== this.selectedItem.id) {
+        this.id = this.selectedItem.id;
+        this.ranks.data = [];
+        this.pools.data = [];
+        this.standbys = [];
+        this.mdsCounters = {};
+      }
+    }
+  }
+
+  ngOnInit() {
+    this.ranks = {
+      columns: [
+        { prop: 'rank' },
+        { prop: 'state' },
+        { prop: 'mds', name: 'Daemon' },
+        { prop: 'activity', cellTemplate: this.activityTmpl },
+        { prop: 'dns', name: 'Dentries', pipe: this.dimless },
+        { prop: 'inos', name: 'Inodes', pipe: this.dimless }
+      ],
+      data: []
+    };
+
+    this.pools = {
+      columns: [
+        { prop: 'pool' },
+        { prop: 'type' },
+        { prop: 'size', pipe: this.dimlessBinary },
+        {
+          name: 'Usage',
+          cellTemplate: this.poolUsageTpl,
+          comparator: (valueA, valueB, rowA, rowB, sortDirection) => {
+            const valA = rowA.used / rowA.avail;
+            const valB = rowB.used / rowB.avail;
+
+            if (valA === valB) {
+              return 0;
+            }
+
+            if (valA > valB) {
+              return 1;
+            } else {
+              return -1;
+            }
+          }
+        }
+      ],
+      data: []
+    };
+  }
+
+  refresh() {
+    this.cephfsService.getCephfs(this.id).subscribe((data: any) => {
+      this.ranks.data = data.cephfs.ranks;
+      this.pools.data = data.cephfs.pools;
+      this.pools.data.forEach((pool) => {
+        pool.size = pool.used + pool.avail;
+      });
+      this.standbys = [
+        {
+          key: 'Standby daemons',
+          value: data.standbys.map((value) => value.name).join(', ')
+        }
+      ];
+      this.name = data.cephfs.name;
+      this.clientCount = data.cephfs.client_count;
+    });
+
+    this.cephfsService.getMdsCounters(this.id).subscribe((data) => {
+      _.each(this.mdsCounters, (value, key) => {
+        if (data[key] === undefined) {
+          delete this.mdsCounters[key];
+        }
+      });
+
+      _.each(data, (mdsData: any, mdsName) => {
+        mdsData.name = mdsName;
+        this.mdsCounters[mdsName] = mdsData;
+      });
+    });
+  }
+
+  trackByFn(index, item) {
+    return item.name;
+  }
+}
index e72238d0eb6376225d3c6a5e4d3944f9a9b38c06..6494b2f14058944636ddc1d272d23b1c7270f291 100644 (file)
@@ -13,7 +13,7 @@
           forceIdentifier="true"
           selectionType="single"
           (updateSelection)="updateSelection($event)">
-  <cd-cephfs cdTableDetail
+  <cd-cephfs-detail cdTableDetail
              [selection]="selection">
-  </cd-cephfs>
+  </cd-cephfs-detail>
 </cd-table>
index 96497150b07a3e055e27f3a3088e1a7a82d5a930..65856bd5c7bfff1fdc9c8dd4386e18611aed7594 100644 (file)
@@ -8,8 +8,8 @@ import { CdTableSelection } from '../../../shared/models/cd-table-selection';
 import { SharedModule } from '../../../shared/shared.module';
 import { CephfsListComponent } from './cephfs-list.component';
 
-@Component({ selector: 'cd-cephfs', template: '' })
-class CephfsStubComponent {
+@Component({ selector: 'cd-cephfs-detail', template: '' })
+class CephfsDetailStubComponent {
   @Input() selection: CdTableSelection;
 }
 
@@ -28,7 +28,7 @@ describe('CephfsListComponent', () => {
   beforeEach(async(() => {
     TestBed.configureTestingModule({
       imports: [SharedModule],
-      declarations: [CephfsListComponent, CephfsStubComponent],
+      declarations: [CephfsListComponent, CephfsDetailStubComponent],
       providers: [{ provide: CephfsService, useValue: fakeService }]
     }).compileComponents();
   }));
index 62a9f368042965110815d2b616c9a3bbd4823fb8..eb6d2979f620554cff4728586252beac8c70a98a 100644 (file)
@@ -8,8 +8,8 @@ import { TabsModule } from 'ngx-bootstrap/tabs';
 import { AppRoutingModule } from '../../app-routing.module';
 import { SharedModule } from '../../shared/shared.module';
 import { CephfsChartComponent } from './cephfs-chart/cephfs-chart.component';
+import { CephfsDetailComponent } from './cephfs-detail/cephfs-detail.component';
 import { CephfsListComponent } from './cephfs-list/cephfs-list.component';
-import { CephfsComponent } from './cephfs/cephfs.component';
 import { ClientsComponent } from './clients/clients.component';
 
 @NgModule({
@@ -21,6 +21,6 @@ import { ClientsComponent } from './clients/clients.component';
     ProgressbarModule.forRoot(),
     TabsModule.forRoot()
   ],
-  declarations: [CephfsComponent, ClientsComponent, CephfsChartComponent, CephfsListComponent]
+  declarations: [CephfsDetailComponent, ClientsComponent, CephfsChartComponent, CephfsListComponent]
 })
 export class CephfsModule {}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs/cephfs.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs/cephfs.component.html
deleted file mode 100644 (file)
index 219defb..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<tabset *ngIf="selectedItem">
-  <tab i18n-heading
-       heading="Details">
-    <div class="row">
-      <div class="col-sm-6">
-        <fieldset>
-          <legend i18n>Ranks</legend>
-
-          <cd-table [data]="ranks.data"
-                    [columns]="ranks.columns"
-                    (fetchData)="refresh()"
-                    [toolHeader]="false">
-          </cd-table>
-        </fieldset>
-
-        <cd-table-key-value [data]="standbys">
-        </cd-table-key-value>
-      </div>
-
-      <div class="col-sm-6">
-        <fieldset>
-          <legend i18n>Pools</legend>
-
-          <cd-table [data]="pools.data"
-                    [columns]="pools.columns"
-                    [toolHeader]="false">
-          </cd-table>
-
-        </fieldset>
-      </div>
-    </div>
-
-    <div class="row"
-         *ngFor="let mdsCounter of objectValues(mdsCounters); trackBy: trackByFn">
-      <div class="cold-md-12">
-        <cd-cephfs-chart [mdsCounter]="mdsCounter"></cd-cephfs-chart>
-      </div>
-    </div>
-
-    <!-- templates -->
-    <ng-template #poolUsageTpl
-                 let-row="row">
-      <cd-usage-bar [totalBytes]="row.size"
-                    [usedBytes]="row.used"></cd-usage-bar>
-    </ng-template>
-
-    <ng-template #activityTmpl
-                 let-row="row"
-                 let-value="value">
-      {{ row.state === 'standby-replay' ? 'Evts' : 'Reqs' }}: {{ value | dimless }} /s
-    </ng-template>
-  </tab>
-  <tab i18n-heading
-       heading="Clients: {{ clientCount }}"
-       (select)="clientsSelect=true"
-       (deselect)="clientsSelect=false">
-    <cd-clients [id]="id" *ngIf="clientsSelect"></cd-clients>
-  </tab>
-</tabset>
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs/cephfs.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs/cephfs.component.scss
deleted file mode 100644 (file)
index d82829a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-.progress {
-  margin-bottom: 0px;
-}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs/cephfs.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs/cephfs.component.spec.ts
deleted file mode 100644 (file)
index 9d6fe41..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-import { NO_ERRORS_SCHEMA } from '@angular/core';
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import { RouterTestingModule } from '@angular/router/testing';
-
-import { Observable } from 'rxjs/Observable';
-
-import { CephfsService } from '../../../shared/api/cephfs.service';
-import { DimlessBinaryPipe } from '../../../shared/pipes/dimless-binary.pipe';
-import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
-import { FormatterService } from '../../../shared/services/formatter.service';
-import { CephfsComponent } from './cephfs.component';
-
-describe('CephfsComponent', () => {
-  let component: CephfsComponent;
-  let fixture: ComponentFixture<CephfsComponent>;
-
-  const fakeFilesystemService = {
-    getCephfs: (id) => {
-      return Observable.create((observer) => {
-        return () => console.log('disposed');
-      });
-    },
-    getMdsCounters: (id) => {
-      return Observable.create((observer) => {
-        return () => console.log('disposed');
-      });
-    }
-  };
-
-  beforeEach(async(() => {
-    TestBed.configureTestingModule({
-      imports: [RouterTestingModule],
-      schemas: [NO_ERRORS_SCHEMA],
-      declarations: [CephfsComponent, DimlessPipe],
-      providers: [
-        DimlessPipe,
-        DimlessBinaryPipe,
-        FormatterService,
-        { provide: CephfsService, useValue: fakeFilesystemService }
-      ]
-    }).compileComponents();
-  }));
-
-  beforeEach(() => {
-    fixture = TestBed.createComponent(CephfsComponent);
-    component = fixture.componentInstance;
-    fixture.detectChanges();
-  });
-
-  it('should create', () => {
-    expect(component).toBeTruthy();
-  });
-});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs/cephfs.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs/cephfs.component.ts
deleted file mode 100644 (file)
index f35dee2..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-import { Component, Input, OnChanges, OnInit, TemplateRef, ViewChild } from '@angular/core';
-
-import * as _ from 'lodash';
-
-import { CephfsService } from '../../../shared/api/cephfs.service';
-import { CdTableSelection } from '../../../shared/models/cd-table-selection';
-import { DimlessBinaryPipe } from '../../../shared/pipes/dimless-binary.pipe';
-import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
-
-@Component({
-  selector: 'cd-cephfs',
-  templateUrl: './cephfs.component.html',
-  styleUrls: ['./cephfs.component.scss']
-})
-export class CephfsComponent implements OnChanges, OnInit {
-  @ViewChild('poolUsageTpl') poolUsageTpl: TemplateRef<any>;
-  @ViewChild('activityTmpl') activityTmpl: TemplateRef<any>;
-
-  @Input() selection: CdTableSelection;
-
-  selectedItem: any;
-
-  id: number;
-  name: string;
-  ranks: any;
-  pools: any;
-  standbys = [];
-  clientCount: number;
-  mdsCounters = {};
-
-  objectValues = Object.values;
-  clientsSelect = false;
-
-  constructor(
-    private cephfsService: CephfsService,
-    private dimlessBinary: DimlessBinaryPipe,
-    private dimless: DimlessPipe
-  ) {}
-
-  ngOnChanges() {
-    if (this.selection.hasSelection) {
-      this.selectedItem = this.selection.first();
-
-      if (this.id !== this.selectedItem.id) {
-        this.id = this.selectedItem.id;
-        this.ranks.data = [];
-        this.pools.data = [];
-        this.standbys = [];
-        this.mdsCounters = {};
-      }
-    }
-  }
-
-  ngOnInit() {
-    this.ranks = {
-      columns: [
-        { prop: 'rank' },
-        { prop: 'state' },
-        { prop: 'mds', name: 'Daemon' },
-        { prop: 'activity', cellTemplate: this.activityTmpl },
-        { prop: 'dns', name: 'Dentries', pipe: this.dimless },
-        { prop: 'inos', name: 'Inodes', pipe: this.dimless }
-      ],
-      data: []
-    };
-
-    this.pools = {
-      columns: [
-        { prop: 'pool' },
-        { prop: 'type' },
-        { prop: 'size', pipe: this.dimlessBinary },
-        {
-          name: 'Usage',
-          cellTemplate: this.poolUsageTpl,
-          comparator: (valueA, valueB, rowA, rowB, sortDirection) => {
-            const valA = rowA.used / rowA.avail;
-            const valB = rowB.used / rowB.avail;
-
-            if (valA === valB) {
-              return 0;
-            }
-
-            if (valA > valB) {
-              return 1;
-            } else {
-              return -1;
-            }
-          }
-        }
-      ],
-      data: []
-    };
-  }
-
-  refresh() {
-    this.cephfsService.getCephfs(this.id).subscribe((data: any) => {
-      this.ranks.data = data.cephfs.ranks;
-      this.pools.data = data.cephfs.pools;
-      this.pools.data.forEach((pool) => {
-        pool.size = pool.used + pool.avail;
-      });
-      this.standbys = [
-        {
-          key: 'Standby daemons',
-          value: data.standbys.map((value) => value.name).join(', ')
-        }
-      ];
-      this.name = data.cephfs.name;
-      this.clientCount = data.cephfs.client_count;
-    });
-
-    this.cephfsService.getMdsCounters(this.id).subscribe((data) => {
-      _.each(this.mdsCounters, (value, key) => {
-        if (data[key] === undefined) {
-          delete this.mdsCounters[key];
-        }
-      });
-
-      _.each(data, (mdsData: any, mdsName) => {
-        mdsData.name = mdsName;
-        this.mdsCounters[mdsName] = mdsData;
-      });
-    });
-  }
-
-  trackByFn(index, item) {
-    return item.name;
-  }
-}