{{/* export_status — GET /d/{sqid}/export/{job}, where the button lands. Built twice (render.go): as a page, and as the bare "export-body" the shim polls. That is why the running and finished states are ALTERNATIVES rather than a result appended under a spinner — the shim keeps the first element of what it fetches and drops the rest, so a fragment has to be one element, and the element that replaces the spinner is the result. While it is running the element is ui's own job-status partial, which carries data-poll (and data-poll-push for a browser that can take server-sent events) and drops it when the job is done, which is what stops the loop. With scripts off the meta refresh below does the same job more slowly — and only while the job is running, or a finished page would refresh for ever. */}} {{define "page-head"}}{{if .Running}}{{end}}{{end}} {{define "export-body"}} {{- if .Running}} {{template "job-status" dict "Name" .Name "Status" .Status "Progress" .Progress "PollURL" .PollURL "PollSeconds" .PollSeconds "PushURL" .PushURL}} {{- else}}
{{- if .Failed}} {{template "callout" dict "Tone" "negative" "Title" .Name "Body" .Err "Alert" true}} {{- else if .Gone}} {{template "callout" dict "Tone" "warning" "Title" .Name "Body" .Gone}} {{- else}}

{{.Done}}

{{.DownloadLabel}}

{{.Held}}

{{- if .Warnings}}

{{.WarningsLabel}}

{{.WarningsBody}}

{{- end}} {{- end}}

{{.AgainLabel}}

{{- end}} {{end}} {{define "content"}} {{template "back-nav" dict "Href" .BackHref "Label" .BackLabel}} {{template "page-header" dict "Title" .Title "Sub" .Name}} {{template "export-body" .}} {{end}}