]> 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>
Fri, 9 Sep 2022 17:30:24 +0000 (19:30 +0200)
Signed-off-by: Pere Diaz Bou <pdiazbou@redhat.com>
(cherry picked from commit 5386dd1cb3195e7bc2dd80dafa1f0d29e8e0eb9e)
(cherry picked from commit 076a0d7f86783779d2903d5ce59445e4bd88f59f)

Resolves: rhbz#2125432

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 fea773382114817b0aa4b9a5ddc53a5032302c0f..49faf477be666cad1fe1c0193a8b15ef8f854a31 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 3249eaf5ec93a569fc5f9e0e271068b4d36b68e0..43f93be3bd3413f0275207947b175dbbed14ec50 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: