// Manutenção: limpeza automática de recursos do runtime sem uso (ver
// docs/plano-limpeza-automatica-docker.md) — mesmas funções dos botões
// manuais da aba Runtime, disparadas por agendamento em vez de clique.
component {
scrollable(direction = vertical, class = u-fill-all) {
column(class = form-panel) {
text(class = u-label-cap, content = "LIMPEZA AUTOMÁTICA")
toggle(
:checked = docker_cleanup_enabled,
on_toggle = field:docker_cleanup_enabled,
label = " Ativar limpeza automática",
)
text(
class = u-muted,
content = """
Roda sozinha, no horário abaixo, os recursos marcados nesta
tela. Desligada por padrão — nada é removido até você marcar
pelo menos um recurso e ativar.
""",
)
text(class = u-label-cap, content = "FREQUÊNCIA")
scroll(class = tabs__scroll, direction = horizontal) {
tabbar(
:value = docker_cleanup_kind, active = @docker_cleanup_kind, :items = docker_cleanup_kinds,
tab_class = tabs__tab, tab_active_class = "tabs__tab tabs__tab--active", padding = "9 16", size = 14,
)
}
row(class = healthcheck__grid, if = @docker_cleanup_kind, equals = interval) {
column(class = healthcheck__field) {
text(class = u-label-cap, content = "A CADA (HORAS)")
// Teto de 168 = uma semana. Acima disso o usuário quer a
// frequência "semanal", que é a aba ao lado.
spinbox(
field_class = field__spin,
form_control = docker_cleanup_hours,
:value = docker_cleanup_hours,
min = 1,
max = 168,
width = 90,
placeholder = 6,
)
}
}
scroll(class = tabs__scroll, direction = horizontal, if = @docker_cleanup_kind, equals = weekly) {
row(class = tabs__main) {
radiogroup(:value = docker_cleanup_weekday, :items = weekdays, layout = row)
}
}
row(class = healthcheck__grid, if = @docker_cleanup_kind, not_equals = interval) {
column(class = healthcheck__field) {
text(class = u-label-cap, content = "HORÁRIO")
timeedit(:value = docker_cleanup_time)
}
}
text(
class = u-muted,
content = "Próxima execução agendada: @docker_cleanup_next_run_label",
)
hr
text(class = u-label-cap, content = "O QUE LIMPAR")
checkbox(
:checked = docker_cleanup_containers,
on_toggle = field:docker_cleanup_containers,
label = "Containers parados",
)
checkbox(
:checked = docker_cleanup_images,
on_toggle = field:docker_cleanup_images,
label = "Imagens sem uso",
)
checkbox(
if = @docker_cleanup_images,
equals = true,
:checked = docker_cleanup_images_all,
on_toggle = field:docker_cleanup_images_all,
label = " incluir todas as não usadas (não só as sem tag)",
)
row(class = healthcheck__grid, if = @docker_cleanup_images, equals = true) {
column(class = healthcheck__field) {
text(class = u-label-cap, content = "SÓ IMAGENS CRIADAS HÁ MAIS DE (HORAS)")
spinbox(
field_class = field__spin,
form_control = docker_cleanup_images_older_than_hours,
:value = docker_cleanup_images_older_than_hours,
min = 0,
max = 8760,
width = 110,
placeholder = 168,
)
text(
class = u-muted,
content = """
0 não filtra por idade. O runtime olha a data de criação da imagem,
não a do último uso: as imagens base antigas continuam elegíveis.
""",
)
}
}
checkbox(
:checked = docker_cleanup_networks,
on_toggle = field:docker_cleanup_networks,
label = "Redes sem uso",
)
checkbox(
:checked = docker_cleanup_build_cache,
on_toggle = field:docker_cleanup_build_cache,
label = "Cache de build",
)
row(class = healthcheck__grid, if = @docker_cleanup_build_cache, equals = true) {
column(class = healthcheck__field) {
text(class = u-label-cap, content = "MANTER O CACHE USADO NAS ÚLTIMAS (HORAS)")
spinbox(
field_class = field__spin,
form_control = docker_cleanup_build_cache_older_than_hours,
:value = docker_cleanup_build_cache_older_than_hours,
min = 0,
max = 8760,
width = 110,
placeholder = 168,
)
text(
class = u-muted,
content = """
0 remove todo o cache sem uso. Com um prazo, o cache de um job
ou deploy recente sobrevive e o próximo build não recomeça do zero.
""",
)
}
}
hr
text(class = "u-label-cap u-error", content = "VOLUMES — CUIDADO")
text(
class = u-muted,
content = """
Volumes sem uso criados por fora do rustploy (não pelos seus
serviços, que só usam bind mount) podem conter dado que ninguém
recriaria sozinho. Confirme que sabe o que existe no host antes
de ativar.
""",
)
checkbox(
:checked = docker_cleanup_volumes,
on_toggle = field:docker_cleanup_volumes,
label = "Volumes sem uso",
)
checkbox(
if = @docker_cleanup_volumes,
equals = true,
:checked = docker_cleanup_volumes_all,
on_toggle = field:docker_cleanup_volumes_all,
label = " incluir todos os sem uso (não só os anônimos)",
)
row(class = env__add) {
button(class = "btn btn--primary", on_click = docker_cleanup_save, disabled = @busy_docker_cleanup_save, text = Salvar)
button(
class = tabs__tab,
if = @docker_cleanup_running,
not_equals = true,
on_click = docker_cleanup_run_now,
disabled = @busy_docker_cleanup_run_now,
text = "Executar agora",
)
button(
class = tabs__tab,
if = @docker_cleanup_running,
equals = true,
text = "Executando…",
)
text(class = u-muted, content = "@docker_cleanup_message")
}
hr
text(class = u-label-cap, content = "ÚLTIMA EXECUÇÃO")
text(class = u-muted, content = "@docker_cleanup_last_run_text")
}
}
}