Repository navigation
Expand file tree
/
Copy pathsync_detail.go.html
More file actions
263 lines (251 loc) · 11.6 KB
/
Copy pathsync_detail.go.html
File metadata and controls
263 lines (251 loc) · 11.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
{{/* Copyright (c) ClaceIO, LLC */}}
{{/* SPDX-License-Identifier: Apache-2.0 */}}
{{/* Sync detail page (/syncs/detail?id=): settings, status and the stored
results of the last invocation. HTMX partial: block sync_content */}}
{{ template "page_open" (dict "Ctx" . "Main" "max-w-6xl") }}
<div
id="sync-content"
class="space-y-4">
{{ block "sync_content" . }}
<!-- Header -->
<div class="page-header flex items-center gap-2 flex-wrap mb-2 md:mb-6">
{{ template "hamburger" . }}
<div>
{{ template "page_title" "Syncs" }}
<div class="flex items-center gap-2"><nav aria-label="Breadcrumb" class="breadcrumbs text-xs text-base-content/70 p-0">
<ul>
<li><a href="{{ .AppPath }}/syncs">Syncs</a></li>
<li class="font-mono">{{ .Data.Id }}</li>
</ul></nav>{{ template "help_link" .Data.HelpUrl }}</div>
<h2 class="text-xl font-medium font-mono break-all">
{{ if .Data.Sync }}{{ .Data.Sync.repo }}{{ else }}{{ .Data.Id }}{{ end }}
</h2>
<p class="page-desc text-sm text-base-content/70">
{{ if .Data.Sync }}
{{ if eq .Data.Sync.state "Failing" }}
<span class="status status-error"></span>
<span class="text-error text-xs">failing</span>
{{ else if eq .Data.Sync.state "Disabled" }}
<span class="status status-warning"></span>
<span class="text-xs">disabled</span>
{{ else }}
<span class="status status-success"></span>
<span class="text-xs">healthy</span>
{{ end }}
{{ if .Data.Sync.branch }}
<span class="badge badge-ghost badge-xs"
>{{ .Data.Sync.branch }}</span
>
{{ end }}
{{ end }}
</p>
</div>
<div class="page-actions ml-auto flex items-center gap-2">
{{ if .Data.Sync }}
<button
class="btn btn-sm btn-primary transition-transform duration-150 active:scale-95 tooltip tooltip-bottom"
{{ if index .Data.Perms "sync:run" }}
data-tip="Fetch from the source and apply now"
hx-post="{{ .AppPath }}/syncs/detail/run"
hx-vals='{"id": "{{ .Data.Id }}"}'
hx-target="#sync-content"
hx-swap="innerHTML"
hx-disable="this"
hx-indicator="#page-progress"
{{ else }}
disabled data-tip="requires sync:run"
{{ end }}>
Sync now
</button>
<button
class="btn btn-sm btn-ghost text-error transition-transform duration-150 active:scale-95 tooltip tooltip-bottom"
{{ if index .Data.Perms "sync:delete" }}
data-tip="Remove this sync source"
hx-post="{{ .AppPath }}/syncs/detail/delete"
hx-vals='{"id": "{{ .Data.Id }}"}'
hx-confirm="Remove sync source {{ .Data.Sync.repo }}? Apps applied by it are not deleted."
hx-target="#sync-content"
hx-swap="innerHTML"
hx-disable="this"
hx-indicator="#page-progress"
{{ else }}
disabled data-tip="requires sync:delete"
{{ end }}>
Delete
</button>
{{ end }}
</div>
</div>
{{ template "page_progress" }}
{{ template "error_alert" .Data.Error }}
{{ template "flash_alerts" .Data }}
{{ if .Data.Sync }}
{{ $s := .Data.Sync }}
<!-- Overview -->
<div class="card bg-base-100 border border-base-300">
<div class="card-body p-5 gap-1">
<h2 class="text-sm font-medium text-base-content/70 mb-2">
Overview
</h2>
<div
class="grid grid-cols-[max-content_minmax(0,1fr)] gap-x-6 gap-y-1.5 text-sm">
<span class="text-xs text-base-content/70 pt-0.5"
>Source</span
>
<span class="font-mono text-xs break-all pt-1"
>{{ $s.repo }}</span
>
{{ if $s.branch }}
<span class="text-xs text-base-content/70 pt-0.5"
>Branch</span
>
<span class="font-mono text-xs pt-1">{{ $s.branch }}</span>
{{ end }}
{{ if $s.git_auth }}
<span class="text-xs text-base-content/70 pt-0.5"
>Git auth</span
>
<span class="font-mono text-xs pt-1"
>{{ $s.git_auth }}</span
>
{{ end }}
<span class="text-xs text-base-content/70 pt-0.5"
>Trigger</span
>
<span class="text-xs pt-1">
{{ if $s.is_scheduled }}
scheduled - every {{ $s.schedule_frequency }} minutes
{{ else }}
webhook
{{ if $s.webhook_url }}
<span class="font-mono break-all"
>{{ $s.webhook_url }}</span
>
{{ end }}
{{ end }}
</span>
<span class="text-xs text-base-content/70 pt-0.5"
>Flags</span
>
<span class="pt-0.5 flex items-center gap-1 flex-wrap">
{{ range $s.flags }}
{{ if eq . "clobber" }}
<span class="badge badge-xs badge-soft badge-warning"
>{{ . }}</span
>
{{ else }}
<span class="badge badge-xs badge-soft badge-primary"
>{{ . }}</span
>
{{ end }}
{{ else }}
<span class="text-xs text-base-content/70"
>staging only - no promote</span
>
{{ end }}
</span>
{{ if $s.reload }}
<span class="text-xs text-base-content/70 pt-0.5"
>Reload</span
>
<span class="font-mono text-xs pt-1">{{ $s.reload }}</span>
{{ end }}
{{ if $s.user }}
<span class="text-xs text-base-content/70 pt-0.5"
>Created by</span
>
<span class="text-xs pt-1">
{{ $s.user }}
{{ if $s.create_time }}
· {{ template "time_ago" $s.create_time }}
{{ end }}
</span>
{{ end }}
<span class="text-xs text-base-content/70 pt-0.5">Id</span>
<span
class="font-mono text-xs text-base-content/70 break-all pt-1"
>{{ $s.id }}</span
>
</div>
</div>
</div>
<!-- Last invocation -->
<div class="card bg-base-100 border border-base-300">
<div
class="px-4 py-2.5 border-b border-base-300 flex items-center gap-2 flex-wrap">
<h2 class="text-sm font-medium">Last invocation</h2>
{{ if $s.last_exec }}
<span class="text-xs text-base-content/70"
>{{ template "time_ago" $s.last_exec }}</span
>
{{ if $s.commit_short }}
<span
class="font-mono text-xs text-base-content/70 tooltip tooltip-top"
data-tip="{{ $s.commit }}"
>{{ $s.commit_short }}</span
>
{{ end }}
{{ end }}
{{ if $s.failure_count }}
<span class="badge badge-error badge-sm badge-soft ml-auto"
>{{ $s.failure_count }} failed runs</span
>
{{ end }}
</div>
<div class="card-body p-4 gap-3">
{{ if not $s.last_exec }}
<p class="text-sm text-base-content/70">
This sync has not run yet
</p>
{{ else }}
{{ template "error_alert" $s.error }}
{{ if .Data.LastResult }}
{{ $r := .Data.LastResult }}
<div class="text-xs text-base-content/70">
{{ if $r.skipped_apply }}
No new commit was found, the apply was skipped
{{ else if not $r.changed }}
{{ $r.total }} apps checked - everything matched the
declared state, no changes were applied
{{ else }}
{{ $r.total }} apps in scope - changes applied:
{{ end }}
</div>
{{ if $r.changed }}
{{ template "sync_result_rows" $r }}
{{ end }}
{{ end }}
{{ end }}
</div>
</div>
<!-- Apps applied by this sync, same view as the apps page -->
<div class="card bg-base-100 border border-base-300">
<div
class="px-4 py-2.5 border-b border-base-300 flex items-center gap-2">
<h2 class="text-sm font-medium">Apps</h2>
<span class="text-xs text-base-content/70"
>{{ template "count" (dict "N" (len .Data.Apps) "One" "app") }} managed by this sync</span
>
<a
href="{{ .AppPath }}/apps"
class="link link-hover text-xs text-primary ml-auto"
>all apps <span aria-hidden="true">→</span></a
>
</div>
{{ if .Data.AppsError }}
<p class="text-sm text-base-content/70 px-4 py-4 break-all">
{{ .Data.AppsError }}
</p>
{{ else if .Data.Apps }}
{{ template "app_table" (dict "Apps" .Data.Apps "AppPath" .AppPath "Perms" .Data.Perms "ShowActions" false) }}
{{ else }}
<p class="text-sm text-base-content/70 px-4 py-4">
No apps have been applied by this sync yet
</p>
{{ end }}
</div>
{{ end }}
{{ end }}
<!-- End of "sync_content" block -->
</div>
{{ template "page_close" . }}