]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: update rbd list api version to 2
authorPere Diaz Bou <pdiazbou@redhat.com>
Mon, 4 Jul 2022 10:56:03 +0000 (12:56 +0200)
committerPere Diaz Bou <pdiazbou@redhat.com>
Tue, 12 Jul 2022 17:09:02 +0000 (19:09 +0200)
Signed-off-by: Pere Diaz Bou <pdiazbou@redhat.com>
src/pybind/mgr/dashboard/controllers/rbd.py
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.ts
src/pybind/mgr/dashboard/openapi.yaml

index ddd26b37fe974b47f30560f117416955b559167d..4376cc3f05aa718abacdc70bb9f57b368230c6f6 100644 (file)
@@ -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)
index 6525f3926b1aac7547418ed09c252f9517d68b55..555f0db0f4f8009335f3392fd5d2f271ccb0e4d0 100644 (file)
@@ -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<RbdPool[]>('api/block/image', { params: params, observe: 'response' })
+      .get<RbdPool[]>('api/block/image', {
+        params: params,
+        headers: { Accept: this.getVersionHeaderValue(2, 0) },
+        observe: 'response'
+      })
       .pipe(
         map((response: any) => {
           return response['body'].map((pool: any) => {
index 2889bbea646ab09f8d1925d93cf05742bd89b7ed..8d07d74f09cf216ed3ae17510aa96469139c019e 100644 (file)
@@ -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: