drivers: include source.search_drivers in GET /drivers
The search_drivers attribute is set at the source model level, not at the the drivers model level. Having said that, by adding its value in the response to GET /drivers, we can avoid doing multiple HTTP calls in the make_ui function. Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
parent
79326cf2eb
commit
8929197010
|
@ -31,13 +31,11 @@ class DriversController(SubiquityTuiController):
|
||||||
endpoint_name = 'drivers'
|
endpoint_name = 'drivers'
|
||||||
|
|
||||||
async def make_ui(self) -> DriversView:
|
async def make_ui(self) -> DriversView:
|
||||||
source_endpoint = self.app.client.source
|
response: DriversResponse = await self.endpoint.GET()
|
||||||
source_response = await source_endpoint.GET()
|
|
||||||
|
|
||||||
if not source_response.search_drivers:
|
if not response.search_drivers:
|
||||||
raise Skip
|
raise Skip
|
||||||
|
|
||||||
response: DriversResponse = await self.endpoint.GET()
|
|
||||||
return DriversView(self, response.drivers,
|
return DriversView(self, response.drivers,
|
||||||
response.install, response.local_only)
|
response.install, response.local_only)
|
||||||
|
|
||||||
|
|
|
@ -399,10 +399,12 @@ class DriversResponse:
|
||||||
to do it. It will bet set to None until we figure out what drivers are
|
to do it. It will bet set to None until we figure out what drivers are
|
||||||
available.
|
available.
|
||||||
:local_only: tells if we are looking for drivers only from the ISO.
|
:local_only: tells if we are looking for drivers only from the ISO.
|
||||||
|
:search_drivers: enables or disables drivers listing.
|
||||||
"""
|
"""
|
||||||
install: bool
|
install: bool
|
||||||
drivers: Optional[List[str]]
|
drivers: Optional[List[str]]
|
||||||
local_only: bool
|
local_only: bool
|
||||||
|
search_drivers: bool
|
||||||
|
|
||||||
|
|
||||||
@attr.s(auto_attribs=True)
|
@attr.s(auto_attribs=True)
|
||||||
|
|
|
@ -102,9 +102,12 @@ class DriversController(SubiquityController):
|
||||||
if wait:
|
if wait:
|
||||||
await asyncio.shield(self._drivers_task)
|
await asyncio.shield(self._drivers_task)
|
||||||
|
|
||||||
|
search_drivers = self.app.controllers.Source.model.search_drivers
|
||||||
|
|
||||||
return DriversResponse(install=self.model.do_install,
|
return DriversResponse(install=self.model.do_install,
|
||||||
drivers=self.drivers,
|
drivers=self.drivers,
|
||||||
local_only=local_only)
|
local_only=local_only,
|
||||||
|
search_drivers=search_drivers)
|
||||||
|
|
||||||
async def POST(self, data: DriversPayload) -> None:
|
async def POST(self, data: DriversPayload) -> None:
|
||||||
self.model.do_install = data.install
|
self.model.do_install = data.install
|
||||||
|
|
Loading…
Reference in New Issue