]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Erasure code service
authorStephan Müller <smueller@suse.com>
Wed, 27 Jun 2018 14:57:41 +0000 (16:57 +0200)
committerStephan Müller <smueller@suse.com>
Tue, 9 Oct 2018 12:50:32 +0000 (14:50 +0200)
Fixes: https://tracker.ceph.com/issues/36355
Signed-off-by: Stephan Müller <smueller@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.spec.ts [new file with mode: 0644]
src/pybind/mgr/dashboard/frontend/src/app/shared/api/erasure-code-profile.service.ts [new file with mode: 0644]

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 (file)
index 0000000..6284fbb
--- /dev/null
@@ -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 (file)
index 0000000..47c1f6c
--- /dev/null
@@ -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');
+  }
+}