mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-02-01 13:53:49 +02:00
Use default symbol theme if none is provided when loading appliances
This commit is contained in:
parent
72eb13d941
commit
6d0c375323
@ -47,7 +47,7 @@ router = APIRouter()
|
|||||||
@router.get("")
|
@router.get("")
|
||||||
async def get_appliances(
|
async def get_appliances(
|
||||||
update: Optional[bool] = False,
|
update: Optional[bool] = False,
|
||||||
symbol_theme: Optional[str] = "Classic"
|
symbol_theme: Optional[str] = None
|
||||||
) -> List[schemas.Appliance]:
|
) -> List[schemas.Appliance]:
|
||||||
"""
|
"""
|
||||||
Return all appliances known by the controller.
|
Return all appliances known by the controller.
|
||||||
@ -56,7 +56,7 @@ async def get_appliances(
|
|||||||
controller = Controller.instance()
|
controller = Controller.instance()
|
||||||
if update:
|
if update:
|
||||||
await controller.appliance_manager.download_appliances()
|
await controller.appliance_manager.download_appliances()
|
||||||
controller.appliance_manager.load_appliances(symbol_theme=symbol_theme)
|
controller.appliance_manager.load_appliances(symbol_theme)
|
||||||
return [c.asdict() for c in controller.appliance_manager.appliances.values()]
|
return [c.asdict() for c in controller.appliance_manager.appliances.values()]
|
||||||
|
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ class ApplianceManager:
|
|||||||
template_data = await self._appliance_to_template(appliance)
|
template_data = await self._appliance_to_template(appliance)
|
||||||
await self._create_template(template_data, templates_repo, rbac_repo, current_user)
|
await self._create_template(template_data, templates_repo, rbac_repo, current_user)
|
||||||
|
|
||||||
def load_appliances(self, symbol_theme: str = "Classic") -> None:
|
def load_appliances(self, symbol_theme: str = None) -> None:
|
||||||
"""
|
"""
|
||||||
Loads appliance files from disk.
|
Loads appliance files from disk.
|
||||||
"""
|
"""
|
||||||
@ -326,6 +326,8 @@ class ApplianceManager:
|
|||||||
from . import Controller
|
from . import Controller
|
||||||
|
|
||||||
controller = Controller.instance()
|
controller = Controller.instance()
|
||||||
|
if not symbol_theme:
|
||||||
|
symbol_theme = controller.symbols.theme
|
||||||
category = appliance["category"]
|
category = appliance["category"]
|
||||||
if category == "guest":
|
if category == "guest":
|
||||||
if "docker" in appliance:
|
if "docker" in appliance:
|
||||||
|
@ -68,7 +68,7 @@ class Symbols:
|
|||||||
|
|
||||||
theme = self._themes.get(symbol_theme, None)
|
theme = self._themes.get(symbol_theme, None)
|
||||||
if not theme:
|
if not theme:
|
||||||
log.warning(f"Could not find symbol theme '{self._current_theme}'")
|
log.warning(f"Could not find symbol theme '{symbol_theme}'")
|
||||||
return None
|
return None
|
||||||
symbol_path = theme.get(symbol)
|
symbol_path = theme.get(symbol)
|
||||||
if symbol_path not in self._symbols_path:
|
if symbol_path not in self._symbols_path:
|
||||||
|
Loading…
Reference in New Issue
Block a user