]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Add Api module
authorTiago Melo <tmelo@suse.com>
Thu, 29 Mar 2018 00:36:41 +0000 (01:36 +0100)
committerTiago Melo <tmelo@suse.com>
Mon, 9 Apr 2018 15:52:40 +0000 (16:52 +0100)
Moved all the api related services into the new module.

Signed-off-by: Tiago Melo <tmelo@suse.com>
76 files changed:
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/pool-detail/pool-detail.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs.service.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs.service.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs/cephfs.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs/cephfs.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/clients/clients.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/clients/clients.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor.service.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor.service.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd.service.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd.service.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard.service.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard.service.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/services/table-performance-counter.service.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/services/table-performance-counter.service.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/services/rgw-daemon.service.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/services/rgw-daemon.service.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/logout/logout.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/api.module.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/auth.service.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/cephfs.service.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/cephfs.service.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/dashboard.service.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/dashboard.service.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/host.service.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/monitor.service.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/monitor.service.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-daemon.service.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-daemon.service.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/table-performance-counter.service.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/table-performance-counter.service.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/tcmu-iscsi.service.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth.service.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/services/configuration.service.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/services/configuration.service.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/services/host.service.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/services/pool.service.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-mirroring.service.spec.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-mirroring.service.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/services/services.module.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/tcmu-iscsi.service.ts [deleted file]
src/pybind/mgr/dashboard/frontend/src/app/shared/shared.module.ts

