From 47d7399cd603db92cd67b2509992b66cdcf53711 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stephan=20M=C3=BCller?= Date: Wed, 27 Jun 2018 16:57:41 +0200 Subject: [PATCH] mgr/dashboard: Erasure code service MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes: https://tracker.ceph.com/issues/36355 Signed-off-by: Stephan Müller --- .../api/erasure-code-profile.service.spec.ts | 30 +++++++++++++++++++ .../api/erasure-code-profile.service.ts | 16 ++++++++++ 2 files changed, 46 insertions(+) create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts new file mode 100644 index 00000000000..6284fbbba97 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts @@ -0,0 +1,30 @@ +import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { TestBed } from '@angular/core/testing'; + +import { configureTestBed } from '../../../testing/unit-test-helper'; +import { ErasureCodeProfileService } from './erasure-code-profile.service'; + +describe('ErasureCodeProfileService', () => { + let service: ErasureCodeProfileService; + let httpTesting: HttpTestingController; + + configureTestBed({ + imports: [HttpClientTestingModule], + providers: [ErasureCodeProfileService] + }); + + beforeEach(() => { + service = TestBed.get(ErasureCodeProfileService); + httpTesting = TestBed.get(HttpTestingController); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); + + it('should call list', () => { + service.list().subscribe(); + const req = httpTesting.expectOne('api/erasure_code_profile'); + expect(req.request.method).toBe('GET'); + }); +}); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts new file mode 100644 index 00000000000..47c1f6c1c7d --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts @@ -0,0 +1,16 @@ +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; + +import { ApiModule } from './api.module'; + +@Injectable({ + providedIn: ApiModule +}) +@Injectable() +export class ErasureCodeProfileService { + constructor(private http: HttpClient) {} + + list() { + return this.http.get('api/erasure_code_profile'); + } +} -- 2.39.5