{{/* Copyright (c) ClaceIO, LLC */}} {{/* SPDX-License-Identifier: Apache-2.0 */}} {{/* App detail page (/apps/detail?path=): overview, promote/reload/delete actions, requested permissions, containers, params and stage/prod version tables. HTMX partial: block detail_content */}} {{/* version_table renders one environment's version list. Context: dict with Versions, Error, Env (prod/stage), Path, AppPath */}} {{ define "version_table" }} {{ if .Error }}

{{ .Error }}

{{ else if not .Versions }}

No versions yet

{{ else }} {{ $ctx := . }}
{{ range .Versions }} {{ end }}
Version Git Actions
v{{ .version }} {{ if .active }} active {{ end }} {{ if .git_sha }} {{ .git_sha }}{{ if .git_branch }} {{ .git_branch }} {{ end }} {{ else }} - {{ end }}
{{ if not .active }} {{ end }} files
{{ end }} {{ end }} {{ template "head" . }}
{{ template "drawer_toggle" }}
{{ block "detail_content" . }} {{ template "page_progress" }} {{ template "error_alert" .Data.Error }} {{ template "flash_alerts" .Data }} {{ if and .Data.AskPromote .Data.App (not .Data.App.is_dev) }} {{ $msg := "Changes were applied to the staging app." }} {{ if eq .Data.AskPromote "reload" }} {{ $msg = "Staging was reloaded from source." }} {{ else if eq .Data.AskPromote "approve" }} {{ $msg = "Permissions were approved on the staging app." }} {{ end }} {{ template "promote_prompt" (dict "Message" (print $msg " Promote to make them live on prod?") "Path" .Data.Path "PostUrl" (print .AppPath "/apps/detail/promote") "Target" "#detail-content" "StageUrl" .Data.App.stage_url "KeepHref" (print .AppPath "/apps/detail?path=" .Data.Path) "Perms" .Data.Perms) }} {{ end }} {{ if .Data.App }}

Overview

Source {{ .Data.App.source_url }}{{ if .Data.App.browse_url }}{{ end }}{{ if .Data.App.git_branch }} {{ .Data.App.git_branch }} {{ end }} {{ if .Data.App.git_commit }} Commit {{ .Data.App.git_commit }} {{ if .Data.App.git_message }} - {{ if gt (len .Data.App.git_message) 500 }} {{ trunc 500 .Data.App.git_message }}… {{ else }} {{ .Data.App.git_message }} {{ end }} {{ end }} {{ end }} Managed by {{ if .Data.Sync }} {{ .Data.Sync.repo }} {{ if .Data.Sync.branch }} {{ .Data.Sync.branch }} {{ end }} {{ else }} imperative {{ end }} Spec {{ if .Data.App.spec }} {{ .Data.App.spec }} {{ else }} - {{ end }} Auth {{ if .Data.App.auth }} {{ .Data.App.auth }} {{ else }} default {{ end }} Version v{{ .Data.App.version }} {{ if .Data.App.update_time }} Updated {{ template "time_ago" .Data.App.update_time }} {{ end }} {{ if .Data.Containers }} Containers {{ range .Data.Containers }} {{ if eq .state "running" }} {{ else }} {{ end }} {{ .env }} · {{ .state }} {{ end }} {{ end }} Id {{ .Data.App.id }}
{{ if .Data.ParamsText }}

Parameters

{{ .Data.ParamsText }}
{{ end }} {{ if .Data.AuditError }}

Requested permissions

Audit failed: {{ .Data.AuditError }}

{{ else if .Data.Audit }} {{ if .Data.NeedsApproval }} {{ end }} {{ template "perms_card" (dict "Review" .Data.Audit "Note" (ternary "Approval pending - approving grants the usage listed above" "All requested permissions are approved" .Data.NeedsApproval)) }} {{ end }} {{ if .Data.App.is_dev }}

Dev apps serve directly from disk - versions are not tracked

{{ else }} {{ if and .Data.App.staged_changes (not .Data.AskPromote) }} {{ template "promote_prompt" (dict "Warning" true "Message" "Staging has changes which are not promoted yet - prod keeps serving the previous version until they are promoted" "Path" .Data.Path "PostUrl" (print .AppPath "/apps/detail/promote") "Confirm" (print "Promote staging to prod for " .Data.Path "?") "Target" "#detail-content" "StageUrl" .Data.App.stage_url "Perms" .Data.Perms) }} {{ end }}

Staging versions

{{ len .Data.StageVersions }} versions {{ if .Data.App.stage_url }} {{ template "open_app_link" (dict "Href" .Data.App.stage_url "Label" "Open staging" "What" "staging app") }} {{ end }}
{{ template "version_table" (dict "Versions" .Data.StageVersions "Error" .Data.StageVersionsError "Env" "stage" "Path" .Data.Path "AppPath" .AppPath "Perms" .Data.Perms) }}

Production versions

{{ len .Data.ProdVersions }} versions {{ template "open_app_link" (dict "Href" .Data.App.url "Label" "Open app" "What" "app") }}
{{ template "version_table" (dict "Versions" .Data.ProdVersions "Error" .Data.ProdVersionsError "Env" "prod" "Path" .Data.Path "AppPath" .AppPath "Perms" .Data.Perms) }}
{{ end }} {{ end }} {{ end }}
{{ template "sidebar" . }}