index 78c19b072475846b7bc1c253533880402821bd39..526c951b511ae8e6d9963482d6cf3515bc3a5823 100644 (file)
@@ -1,7 +1,7 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { AppModule } from '../../../app.module';
-import { TcmuIscsiService } from '../../../shared/services/tcmu-iscsi.service';
+import { TcmuIscsiService } from '../../../shared/api/tcmu-iscsi.service';
 import { IscsiComponent } from './iscsi.component';
 
 describe('IscsiComponent', () => {
index 00416a27e0b7a134b3d9c4a432480d6ddae46de6..2e3f384a76da67d82d6070d548724b0b9493b991 100644 (file)
@@ -1,11 +1,11 @@
 import { Component } from '@angular/core';
 
+import { TcmuIscsiService } from '../../../shared/api/tcmu-iscsi.service';
 import { CellTemplate } from '../../../shared/enum/cell-template.enum';
 import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe';
 import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
 import { ListPipe } from '../../../shared/pipes/list.pipe';
 import { RelativeDatePipe } from '../../../shared/pipes/relative-date.pipe';
-import { TcmuIscsiService } from '../../../shared/services/tcmu-iscsi.service';
 
 @Component({
   selector: 'cd-iscsi',
index f20d0484c018d6d459aaa70bf0d6edeb58c587d1..a9deeae7eec0e23d3cd3d3633bc3e8b013316dcc 100644 (file)
@@ -5,7 +5,7 @@ import { BsDropdownModule, TabsModule } from 'ngx-bootstrap';
 import { ProgressbarModule } from 'ngx-bootstrap/progressbar';
 import { Observable } from 'rxjs/Observable';
 
-import { RbdMirroringService } from '../../../shared/services/rbd-mirroring.service';
+import { RbdMirroringService } from '../../../shared/api/rbd-mirroring.service';
 import { SharedModule } from '../../../shared/shared.module';
 import { MirrorHealthColorPipe } from '../mirror-health-color.pipe';
 import { MirroringComponent } from './mirroring.component';
index b52865e1180b59af860b556736cc65acbba3a99a..74de5628536db714022b3cd12ea053abee9b32e9 100644 (file)
@@ -3,9 +3,9 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
 
 import * as _ from 'lodash';
 
+import { RbdMirroringService } from '../../../shared/api/rbd-mirroring.service';
 import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';
 import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe';
-import { RbdMirroringService } from '../../../shared/services/rbd-mirroring.service';
 
 @Component({
   selector: 'cd-mirroring',
index 98ac59c66640ac86397eb41bd072f1785cb8e27d..56480770761bac96274a60da3084751dcc8f8923 100644 (file)
@@ -1,11 +1,11 @@
 import { Component, OnDestroy, OnInit } from '@angular/core';
 import { ActivatedRoute } from '@angular/router';
 
+import { PoolService } from '../../../shared/api/pool.service';
 import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';
 import { CdTableColumn } from '../../../shared/models/cd-table-column';
 import { DimlessBinaryPipe } from '../../../shared/pipes/dimless-binary.pipe';
 import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
-import { PoolService } from '../../../shared/services/pool.service';
 
 @Component({
   selector: 'cd-pool-detail',
index c47051c18e6e3705ec36e8cfe33df52bf7f8f846..16ccbf41e208fb490bdcb1cba8a941d5bde77359 100644 (file)
@@ -7,7 +7,6 @@ import { ProgressbarModule } from 'ngx-bootstrap/progressbar';
 import { AppRoutingModule } from '../../app-routing.module';
 import { SharedModule } from '../../shared/shared.module';
 import { CephfsChartComponent } from './cephfs-chart/cephfs-chart.component';
-import { CephfsService } from './cephfs.service';
 import { CephfsComponent } from './cephfs/cephfs.component';
 import { ClientsComponent } from './clients/clients.component';
 
@@ -19,7 +18,6 @@ import { ClientsComponent } from './clients/clients.component';
     ChartsModule,
     ProgressbarModule.forRoot()
   ],
-  declarations: [CephfsComponent, ClientsComponent, CephfsChartComponent],
-  providers: [CephfsService]
+  declarations: [CephfsComponent, ClientsComponent, CephfsChartComponent]
 })
 export class CephfsModule {}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs.service.spec.ts
deleted file mode 100644 (file)
index a9e59a0..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-import { HttpClientModule } from '@angular/common/http';
-import { inject, TestBed } from '@angular/core/testing';
-
-import { CephfsService } from './cephfs.service';
-
-describe('CephfsService', () => {
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      imports: [HttpClientModule],
-      providers: [CephfsService]
-    });
-  });
-
-  it(
-    'should be created',
-    inject([CephfsService], (service: CephfsService) => {
-      expect(service).toBeTruthy();
-    })
-  );
-});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs.service.ts
deleted file mode 100644 (file)
index a5c4994..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-
-@Injectable()
-export class CephfsService {
-  baseURL = 'api/cephfs';
-
-  constructor(private http: HttpClient) {}
-
-  getCephfs(id) {
-    return this.http.get(`${this.baseURL}/data/${id}`);
-  }
-
-  getClients(id) {
-    return this.http.get(`${this.baseURL}/clients/${id}`);
-  }
-
-  getMdsCounters(id) {
-    return this.http.get(`${this.baseURL}/mds_counters/${id}`);
-  }
-}
index 3df655defa6dfb020f670eb94a56626a19ef9dbd..e85f85f52040d302eddf85884d13e878752e257c 100644 (file)
@@ -5,9 +5,9 @@ import { ChartsModule } from 'ng2-charts/ng2-charts';
 import { BsDropdownModule, ProgressbarModule } 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 { CephfsService } from '../cephfs.service';
 import { CephfsComponent } from './cephfs.component';
 
 describe('CephfsComponent', () => {
index 774ce4e0ad67eb09ae18622e274a0d3243df5943..cdbbb6fef3c97e452bce8fd854f14c8208634c6f 100644 (file)
@@ -4,9 +4,9 @@ import { ActivatedRoute } from '@angular/router';
 import * as _ from 'lodash';
 import { Subscription } from 'rxjs/Subscription';
 
+import { CephfsService } from '../../../shared/api/cephfs.service';
 import { DimlessBinaryPipe } from '../../../shared/pipes/dimless-binary.pipe';
 import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
-import { CephfsService } from '../cephfs.service';
 
 @Component({
   selector: 'cd-cephfs',
index d3506a9068610fdea914329372457a758065f590..1f4d4a5c9165dcd9c7aba2d0e8923e1d80514152 100644 (file)
@@ -4,8 +4,8 @@ import { RouterTestingModule } from '@angular/router/testing';
 import { BsDropdownModule } from 'ngx-bootstrap';
 import { Observable } from 'rxjs/Observable';
 
+import { CephfsService } from '../../../shared/api/cephfs.service';
 import { SharedModule } from '../../../shared/shared.module';
-import { CephfsService } from '../cephfs.service';
 import { ClientsComponent } from './clients.component';
 
 describe('ClientsComponent', () => {
index fc2cbdec61b241e872e32467fa34ee9b8071fae8..6402da14ee7ad4a52adc4c8b00a852391fffb091 100644 (file)
@@ -1,8 +1,8 @@
 import { Component, OnDestroy, OnInit } from '@angular/core';
 import { ActivatedRoute } from '@angular/router';
 
+import { CephfsService } from '../../../shared/api/cephfs.service';
 import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';
-import { CephfsService } from '../cephfs.service';
 
 @Component({
   selector: 'cd-clients',
index d661f51baed4168b9d4036ef7925d214d825ddab..3840b48b6eae7280871c388999167ada3f986ce6 100644 (file)
@@ -10,14 +10,12 @@ import { SharedModule } from '../../shared/shared.module';
 import { PerformanceCounterModule } from '../performance-counter/performance-counter.module';
 import { ConfigurationComponent } from './configuration/configuration.component';
 import { HostsComponent } from './hosts/hosts.component';
-import { MonitorService } from './monitor.service';
 import { MonitorComponent } from './monitor/monitor.component';
 import { OsdDetailsComponent } from './osd/osd-details/osd-details.component';
 import { OsdListComponent } from './osd/osd-list/osd-list.component';
 import {
   OsdPerformanceHistogramComponent
 } from './osd/osd-performance-histogram/osd-performance-histogram.component';
-import { OsdService } from './osd/osd.service';
 
 @NgModule({
   entryComponents: [
@@ -39,10 +37,6 @@ import { OsdService } from './osd/osd.service';
     OsdListComponent,
     OsdDetailsComponent,
     OsdPerformanceHistogramComponent
-  ],
-  providers: [
-    MonitorService,
-    OsdService
   ]
 })
 export class ClusterModule {}
index 0d98766efd46b146cd739718b7b4f179e0886074..96a5a2cc4ba5c9bb06b490f02b6c92770eb61b0e 100644 (file)
@@ -3,7 +3,7 @@ import { FormsModule } from '@angular/forms';
 
 import { Observable } from 'rxjs/Observable';
 
-import { ConfigurationService } from '../../../shared/services/configuration.service';
+import { ConfigurationService } from '../../../shared/api/configuration.service';
 import { SharedModule } from '../../../shared/shared.module';
 import { ConfigurationComponent } from './configuration.component';
 
index 7c6ed68b448cd7cfa9b5f654f653ae6b956afe50..8df7729997188b34fcc103556a12e17d288fcd06 100644 (file)
@@ -1,6 +1,6 @@
 import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
 
-import { ConfigurationService } from '../../../shared/services/configuration.service';
+import { ConfigurationService } from '../../../shared/api/configuration.service';
 
 @Component({
   selector: 'cd-configuration',
index 28a193fd8ce8d0228b09f80a42bee375f0e840d5..bb22e86a9ab212965d787fd190e321840ddcdf05 100644 (file)
@@ -1,8 +1,8 @@
 import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
 
+import { HostService } from '../../../shared/api/host.service';
 import { CdTableColumn } from '../../../shared/models/cd-table-column';
 import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe';
-import { HostService } from '../../../shared/services/host.service';
 
 @Component({
   selector: 'cd-hosts',
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor.service.spec.ts
deleted file mode 100644 (file)
index 1d5f7de..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-import { HttpClientModule } from '@angular/common/http';
-import {
-  HttpClientTestingModule,
-  HttpTestingController
-} from '@angular/common/http/testing';
-import { inject, TestBed } from '@angular/core/testing';
-
-import { MonitorService } from './monitor.service';
-
-describe('MonitorService', () => {
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      providers: [MonitorService],
-      imports: [HttpClientTestingModule, HttpClientModule]
-    });
-  });
-
-  it('should be created', inject([MonitorService], (service: MonitorService) => {
-    expect(service).toBeTruthy();
-  }));
-});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor.service.ts
deleted file mode 100644 (file)
index 32057f3..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-
-@Injectable()
-export class MonitorService {
-  constructor(private http: HttpClient) {}
-
-  getMonitor() {
-    return this.http.get('api/monitor');
-  }
-}
index 0a23129667ef1e40e73940a0109e823b86316f98..de18f7924868933a25f2e3c469b9d3744ea5c6fc 100644 (file)
@@ -1,7 +1,7 @@
 import { Component } from '@angular/core';
 
+import { MonitorService } from '../../../shared/api/monitor.service';
 import { CellTemplate } from '../../../shared/enum/cell-template.enum';
-import { MonitorService } from '../monitor.service';
 
 @Component({
   selector: 'cd-monitor',
index c24618286de123d452a2d07f35b43df74481064b..19403193311ee559804c43e889ae60ca1a8b1c27 100644 (file)
@@ -5,11 +5,11 @@ import { TabsModule } from 'ngx-bootstrap';
 
 import { DataTableModule } from '../../../../shared/datatable/datatable.module';
 import { CdTableSelection } from '../../../../shared/models/cd-table-selection';
+import { SharedModule } from '../../../../shared/shared.module';
 import { PerformanceCounterModule } from '../../../performance-counter/performance-counter.module';
 import {
   OsdPerformanceHistogramComponent
 } from '../osd-performance-histogram/osd-performance-histogram.component';
-import { OsdService } from '../osd.service';
 import { OsdDetailsComponent } from './osd-details.component';
 
 describe('OsdDetailsComponent', () => {
@@ -22,13 +22,13 @@ describe('OsdDetailsComponent', () => {
         HttpClientModule,
         TabsModule.forRoot(),
         PerformanceCounterModule,
-        DataTableModule
+        DataTableModule,
+        SharedModule
       ],
       declarations: [
         OsdDetailsComponent,
         OsdPerformanceHistogramComponent
-      ],
-      providers: [OsdService]
+      ]
     })
     .compileComponents();
   }));
index 7f2af3724976efda0c01839b780909108225b6cb..5c4752d492ea1aa9d5c1c6e2dce1ce110d0ca673 100644 (file)
@@ -2,8 +2,8 @@ import { Component, Input, OnChanges } from '@angular/core';
 
 import * as _ from 'lodash';
 
+import { OsdService } from '../../../../shared/api/osd.service';
 import { CdTableSelection } from '../../../../shared/models/cd-table-selection';
-import { OsdService } from '../osd.service';
 
 @Component({
   selector: 'cd-osd-details',
index 7a1ef0254a8459b77e780d57f1abdf4d8b848d40..f9a60585c9da1b60609f69270afd7b57a26c4f1c 100644 (file)
@@ -7,12 +7,12 @@ import { ComponentsModule } from '../../../../shared/components/components.modul
 import { DataTableModule } from '../../../../shared/datatable/datatable.module';
 import { DimlessPipe } from '../../../../shared/pipes/dimless.pipe';
 import { FormatterService } from '../../../../shared/services/formatter.service';
+import { SharedModule } from '../../../../shared/shared.module';
 import { PerformanceCounterModule } from '../../../performance-counter/performance-counter.module';
 import { OsdDetailsComponent } from '../osd-details/osd-details.component';
 import {
   OsdPerformanceHistogramComponent
 } from '../osd-performance-histogram/osd-performance-histogram.component';
-import { OsdService } from '../osd.service';
 import { OsdListComponent } from './osd-list.component';
 
 describe('OsdListComponent', () => {
@@ -26,14 +26,15 @@ describe('OsdListComponent', () => {
         PerformanceCounterModule,
         TabsModule.forRoot(),
         DataTableModule,
-        ComponentsModule
+        ComponentsModule,
+        SharedModule
       ],
       declarations: [
         OsdListComponent,
         OsdDetailsComponent,
         OsdPerformanceHistogramComponent
       ],
-      providers: [OsdService, DimlessPipe, FormatterService]
+      providers: [ DimlessPipe, FormatterService]
     })
     .compileComponents();
   }));
index ad64f5c87c997c407bf45e2d3364ebc954424831..2f3980947f5bb1c92eca1e65bec76459f22b45d8 100644 (file)
@@ -1,10 +1,10 @@
 import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
 
+import { OsdService } from '../../../../shared/api/osd.service';
 import { CellTemplate } from '../../../../shared/enum/cell-template.enum';
 import { CdTableColumn } from '../../../../shared/models/cd-table-column';
 import { CdTableSelection } from '../../../../shared/models/cd-table-selection';
 import { DimlessBinaryPipe } from '../../../../shared/pipes/dimless-binary.pipe';
-import { OsdService } from '../osd.service';
 
 @Component({
   selector: 'cd-osd-list',
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd.service.spec.ts
deleted file mode 100644 (file)
index 115d6a4..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-import { HttpClientModule } from '@angular/common/http';
-import { inject, TestBed } from '@angular/core/testing';
-
-import { OsdService } from './osd.service';
-
-describe('OsdService', () => {
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      providers: [OsdService],
-      imports: [
-        HttpClientModule,
-      ],
-    });
-  });
-
-  it('should be created', inject([OsdService], (service: OsdService) => {
-    expect(service).toBeTruthy();
-  }));
-});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd.service.ts
deleted file mode 100644 (file)
index cf9adf1..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-
-@Injectable()
-export class OsdService {
-  private path = 'api/osd';
-
-  constructor (private http: HttpClient) {}
-
-  getList () {
-    return this.http.get(`${this.path}`);
-  }
-
-  getDetails(id: number) {
-    return this.http.get(`${this.path}/${id}`);
-  }
-}
index cf4c025060fc56963a4caf4a7e40af79badfe6dc..34744fc09adadc9567e41308b1a2cce6b6ff1d0d 100644 (file)
@@ -6,7 +6,6 @@ import { ChartsModule } from 'ng2-charts';
 import { TabsModule } from 'ngx-bootstrap/tabs';
 
 import { SharedModule } from '../../shared/shared.module';
-import { DashboardService } from './dashboard.service';
 import { DashboardComponent } from './dashboard/dashboard.component';
 import { HealthPieComponent } from './health-pie/health-pie.component';
 import { HealthComponent } from './health/health.component';
@@ -31,7 +30,6 @@ import { PgStatusPipe } from './pg-status.pipe';
     MdsSummaryPipe,
     PgStatusStylePipe,
     HealthPieComponent
-  ],
-  providers: [DashboardService]
+  ]
 })
 export class DashboardModule {}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard.service.spec.ts
deleted file mode 100644 (file)
index bf061e9..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-import { HttpClientModule } from '@angular/common/http';
-import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
-import { inject, TestBed } from '@angular/core/testing';
-
-import { appendFile } from 'fs';
-
-import { DashboardService } from './dashboard.service';
-
-describe('DashboardService', () => {
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      providers: [DashboardService],
-      imports: [HttpClientTestingModule, HttpClientModule]
-    });
-  });
-
-  it(
-    'should be created',
-    inject([DashboardService], (service: DashboardService) => {
-      expect(service).toBeTruthy();
-    })
-  );
-});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard.service.ts
deleted file mode 100644 (file)
index cb51cb4..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-
-@Injectable()
-export class DashboardService {
-  constructor(private http: HttpClient) {}
-
-  getHealth() {
-    return this.http.get('api/dashboard/health');
-  }
-}
index 983b1452e89da6e34c2917214479f1be41dbea69..847cabdfbd78a38926720ad338bd3d2a398e0229 100644 (file)
@@ -3,8 +3,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { TabsModule } from 'ngx-bootstrap/tabs';
 
