Skip to content

Commit

Permalink
NAS-133576 / 25.04 / Convert webui.enclosure.dashboard to api_method (#…
Browse files Browse the repository at this point in the history
…15396)

* add webui_enclosure.py to new api

* @accepts -> @api_method

* narrow result annotation

* fix typo

* address review
  • Loading branch information
yocalebo authored Jan 15, 2025
1 parent 28b1247 commit c079cf6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/middlewared/middlewared/api/v25_04_0/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@
from .virt_volume import * # noqa
from .vm import * # noqa
from .vm_device import * # noqa
from .webui_enclosure import * # noqa
9 changes: 9 additions & 0 deletions src/middlewared/middlewared/api/v25_04_0/webui_enclosure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from middlewared.api.base import BaseModel


class WebUIEnclosureDashboardArgs(BaseModel):
pass


class WebUIEnclosureDashboardResult(BaseModel):
result: list[dict]
12 changes: 10 additions & 2 deletions src/middlewared/middlewared/plugins/webui/enclosure.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from middlewared.schema import accepts
from middlewared.api import api_method
from middlewared.api.current import (
WebUIEnclosureDashboardArgs,
WebUIEnclosureDashboardResult
)
from middlewared.service import Service


Expand Down Expand Up @@ -63,7 +67,11 @@ def dashboard_impl(self):

return enclosures

@accepts(roles=['ENCLOSURE_READ'])
@api_method(
WebUIEnclosureDashboardArgs,
WebUIEnclosureDashboardResult,
roles=['ENCLOSURE_READ']
)
def dashboard(self):
"""This endpoint is used exclusively by the webUI team for
the enclosure dashboard page for iX sold hardware.
Expand Down

0 comments on commit c079cf6

Please sign in to comment.