github.com/navikt/knorten@v0.0.0-20240419132333-1333f46ed8b6/templates/admin/index.tmpl (about) 1 {{ define "admin/index" }} 2 {{ template "head" . }} 3 <article class="bg-white rounded-md p-4 flex flex-col gap-2"> 4 <h2 class="mb-2">Adminpanel</h2> 5 {{ with .errors }} 6 {{ . }} 7 {{ end }} 8 <ul class="list-disc ml-4"> 9 <li><a 10 class="navds-link" 11 href="/admin/jupyterhub">Rediger globale Jupyter verdier</a></li> 12 <li><a 13 class="navds-link" 14 href="/admin/airflow">Rediger globale Airflow verdier</a></li> 15 </ul> 16 <form action="/admin/team/sync/all" method="POST"> 17 <button 18 type="submit" 19 onclick="return confirm('Er du sikker på at du vil resynce alle team?')" 20 class="mb-4 navds-button navds-button--secondary navds-button--small" 21 > 22 <span class="navds-label">Resync alle team</span> 23 </button> 24 </form> 25 <form action="/admin/jupyterhub/sync/all" method="POST"> 26 <button 27 type="submit" 28 onclick="return confirm('Er du sikker på at du vil resynce alle instanser av jupyterhub?')" 29 class="mb-4 navds-button navds-button--secondary navds-button--small" 30 > 31 <span class="navds-label">Resync alle jupyterhubs</span> 32 </button> 33 </form> 34 <form action="/admin/airflow/sync/all" method="POST"> 35 <button 36 type="submit" 37 onclick="return confirm('Er du sikker på at du vil resynce alle instanser av airflow?')" 38 class="mb-4 navds-button navds-button--secondary navds-button--small" 39 > 40 <span class="navds-label">Resync alle airflow</span> 41 </button> 42 </form> 43 </article> 44 45 {{ range .teams }} 46 {{ $teamID := .ID }} 47 <article class="bg-white rounded-md p-4"> 48 <div class="flex items-center gap-4 pb-4"> 49 <h2> 50 {{ .Slug }} ({{ .ID }}) 51 </h2> 52 <form action="/admin/team/{{ .Slug }}/delete" method="POST"> 53 <fieldset> 54 <button type="submit" 55 onclick="return confirm('Er du sikker på at du vil slette {{ .Slug }}? Dette vil samtidig slette teamets Jupyter og Airflow (dersom det er satt opp). Det er ikke mulig å gjenopprette teamet.')" 56 class="navds-button navds-button--danger navds-button--small bg-surface-danger" 57 > 58 <span class="navds-label"> 59 Slett 60 </span> 61 </button> 62 </fieldset> 63 </form> 64 </div> 65 <p> 66 <strong>Namespace:</strong> {{ .Namespace }} 67 <br> 68 <strong>Logs:</strong> 69 <a class="navds-link" 70 href="https://console.cloud.google.com/logs/query;query=resource.labels.namespace_name%3D%22{{ .Namespace }}%22;duration=PT15M?project={{ $.gcpProject }}"> 71 Log Explorer 72 </a> 73 </p> 74 <label for="machine_types" class="navds-form-field__label navds-label">Apper</label> 75 <table class="navds-table navds-table--small"> 76 <thead class="navds-table__header"> 77 <tr class="navds-table__row"> 78 <th class="navds-table__header-cell navds-label navds-label--small">App</th> 79 <th class="navds-table__header-cell navds-label navds-label--small"></th> 80 <th class="navds-table__header-cell navds-label navds-label--small"></th> 81 </tr> 82 </thead> 83 <tbody class="navds-table__body"> 84 {{ range .Apps }} 85 <tr class="navds-table__row navds-table__row--shade-on-hover"> 86 <td class="navds-table__header-cell navds-label navds-label--small">{{ . }}</td> 87 <td class="navds-table__data-cell navds-body-short navds-body-short--small"> 88 {{ if eq . "airflow" }} 89 <a class="navds-link" 90 href="https://console.cloud.google.com/storage/browser/airflow-logs-{{ $teamID }}-north;tab=objects?project={{ $.gcpProject }}"> 91 Log bucket 92 </a> 93 {{ end }} 94 </td> 95 <td class="navds-table__data-cell navds-body-short navds-body-short--small"> 96 <form action="/admin/{{ . }}/sync" method="POST"> 97 <input type="hidden" name="team" value="{{ $teamID }}"/> 98 <button type="submit" class="navds-link"> Resync</button> 99 </form> 100 </td> 101 </tr> 102 {{ end}} 103 </tbody> 104 </table> 105 <br> 106 107 <label for="machine_types" class="navds-form-field__label navds-label">Users</label> 108 <table class="navds-table navds-table--small"> 109 <thead class="navds-table__header"> 110 <tr class="navds-table__row"> 111 <th class="navds-table__header-cell navds-label navds-label--small">E-mail</th> 112 </tr> 113 </thead> 114 <tbody class="navds-table__body"> 115 {{ range .Users }} 116 <tr class="navds-table__row navds-table__row--shade-on-hover"> 117 <td class="navds-table__data-cell navds-body-short navds-body-short--small">{{ . }}</td> 118 </tr> 119 {{ end }} 120 </tbody> 121 </table> 122 <br> 123 124 <label for="machine_types" class="navds-form-field__label navds-label">Events</label> 125 <table class="navds-table navds-table--small"> 126 <thead class="navds-table__header"> 127 <tr class="navds-table__row"> 128 <th class="navds-table__header-cell navds-label navds-label--small">Status</th> 129 <th class="navds-table__header-cell navds-label navds-label--small">Type</th> 130 <th class="navds-table__header-cell navds-label navds-label--small">Deadline</th> 131 <th class="navds-table__header-cell navds-label navds-label--small">Created at</th> 132 <th class="navds-table__header-cell navds-label navds-label--small">Updated at</th> 133 <th class="navds-table__header-cell navds-label navds-label--small"></th> 134 </tr> 135 </thead> 136 <tbody class="navds-table__body"> 137 {{ range .Events }} 138 <tr class="navds-table__row navds-table__row--shade-on-hover"> 139 <td class="navds-table__data-cell navds-body-short navds-body-short--small"> 140 {{ if eq .Status "completed" }} 141 👍 142 {{ else if eq .Status "failed" }} 143 🛑 144 {{ else if eq .Status "processing" }} 145 🚧 146 {{ else if eq .Status "pending" }} 147 ⏳ 148 {{ else }} 149 {{ .Status }} 150 {{ end }} 151 </td> 152 <td class="navds-table__data-cell navds-body-short navds-body-short--small">{{ .Type }}</td> 153 <td class="navds-table__data-cell navds-body-short navds-body-short--small">{{ .Deadline }}</td> 154 <td class="navds-table__data-cell navds-body-short navds-body-short--small">{{ .CreatedAt.Format "02.01.06 15:04:05" }}</td> 155 <td class="navds-table__data-cell navds-body-short navds-body-short--small">{{ .UpdatedAt.Format "02.01.06 15:04:05" }}</td> 156 <td class="navds-table__data-cell navds-body-short navds-body-short--small"> 157 <a class="navds-link" 158 href="/admin/event/{{ .ID }}"> 159 logs 160 </a> 161 </td> 162 </tr> 163 {{ end}} 164 </tbody> 165 </table> 166 </article> 167 {{ end }} 168 {{ template "footer" }} 169 {{ end }}