+import { DashboardService } from '../../../shared/api/dashboard.service';
 import { SharedModule } from '../../../shared/shared.module';
-import { DashboardService } from '../dashboard.service';
 import { HealthComponent } from './health.component';
 
 describe('HealthComponent', () => {
index 3cdddc970e3c402ec761cde0b61d0025c5a10497..94e21636ad775da13dd01fdad04c7308ec386cac 100644 (file)
@@ -2,7 +2,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
 
 import * as _ from 'lodash';
 
-import { DashboardService } from '../dashboard.service';
+import { DashboardService } from '../../../shared/api/dashboard.service';
 
 @Component({
   selector: 'cd-health',
index f2c20299f4c4ec279ac75453bfc4b70ff4736011..6c3181bfeae7ba97acbc8e70e863453efe8bce89 100644 (file)
@@ -6,7 +6,6 @@ import { SharedModule } from '../../shared/shared.module';
 import {
   PerformanceCounterComponent
 } from './performance-counter/performance-counter.component';
-import { TablePerformanceCounterService } from './services/table-performance-counter.service';
 import {
   TablePerformanceCounterComponent
 } from './table-performance-counter/table-performance-counter.component';
@@ -21,9 +20,6 @@ import {
     TablePerformanceCounterComponent,
     PerformanceCounterComponent
   ],
-  providers: [
-    TablePerformanceCounterService
-  ],
   exports: [
     TablePerformanceCounterComponent
   ]
index a4cc717023179ee9014230a75f6d7d0194d3cfb1..e4c6ddcc1d5157b0f4ed8ef200b9fd28f56155d3 100644 (file)
@@ -3,8 +3,10 @@ import { RouterTestingModule } from '@angular/router/testing';
 
 import { BsDropdownModule } from 'ngx-bootstrap';
 
+import {
+  TablePerformanceCounterService
+} from '../../../shared/api/table-performance-counter.service';
 import { PerformanceCounterModule } from '../performance-counter.module';
-import { TablePerformanceCounterService } from '../services/table-performance-counter.service';
 import { PerformanceCounterComponent } from './performance-counter.component';
 
 describe('PerformanceCounterComponent', () => {
@@ -27,11 +29,7 @@ describe('PerformanceCounterComponent', () => {
   beforeEach(
     async(() => {
       TestBed.configureTestingModule({
-        imports: [
-          PerformanceCounterModule,
-          BsDropdownModule.forRoot(),
-          RouterTestingModule
-        ],
+        imports: [PerformanceCounterModule, BsDropdownModule.forRoot(), RouterTestingModule],
         providers: [{ provide: TablePerformanceCounterService, useValue: fakeService }]
       }).compileComponents();
     })
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/services/table-performance-counter.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/services/table-performance-counter.service.spec.ts
deleted file mode 100644 (file)
index 6f0af94..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-import { HttpClientModule } from '@angular/common/http';
-import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { inject, TestBed } from '@angular/core/testing';
-
-import { BsDropdownModule } from 'ngx-bootstrap';
-
-import { TablePerformanceCounterService } from './table-performance-counter.service';
-
-describe('TablePerformanceCounterService', () => {
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      providers: [TablePerformanceCounterService],
-      imports: [
-        HttpClientTestingModule,
-        BsDropdownModule.forRoot(),
-        HttpClientModule
-      ]
-    });
-  });
-
-  it(
-    'should be created',
-    inject([TablePerformanceCounterService], (service: TablePerformanceCounterService) => {
-      expect(service).toBeTruthy();
-    })
-  );
-});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/services/table-performance-counter.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/services/table-performance-counter.service.ts
deleted file mode 100644 (file)
index b6ac5d5..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-
-@Injectable()
-export class TablePerformanceCounterService {
-
-  private url = 'api/perf_counters';
-
-  constructor(private http: HttpClient) { }
-
-  list() {
-    return this.http.get(this.url)
-      .toPromise()
-      .then((resp: object): object => {
-        return resp;
-      });
-  }
-
-  get(service_type: string, service_id: string) {
-    const serviceType = service_type.replace('-', '_');
-
-    return this.http.get(`${this.url}/${serviceType}/${service_id}`)
-      .toPromise()
-      .then((resp: object): Array<object> => {
-        return resp['counters'];
-      });
-  }
-}
index 4baefe8911daf857a069294cc38ef4d6faccce6e..6a219590074a212f5d3730fb45f07f185a72a63f 100644 (file)
@@ -5,7 +5,6 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 import { BsDropdownModule } from 'ngx-bootstrap';
 
 import { SharedModule } from '../../../shared/shared.module';
-import { TablePerformanceCounterService } from '../services/table-performance-counter.service';
 import { TablePerformanceCounterComponent } from './table-performance-counter.component';
 
 describe('TablePerformanceCounterComponent', () => {
@@ -20,8 +19,7 @@ describe('TablePerformanceCounterComponent', () => {
         HttpClientModule,
         BsDropdownModule.forRoot(),
         SharedModule
-      ],
-      providers: [ TablePerformanceCounterService ]
+      ]
     })
     .compileComponents();
   }));
index 6ac05c9849a6e91e533977f0ee0f317230ac6d32..30c283e3231ed116adf796682698ca28b7ff9e22 100644 (file)
@@ -1,7 +1,9 @@
 import { Component, Input, OnInit, TemplateRef, ViewChild } from '@angular/core';
 
+import {
+  TablePerformanceCounterService
+} from '../../../shared/api/table-performance-counter.service';
 import { CdTableColumn } from '../../../shared/models/cd-table-column';
-import { TablePerformanceCounterService } from '../services/table-performance-counter.service';
 
 /**
  * Display the specified performance counters in a datatable.
index afce56a2bacf8c224e4da13d8ce107850def2919..e5686b056af4930876edf8bd3becf37ac1d23350 100644 (file)
@@ -2,10 +2,10 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 
 import { TabsModule } from 'ngx-bootstrap/tabs';
 
+import { RgwDaemonService } from '../../../shared/api/rgw-daemon.service';
 import { CdTableSelection } from '../../../shared/models/cd-table-selection';
 import { SharedModule } from '../../../shared/shared.module';
 import { PerformanceCounterModule } from '../../performance-counter/performance-counter.module';
-import { RgwDaemonService } from '../services/rgw-daemon.service';
 import { RgwDaemonDetailsComponent } from './rgw-daemon-details.component';
 
 describe('RgwDaemonDetailsComponent', () => {
index 8ac62fac84c8478f8501153c265c7013e0a68394..f3587a0a58a1e24327df02122e9ac8b00ccdaa4a 100644 (file)
@@ -2,8 +2,8 @@ import { Component, Input, OnChanges } from '@angular/core';
 
 import * as _ from 'lodash';
 
+import { RgwDaemonService } from '../../../shared/api/rgw-daemon.service';
 import { CdTableSelection } from '../../../shared/models/cd-table-selection';
-import { RgwDaemonService } from '../services/rgw-daemon.service';
 
 @Component({
   selector: 'cd-rgw-daemon-details',
index c0d331e3599f65888696e6caefa083e1a022226e..f4f08f4c528077facd5767ff678be4fb3579fcbe 100644 (file)
@@ -5,9 +5,9 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 import { TabsModule } from 'ngx-bootstrap/tabs';
 
 import { DataTableModule } from '../../../shared/datatable/datatable.module';
+import { SharedModule } from '../../../shared/shared.module';
 import { PerformanceCounterModule } from '../../performance-counter/performance-counter.module';
 import { RgwDaemonDetailsComponent } from '../rgw-daemon-details/rgw-daemon-details.component';
-import { RgwDaemonService } from '../services/rgw-daemon.service';
 import { RgwDaemonListComponent } from './rgw-daemon-list.component';
 
 describe('RgwDaemonListComponent', () => {
@@ -22,9 +22,9 @@ describe('RgwDaemonListComponent', () => {
         HttpClientTestingModule,
         HttpClientModule,
         TabsModule.forRoot(),
-        PerformanceCounterModule
-      ],
-      providers: [ RgwDaemonService ]
+        PerformanceCounterModule,
+        SharedModule
+      ]
     })
     .compileComponents();
   }));
index ce1c2456fdf0341bff828df166d915a2923d083c..affe3962cd8cda2e1682e3bde39acde40c43c65d 100644 (file)
@@ -1,9 +1,9 @@
 import { Component } from '@angular/core';
 
+import { RgwDaemonService } from '../../../shared/api/rgw-daemon.service';
 import { CdTableColumn } from '../../../shared/models/cd-table-column';
 import { CdTableSelection } from '../../../shared/models/cd-table-selection';
 import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe';
-import { RgwDaemonService } from '../services/rgw-daemon.service';
 
 @Component({
   selector: 'cd-rgw-daemon-list',
index a888940c27da6944cfc893bdcfa39bf3dffd6e70..14577d9c71ff4cc83d320443e335767f2681deb1 100644 (file)
@@ -7,7 +7,6 @@ import { SharedModule } from '../../shared/shared.module';
 import { PerformanceCounterModule } from '../performance-counter/performance-counter.module';
 import { RgwDaemonDetailsComponent } from './rgw-daemon-details/rgw-daemon-details.component';
 import { RgwDaemonListComponent } from './rgw-daemon-list/rgw-daemon-list.component';
-import { RgwDaemonService } from './services/rgw-daemon.service';
 
 @NgModule({
   entryComponents: [
@@ -26,9 +25,6 @@ import { RgwDaemonService } from './services/rgw-daemon.service';
   declarations: [
     RgwDaemonListComponent,
     RgwDaemonDetailsComponent
-  ],
-  providers: [
-    RgwDaemonService
   ]
 })
 export class RgwModule { }
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/services/rgw-daemon.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/services/rgw-daemon.service.spec.ts
deleted file mode 100644 (file)
index 691cc78..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-import { HttpClientModule } from '@angular/common/http';
-import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { inject, TestBed } from '@angular/core/testing';
-
-import { RgwDaemonService } from './rgw-daemon.service';
-
-describe('RgwDaemonService', () => {
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      providers: [RgwDaemonService],
-      imports: [HttpClientTestingModule, HttpClientModule]
-    });
-  });
-
-  it(
-    'should be created',
-    inject([RgwDaemonService], (service: RgwDaemonService) => {
-      expect(service).toBeTruthy();
-    })
-  );
-});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/services/rgw-daemon.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/services/rgw-daemon.service.ts
deleted file mode 100644 (file)
index 907537e..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-
-@Injectable()
-export class RgwDaemonService {
-
-  private url = 'api/rgw/daemon';
-
-  constructor(private http: HttpClient) { }
-
-  list() {
-    return this.http.get(this.url)
-      .toPromise()
-      .then((resp: any) => {
-        return resp;
-      });
-  }
-
-  get(id: string) {
-    return this.http.get(`${this.url}/${id}`)
-      .toPromise()
-      .then((resp: any) => {
-        return resp;
-      });
-  }
-}
index f8f46254976cc862446cc6916ff85babbb033aff..f1a1f90f088f3fd604ad5f7cab2034c3406cc62d 100644 (file)
@@ -3,9 +3,9 @@ import { Router } from '@angular/router';
 
 import { ToastsManager } from 'ng2-toastr';
 
+import { AuthService } from '../../../shared/api/auth.service';
 import { Credentials } from '../../../shared/models/credentials';
 import { AuthStorageService } from '../../../shared/services/auth-storage.service';
-import { AuthService } from '../../../shared/services/auth.service';
 
 @Component({
   selector: 'cd-login',
index 4bf11e368712b7ae1b6344278fca38dff9f57a0a..4a8405e2eefad0daa701deb844d4f490a0806e33 100644 (file)
@@ -1,7 +1,7 @@
 import { Component, OnInit } from '@angular/core';
 import { Router } from '@angular/router';
 
-import { AuthService } from '../../../shared/services/auth.service';
+import { AuthService } from '../../../shared/api/auth.service';
 
 @Component({
   selector: 'cd-logout',
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/api.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/api.module.ts
new file mode 100644 (file)
index 0000000..dbb1af6
--- /dev/null
@@ -0,0 +1,35 @@
+import { CommonModule } from '@angular/common';
+import { NgModule } from '@angular/core';
+
+import { AuthService } from './auth.service';
+import { CephfsService } from './cephfs.service';
+import { ConfigurationService } from './configuration.service';
+import { DashboardService } from './dashboard.service';
+import { HostService } from './host.service';
+import { MonitorService } from './monitor.service';
+import { OsdService } from './osd.service';
+import { PoolService } from './pool.service';
+import { RbdMirroringService } from './rbd-mirroring.service';
+import { RgwDaemonService } from './rgw-daemon.service';
+import { TablePerformanceCounterService } from './table-performance-counter.service';
+import { TcmuIscsiService } from './tcmu-iscsi.service';
+
+@NgModule({
+  imports: [CommonModule],
+  declarations: [],
+  providers: [
+    AuthService,
+    CephfsService,
+    ConfigurationService,
+    DashboardService,
+    HostService,
+    MonitorService,
+    OsdService,
+    PoolService,
+    RbdMirroringService,
+    RgwDaemonService,
+    TablePerformanceCounterService,
+    TcmuIscsiService
+  ]
+})
+export class ApiModule {}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/auth.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/auth.service.ts
new file mode 100644 (file)
index 0000000..c915884
--- /dev/null
@@ -0,0 +1,25 @@
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+
+import { Credentials } from '../models/credentials';
+import { AuthStorageService } from '../services/auth-storage.service';
+
+@Injectable()
+export class AuthService {
+
+  constructor(private authStorageService: AuthStorageService,
+              private http: HttpClient) {
+  }
+
+  login(credentials: Credentials) {
+    return this.http.post('api/auth', credentials).toPromise().then((resp: Credentials) => {
+      this.authStorageService.set(resp.username);
+    });
+  }
+
+  logout() {
+    return this.http.delete('api/auth').toPromise().then(() => {
+      this.authStorageService.remove();
+    });
+  }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/cephfs.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/cephfs.service.spec.ts
new file mode 100644 (file)
index 0000000..a9e59a0
--- /dev/null
@@ -0,0 +1,20 @@
+import { HttpClientModule } from '@angular/common/http';
+import { inject, TestBed } from '@angular/core/testing';
+
+import { CephfsService } from './cephfs.service';
+
+describe('CephfsService', () => {
+  beforeEach(() => {
+    TestBed.configureTestingModule({
+      imports: [HttpClientModule],
+      providers: [CephfsService]
+    });
+  });
+
+  it(
+    'should be created',
+    inject([CephfsService], (service: CephfsService) => {
+      expect(service).toBeTruthy();
+    })
+  );
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/cephfs.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/cephfs.service.ts
new file mode 100644 (file)
index 0000000..a5c4994
--- /dev/null
@@ -0,0 +1,21 @@
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class CephfsService {
+  baseURL = 'api/cephfs';
+
+  constructor(private http: HttpClient) {}
+
+  getCephfs(id) {
+    return this.http.get(`${this.baseURL}/data/${id}`);
+  }
+
+  getClients(id) {
+    return this.http.get(`${this.baseURL}/clients/${id}`);
+  }
+
+  getMdsCounters(id) {
+    return this.http.get(`${this.baseURL}/mds_counters/${id}`);
+  }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.spec.ts
new file mode 100644 (file)
index 0000000..dcb5a9e
--- /dev/null
@@ -0,0 +1,21 @@
+import { HttpClientModule } from '@angular/common/http';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { inject, TestBed } from '@angular/core/testing';
+
+import { ConfigurationService } from './configuration.service';
+
+describe('ConfigurationService', () => {
+  beforeEach(() => {
+    TestBed.configureTestingModule({
+      providers: [ConfigurationService],
+      imports: [HttpClientTestingModule, HttpClientModule]
+    });
+  });
+
+  it(
+    'should be created',
+    inject([ConfigurationService], (service: ConfigurationService) => {
+      expect(service).toBeTruthy();
+    })
+  );
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.ts
new file mode 100644 (file)
index 0000000..41ac7bb
--- /dev/null
@@ -0,0 +1,11 @@
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class ConfigurationService {
+  constructor(private http: HttpClient) {}
+
+  getConfigData() {
+    return this.http.get('api/cluster_conf/');
+  }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/dashboard.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/dashboard.service.spec.ts
new file mode 100644 (file)
index 0000000..bf061e9
--- /dev/null
@@ -0,0 +1,23 @@
+import { HttpClientModule } from '@angular/common/http';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { inject, TestBed } from '@angular/core/testing';
+
+import { appendFile } from 'fs';
+
+import { DashboardService } from './dashboard.service';
+
+describe('DashboardService', () => {
+  beforeEach(() => {
+    TestBed.configureTestingModule({
+      providers: [DashboardService],
+      imports: [HttpClientTestingModule, HttpClientModule]
+    });
+  });
+
+  it(
+    'should be created',
+    inject([DashboardService], (service: DashboardService) => {
+      expect(service).toBeTruthy();
+    })
+  );
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/dashboard.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/dashboard.service.ts
new file mode 100644 (file)
index 0000000..cb51cb4
--- /dev/null
@@ -0,0 +1,11 @@
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class DashboardService {
+  constructor(private http: HttpClient) {}
+
+  getHealth() {
+    return this.http.get('api/dashboard/health');
+  }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/host.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/host.service.ts
new file mode 100644 (file)
index 0000000..3d28cd7
--- /dev/null
@@ -0,0 +1,15 @@
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class HostService {
+
+  constructor(private http: HttpClient) {
+  }
+
+  list() {
+    return this.http.get('api/host').toPromise().then((resp: any) => {
+      return resp;
+    });
+  }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/monitor.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/monitor.service.spec.ts
new file mode 100644 (file)
index 0000000..1d5f7de
--- /dev/null
@@ -0,0 +1,21 @@
+import { HttpClientModule } from '@angular/common/http';
+import {
+  HttpClientTestingModule,
+  HttpTestingController
+} from '@angular/common/http/testing';
+import { inject, TestBed } from '@angular/core/testing';
+
+import { MonitorService } from './monitor.service';
+
+describe('MonitorService', () => {
+  beforeEach(() => {
+    TestBed.configureTestingModule({
+      providers: [MonitorService],
+      imports: [HttpClientTestingModule, HttpClientModule]
+    });
+  });
+
+  it('should be created', inject([MonitorService], (service: MonitorService) => {
+    expect(service).toBeTruthy();
+  }));
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/monitor.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/monitor.service.ts
new file mode 100644 (file)
index 0000000..32057f3
--- /dev/null
@@ -0,0 +1,11 @@
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class MonitorService {
+  constructor(private http: HttpClient) {}
+
+  getMonitor() {
+    return this.http.get('api/monitor');
+  }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts
new file mode 100644 (file)
index 0000000..115d6a4
--- /dev/null
@@ -0,0 +1,19 @@
+import { HttpClientModule } from '@angular/common/http';
+import { inject, TestBed } from '@angular/core/testing';
+
+import { OsdService } from './osd.service';
+
+describe('OsdService', () => {
+  beforeEach(() => {
+    TestBed.configureTestingModule({
+      providers: [OsdService],
+      imports: [
+        HttpClientModule,
+      ],
+    });
+  });
+
+  it('should be created', inject([OsdService], (service: OsdService) => {
+    expect(service).toBeTruthy();
+  }));
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts
new file mode 100644 (file)
index 0000000..cf9adf1
--- /dev/null
@@ -0,0 +1,17 @@
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class OsdService {
+  private path = 'api/osd';
+
+  constructor (private http: HttpClient) {}
+
+  getList () {
+    return this.http.get(`${this.path}`);
+  }
+
+  getDetails(id: number) {
+    return this.http.get(`${this.path}/${id}`);
+  }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.ts
new file mode 100644 (file)
index 0000000..8ac6de9
--- /dev/null
@@ -0,0 +1,15 @@
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class PoolService {
+
+  constructor(private http: HttpClient) {
+  }
+
+  rbdPoolImages(pool) {
+    return this.http.get(`api/rbd/${pool}`).toPromise().then((resp: any) => {
+      return resp;
+    });
+  }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.spec.ts
new file mode 100644 (file)
index 0000000..0f59831
--- /dev/null
@@ -0,0 +1,18 @@
+import { HttpClientModule } from '@angular/common/http';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { inject, TestBed } from '@angular/core/testing';
+
+import { RbdMirroringService } from './rbd-mirroring.service';
+
+describe('RbdMirroringService', () => {
+  beforeEach(() => {
+    TestBed.configureTestingModule({
+      providers: [RbdMirroringService],
+      imports: [HttpClientTestingModule, HttpClientModule]
+    });
+  });
+
+  it('should be created', inject([RbdMirroringService], (service: RbdMirroringService) => {
+    expect(service).toBeTruthy();
+  }));
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.ts
new file mode 100644 (file)
index 0000000..b840b30
--- /dev/null
@@ -0,0 +1,11 @@
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class RbdMirroringService {
+  constructor(private http: HttpClient) {}
+
+  get() {
+    return this.http.get('api/rbdmirror');
+  }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-daemon.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-daemon.service.spec.ts
new file mode 100644 (file)
index 0000000..691cc78
--- /dev/null
@@ -0,0 +1,21 @@
+import { HttpClientModule } from '@angular/common/http';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { inject, TestBed } from '@angular/core/testing';
+
+import { RgwDaemonService } from './rgw-daemon.service';
+
+describe('RgwDaemonService', () => {
+  beforeEach(() => {
+    TestBed.configureTestingModule({
+      providers: [RgwDaemonService],
+      imports: [HttpClientTestingModule, HttpClientModule]
+    });
+  });
+
+  it(
+    'should be created',
+    inject([RgwDaemonService], (service: RgwDaemonService) => {
+      expect(service).toBeTruthy();
+    })
+  );
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-daemon.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-daemon.service.ts
new file mode 100644 (file)
index 0000000..907537e
--- /dev/null
@@ -0,0 +1,26 @@
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class RgwDaemonService {
+
+  private url = 'api/rgw/daemon';
+
+  constructor(private http: HttpClient) { }
+
+  list() {
+    return this.http.get(this.url)
+      .toPromise()
+      .then((resp: any) => {
+        return resp;
+      });
+  }
+
+  get(id: string) {
+    return this.http.get(`${this.url}/${id}`)
+      .toPromise()
+      .then((resp: any) => {
+        return resp;
+      });
+  }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/table-performance-counter.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/table-performance-counter.service.spec.ts
new file mode 100644 (file)
index 0000000..6f0af94
--- /dev/null
@@ -0,0 +1,27 @@
+import { HttpClientModule } from '@angular/common/http';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { inject, TestBed } from '@angular/core/testing';
+
+import { BsDropdownModule } from 'ngx-bootstrap';
+
+import { TablePerformanceCounterService } from './table-performance-counter.service';
+
+describe('TablePerformanceCounterService', () => {
+  beforeEach(() => {
+    TestBed.configureTestingModule({
+      providers: [TablePerformanceCounterService],
+      imports: [
+        HttpClientTestingModule,
+        BsDropdownModule.forRoot(),
+        HttpClientModule
+      ]
+    });
+  });
+
+  it(
+    'should be created',
+    inject([TablePerformanceCounterService], (service: TablePerformanceCounterService) => {
+      expect(service).toBeTruthy();
+    })
+  );
+});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/table-performance-counter.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/table-performance-counter.service.ts
new file mode 100644 (file)
index 0000000..b6ac5d5
--- /dev/null
@@ -0,0 +1,28 @@
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class TablePerformanceCounterService {
+
+  private url = 'api/perf_counters';
+
+  constructor(private http: HttpClient) { }
+
+  list() {
+    return this.http.get(this.url)
+      .toPromise()
+      .then((resp: object): object => {
+        return resp;
+      });
+  }
+
+  get(service_type: string, service_id: string) {
+    const serviceType = service_type.replace('-', '_');
+
+    return this.http.get(`${this.url}/${serviceType}/${service_id}`)
+      .toPromise()
+      .then((resp: object): Array<object> => {
+        return resp['counters'];
+      });
+  }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/tcmu-iscsi.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/tcmu-iscsi.service.ts
new file mode 100644 (file)
index 0000000..2f36bb8
--- /dev/null
@@ -0,0 +1,15 @@
+import { HttpClient } from '@angular/common/http';
+import { Injectable } from '@angular/core';
+
+@Injectable()
+export class TcmuIscsiService {
+
+  constructor(private http: HttpClient) {
+  }
+
+  tcmuiscsi() {
+    return this.http.get('api/tcmuiscsi').toPromise().then((resp: any) => {
+      return resp;
+    });
+  }
+}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth.service.ts
deleted file mode 100644 (file)
index 88a7136..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-
-import { Credentials } from '../models/credentials';
-import { AuthStorageService } from './auth-storage.service';
-
-@Injectable()
-export class AuthService {
-
-  constructor(private authStorageService: AuthStorageService,
-              private http: HttpClient) {
-  }
-
-  login(credentials: Credentials) {
-    return this.http.post('api/auth', credentials).toPromise().then((resp: Credentials) => {
-      this.authStorageService.set(resp.username);
-    });
-  }
-
-  logout() {
-    return this.http.delete('api/auth').toPromise().then(() => {
-      this.authStorageService.remove();
-    });
-  }
-}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/configuration.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/configuration.service.spec.ts
deleted file mode 100644 (file)
index dcb5a9e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-import { HttpClientModule } from '@angular/common/http';
-import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
-import { inject, TestBed } from '@angular/core/testing';
-
-import { ConfigurationService } from './configuration.service';
-
-describe('ConfigurationService', () => {
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      providers: [ConfigurationService],
-      imports: [HttpClientTestingModule, HttpClientModule]
-    });
-  });
-
-  it(
-    'should be created',
-    inject([ConfigurationService], (service: ConfigurationService) => {
-      expect(service).toBeTruthy();
-    })
-  );
-});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/configuration.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/configuration.service.ts
deleted file mode 100644 (file)
index 41ac7bb..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-
-@Injectable()
-export class ConfigurationService {
-  constructor(private http: HttpClient) {}
-
-  getConfigData() {
-    return this.http.get('api/cluster_conf/');
-  }
-}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/host.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/host.service.ts
deleted file mode 100644 (file)
index 3d28cd7..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-
-@Injectable()
-export class HostService {
-
-  constructor(private http: HttpClient) {
-  }
-
-  list() {
-    return this.http.get('api/host').toPromise().then((resp: any) => {
-      return resp;
-    });
-  }
-}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/pool.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/pool.service.ts
deleted file mode 100644 (file)
index 8ac6de9..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-
-@Injectable()
-export class PoolService {
-
-  constructor(private http: HttpClient) {
-  }
-
-  rbdPoolImages(pool) {
-    return this.http.get(`api/rbd/${pool}`).toPromise().then((resp: any) => {
-      return resp;
-    });
-  }
-}
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-mirroring.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-mirroring.service.spec.ts
deleted file mode 100644 (file)
index 0f59831..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-import { HttpClientModule } from '@angular/common/http';
-import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
-import { inject, TestBed } from '@angular/core/testing';
-
-import { RbdMirroringService } from './rbd-mirroring.service';
-
-describe('RbdMirroringService', () => {
-  beforeEach(() => {
-    TestBed.configureTestingModule({
-      providers: [RbdMirroringService],
-      imports: [HttpClientTestingModule, HttpClientModule]
-    });
-  });
-
-  it('should be created', inject([RbdMirroringService], (service: RbdMirroringService) => {
-    expect(service).toBeTruthy();
-  }));
-});
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-mirroring.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-mirroring.service.ts
deleted file mode 100644 (file)
index b840b30..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-
-@Injectable()
-export class RbdMirroringService {
-  constructor(private http: HttpClient) {}
-
-  get() {
-    return this.http.get('api/rbdmirror');
-  }
-}
index 04d4a3ccbde3cbaed7c193a621fc055d57704863..60ddb4d70840f5ca700c0bc6212ad12830ddd536 100644 (file)
@@ -1,21 +1,15 @@
 import { CommonModule } from '@angular/common';
 import { NgModule } from '@angular/core';
 
-import { ConfigurationService } from './configuration.service';
 import { FormatterService } from './formatter.service';
-import { RbdMirroringService } from './rbd-mirroring.service';
 import { SummaryService } from './summary.service';
-import { TcmuIscsiService } from './tcmu-iscsi.service';
 
 @NgModule({
   imports: [CommonModule],
   declarations: [],
   providers: [
     FormatterService,
-    SummaryService,
-    TcmuIscsiService,
-    ConfigurationService,
-    RbdMirroringService
+    SummaryService
   ]
 })
 export class ServicesModule { }
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/tcmu-iscsi.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/tcmu-iscsi.service.ts
deleted file mode 100644 (file)
index 2f36bb8..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
-
-@Injectable()
-export class TcmuIscsiService {
-
-  constructor(private http: HttpClient) {
-  }
-
-  tcmuiscsi() {
-    return this.http.get('api/tcmuiscsi').toPromise().then((resp: any) => {
-      return resp;
-    });
-  }
-}
index 96c6facd2d9defc093d3f7f82922e60d7e5f5189..931a8f9569906949270492a719a7a2c717d32d59 100644 (file)
@@ -1,6 +1,7 @@
 import { CommonModule } from '@angular/common';
 import { NgModule } from '@angular/core';
 
+import { ApiModule } from './api/api.module';
 import { ComponentsModule } from './components/components.module';
 import { DataTableModule } from './datatable/datatable.module';
 import { DimlessBinaryDirective } from './directives/dimless-binary.directive';
@@ -8,10 +9,7 @@ import { PasswordButtonDirective } from './directives/password-button.directive'
 import { PipesModule } from './pipes/pipes.module';
 import { AuthGuardService } from './services/auth-guard.service';
 import { AuthStorageService } from './services/auth-storage.service';
-import { AuthService } from './services/auth.service';
 import { FormatterService } from './services/formatter.service';
-import { HostService } from './services/host.service';
-import { PoolService } from './services/pool.service';
 import { ServicesModule } from './services/services.module';
 
 @NgModule({
@@ -20,7 +18,8 @@ import { ServicesModule } from './services/services.module';
     PipesModule,
     ComponentsModule,
     ServicesModule,
-    DataTableModule
+    DataTableModule,
+    ApiModule
   ],
   declarations: [
     PasswordButtonDirective,
@@ -35,12 +34,9 @@ import { ServicesModule } from './services/services.module';
     DataTableModule
   ],
   providers: [
-    AuthService,
     AuthStorageService,
     AuthGuardService,
-    PoolService,
     FormatterService,
-    HostService
   ],
 })
 export class SharedModule {}