activity.html

79 lines
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
<div class="flex items-center justify-between mb-2">
    <h3 class="text-[11px] font-semibold uppercase tracking-wider text-slate-400">Activity</h3>
    {{if dashboard.RecentActivity}}
    <button hx-post="/activity/clear" hx-target="body" hx-confirm="Clear all activity history?"
        class="text-[10px] text-slate-300 hover:text-slate-500 transition-colors btn-press" title="Clear activity log">Clear</button>
    {{end}}
</div>
{{if dashboard.RecentActivity}}
<div class="relative ml-2 border-l border-slate-100 pl-4 space-y-0">
    {{range $group := dashboard.RecentActivity}}
    {{if $group.Single}}
    <div class="relative flex items-start gap-2 py-1.5">
        <div class="absolute -left-[18.5px] top-[9px] w-2 h-2 rounded-full border-2 border-white
            {{if contains $group.First.Summary "failed"}}bg-red-500
            {{else if eq $group.Action "clone"}}bg-sky-400
            {{else if eq $group.Action "pull"}}bg-blue-400
            {{else if eq $group.Action "delete"}}bg-red-400
            {{else if eq $group.Action "delete_service"}}bg-red-400
            {{else if eq $group.Action "init"}}bg-emerald-400
            {{else if eq $group.Action "create_project"}}bg-emerald-400
            {{else if eq $group.Action "deploy"}}bg-violet-400
            {{else if eq $group.Action "start"}}bg-emerald-400
            {{else if eq $group.Action "stop"}}bg-slate-400
            {{else if eq $group.Action "restart"}}bg-amber-400
            {{else if eq $group.Action "coder_restart"}}bg-orange-400
            {{else if eq $group.Action "domain_setup"}}bg-teal-400
            {{else if eq $group.Action "signin"}}bg-indigo-400
            {{else if eq $group.Action "signup"}}bg-indigo-400
            {{else if eq $group.Action "password_change"}}bg-indigo-400
            {{else if eq $group.Action "add_route"}}bg-teal-400
            {{else if eq $group.Action "update_route"}}bg-teal-400
            {{else if eq $group.Action "delete_route"}}bg-red-400
            {{else}}bg-slate-300{{end}}"></div>
        <span class="text-[12px] flex-1 break-words {{if contains $group.First.Summary "failed"}}text-red-500 font-medium{{else}}text-slate-500{{end}}">{{$group.First.Summary}}</span>
        <span class="text-[10px] text-slate-300 shrink-0 font-mono mt-0.5">{{$group.First.Ago}}</span>
    </div>
    {{else}}
    <details class="relative group">
        <summary class="flex items-center gap-2 py-1.5 cursor-pointer select-none list-none [&::-webkit-details-marker]:hidden">
            <div class="absolute -left-[18.5px] w-2 h-2 rounded-full border-2 border-white
                {{if contains $group.First.Summary "failed"}}bg-red-500
                {{else if eq $group.Action "clone"}}bg-sky-400
                {{else if eq $group.Action "pull"}}bg-blue-400
                {{else if eq $group.Action "delete"}}bg-red-400
                {{else if eq $group.Action "delete_service"}}bg-red-400
                {{else if eq $group.Action "init"}}bg-emerald-400
                {{else if eq $group.Action "create_project"}}bg-emerald-400
                {{else if eq $group.Action "deploy"}}bg-violet-400
                {{else if eq $group.Action "start"}}bg-emerald-400
                {{else if eq $group.Action "stop"}}bg-slate-400
                {{else if eq $group.Action "restart"}}bg-amber-400
                {{else if eq $group.Action "coder_restart"}}bg-orange-400
                {{else if eq $group.Action "domain_setup"}}bg-teal-400
                {{else if eq $group.Action "signin"}}bg-indigo-400
                {{else if eq $group.Action "signup"}}bg-indigo-400
                {{else if eq $group.Action "password_change"}}bg-indigo-400
                {{else if eq $group.Action "add_route"}}bg-teal-400
                {{else if eq $group.Action "update_route"}}bg-teal-400
                {{else if eq $group.Action "delete_route"}}bg-red-400
                {{else}}bg-slate-300{{end}}"></div>
            <span class="text-[12px] text-slate-500 truncate flex-1">{{$group.First.Summary}}</span>
            <span class="text-[10px] font-mono text-slate-300 bg-slate-50 px-1.5 py-0.5 rounded shrink-0">+{{$group.Count}}</span>
            <span class="text-[10px] text-slate-300 shrink-0 font-mono">{{$group.First.Ago}}</span>
        </summary>
        <div class="ml-1 mt-0.5 mb-1 space-y-0">
            {{range $act := $group.Items}}
            <div class="flex items-start gap-2 py-0.5">
                <span class="text-[11px] flex-1 break-words {{if contains $act.Summary "failed"}}text-red-500{{else}}text-slate-400{{end}}">{{$act.Summary}}</span>
                <span class="text-[10px] text-slate-300 shrink-0 font-mono">{{$act.Ago}}</span>
            </div>
            {{end}}
        </div>
    </details>
    {{end}}
    {{end}}
</div>
{{else}}
<p class="text-[12px] text-slate-300 py-2 text-center">No activity yet</p>
{{end}}