Set background colour of the indexes, groups and keys cells

Green indicates we've collected a full set. For indexes, red indicates
some are missing (as this is a critical problem - the client won't start
at all if an index is missing). Yellow indicates groups or keys are
missing, as this is less critical (the client will likely work in most
cases).

Signed-off-by: Graham <gpe@openrs2.org>
Graham 4 years ago
parent 3ff6cd2d02
commit bce6270957
  1. 9
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheExporter.kt
  2. 18
      archive/src/main/resources/org/openrs2/archive/templates/caches/index.html

@ -17,8 +17,13 @@ public class CacheExporter @Inject constructor(
private val database: Database,
private val alloc: ByteBufAllocator
) {
public data class ArchiveStats(val indexes: Long, val validIndexes: Long)
public data class GroupStats(val groups: Long, val validGroups: Long, val keys: Long, val validKeys: Long)
public data class ArchiveStats(val indexes: Long, val validIndexes: Long) {
public val allIndexesValid: Boolean = indexes == validIndexes
}
public data class GroupStats(val groups: Long, val validGroups: Long, val keys: Long, val validKeys: Long) {
public val allGroupsValid: Boolean = groups == validGroups
public val allKeysValid: Boolean = keys == validKeys
}
public data class Cache(
val id: Int,

@ -26,9 +26,21 @@
<td th:text="${cache.build}">550</td>
<td th:text="${#temporals.formatISO(cache.timestamp)}"></td>
<td th:text="${cache.name}"></td>
<td th:text="${cache.archiveStats}? ${cache.archiveStats.validIndexes} + ' / ' + ${cache.archiveStats.indexes} : 'Calculating...'">Calculating...</td>
<td th:text="${cache.groupStats}? ${#numbers.formatInteger(cache.groupStats.validGroups, 1, 'COMMA')} + ' / ' + ${#numbers.formatInteger(cache.groupStats.groups, 1, 'COMMA')} : 'Calculating...'">Calculating...</td>
<td th:text="${cache.groupStats}? ${#numbers.formatInteger(cache.groupStats.validKeys, 1, 'COMMA')} + ' / ' + ${#numbers.formatInteger(cache.groupStats.keys, 1, 'COMMA')} : 'Calculating...'">Calculating...</td>
<td
th:class="${cache.archiveStats}? (${cache.archiveStats.allIndexesValid}? 'table-success' : 'table-danger')"
th:text="${cache.archiveStats}? ${cache.archiveStats.validIndexes} + ' / ' + ${cache.archiveStats.indexes} : 'Calculating...'"
>Calculating...
</td>
<td
th:class="${cache.groupStats}? (${cache.groupStats.allGroupsValid}? 'table-success' : 'table-warning')"
th:text="${cache.groupStats}? ${#numbers.formatInteger(cache.groupStats.validGroups, 1, 'COMMA')} + ' / ' + ${#numbers.formatInteger(cache.groupStats.groups, 1, 'COMMA')} : 'Calculating...'"
>Calculating...
</td>
<td
th:class="${cache.groupStats}? (${cache.groupStats.allKeysValid}? 'table-success' : 'table-warning')"
th:text="${cache.groupStats}? ${#numbers.formatInteger(cache.groupStats.validKeys, 1, 'COMMA')} + ' / ' + ${#numbers.formatInteger(cache.groupStats.keys, 1, 'COMMA')} : 'Calculating...'"
>Calculating...
</td>
<td>
<a th:href="${'/caches/' + cache.id + '.zip'}" class="btn btn-primary btn-sm">Cache</a>
<a th:href="${'/caches/' + cache.id + '.json'}" class="btn btn-primary btn-sm">Keys</a>

Loading…
Cancel
Save