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: v18.0.0~511^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5386dd1cb3195e7bc2dd80dafa1f0d29e8e0eb9e;p=ceph.git mgr/dashboard: update rbd list api version to 2 Signed-off-by: Pere Diaz Bou --- diff --git a/src/pybind/mgr/dashboard/controllers/rbd.py b/src/pybind/mgr/dashboard/controllers/rbd.py index ddd26b37fe97..4376cc3f05aa 100644 --- a/src/pybind/mgr/dashboard/controllers/rbd.py +++ b/src/pybind/mgr/dashboard/controllers/rbd.py @@ -23,6 +23,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__) @@ -107,6 +108,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 2889bbea646a..8d07d74f09cf 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: