for pool in data:
self.assertIn('pool_name', pool)
self.assertIn('type', pool)
+ self.assertIn('application_metadata', pool)
self.assertIn('flags', pool)
self.assertIn('flags_names', pool)
self.assertNotIn('stats', pool)
for pool in data:
self.assertIn('pool_name', pool)
self.assertIn('type', pool)
+ self.assertIn('application_metadata', pool)
self.assertIn('flags', pool)
self.assertIn('stats', pool)
self.assertIn('flags_names', pool)
self.assertEqual(pool[k], int(v), '{}: {} != {}'.format(k, pool[k], v))
elif k == 'application_metadata':
self.assertEqual(pool[k],
- {name: {} for name in data['application_metadata'].split(',')})
+ data['application_metadata'].split(','))
elif k == 'pool':
self.assertEqual(pool['pool_name'], v)
elif k in ['compression_mode', 'compression_algorithm',
res[attr] = {1: 'replicated', 3: 'erasure'}[pool[attr]]
elif attr == 'crush_rule':
res[attr] = crush_rules[pool[attr]]
+ elif attr == 'application_metadata':
+ res[attr] = pool[attr].keys()
else:
res[attr] = pool[attr]
import {
PerformanceCounterComponent
} from './ceph/performance-counter/performance-counter/performance-counter.component';
+import { PoolListComponent } from './ceph/pool/pool-list/pool-list.component';
import { RgwBucketListComponent } from './ceph/rgw/rgw-bucket-list/rgw-bucket-list.component';
import { RgwDaemonListComponent } from './ceph/rgw/rgw-daemon-list/rgw-daemon-list.component';
import { RgwUserListComponent } from './ceph/rgw/rgw-user-list/rgw-user-list.component';
{ path: 'block/rbd', component: RbdListComponent, canActivate: [AuthGuardService] },
{ path: 'rbd/add', component: RbdFormComponent, canActivate: [AuthGuardService] },
{ path: 'rbd/edit/:pool/:name', component: RbdFormComponent, canActivate: [AuthGuardService] },
+ { path: 'pool', component: PoolListComponent, canActivate: [AuthGuardService] },
{
path: 'perf_counters/:type/:id',
component: PerformanceCounterComponent,
import { ClusterModule } from './cluster/cluster.module';
import { DashboardModule } from './dashboard/dashboard.module';
import { PerformanceCounterModule } from './performance-counter/performance-counter.module';
+import { PoolModule } from './pool/pool.module';
import { RgwModule } from './rgw/rgw.module';
@NgModule({
RgwModule,
PerformanceCounterModule,
BlockModule,
+ PoolModule,
CephfsModule,
SharedModule
],
--- /dev/null
+<nav aria-label="breadcrumb">
+ <ol class="breadcrumb">
+ <li class="breadcrumb-item active">Pools</li>
+ </ol>
+</nav>
+<cd-table [data]="pools"
+ (fetchData)="getPoolList()"
+ [columns]="columns"
+ selectionType="single"
+ (updateSelection)="updateSelection($event)">
+ <tabset cdTableDetail *ngIf="selection.hasSingleSelection">
+ <tab i18n-heading
+ heading="Details">
+ <cd-table-key-value [data]="selection.first()" [autoReload]="false">
+ </cd-table-key-value>
+ </tab>
+ </tabset>
+</cd-table>
+
--- /dev/null
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { TabsModule } from 'ngx-bootstrap/tabs/tabs.module';
+
+import { SharedModule } from '../../../shared/shared.module';
+import { PoolListComponent } from './pool-list.component';
+
+describe('PoolListComponent', () => {
+ let component: PoolListComponent;
+ let fixture: ComponentFixture<PoolListComponent>;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ PoolListComponent ],
+ imports: [
+ SharedModule,
+ TabsModule.forRoot(),
+ HttpClientTestingModule
+ ],
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(PoolListComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
--- /dev/null
+import { Component } from '@angular/core';
+
+import { PoolService } from '../../../shared/api/pool.service';
+import { CdTableColumn } from '../../../shared/models/cd-table-column';
+import { CdTableSelection } from '../../../shared/models/cd-table-selection';
+
+@Component({
+ selector: 'cd-pool-list',
+ templateUrl: './pool-list.component.html',
+ styleUrls: ['./pool-list.component.scss']
+})
+export class PoolListComponent {
+ pools = [];
+ columns: CdTableColumn[];
+ selection = new CdTableSelection();
+
+ constructor(
+ private poolService: PoolService,
+ ) {
+ this.columns = [
+ {
+ prop: 'pool_name',
+ name: 'Name',
+ flexGrow: 3
+ },
+ {
+ prop: 'type',
+ name: 'Type',
+ flexGrow: 2
+ },
+ {
+ prop: 'application_metadata',
+ name: 'Applications',
+ flexGrow: 3
+ },
+ {
+ prop: 'pg_placement_num',
+ name: 'Placement Groups',
+ flexGrow: 1,
+ cellClass: 'text-right'
+ },
+ {
+ prop: 'size',
+ name: 'Replica Size',
+ flexGrow: 1,
+ cellClass: 'text-right'
+ },
+ {
+ prop: 'last_change',
+ name: 'Last Change',
+ flexGrow: 1,
+ cellClass: 'text-right'
+ },
+ {
+ prop: 'erasure_code_profile',
+ name: 'Erasure Coded Profile',
+ flexGrow: 2
+ },
+ {
+ prop: 'crush_rule',
+ name: 'Crush Ruleset',
+ flexGrow: 2
+ }
+ ];
+ }
+
+ updateSelection(selection: CdTableSelection) {
+ this.selection = selection;
+ }
+
+ getPoolList() {
+ this.poolService.getList().subscribe((pools: any[]) => {
+ this.pools = pools;
+ });
+ }
+
+}
--- /dev/null
+import { CommonModule } from '@angular/common';
+import { NgModule } from '@angular/core';
+
+import { TabsModule } from 'ngx-bootstrap/tabs';
+
+import { ServicesModule } from '../../shared/services/services.module';
+import { SharedModule } from '../../shared/shared.module';
+import { PoolListComponent } from './pool-list/pool-list.component';
+
+@NgModule({
+ imports: [
+ CommonModule,
+ TabsModule,
+ SharedModule,
+ ServicesModule
+ ],
+ exports: [
+ PoolListComponent
+ ],
+ declarations: [
+ PoolListComponent
+ ]
+})
+export class PoolModule { }
</ul>
</li>
+ <!-- Pools -->
+ <li routerLinkActive="active"
+ class="tc_menuitem tc_menuitem_pool">
+ <a i18n
+ routerLink="/pool">Pool
+ </a>
+ </li>
+
<!-- Block -->
<li dropdown
routerLinkActive="active"
constructor(private http: HttpClient) {
}
+ getList () {
+ return this.http.get('api/pool');
+ }
+
list(attrs = []) {
const attrsStr = attrs.join(',');
return this.http.get(`api/pool?attrs=${attrsStr}`).toPromise().then((resp: any) => {