You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
5.6 KiB

######################################################################
# @CCOSTAN - Follow Me on X
# For more info visit https://www.vcloudinfo.com/click-here
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# -------------------------------------------------------------------
# Infrastructure Partial - Docker inventory
# Complete stack and monitored-container inventory for drill-down use.
# -------------------------------------------------------------------
# Notes: This partial belongs to a hidden subview; the main Docker view stays exception-first.
######################################################################
# -------------------------------------------------------------------
# Inventory navigation (mandatory first full-width wrapper)
# -------------------------------------------------------------------
- type: grid
column_span: 4
columns: 1
square: false
cards:
- type: custom:layout-card
grid_options:
columns: full
layout_type: custom:grid-layout
layout:
grid-template-columns: repeat(3, minmax(0, 1fr))
grid-auto-flow: row
grid-auto-rows: min-content
grid-gap: 12px
margin: 0
mediaquery:
"(max-width: 900px)":
grid-template-columns: repeat(1, minmax(0, 1fr))
cards:
- type: custom:button-card
template: bearstone_infra_list_row
entity: sensor.docker_monitored_container_count
name: Back to Docker Operations
icon: mdi:arrow-left
state_display: >
[[[ return `${entity.state} monitored workloads`; ]]]
tap_action:
action: navigate
navigation_path: /dashboard-infrastructure/docker
- type: custom:button-card
template: bearstone_infra_status_kpi
entity: sensor.docker_monitored_unavailable_count
name: Unavailable
icon: mdi:alert-circle-outline
variables:
ok_state: '0'
healthy_text: NONE
raw_suffix: UNAVAILABLE
- type: custom:button-card
template: bearstone_infra_status_kpi
entity: binary_sensor.docker_container_telemetry_degraded
name: Telemetry
icon: mdi:lan-check
variables:
ok_state: 'off'
# -------------------------------------------------------------------
# All stacks
# -------------------------------------------------------------------
- type: grid
column_span: 4
columns: 1
square: false
cards:
- type: custom:vertical-stack-in-card
grid_options:
columns: full
card_mod:
style: !include /config/dashboards/infrastructure/card_mod/infra_panel.yaml
cards:
- type: custom:button-card
template: bearstone_infra_panel_header
name: Docker Stacks
- type: custom:button-card
template: bearstone_infra_list_row
entity: sensor.docker_monitored_container_count
name: Stack Telemetry
icon: mdi:package-variant
state_display: >
[[[
const count = Object.keys(states)
.filter(id => /^binary_sensor\..*_stack_status$/.test(id)).length;
return count ? `${count} stacks reported` : 'Not exposed by Portainer';
]]]
- type: custom:auto-entities
show_empty: false
card:
type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: repeat(4, minmax(0, 1fr))
grid-auto-flow: row
grid-auto-rows: min-content
grid-gap: 12px
margin: 0
mediaquery:
"(max-width: 900px)":
grid-template-columns: repeat(2, minmax(0, 1fr))
card_param: cards
filter:
include:
- entity_id: binary_sensor.*_stack_status
options:
type: custom:button-card
template: bearstone_infra_list_row_running
icon: mdi:package-variant
state_display: >
[[[
const base = entity.entity_id.replace('binary_sensor.', '').replace('_stack_status', '');
const count = states[`sensor.${base}_stack_containers_count`]?.state ?? 'n/a';
const status = entity.state === 'on' ? 'RUNNING' : 'DOWN';
return `${status} | ${count} containers`;
]]]
sort:
method: name
# -------------------------------------------------------------------
# All monitored containers
# -------------------------------------------------------------------
- type: grid
column_span: 4
columns: 1
square: false
cards:
- type: custom:vertical-stack-in-card
grid_options:
columns: full
card_mod:
style: !include /config/dashboards/infrastructure/card_mod/infra_panel.yaml
cards:
- type: custom:button-card
template: bearstone_infra_panel_header
name: Monitored Containers
- type: custom:auto-entities
show_empty: true
card:
type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: repeat(4, minmax(0, 1fr))
grid-auto-flow: row
grid-auto-rows: min-content
grid-gap: 12px
margin: 0
mediaquery:
"(max-width: 900px)":
grid-template-columns: repeat(2, minmax(0, 1fr))
card_param: cards
filter:
template: |
[{% for entity_id in state_attr('sensor.docker_monitored_switch_inventory', 'entity_id') or [] %}
{% if not entity_id.endswith('_container_2') %}
{'entity': '{{ entity_id }}',
'type': 'custom:button-card',
'template': 'bearstone_infra_container_row',
'icon': 'mdi:docker'},
{% endif %}
{% endfor %}]
sort:
method: name

Powered by TurnKey Linux.