updates
This commit is contained in:
21
app.py
21
app.py
@@ -11,6 +11,7 @@ DEFAULT_GROUP_PRIORITY = 100
|
||||
DEFAULT_GROUP = 'Applications'
|
||||
DEFAULT_GROUP_ICON = 'fas fa-box'
|
||||
DEFAULT_TITLE = 'Traefik Routers'
|
||||
DEFAULT_ICON = 'fas fa-bars'
|
||||
|
||||
client = docker.from_env()
|
||||
|
||||
@@ -30,6 +31,7 @@ def filter_routers(routers, containers):
|
||||
if not is_router_hidden(router['name'], containers):
|
||||
router['description'] = get_router_description(router['name'], containers)
|
||||
router['display_name'] = get_router_display_name(router['name'], containers)
|
||||
router['icon'] = get_router_icon(router['name'], containers)
|
||||
router['group'] = get_router_group(router['name'], containers)
|
||||
filtered_routers.append(router)
|
||||
break
|
||||
@@ -71,16 +73,17 @@ def get_router_group(router_name, containers):
|
||||
return labels[group_label]
|
||||
return DEFAULT_GROUP
|
||||
|
||||
def get_groups(containers):
|
||||
groups = {
|
||||
DEFAULT_GROUP: {
|
||||
'priority': DEFAULT_GROUP_PRIORITY,
|
||||
'collapsed': False,
|
||||
'routers': [],
|
||||
'icon': DEFAULT_GROUP_ICON
|
||||
}
|
||||
}
|
||||
def get_router_icon(router_name, containers):
|
||||
service_name = router_name.split('@')[0]
|
||||
for container in containers:
|
||||
labels = container.attrs.get('Config', {}).get('Labels', {})
|
||||
icon_label = f'traefik-frontend.http.routers.{service_name}.icon'
|
||||
if icon_label in labels:
|
||||
return labels[icon_label]
|
||||
return DEFAULT_ICON
|
||||
|
||||
def get_groups(containers):
|
||||
groups = {DEFAULT_GROUP: {'priority': DEFAULT_GROUP_PRIORITY, 'collapsed': False, 'routers': [], 'icon': DEFAULT_GROUP_ICON}}
|
||||
for container in containers:
|
||||
labels = container.attrs.get('Config', {}).get('Labels', {})
|
||||
for label, value in labels.items():
|
||||
|
||||
Reference in New Issue
Block a user