]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: move config table details to their own component
authorTatjana Dehler <tdehler@suse.com>
Mon, 8 Oct 2018 09:49:11 +0000 (11:49 +0200)
committerTatjana Dehler <tdehler@suse.com>
Tue, 9 Oct 2018 12:50:10 +0000 (14:50 +0200)
Fixes: http://tracker.ceph.com/issues/24455
Signed-off-by: Tatjana Dehler <tdehler@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.html [new file with mode: 0755]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.scss [new file with mode: 0755]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.spec.ts [new file with mode: 0755]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.ts [new file with mode: 0755]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts

index 357c8062a4a39e6c34d7ae2a440bea6de4c0cb4c..563871f53212df52c4d1f087f9ca07ec09dc9a09 100644 (file)
@@ -9,6 +9,7 @@ import { TabsModule } from 'ngx-bootstrap/tabs';
 
 import { SharedModule } from '../../shared/shared.module';
 import { PerformanceCounterModule } from '../performance-counter/performance-counter.module';
+import { ConfigurationDetailsComponent } from './configuration/configuration-details/configuration-details.component';
 import { ConfigurationComponent } from './configuration/configuration.component';
 import { HostDetailsComponent } from './hosts/host-details/host-details.component';
 import { HostsComponent } from './hosts/hosts.component';
@@ -41,7 +42,8 @@ import { OsdScrubModalComponent } from './osd/osd-scrub-modal/osd-scrub-modal.co
     OsdPerformanceHistogramComponent,
     OsdScrubModalComponent,
     OsdFlagsModalComponent,
-    HostDetailsComponent
+    HostDetailsComponent,
+    ConfigurationDetailsComponent
   ]
 })
 export class ClusterModule {}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.html
new file mode 100755 (executable)
index 0000000..ea9b527
--- /dev/null
@@ -0,0 +1,7 @@
+<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>
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.scss
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.spec.ts
new file mode 100755 (executable)
index 0000000..dd70c1d
--- /dev/null
@@ -0,0 +1,27 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { TabsModule } from 'ngx-bootstrap';
+
+import { configureTestBed } from '../../../../../testing/unit-test-helper';
+import { DataTableModule } from '../../../../shared/datatable/datatable.module';
+import { ConfigurationDetailsComponent } from './configuration-details.component';
+
+describe('ConfigurationDetailsComponent', () => {
+  let component: ConfigurationDetailsComponent;
+  let fixture: ComponentFixture<ConfigurationDetailsComponent>;
+
+  configureTestBed({
+    declarations: [ConfigurationDetailsComponent],
+    imports: [DataTableModule, TabsModule.forRoot()]
+  });
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(ConfigurationDetailsComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-details/configuration-details.component.ts
new file mode 100755 (executable)
index 0000000..359898d
--- /dev/null
@@ -0,0 +1,22 @@
+import { Component, Input, OnChanges } from '@angular/core';
+
+import { CdTableSelection } from '../../../../shared/models/cd-table-selection';
+
+@Component({
+  selector: 'cd-configuration-details',
+  templateUrl: './configuration-details.component.html',
+  styleUrls: ['./configuration-details.component.scss']
+})
+export class ConfigurationDetailsComponent implements OnChanges {
+  @Input()
+  selection: CdTableSelection;
+  selectedItem: any;
+
+  constructor() {}
+
+  ngOnChanges() {
+    if (this.selection.hasSelection) {
+      this.selectedItem = this.selection.first();
+    }
+  }
+}
index 7b3aeb3aa4ca5f7e7534686ac5f33b23f81569e8..b7012699ece28da3295d9b52af42ce5ac483ca3f 100644 (file)
       </select>
     </div>
   </div>
-  <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>
-  <ng-template #confValTpl let-value="value">
-    <span *ngIf="value">
-      <span *ngFor="let conf of value; last as isLast">
-        {{ conf.section }}: {{ conf.value }}{{ !isLast ? "," : "" }}<br/>
-      </span>
+  <cd-configuration-details cdTableDetail
+                            [selection]="selection">
+  </cd-configuration-details>
+</cd-table>
+
+<ng-template #confValTpl let-value="value">
+  <span *ngIf="value">
+    <span *ngFor="let conf of value; last as isLast">
+      {{ conf.section }}: {{ conf.value }}{{ !isLast ? "," : "" }}<br/>
     </span>
-  </ng-template>
-  <ng-template #confFlagTpl let-value="value">
-    <span *ngIf="value !== ''">
-      <span *ngFor="let flag of value; last as isLast">
-        <span title="{{ flags[flag] }}">
-          {{ flag | uppercase }}{{ !isLast ? "," : "" }}<br/>
-        </span>
+  </span>
+</ng-template>
+
+<ng-template #confFlagTpl let-value="value">
+  <span *ngIf="value !== ''">
+    <span *ngFor="let flag of value; last as isLast">
+      <span title="{{ flags[flag] }}">
+        {{ flag | uppercase }}{{ !isLast ? "," : "" }}<br/>
       </span>
     </span>
-  </ng-template>
-</cd-table>
+  </span>
+</ng-template>
index 9bc397802ade9fa59c1c6ef3dcbe6056738fdb11..4099de03ec11a2db0ec0388765ebc6ec5805c1c2 100644 (file)
@@ -8,6 +8,7 @@ import { TabsModule } from 'ngx-bootstrap/tabs/tabs.module';
 import { configureTestBed } from '../../../../testing/unit-test-helper';
 import { ConfigurationService } from '../../../shared/api/configuration.service';
 import { SharedModule } from '../../../shared/shared.module';
+import { ConfigurationDetailsComponent } from './configuration-details/configuration-details.component';
 import { ConfigurationComponent } from './configuration.component';
 
 describe('ConfigurationComponent', () => {
@@ -15,7 +16,7 @@ describe('ConfigurationComponent', () => {
   let fixture: ComponentFixture<ConfigurationComponent>;
 
   configureTestBed({
-    declarations: [ConfigurationComponent],
+    declarations: [ConfigurationComponent, ConfigurationDetailsComponent],
     providers: [ConfigurationService],
     imports: [
       SharedModule,