Moved all the api related services into the new module.
Signed-off-by: Tiago Melo <tmelo@suse.com>
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', () => {
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',
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';
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',
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',
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';
ChartsModule,
ProgressbarModule.forRoot()
],
- declarations: [CephfsComponent, ClientsComponent, CephfsChartComponent],
- providers: [CephfsService]
+ declarations: [CephfsComponent, ClientsComponent, CephfsChartComponent]
})
export class CephfsModule {}
+++ /dev/null
-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();
- })
- );
-});
+++ /dev/null
-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}`);
- }
-}
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', () => {
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',
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', () => {
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',
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: [
OsdListComponent,
OsdDetailsComponent,
OsdPerformanceHistogramComponent
- ],
- providers: [
- MonitorService,
- OsdService
]
})
export class ClusterModule {}
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';
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',
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',
+++ /dev/null
-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();
- }));
-});
+++ /dev/null
-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');
- }
-}
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',
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', () => {
HttpClientModule,
TabsModule.forRoot(),
PerformanceCounterModule,
- DataTableModule
+ DataTableModule,
+ SharedModule
],
declarations: [
OsdDetailsComponent,
OsdPerformanceHistogramComponent
- ],
- providers: [OsdService]
+ ]
})
.compileComponents();
}));
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',
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', () => {
PerformanceCounterModule,
TabsModule.forRoot(),
DataTableModule,
- ComponentsModule
+ ComponentsModule,
+ SharedModule
],
declarations: [
OsdListComponent,
OsdDetailsComponent,
OsdPerformanceHistogramComponent
],
- providers: [OsdService, DimlessPipe, FormatterService]
+ providers: [ DimlessPipe, FormatterService]
})
.compileComponents();
}));
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',
+++ /dev/null
-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();
- }));
-});
+++ /dev/null
-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}`);
- }
-}
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';
MdsSummaryPipe,
PgStatusStylePipe,
HealthPieComponent
- ],
- providers: [DashboardService]
+ ]
})
export class DashboardModule {}
+++ /dev/null
-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();
- })
- );
-});
+++ /dev/null
-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');
- }
-}
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', () => {
import * as _ from 'lodash';
-import { DashboardService } from '../dashboard.service';
+import { DashboardService } from '../../../shared/api/dashboard.service';
@Component({
selector: 'cd-health',
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';
TablePerformanceCounterComponent,
PerformanceCounterComponent
],
- providers: [
- TablePerformanceCounterService
- ],
exports: [
TablePerformanceCounterComponent
]
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', () => {
beforeEach(
async(() => {
TestBed.configureTestingModule({
- imports: [
- PerformanceCounterModule,
- BsDropdownModule.forRoot(),
- RouterTestingModule
- ],
+ imports: [PerformanceCounterModule, BsDropdownModule.forRoot(), RouterTestingModule],
providers: [{ provide: TablePerformanceCounterService, useValue: fakeService }]
}).compileComponents();
})
+++ /dev/null
-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();
- })
- );
-});
+++ /dev/null
-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'];
- });
- }
-}
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', () => {
HttpClientModule,
BsDropdownModule.forRoot(),
SharedModule
- ],
- providers: [ TablePerformanceCounterService ]
+ ]
})
.compileComponents();
}));
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.
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', () => {
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',
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', () => {
HttpClientTestingModule,
HttpClientModule,
TabsModule.forRoot(),
- PerformanceCounterModule
- ],
- providers: [ RgwDaemonService ]
+ PerformanceCounterModule,
+ SharedModule
+ ]
})
.compileComponents();
}));
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',
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: [
declarations: [
RgwDaemonListComponent,
RgwDaemonDetailsComponent
- ],
- providers: [
- RgwDaemonService
]
})
export class RgwModule { }
+++ /dev/null
-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();
- })
- );
-});
+++ /dev/null
-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;
- });
- }
-}
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',
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',
--- /dev/null
+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 {}
--- /dev/null
+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();
+ });
+ }
+}
--- /dev/null
+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();
+ })
+ );
+});
--- /dev/null
+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}`);
+ }
+}
--- /dev/null
+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();
+ })
+ );
+});
--- /dev/null
+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/');
+ }
+}
--- /dev/null
+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();
+ })
+ );
+});
--- /dev/null
+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');
+ }
+}
--- /dev/null
+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;
+ });
+ }
+}
--- /dev/null
+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();
+ }));
+});
--- /dev/null
+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');
+ }
+}
--- /dev/null
+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();
+ }));
+});
--- /dev/null
+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}`);
+ }
+}
--- /dev/null
+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;
+ });
+ }
+}
--- /dev/null
+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();
+ }));
+});
--- /dev/null
+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');
+ }
+}
--- /dev/null
+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();
+ })
+ );
+});
--- /dev/null
+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;
+ });
+ }
+}
--- /dev/null
+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();
+ })
+ );
+});
--- /dev/null
+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'];
+ });
+ }
+}
--- /dev/null
+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;
+ });
+ }
+}
+++ /dev/null
-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();
- });
- }
-}
+++ /dev/null
-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();
- })
- );
-});
+++ /dev/null
-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/');
- }
-}
+++ /dev/null
-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;
- });
- }
-}
+++ /dev/null
-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;
- });
- }
-}
+++ /dev/null
-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();
- }));
-});
+++ /dev/null
-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');
- }
-}
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 { }
+++ /dev/null
-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;
- });
- }
-}
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';
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({
PipesModule,
ComponentsModule,
ServicesModule,
- DataTableModule
+ DataTableModule,
+ ApiModule
],
declarations: [
PasswordButtonDirective,
DataTableModule
],
providers: [
- AuthService,
AuthStorageService,
AuthGuardService,
- PoolService,
FormatterService,
- HostService
],
})
export class SharedModule {}