refactoring
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/* Administration overview. */
|
||||
|
||||
/**
|
||||
* goal : Refresh the software and database versions on the admin overview.
|
||||
* pre : api performs authenticated requests and translate resolves UI keys.
|
||||
* post : The overview shows current and required version information.
|
||||
* result : A promise that resolves after the overview has been updated.
|
||||
*/
|
||||
async function loadAdminOverview(api, translate) {
|
||||
const info = await api("/api/admin/info");
|
||||
document.getElementById("admin-software-version").textContent =
|
||||
info.softwareVersion || "?";
|
||||
|
||||
const schemaVersion = info.databaseSchemaVersion ?? "?";
|
||||
const requiredSchemaVersion = info.requiredDatabaseSchemaVersion ?? "?";
|
||||
const databaseVersion = document.getElementById("admin-database-schema-version");
|
||||
if (schemaVersion === requiredSchemaVersion) {
|
||||
databaseVersion.textContent = String(schemaVersion);
|
||||
} else {
|
||||
databaseVersion.textContent =
|
||||
`${schemaVersion} (${translate("required", "required")}: ${requiredSchemaVersion})`;
|
||||
}
|
||||
}
|
||||
|
||||
export { loadAdminOverview };
|
||||
Reference in New Issue
Block a user