26 lines
1.0 KiB
JavaScript
26 lines
1.0 KiB
JavaScript
/* 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 };
|