2017-03-24 19:57:23 +01:00
<!DOCTYPE HTML>
<!--
RaspMatic update addon
2018-02-26 22:52:33 +01:00
Copyright (C) 2018 Jan Schneider < oss @ janschneider . net >
2017-03-24 19:57:23 +01:00
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see < http: / / www . gnu . org / licenses / > .
-->
< html >
< head >
< meta charset = "UTF-8" >
< meta http-equiv = "Content-Type" content = "text/html;charset=UTF-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1" >
2018-12-22 17:34:46 +01:00
< script src = "js/jquery-3.3.1.min.js" > < / script >
< script src = "js/i18next-13.0.0.min.js" > < / script >
< script src = "js/jquery-i18next-1.2.1.min.js" > < / script >
< script src = "js/semantic-2.4.2.min.js" > < / script >
< link rel = "stylesheet" href = "css/semantic-2.4.2.min.css" / >
2017-03-24 19:57:23 +01:00
< style >
< / style >
2019-01-11 13:27:54 +01:00
2018-01-23 00:34:09 +01:00
< title data-i18n = "title" > RaspberryMatic Update Addon< / title >
2017-03-24 19:57:23 +01:00
< script >
2018-01-23 00:34:09 +01:00
var language = navigator.language || navigator.userLanguage;
2017-03-25 01:45:39 +01:00
var message_timer_id = null;
2018-01-20 23:43:14 +01:00
var running_installation = "";
2017-03-26 20:25:01 +02:00
var current_firmware = '?';
var latest_firmware = '?';
2018-02-08 22:38:33 +01:00
var wlanScanTimer;
2018-02-28 00:52:31 +01:00
var moving_userfs_to_device = false;
2018-07-28 02:04:49 +02:00
var sid = null;
2019-01-11 13:27:54 +01:00
2018-07-28 02:04:49 +02:00
function get_url_vars() {
var vars = {};
var params = window.location.search.substring(1).split('&');
for(var i=0; i< params.length ; i + + ) {
param = params[i].split('=');
if (param.length > 1) {
vars[param[0]] = param[1];
}
}
return vars;
}
2019-01-11 13:27:54 +01:00
2018-07-28 02:04:49 +02:00
function get_url_var(name) {
return get_url_vars()[name];
}
2019-01-11 13:27:54 +01:00
2018-01-29 22:36:14 +01:00
function display_message(type, text, millis) {
2017-03-25 01:45:39 +01:00
clear_message();
2020-01-11 09:35:19 +01:00
$('#message-text').html(text);
2017-03-25 01:45:39 +01:00
$('#message').attr('class', 'ui ' + type + ' message visible');
message_timer_id = setTimeout(clear_message, millis);
}
2019-01-11 13:27:54 +01:00
2017-03-25 01:45:39 +01:00
function clear_message() {
if (message_timer_id != null) {
clearTimeout(message_timer_id);
}
message_timer_id = null;
2020-01-11 09:35:19 +01:00
$('#message-text').html('');
2017-03-25 01:45:39 +01:00
$('#message').attr('class', 'ui message hidden');
2017-03-26 00:26:39 +01:00
}
2019-01-11 13:27:54 +01:00
2017-03-26 00:26:39 +01:00
function default_error_callback(xhr, ajaxOptions, thrownError) {
console.error(xhr);
err = thrownError;
try {
obj = JSON.parse(xhr.responseText);
if (obj.error != null) {
err = obj.error;
}
}
catch(e) {
}
2018-01-29 22:36:14 +01:00
display_message('error', i18next.t('error_occurred', {'error': err}), 10000);
2017-03-25 01:45:39 +01:00
}
2019-01-11 13:27:54 +01:00
2017-03-25 01:45:39 +01:00
function rest(method, path, data, success_callback, error_callback) {
if (!error_callback) {
2017-03-26 00:26:39 +01:00
error_callback = default_error_callback
2017-03-25 01:45:39 +01:00
}
2018-07-28 02:04:49 +02:00
if (data != null) {
data = JSON.stringify(data);
}
2017-03-25 01:45:39 +01:00
$.ajax({
2018-07-28 02:04:49 +02:00
url: "rest.cgi?sid=" + sid + "& path=" + path,
2017-03-25 01:45:39 +01:00
type: method,
data: data,
context: document.body,
success: success_callback,
error: error_callback
});
}
2019-01-11 13:27:54 +01:00
2018-02-11 19:07:21 +01:00
function show_reboot_dialog() {
$('#modal-reboot').modal({
onDeny: function(){
return true;
},
onApprove: function() {
rest('POST', '/system_reboot', null, function(data) {
display_message('success', i18next.t('system_is_rebooting'), 120000);
});
return true;
}
})
2019-01-11 13:27:54 +01:00
.modal('show');
2018-02-11 19:07:21 +01:00
}
2019-01-11 13:27:54 +01:00
2018-02-11 19:07:21 +01:00
function show_shutdown_dialog() {
$('#modal-shutdown').modal({
onDeny: function(){
return true;
},
onApprove: function() {
rest('POST', '/system_shutdown', null, function(data) {
display_message('success', i18next.t('system_is_shutting_down'), 120000);
});
return true;
}
})
2019-01-11 13:27:54 +01:00
.modal('show');
2018-02-11 19:07:21 +01:00
}
2019-01-11 13:27:54 +01:00
2018-01-29 22:36:14 +01:00
function disable_buttons() {
2018-02-26 22:52:33 +01:00
$('#install-latest-firmware-button').addClass('disabled');
2018-03-21 00:14:13 +01:00
$('#install-firmware-url-button').addClass('disabled');
2018-01-29 22:36:14 +01:00
$('[data-install-firmware-version]').addClass('disabled');
$('[data-delete-firmware-version]').addClass('disabled');
$('[data-update-addon-id]').addClass('disabled');
$('[data-uninstall-addon-id]').addClass('disabled');
$('#install-addon-url-button').addClass('disabled');
$('#install-addon-file-button').addClass('disabled');
}
2019-01-11 13:27:54 +01:00
2018-01-29 22:36:14 +01:00
function reset_buttons() {
2018-02-26 22:52:33 +01:00
$('#install-latest-firmware-button').removeClass('loading');
$('#install-latest-firmware-button').removeClass('disabled');
2018-03-21 00:14:13 +01:00
$('#install-firmware-url-button').removeClass('loading');
$('#install-firmware-url-button').removeClass('disabled');
2018-01-29 22:36:14 +01:00
$('[data-install-firmware-version]').removeClass('loading');
$('[data-install-firmware-version]').removeClass('disabled');
$('[data-delete-firmware-version]').removeClass('disabled');
$('[data-update-addon-id]').removeClass('loading');
$('[data-update-addon-id]').removeClass('disabled');
$('[data-uninstall-addon-id]').removeClass('disabled');
$('[data-uninstall-addon-id]').removeClass('loading');
$('#install-addon-url-button').removeClass('disabled');
$('#install-addon-url-button').removeClass('loading');
$('#install-addon-file-button').removeClass('disabled');
$('#install-addon-file-button').removeClass('loading');
}
2019-01-11 13:27:54 +01:00
2018-01-23 00:34:09 +01:00
function set_running_installation(installation_info, error) {
//console.info("set_running_installation: |" + installation_info + "|" + running_installation + "|" + error);
2018-01-20 23:43:14 +01:00
var firmware_regex = /firmware\s+(.*)/i;
if (running_installation & & (!installation_info)) {
// Running installation finished
var match = firmware_regex.exec(running_installation);
2018-01-23 00:34:09 +01:00
if (error) {
2018-01-23 23:25:42 +01:00
$('#install-progress').progress("set error");
2018-01-29 22:36:14 +01:00
display_message('error', i18next.t('installation_failed', {'what': running_installation, 'error': error}), 4*3600000);
2018-01-23 00:34:09 +01:00
}
else {
2018-01-23 23:25:42 +01:00
$('#install-progress').progress("set success");
2018-01-29 22:36:14 +01:00
display_message('success', i18next.t('installation_success', {'what': running_installation}), 4*3600000);
2018-01-23 00:34:09 +01:00
}
$('#modal-log').modal('refresh');
$('#log-content').scrollTop($('#log-content').prop("scrollHeight"));
2018-01-29 22:36:14 +01:00
reset_buttons();
2017-06-18 23:27:29 +02:00
}
2019-01-11 13:27:54 +01:00
2018-01-20 23:43:14 +01:00
running_installation = installation_info;
2019-01-11 13:27:54 +01:00
2018-01-20 23:43:14 +01:00
if (running_installation) {
var match = firmware_regex.exec(running_installation);
if (match != null) {
var version = match[1];
2018-01-29 22:36:14 +01:00
display_message('info', i18next.t('installing_firmware', {'version': version}), 3600000);
disable_buttons();
2018-01-20 23:43:14 +01:00
$('[data-install-firmware-version="' + version + '"]').addClass('loading');
2018-01-29 22:36:14 +01:00
$('[data-install-firmware-version="' + version + '"]').removeClass('disabled');
2018-01-20 23:43:14 +01:00
}
}
2017-06-18 23:27:29 +02:00
}
2019-01-11 13:27:54 +01:00
2017-03-26 00:26:39 +01:00
function update_install_log() {
2018-01-20 23:43:14 +01:00
rest("GET", "/get_running_installation", null, function(installation_info) {
2018-01-23 23:25:42 +01:00
if (running_installation) {
if ($('#install-progress').progress("get percent") >= 95) {
2018-01-24 00:11:18 +01:00
$('#install-progress').progress("decrement", 20);
2018-01-23 00:34:09 +01:00
}
2018-01-23 23:25:42 +01:00
$('#install-progress').progress('increment');
if (installation_info != running_installation) {
if (installation_info == "") {
// Wait a while to handle potential errors
setTimeout(function() {
set_running_installation(installation_info);
}, 3000);
}
else {
set_running_installation(installation_info);
}
2018-01-23 00:34:09 +01:00
}
}
2018-01-20 23:43:14 +01:00
});
2017-03-26 00:26:39 +01:00
rest("GET", "/read_install_log", null, function(data) {
$('#log-content').html(data.replace(/\n/g, '< br / > '));
2018-01-23 00:34:09 +01:00
//$('#modal-log').modal('refresh');
2017-03-26 00:26:39 +01:00
$('#log-content').scrollTop($('#log-content').prop("scrollHeight"));
2018-01-20 23:43:14 +01:00
if (running_installation) {
2017-03-26 00:26:39 +01:00
setTimeout(update_install_log, 1000);
}
});
}
2019-01-11 13:27:54 +01:00
2017-03-26 20:25:01 +02:00
function delete_firmware_image(version) {
2018-07-28 02:04:49 +02:00
rest("POST", "/delete_firmware_image", {"version":version},
2019-01-11 13:27:54 +01:00
function(data) {
display_message('success', i18next.t('delete_firmware_img_success', {'version': version}), 5000);
get_firmware_info();
}
2017-03-26 20:25:01 +02:00
);
}
2019-01-11 13:27:54 +01:00
2018-03-21 00:14:13 +01:00
function install_firmware(download_url, version) {
2017-03-26 00:26:39 +01:00
$('#log-content').html('');
2018-01-23 23:25:42 +01:00
$('#install-progress').progress("reset");
2017-03-25 01:45:39 +01:00
$('#modal-log').modal('show');
2018-01-20 23:43:14 +01:00
if (!running_installation) {
var reboot = $('#reboot-after-install').is(':checked');
2018-02-27 20:57:18 +01:00
var keep_download = ! $('#delete-download-after-install').is(':checked');
2018-01-20 23:43:14 +01:00
var dryrun = $('#dryrun').is(':checked');
2018-03-21 00:14:13 +01:00
if (version) {
set_running_installation("Firmware " + version);
}
else {
set_running_installation("Firmware unknown");
}
if (!download_url) download_url = "";
if (!version) version = "";
2018-07-28 02:04:49 +02:00
rest("POST", "/start_install_firmware", {"download_url": download_url, "version":version, "language": language, "reboot":reboot, "dryrun":dryrun, "keep_download": keep_download},
2019-01-11 13:27:54 +01:00
function(data) {
// We are not expecting a response
},
function(xhr, ajaxOptions, thrownError) {
2020-01-11 09:35:19 +01:00
err = thrownError;
try {
obj = JSON.parse(xhr.responseText);
if (obj.error != null) {
err = obj.error;
}
}
catch(e) {
}
2019-01-11 13:27:54 +01:00
console.error("Firmware installation error: " + thrownError + ": " + xhr.responseText);
//$('#modal-log').modal('hide');
2020-01-11 09:35:19 +01:00
set_running_installation("", err);
2019-01-11 13:27:54 +01:00
}
2018-01-20 23:43:14 +01:00
);
}
2017-03-26 00:26:39 +01:00
setTimeout(update_install_log, 1000);
2017-03-25 01:45:39 +01:00
}
2019-01-11 13:27:54 +01:00
2017-03-26 20:25:01 +02:00
function install_latest_firmware() {
if (latest_firmware & & latest_firmware != '?') {
2018-03-21 00:14:13 +01:00
install_firmware(null, latest_firmware);
2017-03-26 20:25:01 +02:00
}
}
2019-01-11 13:27:54 +01:00
2017-03-26 20:25:01 +02:00
function get_firmware_info() {
2018-01-21 01:47:07 +01:00
$('#dimmer-firmware-info').addClass('active');
2017-03-25 01:45:39 +01:00
rest("GET", "/get_firmware_info", null, function(data) {
2018-01-21 01:47:07 +01:00
$('#firmware-info tbody').empty();
2018-03-18 16:54:55 +01:00
var latest_firmware_supported = false;
2017-03-25 01:45:39 +01:00
data.forEach(function(fw) {
2018-03-18 16:54:55 +01:00
if (fw.latest) {
latest_firmware = fw.version;
latest_firmware_supported = fw.supported;
}
2019-01-11 13:11:16 +01:00
if (fw.installed) {
current_firmware = fw.version;
if (current_firmware.length < = 8) {
//ccu3 and not raspberrymatic because of short version string
2019-01-27 21:34:23 +01:00
$('#firmware-header').hide();
$('#firmware-summary').hide();
$('#firmware-list').hide();
2019-01-11 13:11:16 +01:00
}
}
2017-03-26 20:25:01 +02:00
var color = 'yellow';
if (fw.latest) color = 'green';
if (fw.installed) color = 'gray';
2018-03-18 16:54:55 +01:00
var disabled = ((fw.image || fw.url) & & fw.supported ? '' : 'disabled');
2018-01-23 00:34:09 +01:00
var binstall = $('< div class = "ui '+ color +' basic '+ disabled +' button" > ').attr('data-install-firmware-version', fw.version).append($('< i class = "sign in icon" > '), i18next.t('install'));
2017-03-25 01:45:39 +01:00
binstall.click(function() {
2018-03-21 00:14:13 +01:00
install_firmware(null, this.getAttribute('data-install-firmware-version'));
2017-03-25 01:45:39 +01:00
});
2017-03-26 20:25:01 +02:00
var bcls = '';
if (!fw.image) bcls = 'disabled';
2018-01-20 23:43:14 +01:00
if (fw.version == running_installation) bcls = 'loading';
2018-01-29 22:36:14 +01:00
var bdelete = $('< div class = "ui orange basic '+ bcls +' button" > ').attr('data-delete-firmware-version', fw.version).append($('< i class = "delete icon" > '), i18next.t('delete_download'));
2017-03-26 20:25:01 +02:00
bdelete.click(function() {
2018-01-29 22:36:14 +01:00
delete_firmware_image(this.getAttribute('data-delete-firmware-version'));
2017-03-26 20:25:01 +02:00
});
2019-01-11 13:27:54 +01:00
2017-03-25 01:45:39 +01:00
var available = (fw.url ? 'checked=""' : '')
2020-01-26 19:55:15 +01:00
var experimental = (fw.experimental ? 'checked=""' : '')
2017-03-25 01:45:39 +01:00
var downloaded = (fw.image ? 'checked=""' : '')
2017-03-26 20:25:01 +02:00
var cls = '';
2020-02-22 23:40:43 +01:00
var style = '';
2017-03-26 20:25:01 +02:00
if (fw.installed) cls = ' class="warning"';
2020-02-25 12:02:46 +01:00
if (fw.experimental) { cls = ' class="error"'; style = 'display: none!important;' }
2017-03-26 20:25:01 +02:00
if (fw.latest) cls = ' class="positive"';
2020-02-22 23:40:43 +01:00
$("#firmware-info tbody").append($('< tr ' + cls + ' style = "' + style + '" > ').attr('data-experimental', fw.experimental).append(
2019-01-11 13:27:54 +01:00
$('< td > ').append($('< a > ', {text: fw.version, title: i18next.t('open_release_info'), href: fw.info_url, target: "_blank"})),
$('< td class = "center aligned" > ').append($('< div class = "ui disabled checkbox" > ').append($('< input type = "checkbox" disabled = "disabled" ' + available + ' > '),$('< label > < / label > '))),
2020-01-26 19:55:15 +01:00
$('< td class = "center aligned" > ').append($('< div class = "ui disabled checkbox" > ').append($('< input type = "checkbox" disabled = "disabled" ' + experimental + ' > '),$('< label > < / label > '))),
2019-01-11 13:27:54 +01:00
$('< td class = "center aligned" > ').append($('< div class = "ui disabled checkbox" > ').append($('< input type = "checkbox" disabled = "disabled" ' + downloaded + ' > '),$('< label > < / label > '))),
$('< td class = "center aligned" > ').append(bdelete, binstall)
2017-03-25 01:45:39 +01:00
));
});
2017-03-26 20:25:01 +02:00
var color = "#d01919";
if (current_firmware == latest_firmware) {
color = "#21BA45";
}
$("#firmware-summary").empty();
$("#firmware-summary").append(
2019-01-11 13:27:54 +01:00
$('< div class = "ui item" > ').html(i18next.t('current_installed_version') + ': < span style = "color:'+ color +'" > ' + current_firmware + '< / span > '),
$('< div class = "ui item" > ').html(i18next.t('latest_available_version') + ': ' + latest_firmware)
2017-03-26 20:25:01 +02:00
);
2018-03-18 16:54:55 +01:00
if (latest_firmware_supported & & current_firmware != latest_firmware) {
2017-03-26 20:25:01 +02:00
$("#firmware-summary").append(
2019-01-11 13:27:54 +01:00
$('< div id = "install-latest-firmware-button" class = "ui green basic button" style = "margin-top:20px; margin-bottom:20px;" > ').click(install_latest_firmware).append($('< i class = "sign in icon" > '), i18next.t('install_latest_firmware'))
2017-03-26 20:25:01 +02:00
);
}
2019-01-11 13:27:54 +01:00
2018-01-20 23:43:14 +01:00
rest("GET", "/get_running_installation", null, function(installation_info) {
set_running_installation(installation_info);
});
2018-01-21 01:47:07 +01:00
$('#dimmer-firmware-info').removeClass('active');
2017-03-25 01:45:39 +01:00
});
2017-03-26 20:25:01 +02:00
}
2019-01-11 13:27:54 +01:00
2020-02-22 23:40:43 +01:00
function show_experimental_firmware(show) {
2020-02-25 12:02:46 +01:00
$('tr[data-experimental="true"]').css('cssText', show ? '' : 'display:none !important');
2020-02-22 23:40:43 +01:00
}
2017-06-20 02:01:21 +02:00
function get_system_info() {
rest("GET", "/get_system_info", null, function(data) {
$("#system-info").empty();
$("#system-info").append(
2019-01-11 13:27:54 +01:00
$('< div class = "item" > ').html(i18next.t('system_type', {'system_type': data.system_type})),
$('< div class = "item" > ').html(i18next.t('uptime', {'uptime': data.uptime}))
2017-06-20 02:01:21 +02:00
);
});
}
2019-01-11 13:27:54 +01:00
2018-02-26 22:52:33 +01:00
function format_size(size) {
2018-02-28 20:02:00 +01:00
if (size < 0 ) {
2018-03-01 18:50:17 +01:00
return '';
2018-02-28 20:02:00 +01:00
}
2018-02-26 22:52:33 +01:00
if (size > 1024 * 1024 * 1024) {
return (parseInt(size)/1024/1024/1024).toFixed(1) + ' GB'
}
else if (size > 1024 * 1024) {
return (parseInt(size)/1024/1024).toFixed(1) + ' MB'
}
2018-02-28 20:02:00 +01:00
else {
2018-02-26 22:52:33 +01:00
return (parseInt(size)/1024).toFixed(1) + ' KB'
}
}
2019-01-11 13:27:54 +01:00
2018-02-26 22:52:33 +01:00
function get_partitions() {
2018-02-27 22:57:04 +01:00
$('#dimmer-volume-info').addClass('active');
2018-02-26 22:52:33 +01:00
rest("GET", "/get_partitions", null, function(data) {
var disks = {};
data.forEach(function(partition) {
if (partition.partition == 0) {
2018-02-27 22:50:37 +01:00
disks[partition.disk_device] = partition;
2018-02-28 00:52:31 +01:00
disks[partition.disk_device].userfs_on_disk = false;
disks[partition.disk_device].bootfs_on_disk = false;
2018-02-27 22:50:37 +01:00
disks[partition.disk_device].partitions = {};
2018-02-26 22:52:33 +01:00
}
});
data.forEach(function(partition) {
2018-02-27 22:50:37 +01:00
disks[partition.disk_device].partitions[partition.partition] = partition;
if (partition.mountpoint == '/usr/local') {
2018-02-28 00:52:31 +01:00
disks[partition.disk_device].userfs_on_disk = true;
}
else if (partition.mountpoint == '/boot') {
disks[partition.disk_device].bootfs_on_disk = true;
2018-02-27 22:50:37 +01:00
}
2018-02-26 22:52:33 +01:00
});
2018-02-27 22:57:04 +01:00
$('#volume-info tbody').empty();
2018-02-26 22:52:33 +01:00
for (var disk_device in disks) {
2018-02-27 22:50:37 +01:00
parts = Object.keys(disks[disk_device].partitions);
2018-02-26 22:52:33 +01:00
parts.sort();
2019-01-11 13:27:54 +01:00
2018-02-26 22:52:33 +01:00
for (var part in parts) {
2018-02-27 22:50:37 +01:00
var partition = disks[disk_device].partitions[part];
2018-02-28 20:02:00 +01:00
var is_sys_partition = (partition.filesystem_label == 'userfs' || partition.filesystem_label == 'bootfs' || partition.filesystem_label == 'rootfs' || partition.filesystem_label == 'rootfs1' || partition.filesystem_label == 'rootfs2')
2019-01-11 13:27:54 +01:00
2018-02-27 22:50:37 +01:00
var menu_items = [];
2018-02-28 00:52:31 +01:00
var skip_dev = false;
if (disks[disk_device].userfs_on_disk) {
skip_dev = true;
}
else if (disks[disk_device].bootfs_on_disk & & (partition.partition == 0)) {
skip_dev = true;
}
2018-02-28 20:02:00 +01:00
else if (is_sys_partition & & (partition.partition > 0)) {
2018-02-28 00:52:31 +01:00
skip_dev = true;
}
2019-01-11 13:27:54 +01:00
2018-02-28 00:52:31 +01:00
if (! skip_dev) {
2018-02-28 00:11:00 +01:00
var device = partition.disk_device;
var label = i18next.t('use_disk_for_userfs');
if (partition.partition > 0) {
device = partition.partition_device;
var label = i18next.t('use_partition_for_userfs');
}
menu_items.push($('< a class = "item" > ').append(label).attr('data-device', device).click(function() {
var target_device = this.getAttribute('data-device');
$('#modal-move-userfs').modal({
2018-02-28 00:52:31 +01:00
onDeny: function() {
2018-02-28 00:11:00 +01:00
return true;
},
onApprove: function() {
2018-02-28 00:52:31 +01:00
display_message('warning', i18next.t('moving_userfs'), 300000);
2018-02-28 01:28:42 +01:00
if (!moving_userfs_to_device) {
2018-07-28 02:04:49 +02:00
rest('POST', '/move_userfs_to_device', {"target_device":target_device},
2019-01-11 13:27:54 +01:00
function(data) {
moving_userfs_to_device = false;
display_message('success', i18next.t('userfs_moved'), 120000);
rest('POST', '/system_reboot');
},
function(xhr, ajaxOptions, thrownError) {
moving_userfs_to_device = false;
default_error_callback(xhr, ajaxOptions, thrownError);
}
2018-02-28 01:28:42 +01:00
);
}
moving_userfs_to_device = true;
2018-02-28 00:11:00 +01:00
}
})
2019-01-11 13:27:54 +01:00
.modal('show');
2018-02-27 22:50:37 +01:00
}));
2019-01-11 13:27:54 +01:00
2018-03-31 10:22:40 +02:00
if (partition.partition == 0) {
menu_items.push($('< a class = "item" > ').append(i18next.t('delete_partition_table')).attr('data-device', device).click(function() {
var device = this.getAttribute('data-device');
$('#modal-delete-partition-table').modal({
onDeny: function() {
return true;
},
onApprove: function() {
2018-07-28 02:04:49 +02:00
rest('POST', '/delete_partition_table', {"device":device},
2019-01-11 13:27:54 +01:00
function(data) {
display_message('success', i18next.t('partiton_table_deleted'), 120000);
get_partitions();
},
function(xhr, ajaxOptions, thrownError) {
default_error_callback(xhr, ajaxOptions, thrownError);
get_partitions();
}
2018-03-31 10:22:40 +02:00
);
}
})
2019-01-11 13:27:54 +01:00
.modal('show');
2018-03-31 10:22:40 +02:00
}));
}
2018-02-27 22:50:37 +01:00
}
var menu = null;
if (menu_items.length > 0) {
2018-02-28 00:52:31 +01:00
menu = $('< div class = "ui compact menu" style = "min-height:28px; max-height:28px;" > ').append(
2019-01-11 13:27:54 +01:00
$('< div class = "ui floating dropdown top right item" > ').append(
i18next.t('action'),
$('< i class = "dropdown icon" > '),
$('< div class = "menu" > ').append(menu_items)
)
2018-02-27 22:50:37 +01:00
)
}
2019-01-11 13:27:54 +01:00
2018-02-26 22:52:33 +01:00
if (partition.partition == 0) {
var st = "border:none; border-top: 2px solid #aaafaf";
2018-02-27 22:57:04 +01:00
$("#volume-info tbody").append($('< tr style = "background: #f8ffff;" > ').append(
2019-01-11 13:27:54 +01:00
$('< td style = "'+st+'" class = "top aligned" rowspan = "' + parts.length + '" > ')
.append($('< label > ' + partition.model + '< / label > < br / > < strong > ' + partition.disk_device + '< / strong > ')),
$('< td style = "'+st+'" class = "center aligned" colspan = "4" > '),
$('< td class = "right aligned" style = "'+st+'" > ').append($('< label > ' + format_size(partition.size) + '< / label > ')),
$('< td style = "'+st+'" colspan = "2" > '),
$('< td style = "'+st+'" class = "center aligned" > ').append(menu)
2018-02-26 22:52:33 +01:00
));
} else {
var usage = '';
if (partition.filesystem_usage & & partition.filesystem_usage >= 0) {
usage = (parseFloat(partition.filesystem_usage) * 100).toFixed(0) + '%'
}
2018-02-28 20:02:00 +01:00
var st = (is_sys_partition) ? 'style="font-weight:bolder"' : '';
2018-03-01 18:50:17 +01:00
var used = (partition.filesystem_used == -1) ? '' : format_size(partition.filesystem_used);
var free = (partition.filesystem_used == -1) ? '' : format_size(partition.size-partition.filesystem_used);
2018-02-28 20:32:31 +01:00
$("#volume-info tbody").append($('< tr > ').append(
2019-01-11 13:27:54 +01:00
$('< td style = "border-left: 1px solid rgba(34,36,38,.1)" > ').append($('< label > ' + partition.partition + '< / label > ')),
$('< td > ').append($('< label > ' + partition.filesystem_type + '< / label > ')),
$('< td > ').append($('< label ' + st + ' > ' + partition.filesystem_label + '< / label > ')),
$('< td > ').append($('< label ' + st + ' > ' + partition.mountpoint + '< / label > ')),
$('< td class = "right aligned" > ').append($('< label > ' + format_size(partition.size) + '< / label > ')),
$('< td class = "right aligned" > ').append($('< label > ' + used + '< / label > ')),
$('< td class = "right aligned" > ').append($('< label > ' + free + '< / label > ')),
$('< td class = "center aligned" > ').append(menu)
2018-02-26 22:52:33 +01:00
));
}
}
2018-02-27 22:50:37 +01:00
$('.dropdown').dropdown({});
2018-02-26 22:52:33 +01:00
}
2018-02-27 22:57:04 +01:00
$('#dimmer-volume-info').removeClass('active');
2018-02-26 22:52:33 +01:00
});
}
2019-01-11 13:27:54 +01:00
2018-01-29 00:04:12 +01:00
function install_addon(addon_id, download_url, file_input) {
2018-01-21 01:47:07 +01:00
if (!running_installation) {
2018-01-29 22:36:14 +01:00
display_message('info', i18next.t('installing_addon', {'addon_id': addon_id}), 180000);
2018-01-29 00:04:12 +01:00
if (addon_id) {
$('[data-update-addon-id="' + addon_id + '"]').addClass('loading');
}
if (download_url) {
$('#install-addon-url-button').addClass('loading');
}
if (file_input) {
$('#install-addon-file-button').addClass('loading');
}
2018-01-29 22:36:14 +01:00
disable_buttons();
2018-01-29 00:04:12 +01:00
var success_callback = function(data) {
//console.info(data);
2018-01-29 22:36:14 +01:00
reset_buttons();
display_message('success', data, 5000);
2018-01-29 00:04:12 +01:00
if (addon_id) {
2018-02-28 01:03:25 +01:00
if (addon_id == 'rmupdate') {
location.reload();
}
else {
$('#tr-' + addon_id).removeClass('warning');
$('#tr-' + addon_id).addClass('positive');
$('#button-update-' + addon_id).removeClass('green');
$('#button-update-' + addon_id).addClass('gray');
$('#button-update-' + addon_id).contents().last()[0].textContent = i18next.t('reinstall');
$('#label-version-' + addon_id).text($('#label-available-version-' + addon_id).text());
}
2018-01-29 00:04:12 +01:00
}
else {
2018-01-27 23:53:12 +01:00
$('#install-addon-url-input').val('');
2018-01-29 00:04:12 +01:00
$('#install-addon-file-input').val('');
get_addon_info();
2018-01-27 23:53:12 +01:00
}
2018-01-29 00:04:12 +01:00
}
var error_callback = function(xhr, ajaxOptions, thrownError) {
console.error("Addon installation error: " + thrownError + ": " + xhr.responseText);
2018-01-29 22:36:14 +01:00
reset_buttons();
2018-01-29 00:04:12 +01:00
$('#install-addon-url-input').val('');
$('#install-addon-file-input').val('');
default_error_callback(xhr, ajaxOptions, thrownError);
}
2019-01-11 13:27:54 +01:00
2018-01-29 00:04:12 +01:00
if (file_input) {
$.ajax({
2018-07-28 02:04:49 +02:00
url: 'rest.cgi?sid=' + sid + '& path=/install_addon_archive',
2018-01-29 00:04:12 +01:00
data: file_input.files[0],
type: 'POST',
processData: false,
contentType: 'application/octet-stream',
success: success_callback,
error: error_callback
});
}
else {
2018-07-28 02:04:49 +02:00
rest("POST", "/install_addon", {"addon_id":addon_id, "download_url":download_url},
2019-01-11 13:27:54 +01:00
success_callback, error_callback
2018-01-29 00:04:12 +01:00
);
}
2018-01-27 23:53:12 +01:00
}
}
2019-01-11 13:27:54 +01:00
2018-01-27 23:53:12 +01:00
function uninstall_addon(addon_id) {
if (!running_installation) {
2018-01-29 22:36:14 +01:00
display_message('info', i18next.t('uninstalling_addon', {'addon_id': addon_id}), 180000);
disable_buttons();
2018-01-27 23:53:12 +01:00
$('[data-uninstall-addon-id="' + addon_id + '"]').addClass('loading');
2018-07-28 02:04:49 +02:00
rest("POST", "/uninstall_addon", {"addon_id":addon_id},
2019-01-11 13:27:54 +01:00
function(data) {
//console.info(data);
display_message('success', data, 5000);
reset_buttons();
$('#tr-' + addon_id).remove();
},
function(xhr, ajaxOptions, thrownError) {
console.error("Addon installation error: " + thrownError + ": " + xhr.responseText);
reset_buttons();
default_error_callback(xhr, ajaxOptions, thrownError);
}
2018-01-21 01:47:07 +01:00
);
}
}
2019-01-11 13:27:54 +01:00
2018-01-20 23:43:14 +01:00
function get_addon_info() {
2018-01-21 01:47:07 +01:00
$('#dimmer-addon-info').addClass('active');
2018-01-20 23:43:14 +01:00
rest("GET", "/get_addon_info", null, function(data) {
2018-01-21 01:47:07 +01:00
$('#addon-info tbody').empty();
2018-01-20 23:43:14 +01:00
data.forEach(function(addon) {
2018-01-21 01:47:07 +01:00
var color = 'gray';
if (addon.available_version & & (addon.version != addon.available_version)) color = 'green';
2019-01-11 13:27:54 +01:00
2018-01-21 01:47:07 +01:00
var disabled = ((addon.available_version & & addon.download_url) ? '' : 'disabled');
var bupdate = $('< div class = "ui '+ color +' basic '+ disabled +' button" id = "button-update-' + addon.id + '" > ')
2019-01-11 13:27:54 +01:00
.append($('< i class = "sign in icon" > '), (addon.version == addon.available_version) ? i18next.t('reinstall') : i18next.t('update'));
2018-01-29 22:36:14 +01:00
if (!disabled) {
bupdate.attr('data-update-addon-id', addon.id).attr('data-update-addon-available-version', addon.available_version)
}
2018-01-21 01:47:07 +01:00
bupdate.click(function() {
install_addon(this.getAttribute('data-update-addon-id'));
});
2019-01-11 13:27:54 +01:00
2018-01-21 01:47:07 +01:00
disabled = ((addon.config_url) ? '' : 'disabled');
var bconfig = $('< div class = "ui blue basic '+ disabled +' button" > ')
2019-01-11 13:27:54 +01:00
.attr('data-addon-config-url', addon.config_url)
.append($('< i class = "setting icon" > '), i18next.t('open_config'));
2018-01-21 01:47:07 +01:00
bconfig.click(function() {
2018-07-21 22:53:40 +02:00
var win = window.open(this.getAttribute('data-addon-config-url') + window.location.search, '_blank');
2018-01-21 01:47:07 +01:00
win.focus();
});
2019-01-11 13:27:54 +01:00
2018-01-27 23:53:12 +01:00
var buninstall = $('< div class = "ui orange basic button" > ')
2019-01-11 13:27:54 +01:00
.attr('data-uninstall-addon-id', addon.id)
.append($('< i class = "remove icon" > '), i18next.t('uninstall'));
2018-01-27 23:53:12 +01:00
buninstall.click(function() {
var addon_id = this.getAttribute('data-uninstall-addon-id');
$('#modal-uninstall-addon').modal({
onDeny: function(){
return true;
},
onApprove: function() {
uninstall_addon(addon_id);
return true;
}
})
2019-01-11 13:27:54 +01:00
.modal('show');
2018-01-27 23:53:12 +01:00
});
2019-01-11 13:27:54 +01:00
2018-01-21 01:47:07 +01:00
var cls = (((!addon.available_version) || (addon.version == addon.available_version)) ? "positive" : "warning");
var available_version = ((addon.available_version) ? addon.available_version : "?");
$("#addon-info tbody").append($('< tr class = "' + cls + '" id = "tr-' + addon.id + '" > ').append(
2019-01-11 13:27:54 +01:00
$('< td > ').append($('< label > ' + addon.name + '< / label > ')),
$('< td > ').append($('< label id = "label-version-' + addon.id + '" > ' + addon.version + '< / label > ')),
$('< td > ').append($('< label id = "label-available-version-' + addon.id + '" > ' + available_version + '< / label > ')),
$('< td class = "center aligned" > ').append(bupdate, bconfig, buninstall)
2018-01-20 23:43:14 +01:00
));
});
2018-01-21 01:47:07 +01:00
$('#dimmer-addon-info').removeClass('active');
2018-01-29 22:36:14 +01:00
if (running_installation) {
// deactivate buttons
set_running_installation(running_installation);
}
2018-01-20 23:43:14 +01:00
});
}
2019-01-11 13:27:54 +01:00
2018-05-01 17:02:28 +02:00
function wlan_scan(force) {
if (!force & & !$('#wlan-scan-checkbox').prop("checked")) {
return;
}
2018-02-07 23:17:34 +01:00
rest("GET", "/wlan_scan", null, function(data) {
2019-01-11 13:27:54 +01:00
$('#wlan-list tbody').empty();
data.forEach(function(wlan) {
var cls = (wlan.connected == "1") ? "disabled" : "";
var bconnect = $('< div class = "ui green basic button ' + cls + '" > ')
.attr('data-ssid', wlan.ssid)
.append($('< i class = "sign in icon" > '), i18next.t('connect'));
bconnect.click(function() {
$('#form-connect-wlan').form('clear');
$('#form-connect-wlan').attr('data-ssid', this.getAttribute('data-ssid'));
$('#modal-connect-wlan').modal('show');
});
cls = (wlan.connected == "1") ? "" : "disabled";
var bdisconnect = $('< div class = "ui orange basic button ' + cls + '" > ')
.attr('data-ssid', wlan.ssid)
.append($('< i class = "delete icon" > '), i18next.t('disconnect'));
bdisconnect.click(function() {
$('.button[data-ssid]').addClass('loading');
rest("POST", "/wlan_disconnect");
2018-02-08 22:38:33 +01:00
});
2019-01-11 13:27:54 +01:00
var connected_checked = ((wlan.connected == "1") ? 'checked=""' : '')
cls = (wlan.connected == "1") ? "positive" : "";
$("#wlan-list tbody").append($('< tr class = "' + cls + '" > ').append(
$('< td > ').append($('< label > ' + wlan.ssid + '< / label > ')),
$('< td class = "center aligned" > ').append($('< div class = "ui disabled checkbox" > ').append($('< input type = "checkbox" disabled = "disabled" ' + connected_checked + ' > '),$('< label > < / label > '))),
$('< td > ').append($('< label > ' + wlan.signal + '< / label > ')),
$('< td class = "center aligned" > ').append(bconnect, bdisconnect)
));
});
wlanScanTimer = setTimeout(function(){ wlan_scan(); }, 5000);
},
function(xhr, ajaxOptions, thrownError) {
wlanScanTimer = setTimeout(function(){ wlan_scan(); }, 5000);
});
2018-02-07 23:17:34 +01:00
}
2019-01-11 13:27:54 +01:00
2018-07-28 02:04:49 +02:00
function init() {
2018-12-22 17:34:46 +01:00
$('#content').dimmer('hide');
2018-07-28 02:04:49 +02:00
var form_config = {
on: 'blur',
fields: {
password: {
identifier: 'password'
}
},
onSuccess: function(event, fields) {
if (wlanScanTimer) {
clearTimeout(wlanScanTimer);
}
wlanScanTimer = setTimeout(function(){ wlan_scan(); }, 10000);
$(event.currentTarget).closest("div.modal").modal('hide');
var ssid = $('#form-connect-wlan').attr('data-ssid');
var password = $(event.currentTarget).form('get value', 'password');
$('.button[data-ssid]').addClass('loading');
rest("POST", "/wlan_connect", {"ssid": ssid, "password": password});
event.preventDefault();
}
};
$('#form-connect-wlan').form(form_config);
2019-01-11 13:27:54 +01:00
2018-07-28 02:04:49 +02:00
rest("GET", "/version", null, function(version) {
document.title = document.title + " " + version;
});
rest("GET", "/is_system_upgradeable", null, function(upgradeable) {
if (!upgradeable) {
display_message('error', i18next.t('system_not_upgradeable'), 10000);
}
});
get_system_info();
get_partitions();
get_firmware_info();
get_addon_info();
wlan_scan(true);
}
2019-01-11 13:27:54 +01:00
2017-03-26 20:25:01 +02:00
$(document).ready(function() {
2018-01-23 00:34:09 +01:00
i18next.init({
lng: language,
fallbackLng: 'en',
resources: {
en: {
translation: {
title: 'System update',
system_info: 'System information',
2018-01-27 09:10:10 +01:00
system_type: 'System type: {{system_type}}',
2018-02-28 00:11:00 +01:00
uptime: 'Uptime: {{uptime}}',
2018-02-08 22:53:02 +01:00
reboot_system: 'Reboot system',
shutdown_system: 'Shutdown system',
2018-02-11 19:07:21 +01:00
reboot: 'Reboot',
shutdown: 'Shutdown',
sure_to_reboot_system: 'Are you sure you want to reboot the system now?',
sure_to_shutdown_system: 'Are you sure you want to shutdown the system now?',
system_is_rebooting: 'System is going down for reboot now.',
system_is_shutting_down: 'System is going down for shutdown now.',
2018-02-27 22:57:04 +01:00
volumes: 'Volumes',
2018-02-26 22:52:33 +01:00
device: 'Device',
partition_number: 'Partition',
filesystem_type: 'Filesystem',
filesystem_label: 'Label',
mountpoint: 'Mountpoint',
size: 'Size',
2018-02-28 20:02:00 +01:00
used: 'Used',
free: 'Free',
2018-03-01 17:39:44 +01:00
use_disk_for_userfs: 'Format and use whole disk for userfs.',
2018-02-28 00:11:00 +01:00
use_partition_for_userfs: 'Use partition for userfs.',
move_userfs: 'Move userfs to another device',
sure_to_move_userfs: 'Are you sure you want to move userfs?',
move: 'Move',
2018-02-28 00:52:31 +01:00
moving_userfs: 'Moving userfs, please wait, this will take a while...',
2018-02-28 00:11:00 +01:00
userfs_moved: 'Userfs moved, system will reboot now.',
2018-03-31 10:22:40 +02:00
delete_partition_table: 'Delete partition table.',
sure_to_delete_partition_table: 'Are you sure you want to delete the partition table?',
delete: 'Delete',
partiton_table_deleted: 'Partiton table deleted.',
2018-01-23 00:34:09 +01:00
firmwares: 'Firmwares',
2020-02-22 23:40:43 +01:00
show_experimental_fw: 'Show experimental versions',
2018-01-23 00:34:09 +01:00
current_installed_version: 'Current installed version',
latest_available_version: 'Latest available version',
loading: 'Loading',
version: 'Version',
available: 'Available',
2018-03-18 16:54:55 +01:00
supported: 'Supported',
2020-01-26 19:55:15 +01:00
experimental: 'Experimental',
2018-01-23 00:34:09 +01:00
downloaded: 'Downloaded',
action: 'Action',
delete_download: 'Delete download',
install: 'Install',
installation_log: 'Installation log',
open_release_info: 'Open release info',
perform_trial_run: 'Perform a trial run with no changes made',
2018-02-27 20:57:18 +01:00
delete_download_after_install: 'Delete download after installation',
2018-01-23 00:34:09 +01:00
reboot_after_install: 'Reboot system after installation',
addons: 'Addons',
addon_name: 'Addon name',
installed_version: 'Installed version',
available_version: 'Available version',
reinstall: 'Reinstall',
update: 'Update',
open_config: 'Open config',
error_occurred: 'An error occurred: {{error}}',
installation_failed: 'Failed to install {{what}}: {{error}}',
installation_success: '{{what}} successfully installed.',
delete_firmware_img_success: 'Firmware image {{version}} successfully deleted.',
installing_firmware: 'Installing firmware {{version}}.',
install_latest_firmware: 'Install latest firmware',
2018-01-27 23:53:12 +01:00
system_not_upgradeable: 'System not upgradeable or filesystem to small!',
uninstall: 'Uninstall',
cancel: 'Canel',
uninstall_addon: 'Uninstall addon',
sure_to_uninstall_addon: 'Are you sure you want to uninstall this addon?',
installing_addon: 'Installing addon {{addon_id}}.',
uninstalling_addon: 'Uninstalling addon {{addon_id}}.',
install_addon_from_url: 'Install addon from url',
2018-01-29 00:04:12 +01:00
install_addon_from_file: 'Install addon from file',
choose_addon_file: 'Choose and install addon-file',
2018-02-07 23:17:34 +01:00
wlan: "WLAN",
2018-05-01 17:02:28 +02:00
wlan_scanning: "Scan for networks",
2018-02-07 23:17:34 +01:00
wlan_ssid: "SSID",
wlan_signal: "Signal",
2018-02-08 22:38:33 +01:00
wlan_connected: "Connected",
connect_to_wlan: "Connect with wifi",
password: "Password",
2018-02-07 23:17:34 +01:00
connect: "Connect",
2018-02-08 22:38:33 +01:00
disconnect: "Disconnect",
2018-07-28 02:04:49 +02:00
login: "Login",
username: "Username",
2018-01-23 00:34:09 +01:00
}
},
de: {
translation: {
title: 'System-Aktualisierung',
system_info: 'System-Informationen',
2018-01-27 09:10:10 +01:00
system_type: 'System-Typ: {{system_type}}',
2018-02-28 00:11:00 +01:00
uptime: 'Betriebszeit: {{uptime}}',
2018-02-08 22:53:02 +01:00
reboot_system: 'System neu starten',
shutdown_system: 'System herunterfahren',
2018-02-11 19:07:21 +01:00
reboot: 'Neu starten',
shutdown: 'Herunterfahren',
sure_to_reboot_system: 'Soll das System jetzt neu gestartet werden?',
sure_to_shutdown_system: 'Soll das System jetzt heruntergefahren werden?',
system_is_rebooting: 'Das System wird neu gestartet.',
system_is_shutting_down: 'Das System wird heruntergefahren.',
2018-02-27 22:57:04 +01:00
volumes: 'Datenträger',
2018-02-26 22:52:33 +01:00
device: 'Gerät',
partition_number: 'Partition',
filesystem_type: 'Dateisystem',
filesystem_label: 'Label',
mountpoint: 'Einhängepunkt',
size: 'Größe',
2018-02-28 20:02:00 +01:00
used: 'Belegt',
free: 'Frei',
2018-03-01 17:39:44 +01:00
use_disk_for_userfs: 'Gesamten Datenträger neu formatieren< br / > und für userfs verwenden.',
2018-02-28 00:11:00 +01:00
use_partition_for_userfs: 'Die Partition als userfs verwenden.',
move_userfs: 'Userfs auf anderen Datenträger verschieben',
sure_to_move_userfs: 'Soll das userfs wirklich verschoben werden?',
move: 'Verschieben',
2018-02-28 00:52:31 +01:00
moving_userfs: 'Verschiebe userfs, bitte warten, dies kann einige Zeit dauern...',
2018-02-28 00:11:00 +01:00
userfs_moved: 'Userfs wurde verschoben, das System wird neu gestartet.',
2018-03-31 10:22:40 +02:00
delete_partition_table: 'Partitionstabelle löschen.',
sure_to_delete_partition_table: 'Soll die Partitionstabelle wirklich gelöscht werden?',
delete: 'Löschen',
partiton_table_deleted: 'Partitionstabelle gelöscht.',
2018-01-23 00:34:09 +01:00
firmwares: 'Firmwares',
2020-02-22 23:40:43 +01:00
show_experimental_fw: 'Experimentelle Versionen anzeigen',
2018-01-23 00:34:09 +01:00
current_installed_version: 'Momentan installierte Version',
latest_available_version: 'Aktuellste verfügbare Version',
loading: 'Lade',
version: 'Version',
available: 'Verfügbar',
2018-03-18 16:54:55 +01:00
supported: 'Unterstützt',
2020-01-26 19:55:15 +01:00
experimental: 'Experimentell',
2018-01-23 00:34:09 +01:00
downloaded: 'Heruntergeladen',
action: 'Aktion',
delete_download: 'Download löschen',
install: 'Installieren',
installation_log: 'Installations-Protokoll',
open_release_info: 'Release-Informationen öffnen',
perform_trial_run: 'Testlauf durchführen ohne Änderungen durchzuführen',
2018-02-27 20:57:18 +01:00
delete_download_after_install: 'Download nach Installation löschen',
2018-01-23 00:34:09 +01:00
reboot_after_install: 'System nach Installation neu starten',
addons: 'Zusatzsoftware',
addon_name: 'Name des Addons',
installed_version: 'Installierte Version',
available_version: 'Verfügbare Version',
reinstall: 'Neu installieren',
update: 'Aktualisieren',
open_config: 'Konfiguration öffnen',
error_occurred: 'Ein Fehler ist aufgetreten: {{error}}',
installation_failed: 'Fehler beim Installieren von {{what}}: {{error}}',
installation_success: '{{what}} erfolgreich installiert.',
delete_firmware_img_success: 'Firmware-Image {{version}} erfolgreich gelöscht.',
installing_firmware: 'Installiere Firmware {{version}}.',
install_latest_firmware: 'Aktuellste Firmware installieren',
2018-01-27 23:53:12 +01:00
system_not_upgradeable: 'System nicht aktualisierbar oder Dateisystem zu klein!',
uninstall: 'Deinstallieren',
cancel: 'Abbrechen',
uninstall_addon: 'Addon deinstallieren',
sure_to_uninstall_addon: 'Sind sie sicher, dass sie dieses Addon deinstallieren wollen?',
installing_addon: 'Installiere Addon {{addon_id}}.',
uninstalling_addon: 'Deinstalliere Addon {{addon_id}}.',
install_addon_from_url: 'Addon von URL installieren',
2018-01-29 00:04:12 +01:00
install_addon_from_file: 'Addon aus Datei installieren',
choose_addon_file: 'Addon-Datei auswählen und installieren',
2018-02-07 23:17:34 +01:00
wlan: "WLAN",
2018-05-01 17:02:28 +02:00
wlan_scanning: "Nach Netzwerken suchen",
2018-02-07 23:17:34 +01:00
wlan_ssid: "SSID",
wlan_signal: "Signal",
2018-02-08 22:38:33 +01:00
wlan_connected: "Verbunden",
connect_to_wlan: "Mit WLAN verbinden",
password: "Passwort",
2018-02-07 23:17:34 +01:00
connect: "Verbinden",
2018-02-08 22:38:33 +01:00
disconnect: "Trennen",
2018-07-28 02:04:49 +02:00
login: "Anmelden",
username: "Benuzername",
2018-01-23 00:34:09 +01:00
}
}
}
}, function(err, t) {
jqueryI18next.init(i18next, $);
$('title').localize();
$('h1').localize();
$('h2').localize();
$('div').localize();
$('th').localize();
$('label').localize();
2018-01-29 00:04:12 +01:00
$('#install-addon-url-button').contents().last()[0].textContent = i18next.t('install');
2018-03-21 00:14:13 +01:00
$('#install-firmware-url-button').contents().last()[0].textContent = i18next.t('install');
2018-01-29 00:04:12 +01:00
$('#install-addon-file-button').contents().last()[0].textContent = i18next.t('choose_addon_file');
2018-01-23 00:34:09 +01:00
});
2019-01-11 13:27:54 +01:00
2018-12-22 17:34:46 +01:00
$('#content').dimmer('show');
2018-07-28 02:04:49 +02:00
sid = get_url_var('sid');
rest("GET", "/get_session", null,
2019-01-11 13:27:54 +01:00
function(data) {
init();
},
function(xhr, ajaxOptions, thrownError) {
if (xhr.status == 401) {
var form_config = {
on: 'blur',
fields: {
username: {
identifier: 'username'
2019-01-11 13:11:16 +01:00
},
2019-01-11 13:27:54 +01:00
password: {
identifier: 'password'
2019-01-11 13:11:16 +01:00
}
2019-01-11 13:27:54 +01:00
},
onSuccess: function(event, fields) {
event.preventDefault();
var username = $(event.currentTarget).form('get value', 'username');
var password = $(event.currentTarget).form('get value', 'password');
rest("POST", "/login", {"username": username, "password": password},
function(data) {
window.location.href = window.location.href.replace(/\?.*/, '') + '?sid=@' + data + '@';
},
function(xhr, ajaxOptions, thrownError) {
default_error_callback(xhr, ajaxOptions, thrownError);
}
);
}
};
$('#form-login').form(form_config);
$('#modal-login').modal('show');
}
else {
default_error_callback(xhr, ajaxOptions, thrownError);
2018-02-08 22:38:33 +01:00
}
2019-01-11 13:27:54 +01:00
}
2018-07-28 02:04:49 +02:00
);
2017-03-25 01:45:39 +01:00
});
2019-01-11 13:27:54 +01:00
2017-03-24 19:57:23 +01:00
< / script >
< / head >
< body >
2019-01-11 13:27:54 +01:00
< div style = "position: fixed; left: 50%; top: 2vh; z-index: 2000" >
< div style = "position: relative; left: -50%;" >
< div class = "ui container" >
< div id = "message" class = "ui message hidden" style = "margin-left: 100px; margin-right: 100px; min-height: 50px; min-width: 340px" >
< i class = "close icon" onclick = "clear_message();" > < / i >
2020-01-11 09:35:19 +01:00
< pre id = "message-text" style = 'font-family: Lato,"Helvetica Neue",Arial,Helvetica,sans-serif; white-space: pre-wrap;' / >
2019-01-11 13:27:54 +01:00
< / div >
2018-01-29 22:36:14 +01:00
< / div >
< / div >
< / div >
2019-01-11 13:27:54 +01:00
< div id = "content" style = "padding: 0; margin: 0; width: 100%" >
< div style = "padding-top: 5vw; padding-bottom: 5vw" class = "ui container" >
< h1 class = "ui center aligned dividing header" data-i18n = "title" > < / h1 >
< h2 class = "ui header" >
< i class = "info icon" > < / i >
< div data-i18n = "system_info" class = "content" >
< / div >
< / h2 >
< div class = "ui list" id = "system-info" >
2018-02-26 22:52:33 +01:00
< / div >
2019-01-11 13:27:54 +01:00
< div class = "ui orange basic button" data-i18n = "reboot_system" onclick = "show_reboot_dialog();" > < / div >
< div class = "ui red basic button" data-i18n = "shutdown_system" onclick = "show_shutdown_dialog();" > < / div >
< h2 class = "ui header" >
< i class = "hdd outline icon" > < / i >
< div data-i18n = "volumes" class = "content" >
< / div >
< / h2 >
< div class = "dimmable" >
< div id = "dimmer-volume-info" class = "ui active inverted dimmer" >
< div class = "ui loader" data-i18n = "loading" > < / div >
< / div >
< table id = "volume-info" class = "ui celled stackable table" >
< thead >
< tr >
< th data-i18n = "device" > < / th >
< th data-i18n = "partition_number" > < / th >
< th data-i18n = "filesystem_type" > < / th >
< th data-i18n = "filesystem_label" > < / th >
< th data-i18n = "mountpoint" > < / th >
< th class = "right aligned" data-i18n = "size" > < / th >
< th class = "right aligned" data-i18n = "used" > < / th >
< th class = "right aligned" data-i18n = "free" > < / th >
< th class = "center aligned" data-i18n = "action" > < / th >
< / tr >
< / thead >
< tbody >
< / tbody >
< / table >
2018-02-26 22:52:33 +01:00
< / div >
2019-01-11 13:27:54 +01:00
2019-01-27 21:34:23 +01:00
< h2 id = "firmware-header" class = "ui header" >
2019-01-11 13:27:54 +01:00
< i class = "settings icon" > < / i >
< div data-i18n = "firmwares" class = "content" >
< / div >
< / h2 >
2019-01-27 21:34:23 +01:00
< div id = "firmware-summary" class = "ui list" id = "firmware-summary" >
2018-01-27 23:53:12 +01:00
< / div >
2019-01-11 13:27:54 +01:00
2019-01-27 21:34:23 +01:00
< div id = "firmware-list" class = "dimmable" >
2019-01-11 13:27:54 +01:00
< div id = "dimmer-firmware-info" class = "ui active inverted dimmer" >
< div class = "ui loader" data-i18n = "loading" > < / div >
< / div >
< div style = "width: 100%" class = "ui action input" >
< input id = "install-firmware-url-input" type = "text" placeholder = "http://.../RaspberryMatic.zip" / >
< button id = "install-firmware-url-button" class = "ui green right labeled icon button" onclick = "install_firmware($('#install-firmware-url-input').val());" >
< i class = "sign in icon" > < / i >
install
< / button >
< / div >
2020-02-22 23:40:43 +01:00
< div class = "ui checkbox" style = "margin-top: 20px;" >
< input id = "show-experimental-fw" type = "checkbox" onchange = "show_experimental_firmware(this.checked);" >
< label data-i18n = "show_experimental_fw" > < / label >
< / div >
2019-01-11 13:27:54 +01:00
< table id = "firmware-info" class = "ui celled stackable table" >
< thead >
< tr >
< th data-i18n = "version" > < / th >
< th class = "center aligned" data-i18n = "available" > < / th >
2020-01-26 19:55:15 +01:00
< th class = "center aligned" data-i18n = "experimental" > < / th >
2019-01-11 13:27:54 +01:00
< th class = "center aligned" data-i18n = "downloaded" > < / th >
< th class = "center aligned" data-i18n = "action" > < / th >
< / tr >
< / thead >
< tbody >
< / tbody >
< / table >
< div class = "ui checkbox" >
< input id = "dryrun" type = "checkbox" >
< label data-i18n = "perform_trial_run" > < / label >
< / div >
< br / >
< div class = "ui checkbox" >
< input id = "delete-download-after-install" type = "checkbox" checked = "checked" >
< label data-i18n = "delete_download_after_install" > < / label >
< / div >
< br / >
< div class = "ui checkbox" >
< input id = "reboot-after-install" type = "checkbox" checked = "checked" >
< label data-i18n = "reboot_after_install" > < / label >
< / div >
2018-12-22 17:34:46 +01:00
< / div >
2019-01-11 13:27:54 +01:00
< h2 class = "ui header" >
< i class = "plug icon" > < / i >
< div data-i18n = "addons" class = "content" >
< / div >
< / h2 >
< div class = "dimmable" >
< div id = "dimmer-addon-info" class = "ui active inverted dimmer" >
< div class = "ui loader" data-i18n = "loading" > < / div >
< / div >
< table id = "addon-info" class = "ui celled stackable table" >
< thead >
< tr >
< th data-i18n = "addon_name" > < / th >
< th data-i18n = "installed_version" > < / th >
< th data-i18n = "available_version" > < / th >
< th class = "center aligned" data-i18n = "action" > < / th >
< / tr >
< / thead >
< tbody >
< / tbody >
< / table >
2018-01-21 01:47:07 +01:00
< / div >
2019-01-11 13:27:54 +01:00
< h2 class = "ui header" >
< i class = "cloud download icon" > < / i >
< div data-i18n = "install_addon_from_url" class = "content" >
< / div >
< / h2 >
2018-03-21 00:14:13 +01:00
< div style = "width: 100%" class = "ui action input" >
2019-01-11 13:27:54 +01:00
< input id = "install-addon-url-input" type = "text" placeholder = "http://.../addon.tar.gz" / >
< button id = "install-addon-url-button" class = "ui green right labeled icon button" onclick = "install_addon(null, $('#install-addon-url-input').val());" >
2018-03-21 00:14:13 +01:00
< i class = "sign in icon" > < / i >
install
< / button >
< / div >
2019-01-11 13:27:54 +01:00
< h2 class = "ui header" >
< i class = "upload icon" > < / i >
< div data-i18n = "install_addon_from_file" class = "content" >
< / div >
< / h2 >
< div style = "width: 100%" class = "ui action input" >
< input class = "inputfile" id = "install-addon-file-input" type = "file" onchange = "install_addon(null, null, this);" style = "display: none;" / >
< label id = "install-addon-file-button" for = "install-addon-file-input" class = "ui green button" >
< i class = "ui file archive outline icon" > < / i >
choose_addon_file
< / label >
2019-01-11 13:11:16 +01:00
< / div >
2019-01-11 13:27:54 +01:00
< h2 class = "ui header" >
< i class = "wifi icon" > < / i >
< div data-i18n = "wlan" class = "content" >
< / div >
< / h2 >
< div >
< div class = "ui toggle checkbox" >
< input type = "checkbox" id = "wlan-scan-checkbox" onclick = "wlan_scan();" >
< label data-i18n = "wlan_scanning" > < / label >
< / div >
< table id = "wlan-list" class = "ui celled stackable table" >
< thead >
< tr >
< th data-i18n = "wlan_ssid" > < / th >
< th data-i18n = "wlan_connected" > < / th >
< th data-i18n = "wlan_signal" > < / th >
< th class = "center aligned" data-i18n = "action" > < / th >
< / tr >
< / thead >
< tbody >
< / tbody >
< / table >
2018-05-01 17:02:28 +02:00
< / div >
2018-02-07 23:17:34 +01:00
< / div >
2019-01-11 13:27:54 +01:00
< / div >
< div style = "height:60vh;" id = "modal-log" class = "ui modal" >
< i class = "close icon" > < / i >
< div class = "header" data-i18n = "installation_log" >
2018-01-27 23:53:12 +01:00
< / div >
2019-01-11 13:27:54 +01:00
< div class = "ui bottom attached progress" data-value = "0" data-total = "25" id = "install-progress" >
< div class = "bar" > < / div >
2018-02-11 19:07:21 +01:00
< / div >
2019-01-11 13:27:54 +01:00
< div class = "content" >
< pre style = "height:40vh; overflow-x:hidden; overflow-y:auto; white-space: pre-wrap;" id = "log-content" >
< / pre >
2019-01-11 13:11:16 +01:00
< / div >
2019-01-11 13:27:54 +01:00
< / div >
< div id = "modal-uninstall-addon" class = "ui small basic modal transition scrolling" >
< div data-i18n = "uninstall_addon" class = "header" > < / div >
< div class = "content" >
< p data-i18n = "sure_to_uninstall_addon" > < / p >
< / div >
< div class = "actions" >
< div data-i18n = "cancel" class = "ui gray basic cancel inverted button" >
2019-01-11 13:11:16 +01:00
< / div >
2019-01-11 13:27:54 +01:00
< div data-i18n = "uninstall" class = "ui red approve inverted button" >
2018-02-11 19:07:21 +01:00
< / div >
< / div >
< / div >
2019-01-11 13:27:54 +01:00
< div id = "modal-reboot" class = "ui small basic modal transition scrolling" >
< div data-i18n = "reboot_system" class = "header" > < / div >
< div class = "content" >
< p data-i18n = "sure_to_reboot_system" > < / p >
2018-02-11 19:07:21 +01:00
< / div >
2019-01-11 13:27:54 +01:00
< div class = "actions" >
< div data-i18n = "cancel" class = "ui gray basic cancel inverted button" >
< / div >
< div data-i18n = "reboot" class = "ui red approve inverted button" >
< / div >
2018-02-11 19:07:21 +01:00
< / div >
< / div >
2019-01-11 13:27:54 +01:00
< div id = "modal-shutdown" class = "ui small basic modal transition scrolling" >
< div data-i18n = "shutdown_system" class = "header" > < / div >
< div class = "content" >
< p data-i18n = "sure_to_shutdown_system" > < / p >
2018-02-28 00:11:00 +01:00
< / div >
2019-01-11 13:27:54 +01:00
< div class = "actions" >
< div data-i18n = "cancel" class = "ui gray basic cancel inverted button" >
< / div >
< div data-i18n = "shutdown" class = "ui red approve inverted button" >
< / div >
2018-02-28 00:11:00 +01:00
< / div >
< / div >
2019-01-11 13:27:54 +01:00
< div id = "modal-move-userfs" class = "ui small basic modal transition scrolling" >
< div data-i18n = "move_userfs" class = "header" > < / div >
< div class = "content" >
< p data-i18n = "sure_to_move_userfs" > < / p >
2018-03-31 10:22:40 +02:00
< / div >
2019-01-11 13:27:54 +01:00
< div class = "actions" >
< div data-i18n = "cancel" class = "ui gray basic cancel inverted button" >
< / div >
< div data-i18n = "move" class = "ui red approve inverted button" >
< / div >
2018-03-31 10:22:40 +02:00
< / div >
< / div >
2019-01-11 13:27:54 +01:00
< div id = "modal-delete-partition-table" class = "ui small basic modal transition scrolling" >
< div data-i18n = "delete_partition_table" class = "header" > < / div >
< div class = "content" >
< p data-i18n = "sure_to_delete_partition_table" > < / p >
2018-02-08 22:38:33 +01:00
< / div >
2019-01-11 13:27:54 +01:00
< div class = "actions" >
< div data-i18n = "cancel" class = "ui gray basic cancel inverted button" >
< / div >
< div data-i18n = "delete" class = "ui red approve inverted button" >
< / div >
2018-02-08 22:38:33 +01:00
< / div >
< / div >
2019-01-11 13:27:54 +01:00
< div id = "modal-connect-wlan" class = "ui modal" >
< i class = "close icon" > < / i >
< div class = "header" data-i18n = "connect_to_wlan" >
2018-07-28 02:04:49 +02:00
< / div >
2019-01-11 13:27:54 +01:00
< div class = "content" >
< form id = "form-connect-wlan" class = "ui form" >
< div class = "field" >
< label data-i18n = "password" > < / label >
< input type = "password" name = "password" >
< / div >
< div class = "ui error message" > < / div >
< div class = "ui button" onclick = "$('#modal-connect-wlan').modal('hide');" data-i18n = "cancel" > < / div >
< div id = "submit-connect-wlan" class = "ui primary submit button" data-i18n = "connect" > < / div >
< / form >
2018-07-28 02:04:49 +02:00
< / div >
< / div >
2019-01-11 13:27:54 +01:00
< div id = "modal-login" class = "ui modal" >
< i class = "close icon" > < / i >
< div class = "header" data-i18n = "login" >
< / div >
< div class = "content" >
< form id = "form-login" class = "ui form" >
< div class = "field" >
< label data-i18n = "username" > < / label >
< input type = "text" name = "username" value = "Admin" >
< / div >
< div class = "field" >
< label data-i18n = "password" > < / label >
< input type = "password" name = "password" >
< / div >
< div class = "ui error message" > < / div >
<!--
< div class = "ui button" onclick = "$('#modal-login').modal('hide');" data-i18n = "cancel" > < / div >
-->
< div id = "submit-login" class = "ui primary submit button" data-i18n = "login" > < / div >
< / form >
< / div >
2019-01-11 13:11:16 +01:00
< / div >
2019-01-11 13:27:54 +01:00
2017-03-24 19:57:23 +01:00
< / body >
< / html >