migration now works also in electron

This commit is contained in:
azivner
2017-11-30 19:58:00 -05:00
parent 719f553054
commit 7bdf269095
9 changed files with 20 additions and 14 deletions

View File

@@ -106,10 +106,6 @@ $(document).tooltip({
}
});
function isElectron() {
return window && window.process && window.process.type;
}
let appShown = false;
function showAppIfHidden() {

View File

@@ -1,7 +1,7 @@
"use strict";
$(document).ready(() => {
$.get(baseApiUrl + 'migration').then(result => {
server.get('migration').then(result => {
const appDbVersion = result.app_db_version;
const dbVersion = result.db_version;
@@ -22,11 +22,7 @@ $("#run-migration").click(async () => {
$("#migration-result").show();
const result = await $.ajax({
url: baseApiUrl + 'migration',
type: 'POST',
error: () => showError("Migration failed with unknown error")
});
const result = await server.post('migration');
for (const migration of result.migrations) {
const row = $('<tr>')

View File

@@ -1,7 +1,14 @@
const server = (function() {
function getHeaders() {
let protectedSessionId = null;
try { // this is because protected session might not be declared in some cases - like when it's included in migration page
protectedSessionId = protected_session.getProtectedSessionId();
}
catch(e) {}
return {
'x-protected-session-id': protected_session.getProtectedSessionId()
'x-protected-session-id': protectedSessionId
};
}

View File

@@ -46,4 +46,8 @@ function formatDate(date) {
function formatDateTime(date) {
return formatDate(date) + " " + formatTime(date);
}
function isElectron() {
return window && window.process && window.process.type;
}