From: Tiago Melo Date: Thu, 29 Mar 2018 00:36:41 +0000 (+0100) Subject: mgr/dashboard: Add Api module X-Git-Tag: v13.1.0~346^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=76ec342d78b80020b4a7c5c4be193046ef646e27;p=ceph-ci.git mgr/dashboard: Add Api module Moved all the api related services into the new module. Signed-off-by: Tiago Melo --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts index 78c19b07247..526c951b511 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts @@ -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', () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts index 00416a27e0b..2e3f384a76d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts @@ -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', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.component.spec.ts index f20d0484c01..a9deeae7eec 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.component.spec.ts @@ -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'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.component.ts index b52865e1180..74de5628536 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/mirroring.component.ts @@ -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', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/pool-detail/pool-detail.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/pool-detail/pool-detail.component.ts index 98ac59c6664..56480770761 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/pool-detail/pool-detail.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/pool-detail/pool-detail.component.ts @@ -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', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs.module.ts index c47051c18e6..16ccbf41e20 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs.module.ts @@ -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 index a9e59a016dd..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs.service.spec.ts +++ /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 index a5c4994da45..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs.service.ts +++ /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}`); - } -} 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 index 3df655defa6..e85f85f5204 100644 --- 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 @@ -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', () => { 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 index 774ce4e0ad6..cdbbb6fef3c 100644 --- 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 @@ -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', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/clients/clients.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/clients/clients.component.spec.ts index d3506a90686..1f4d4a5c916 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/clients/clients.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/clients/clients.component.spec.ts @@ -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', () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/clients/clients.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/clients/clients.component.ts index fc2cbdec61b..6402da14ee7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/clients/clients.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/clients/clients.component.ts @@ -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', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts index d661f51baed..3840b48b6ea 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts @@ -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 {} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts index 0d98766efd4..96a5a2cc4ba 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.spec.ts @@ -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'; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts index 7c6ed68b448..8df77299971 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts @@ -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', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts index 28a193fd8ce..bb22e86a9ab 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts @@ -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 index 1d5f7de97b7..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor.service.spec.ts +++ /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 index 32057f3b6ea..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor.service.ts +++ /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'); - } -} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts index 0a23129667e..de18f792486 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts @@ -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', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts index c24618286de..19403193311 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts @@ -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(); })); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts index 7f2af372497..5c4752d492e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.ts @@ -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', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts index 7a1ef0254a8..f9a60585c9d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts @@ -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(); })); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts index ad64f5c87c9..2f3980947f5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts @@ -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 index 115d6a4dbd9..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd.service.spec.ts +++ /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 index cf9adf1b5fd..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd.service.ts +++ /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}`); - } -} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard.module.ts index cf4c025060f..34744fc09ad 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard.module.ts @@ -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 index bf061e9f645..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard.service.spec.ts +++ /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 index cb51cb4d71b..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/dashboard.service.ts +++ /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'); - } -} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts index 983b1452e89..847cabdfbd7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts @@ -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', () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts index 3cdddc970e3..94e21636ad7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts @@ -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', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter.module.ts index f2c20299f4c..6c3181bfeae 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter.module.ts @@ -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 ] diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts index a4cc7170231..e4c6ddcc1d5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts @@ -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 index 6f0af94e4b6..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/services/table-performance-counter.service.spec.ts +++ /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 index b6ac5d5fe3e..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/services/table-performance-counter.service.ts +++ /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 => { - return resp['counters']; - }); - } -} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts index 4baefe8911d..6a219590074 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.spec.ts @@ -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(); })); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.ts index 6ac05c9849a..30c283e3231 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/performance-counter/table-performance-counter/table-performance-counter.component.ts @@ -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. diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.spec.ts index afce56a2bac..e5686b056af 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.spec.ts @@ -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', () => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.ts index 8ac62fac84c..f3587a0a58a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.ts @@ -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', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts index c0d331e3599..f4f08f4c528 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.spec.ts @@ -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(); })); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts index ce1c2456fdf..affe3962cd8 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.ts @@ -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', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw.module.ts index a888940c27d..14577d9c71f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw.module.ts @@ -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 index 691cc787a9b..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/services/rgw-daemon.service.spec.ts +++ /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 index 907537ef2d9..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/services/rgw-daemon.service.ts +++ /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; - }); - } -} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.ts index f8f46254976..f1a1f90f088 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.ts @@ -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', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/logout/logout.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/logout/logout.component.ts index 4bf11e36871..4a8405e2eef 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/core/auth/logout/logout.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/core/auth/logout/logout.component.ts @@ -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 index 00000000000..dbb1af6d5a7 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/api.module.ts @@ -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 index 00000000000..c915884a034 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/auth.service.ts @@ -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 index 00000000000..a9e59a016dd --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/cephfs.service.spec.ts @@ -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 index 00000000000..a5c4994da45 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/cephfs.service.ts @@ -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 index 00000000000..dcb5a9e10b9 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.spec.ts @@ -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 index 00000000000..41ac7bb5196 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.ts @@ -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 index 00000000000..bf061e9f645 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/dashboard.service.spec.ts @@ -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 index 00000000000..cb51cb4d71b --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/dashboard.service.ts @@ -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 index 00000000000..3d28cd78926 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/host.service.ts @@ -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 index 00000000000..1d5f7de97b7 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/monitor.service.spec.ts @@ -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 index 00000000000..32057f3b6ea --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/monitor.service.ts @@ -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 index 00000000000..115d6a4dbd9 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.spec.ts @@ -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 index 00000000000..cf9adf1b5fd --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts @@ -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 index 00000000000..8ac6de9d5b4 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.ts @@ -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 index 00000000000..0f598318a31 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.spec.ts @@ -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 index 00000000000..b840b3053a0 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.ts @@ -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 index 00000000000..691cc787a9b --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-daemon.service.spec.ts @@ -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 index 00000000000..907537ef2d9 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-daemon.service.ts @@ -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 index 00000000000..6f0af94e4b6 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/table-performance-counter.service.spec.ts @@ -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 index 00000000000..b6ac5d5fe3e --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/table-performance-counter.service.ts @@ -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 => { + 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 index 00000000000..2f36bb81813 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/tcmu-iscsi.service.ts @@ -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 index 88a7136289e..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth.service.ts +++ /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 index dcb5a9e10b9..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/configuration.service.spec.ts +++ /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 index 41ac7bb5196..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/configuration.service.ts +++ /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 index 3d28cd78926..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/host.service.ts +++ /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 index 8ac6de9d5b4..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/pool.service.ts +++ /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 index 0f598318a31..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-mirroring.service.spec.ts +++ /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 index b840b3053a0..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/rbd-mirroring.service.ts +++ /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'); - } -} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/services.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/services.module.ts index 04d4a3ccbde..60ddb4d7084 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/services.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/services/services.module.ts @@ -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 index 2f36bb81813..00000000000 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/services/tcmu-iscsi.service.ts +++ /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; - }); - } -} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/shared.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/shared.module.ts index 96c6facd2d9..931a8f95699 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/shared.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/shared.module.ts @@ -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 {}