1
0

home.twig 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. {% extends "layout.twig" %}
  2. {% block content %}
  3. <section class="space-y-6">
  4. {% if authError|default(false) %}
  5. <div class="rounded-md border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:bg-red-900 dark:border-red-800 dark:text-red-200">
  6. Sign-in failed. Check the server logs or the audit log for details.
  7. </div>
  8. {% endif %}
  9. {% if deletedSprintName|default('') != '' %}
  10. <div class="rounded-md border border-green-200 bg-green-50 px-4 py-3 text-sm text-green-800 dark:bg-green-900 dark:border-green-800 dark:text-green-200">
  11. Sprint <b>{{ deletedSprintName }}</b> was deleted.
  12. </div>
  13. {% endif %}
  14. {% if currentUser is null %}
  15. <div class="rounded-lg border bg-white p-6 dark:bg-slate-800 dark:border-slate-700">
  16. <h1 class="text-2xl font-semibold tracking-tight">Sprint Planner</h1>
  17. <p class="text-slate-600 mt-2 max-w-prose dark:text-slate-400">
  18. Sign in with your Microsoft account to get started. The first person
  19. to sign in becomes the admin automatically.
  20. </p>
  21. <div class="mt-4 flex flex-wrap items-center gap-3">
  22. {% if oidcConfigured %}
  23. <a href="/auth/login"
  24. class="inline-flex items-center gap-2 rounded-md bg-slate-900 text-white px-4 py-2 text-sm font-medium hover:bg-slate-800 dark:bg-slate-700 dark:hover:bg-slate-600">
  25. Sign in with Microsoft
  26. </a>
  27. {% endif %}
  28. {% if localAdminEnabled %}
  29. <a href="/auth/local"
  30. class="inline-flex items-center gap-2 rounded-md border border-slate-300 bg-white text-slate-700 px-4 py-2 text-sm font-medium hover:bg-slate-100 dark:bg-slate-800 dark:border-slate-600 dark:text-slate-200 dark:hover:bg-slate-700">
  31. Sign in as local admin
  32. </a>
  33. {% endif %}
  34. {% if not oidcConfigured and not localAdminEnabled %}
  35. <span class="inline-block rounded-md bg-slate-100 text-slate-600 px-3 py-2 text-sm dark:bg-slate-700 dark:text-slate-300">
  36. No sign-in method configured. Set <code>ENTRA_*</code> (with
  37. <code>OIDC_ENABLED</code> not set to <code>false</code>) or
  38. <code>LOCAL_ADMIN_*</code> in <code>.env</code>.
  39. </span>
  40. {% endif %}
  41. </div>
  42. </div>
  43. {% else %}
  44. <div class="flex items-end justify-between gap-4">
  45. <div>
  46. <h1 class="text-2xl font-semibold tracking-tight">Sprints</h1>
  47. <p class="text-slate-600 mt-1 text-sm dark:text-slate-400">
  48. {{ sprintRows|length }} sprint{{ sprintRows|length == 1 ? '' : 's' }}.
  49. </p>
  50. </div>
  51. {% if currentUser.isAdmin %}
  52. <a href="/sprints/new"
  53. class="inline-flex items-center gap-2 rounded-md bg-slate-900 text-white px-4 py-2 text-sm font-medium hover:bg-slate-800 dark:bg-slate-700 dark:hover:bg-slate-600">
  54. New sprint
  55. </a>
  56. {% endif %}
  57. </div>
  58. <div class="rounded-lg border bg-white overflow-hidden dark:bg-slate-800 dark:border-slate-700">
  59. {% if sprintRows is empty %}
  60. <div class="p-8 text-center text-slate-500 text-sm dark:text-slate-400">
  61. No sprints yet.
  62. {% if currentUser.isAdmin %}
  63. <a href="/sprints/new" class="text-blue-700 hover:underline dark:text-blue-400 dark:hover:text-blue-300">Create the first one</a>.
  64. {% endif %}
  65. </div>
  66. {% else %}
  67. <table class="min-w-full text-sm">
  68. <thead class="bg-slate-50 text-slate-600 text-xs uppercase tracking-wider dark:bg-slate-700 dark:text-slate-300">
  69. <tr>
  70. <th class="text-left px-4 py-2 font-semibold">Name</th>
  71. <th class="text-left px-4 py-2 font-semibold">Dates</th>
  72. <th class="text-right px-4 py-2 font-semibold">Workers</th>
  73. <th class="text-right px-4 py-2 font-semibold">Tasks</th>
  74. <th class="text-right px-4 py-2 font-semibold">Reserve</th>
  75. <th class="text-left px-4 py-2 font-semibold">Status</th>
  76. </tr>
  77. </thead>
  78. <tbody class="divide-y divide-slate-100 dark:divide-slate-700">
  79. {% for row in sprintRows %}
  80. {% set s = row.sprint %}
  81. <tr class="hover:bg-slate-50 cursor-pointer dark:hover:bg-slate-700"
  82. data-href="/sprints/{{ s.id }}">
  83. <td class="px-4 py-2 font-medium">
  84. <a href="/sprints/{{ s.id }}" class="hover:underline">{{ s.name }}</a>
  85. </td>
  86. <td class="px-4 py-2 text-slate-600 dark:text-slate-400">
  87. {{ s.startDate }} – {{ s.endDate }}
  88. </td>
  89. <td class="px-4 py-2 text-right font-mono">{{ row.nWorkers }}</td>
  90. <td class="px-4 py-2 text-right font-mono">{{ row.nTasks }}</td>
  91. <td class="px-4 py-2 text-right font-mono">
  92. {{ (s.reserveFraction * 100)|number_format(0) }}%
  93. </td>
  94. <td class="px-4 py-2">
  95. {% if s.isArchived %}
  96. <span class="inline-block px-2 py-0.5 text-xs bg-slate-100 text-slate-600 rounded dark:bg-slate-700 dark:text-slate-300">archived</span>
  97. {% else %}
  98. <span class="inline-block px-2 py-0.5 text-xs bg-green-100 text-green-800 rounded dark:bg-green-900 dark:text-green-200">active</span>
  99. {% endif %}
  100. </td>
  101. </tr>
  102. {% endfor %}
  103. </tbody>
  104. </table>
  105. {% endif %}
  106. </div>
  107. {% endif %}
  108. {% if currentUser is not null and currentUser.isAdmin %}
  109. <details class="rounded-lg border bg-white p-4 dark:bg-slate-800 dark:border-slate-700">
  110. <summary class="text-sm font-semibold text-slate-700 uppercase tracking-wider cursor-pointer dark:text-slate-200">Runtime</summary>
  111. <dl class="mt-3 grid grid-cols-[max-content_1fr] gap-x-6 gap-y-1 text-sm">
  112. <dt class="text-slate-500 dark:text-slate-400">App version</dt>
  113. <dd class="font-mono">{{ appVersion }}</dd>
  114. <dt class="text-slate-500 dark:text-slate-400">Creator</dt>
  115. <dd class="font-mono">{{ appCreator }}</dd>
  116. <dt class="text-slate-500 dark:text-slate-400">APP_ENV</dt>
  117. <dd class="font-mono">{{ appEnv }}</dd>
  118. <dt class="text-slate-500 dark:text-slate-400">SQLite file</dt>
  119. <dd class="font-mono break-all">{{ dbPath }}</dd>
  120. <dt class="text-slate-500 dark:text-slate-400">Schema version</dt>
  121. <dd class="font-mono">{{ schemaVersion }}</dd>
  122. <dt class="text-slate-500 dark:text-slate-400">OIDC</dt>
  123. <dd class="font-mono">{{ oidcConfigured ? 'enabled' : 'disabled' }}</dd>
  124. <dt class="text-slate-500 dark:text-slate-400">Local admin</dt>
  125. <dd class="font-mono">{{ localAdminEnabled ? 'enabled' : 'disabled' }}</dd>
  126. </dl>
  127. <p class="mt-4 text-xs text-slate-500 dark:text-slate-400">
  128. Liveness probe: <a class="text-blue-700 hover:underline dark:text-blue-400 dark:hover:text-blue-300" href="/healthz"><code>/healthz</code></a>
  129. </p>
  130. </details>
  131. {% endif %}
  132. </section>
  133. {% endblock %}