From e1ac5cfd623592fda2546758e327deebb8f2c390 Mon Sep 17 00:00:00 2001 From: Volker Theile Date: Tue, 24 Jul 2018 09:28:49 +0200 Subject: [PATCH] mgr/dashboard: RGW is not working if an URL prefix is defined Fixes https://tracker.ceph.com/issues/25068 Signed-off-by: Volker Theile --- .../app/shared/api/rgw-bucket.service.spec.ts | 20 +++++------ .../src/app/shared/api/rgw-bucket.service.ts | 2 +- .../app/shared/api/rgw-user.service.spec.ts | 34 +++++++++---------- .../src/app/shared/api/rgw-user.service.ts | 2 +- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-bucket.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-bucket.service.spec.ts index a57b1be688dba..b210757d2742c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-bucket.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-bucket.service.spec.ts @@ -31,7 +31,7 @@ describe('RgwBucketService', () => { service.list().subscribe((resp) => { result = resp; }); - const req = httpTesting.expectOne('/api/rgw/bucket'); + const req = httpTesting.expectOne('api/rgw/bucket'); req.flush([]); expect(req.request.method).toBe('GET'); expect(result).toEqual([]); @@ -42,13 +42,13 @@ describe('RgwBucketService', () => { service.list().subscribe((resp) => { result = resp; }); - let req = httpTesting.expectOne('/api/rgw/bucket'); + let req = httpTesting.expectOne('api/rgw/bucket'); req.flush(['foo', 'bar']); - req = httpTesting.expectOne('/api/rgw/bucket/foo'); + req = httpTesting.expectOne('api/rgw/bucket/foo'); req.flush({ name: 'foo' }); - req = httpTesting.expectOne('/api/rgw/bucket/bar'); + req = httpTesting.expectOne('api/rgw/bucket/bar'); req.flush({ name: 'bar' }); expect(req.request.method).toBe('GET'); @@ -57,31 +57,31 @@ describe('RgwBucketService', () => { it('should call get', () => { service.get('foo').subscribe(); - const req = httpTesting.expectOne('/api/rgw/bucket/foo'); + const req = httpTesting.expectOne('api/rgw/bucket/foo'); expect(req.request.method).toBe('GET'); }); it('should call create', () => { service.create('foo', 'bar').subscribe(); - const req = httpTesting.expectOne('/api/rgw/bucket?bucket=foo&uid=bar'); + const req = httpTesting.expectOne('api/rgw/bucket?bucket=foo&uid=bar'); expect(req.request.method).toBe('POST'); }); it('should call update', () => { service.update('foo', 'bar', 'baz').subscribe(); - const req = httpTesting.expectOne('/api/rgw/bucket/foo?bucket_id=bar&uid=baz'); + const req = httpTesting.expectOne('api/rgw/bucket/foo?bucket_id=bar&uid=baz'); expect(req.request.method).toBe('PUT'); }); it('should call delete, with purgeObjects = true', () => { service.delete('foo').subscribe(); - const req = httpTesting.expectOne('/api/rgw/bucket/foo?purge_objects=true'); + const req = httpTesting.expectOne('api/rgw/bucket/foo?purge_objects=true'); expect(req.request.method).toBe('DELETE'); }); it('should call delete, with purgeObjects = false', () => { service.delete('foo', false).subscribe(); - const req = httpTesting.expectOne('/api/rgw/bucket/foo?purge_objects=false'); + const req = httpTesting.expectOne('api/rgw/bucket/foo?purge_objects=false'); expect(req.request.method).toBe('DELETE'); }); @@ -90,7 +90,7 @@ describe('RgwBucketService', () => { service.exists('foo').subscribe((resp) => { result = resp; }); - const req = httpTesting.expectOne('/api/rgw/bucket'); + const req = httpTesting.expectOne('api/rgw/bucket'); expect(req.request.method).toBe('GET'); req.flush(['foo', 'bar']); expect(result).toBe(true); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-bucket.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-bucket.service.ts index f1de82eda5a83..fdd94672dfa95 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-bucket.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-bucket.service.ts @@ -13,7 +13,7 @@ import { ApiModule } from './api.module'; providedIn: ApiModule }) export class RgwBucketService { - private url = '/api/rgw/bucket'; + private url = 'api/rgw/bucket'; constructor(private http: HttpClient) {} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-user.service.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-user.service.spec.ts index b9acad14d4802..060b79a54f4bb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-user.service.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-user.service.spec.ts @@ -33,7 +33,7 @@ describe('RgwUserService', () => { service.list().subscribe((resp) => { result = resp; }); - const req = httpTesting.expectOne('/api/rgw/user'); + const req = httpTesting.expectOne('api/rgw/user'); expect(req.request.method).toBe('GET'); req.flush([]); expect(result).toEqual([]); @@ -45,15 +45,15 @@ describe('RgwUserService', () => { result = resp; }); - let req = httpTesting.expectOne('/api/rgw/user'); + let req = httpTesting.expectOne('api/rgw/user'); expect(req.request.method).toBe('GET'); req.flush(['foo', 'bar']); - req = httpTesting.expectOne('/api/rgw/user/foo'); + req = httpTesting.expectOne('api/rgw/user/foo'); expect(req.request.method).toBe('GET'); req.flush({ name: 'foo' }); - req = httpTesting.expectOne('/api/rgw/user/bar'); + req = httpTesting.expectOne('api/rgw/user/bar'); expect(req.request.method).toBe('GET'); req.flush({ name: 'bar' }); @@ -62,79 +62,79 @@ describe('RgwUserService', () => { it('should call enumerate', () => { service.enumerate().subscribe(); - const req = httpTesting.expectOne('/api/rgw/user'); + const req = httpTesting.expectOne('api/rgw/user'); expect(req.request.method).toBe('GET'); }); it('should call get', () => { service.get('foo').subscribe(); - const req = httpTesting.expectOne('/api/rgw/user/foo'); + const req = httpTesting.expectOne('api/rgw/user/foo'); expect(req.request.method).toBe('GET'); }); it('should call getQuota', () => { service.getQuota('foo').subscribe(); - const req = httpTesting.expectOne('/api/rgw/user/foo/quota'); + const req = httpTesting.expectOne('api/rgw/user/foo/quota'); expect(req.request.method).toBe('GET'); }); it('should call update', () => { service.update('foo', { xxx: 'yyy' }).subscribe(); - const req = httpTesting.expectOne('/api/rgw/user/foo?xxx=yyy'); + const req = httpTesting.expectOne('api/rgw/user/foo?xxx=yyy'); expect(req.request.method).toBe('PUT'); }); it('should call updateQuota', () => { service.updateQuota('foo', { xxx: 'yyy' }).subscribe(); - const req = httpTesting.expectOne('/api/rgw/user/foo/quota?xxx=yyy'); + const req = httpTesting.expectOne('api/rgw/user/foo/quota?xxx=yyy'); expect(req.request.method).toBe('PUT'); }); it('should call create', () => { service.create({ foo: 'bar' }).subscribe(); - const req = httpTesting.expectOne('/api/rgw/user?foo=bar'); + const req = httpTesting.expectOne('api/rgw/user?foo=bar'); expect(req.request.method).toBe('POST'); }); it('should call delete', () => { service.delete('foo').subscribe(); - const req = httpTesting.expectOne('/api/rgw/user/foo'); + const req = httpTesting.expectOne('api/rgw/user/foo'); expect(req.request.method).toBe('DELETE'); }); it('should call createSubuser', () => { service.createSubuser('foo', { xxx: 'yyy' }).subscribe(); - const req = httpTesting.expectOne('/api/rgw/user/foo/subuser?xxx=yyy'); + const req = httpTesting.expectOne('api/rgw/user/foo/subuser?xxx=yyy'); expect(req.request.method).toBe('POST'); }); it('should call deleteSubuser', () => { service.deleteSubuser('foo', 'bar').subscribe(); - const req = httpTesting.expectOne('/api/rgw/user/foo/subuser/bar'); + const req = httpTesting.expectOne('api/rgw/user/foo/subuser/bar'); expect(req.request.method).toBe('DELETE'); }); it('should call addCapability', () => { service.addCapability('foo', 'bar', 'baz').subscribe(); - const req = httpTesting.expectOne('/api/rgw/user/foo/capability?type=bar&perm=baz'); + const req = httpTesting.expectOne('api/rgw/user/foo/capability?type=bar&perm=baz'); expect(req.request.method).toBe('POST'); }); it('should call deleteCapability', () => { service.deleteCapability('foo', 'bar', 'baz').subscribe(); - const req = httpTesting.expectOne('/api/rgw/user/foo/capability?type=bar&perm=baz'); + const req = httpTesting.expectOne('api/rgw/user/foo/capability?type=bar&perm=baz'); expect(req.request.method).toBe('DELETE'); }); it('should call addS3Key', () => { service.addS3Key('foo', { xxx: 'yyy' }).subscribe(); - const req = httpTesting.expectOne('/api/rgw/user/foo/key?key_type=s3&xxx=yyy'); + const req = httpTesting.expectOne('api/rgw/user/foo/key?key_type=s3&xxx=yyy'); expect(req.request.method).toBe('POST'); }); it('should call deleteS3Key', () => { service.deleteS3Key('foo', 'bar').subscribe(); - const req = httpTesting.expectOne('/api/rgw/user/foo/key?key_type=s3&access_key=bar'); + const req = httpTesting.expectOne('api/rgw/user/foo/key?key_type=s3&access_key=bar'); expect(req.request.method).toBe('DELETE'); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-user.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-user.service.ts index a1563940737e8..cc7b749a584b8 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-user.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-user.service.ts @@ -13,7 +13,7 @@ import { ApiModule } from './api.module'; providedIn: ApiModule }) export class RgwUserService { - private url = '/api/rgw/user'; + private url = 'api/rgw/user'; constructor(private http: HttpClient) {} -- 2.39.5