pleroma/installer/assets/js/app.js
Alexander Strizhakov 36bd97ba87
pleroma installer and config versioning
- added DynamicSupervisor, which starts Pleroma deps and restarts config dependent deps
- added pleroma installer, where user can configure database credentials
and pleroma config. Settings are saved into file and in database
- added versioning for in database config. New version is created from
changes which are passed to config update/delete endpoint. Every version
contains backup with all changes added through update. Versioning
supports rollbacks with N steps. With a rollback, all versions that
come after the version on which the rollback was made are deleted.
2021-03-17 08:40:42 +03:00

60 lines
1.8 KiB
JavaScript

// We need to import the CSS so that webpack will load it.
// The MiniCssExtractPlugin is used to separate it out into
// its own CSS file.
import css from "../css/app.css"
// webpack automatically bundles all modules in your
// entry points. Those entry points can be configured
// in "webpack.config.js".
//
// Import dependencies
//
import "phoenix_html"
import "phoenix"
import { Ajax } from "phoenix"
// Import local files
//
// Local files can be imported directly using relative paths, for example:
// import socket from "./socket"
window.onload = function () {
let endpointUrlEl = document.getElementById('config_form_endpoint_url')
if (endpointUrlEl) {
endpointUrlEl.addEventListener('change', function (evt) {
let endpointUrl = new URL(endpointUrlEl.value);
let adminEmailEl = document.getElementById('config_form_instance_email');
if (adminEmailEl.value == '') {
adminEmailEl.value = 'admin@' + endpointUrl.hostname;
}
let adminUserEmailEl = document.getElementById('config_form_admin_email');
if (adminUserEmailEl.value == '') {
adminUserEmailEl.value = 'admin@' + endpointUrl.hostname;
}
let notifyEmailEl = document.getElementById('config_form_instance_notify_email');
if (notifyEmailEl.value == '') {
notifyEmailEl.value = 'no-reply@' + endpointUrl.hostname;
}
});
}
let migrations = document.getElementById('migrations')
if (migrations) {
Ajax.request("GET", "/run_migrations", "application/json", "", 20000, show_error, (resp) => {
if (resp == "ok") {
window.location = "/config";
} else {
show_error();
}
});
}
}
function show_error() {
let errorEl = document.getElementById('error');
errorEl.style.visibility = 'visible';
}