From: Pere Diaz Bou Date: Mon, 4 Jul 2022 10:56:03 +0000 (+0200) Subject: mgr/dashboard: update rbd list api version to 2 X-Git-Tag: v16.2.11~407^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3cb550a0f930f5510ad21701f92fa7b211725923;p=ceph.git mgr/dashboard: update rbd list api version to 2 Signed-off-by: Pere Diaz Bou (cherry picked from commit 5386dd1cb3195e7bc2dd80dafa1f0d29e8e0eb9e) --- diff --git a/src/pybind/mgr/dashboard/controllers/rbd.py b/src/pybind/mgr/dashboard/controllers/rbd.py index f496e4263da8..d26fcfa7292b 100644 --- a/src/pybind/mgr/dashboard/controllers/rbd.py +++ b/src/pybind/mgr/dashboard/controllers/rbd.py @@ -24,6 +24,7 @@ from ..tools import ViewCache, str_to_bool from . import APIDoc, APIRouter, BaseController, CreatePermission, \ DeletePermission, Endpoint, EndpointDoc, ReadPermission, RESTController, \ Task, UIRouter, UpdatePermission, allow_empty_body +from ._version import APIVersion logger = logging.getLogger(__name__) @@ -108,6 +109,7 @@ class Rbd(RESTController): 'offset': (int, 'offset'), }, responses={200: RBD_SCHEMA}) + @RESTController.MethodMap(version=APIVersion(2, 0)) # type: ignore def list(self, pool_name=None, offset: int = 0, limit: int = 5, search: str = ''): return self._rbd_list(pool_name, offset=offset, limit=limit, search=search) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.ts index 6525f3926b1a..555f0db0f4f8 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.ts @@ -4,6 +4,7 @@ import { Injectable } from '@angular/core'; import _ from 'lodash'; import { map } from 'rxjs/operators'; +import { ApiClient } from '~/app/shared/api/api-client'; import { cdEncode, cdEncodeNot } from '../decorators/cd-encode'; import { ImageSpec } from '../models/image-spec'; import { RbdConfigurationService } from '../services/rbd-configuration.service'; @@ -13,8 +14,10 @@ import { RbdPool } from './rbd.model'; @Injectable({ providedIn: 'root' }) -export class RbdService { - constructor(private http: HttpClient, private rbdConfigurationService: RbdConfigurationService) {} +export class RbdService extends ApiClient { + constructor(private http: HttpClient, private rbdConfigurationService: RbdConfigurationService) { + super(); + } isRBDPool(pool: any) { return _.indexOf(pool.application_metadata, 'rbd') !== -1 && !pool.pool_name.includes('/'); @@ -42,7 +45,11 @@ export class RbdService { list(params: any) { return this.http - .get('api/block/image', { params: params, observe: 'response' }) + .get('api/block/image', { + params: params, + headers: { Accept: this.getVersionHeaderValue(2, 0) }, + observe: 'response' + }) .pipe( map((response: any) => { return response['body'].map((pool: any) => { diff --git a/src/pybind/mgr/dashboard/openapi.yaml b/src/pybind/mgr/dashboard/openapi.yaml index 832f70a03468..646f52482550 100644 --- a/src/pybind/mgr/dashboard/openapi.yaml +++ b/src/pybind/mgr/dashboard/openapi.yaml @@ -166,10 +166,15 @@ paths: name: limit schema: type: integer + - default: '' + in: query + name: search + schema: + type: string responses: '200': content: - application/vnd.ceph.api.v1.0+json: + application/vnd.ceph.api.v2.0+json: schema: items: properties: