1
0

home.twig 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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> or
  37. <code>LOCAL_ADMIN_*</code> in <code>.env</code>.
  38. </span>
  39. {% endif %}
  40. </div>
  41. </div>
  42. {% else %}
  43. <div class="flex items-end justify-between gap-4">
  44. <div>
  45. <h1 class="text-2xl font-semibold tracking-tight">Sprints</h1>
  46. <p class="text-slate-600 mt-1 text-sm dark:text-slate-400">
  47. {{ sprintRows|length }} sprint{{ sprintRows|length == 1 ? '' : 's' }}.
  48. </p>
  49. </div>
  50. {% if currentUser.isAdmin %}
  51. <a href="/sprints/new"
  52. 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">
  53. New sprint
  54. </a>
  55. {% endif %}
  56. </div>
  57. <div class="rounded-lg border bg-white overflow-hidden dark:bg-slate-800 dark:border-slate-700">
  58. {% if sprintRows is empty %}
  59. <div class="p-8 text-center text-slate-500 text-sm dark:text-slate-400">
  60. No sprints yet.
  61. {% if currentUser.isAdmin %}
  62. <a href="/sprints/new" class="text-blue-700 hover:underline dark:text-blue-400 dark:hover:text-blue-300">Create the first one</a>.
  63. {% endif %}
  64. </div>
  65. {% else %}
  66. <table class="min-w-full text-sm">
  67. <thead class="bg-slate-50 text-slate-600 text-xs uppercase tracking-wider dark:bg-slate-700 dark:text-slate-300">
  68. <tr>
  69. <th class="text-left px-4 py-2 font-semibold">Name</th>
  70. <th class="text-left px-4 py-2 font-semibold">Dates</th>
  71. <th class="text-right px-4 py-2 font-semibold">Workers</th>
  72. <th class="text-right px-4 py-2 font-semibold">Tasks</th>
  73. <th class="text-right px-4 py-2 font-semibold">Reserve</th>
  74. <th class="text-left px-4 py-2 font-semibold">Status</th>
  75. </tr>
  76. </thead>
  77. <tbody class="divide-y divide-slate-100 dark:divide-slate-700">
  78. {% for row in sprintRows %}
  79. {% set s = row.sprint %}
  80. <tr class="hover:bg-slate-50 cursor-pointer dark:hover:bg-slate-700"
  81. data-href="/sprints/{{ s.id }}">
  82. <td class="px-4 py-2 font-medium">
  83. <a href="/sprints/{{ s.id }}" class="hover:underline">{{ s.name }}</a>
  84. </td>
  85. <td class="px-4 py-2 text-slate-600 dark:text-slate-400">
  86. {{ s.startDate }} – {{ s.endDate }}
  87. </td>
  88. <td class="px-4 py-2 text-right font-mono">{{ row.nWorkers }}</td>
  89. <td class="px-4 py-2 text-right font-mono">{{ row.nTasks }}</td>
  90. <td class="px-4 py-2 text-right font-mono">
  91. {{ (s.reserveFraction * 100)|number_format(0) }}%
  92. </td>
  93. <td class="px-4 py-2">
  94. {% if s.isArchived %}
  95. <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>
  96. {% else %}
  97. <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>
  98. {% endif %}
  99. </td>
  100. </tr>
  101. {% endfor %}
  102. </tbody>
  103. </table>
  104. {% endif %}
  105. </div>
  106. {% endif %}
  107. {% if currentUser is null or currentUser.isAdmin %}
  108. <details class="rounded-lg border bg-white p-4 dark:bg-slate-800 dark:border-slate-700">
  109. <summary class="text-sm font-semibold text-slate-700 uppercase tracking-wider cursor-pointer dark:text-slate-200">Runtime</summary>
  110. <dl class="mt-3 grid grid-cols-[max-content_1fr] gap-x-6 gap-y-1 text-sm">
  111. <dt class="text-slate-500 dark:text-slate-400">PHP</dt>
  112. <dd class="font-mono">{{ constant('PHP_VERSION') }}</dd>
  113. <dt class="text-slate-500 dark:text-slate-400">APP_ENV</dt>
  114. <dd class="font-mono">{{ appEnv }}</dd>
  115. <dt class="text-slate-500 dark:text-slate-400">SQLite file</dt>
  116. <dd class="font-mono break-all">{{ dbPath }}</dd>
  117. <dt class="text-slate-500 dark:text-slate-400">Schema version</dt>
  118. <dd class="font-mono">{{ schemaVersion }}</dd>
  119. <dt class="text-slate-500 dark:text-slate-400">OIDC</dt>
  120. <dd class="font-mono">{{ oidcConfigured ? 'configured' : 'not configured' }}</dd>
  121. <dt class="text-slate-500 dark:text-slate-400">Local admin</dt>
  122. <dd class="font-mono">{{ localAdminEnabled ? 'enabled' : 'disabled' }}</dd>
  123. </dl>
  124. <p class="mt-4 text-xs text-slate-500 dark:text-slate-400">
  125. Liveness probe: <a class="text-blue-700 hover:underline dark:text-blue-400 dark:hover:text-blue-300" href="/healthz"><code>/healthz</code></a>
  126. </p>
  127. </details>
  128. {% endif %}
  129. </section>
  130. {% endblock %}