From 45907d66c0d1cb205da53ca48172ef59e51b82b5 Mon Sep 17 00:00:00 2001
From: Laurent Peuch
Date: Wed, 11 Sep 2019 04:02:49 +0200
Subject: [PATCH 01/46] [mod] rename parameters according to changes in
cli/core for ux
---
src/js/yunohost/controllers/domains.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/js/yunohost/controllers/domains.js b/src/js/yunohost/controllers/domains.js
index 259b8b08..d50da321 100644
--- a/src/js/yunohost/controllers/domains.js
+++ b/src/js/yunohost/controllers/domains.js
@@ -306,7 +306,7 @@
y18n.t('confirm_change_maindomain'),
function(){
var params = {
- new_domain: c.params['domain']
+ new_main_domain: c.params['domain']
};
c.api('/domains/main', function(data) { // http://api.yunohost.org/#!/tools/tools_maindomain_put_1
store.clear('slide');
From 9c7ed43a24884f3814ee477436c9dd98fcfa9ef6 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Mon, 14 Oct 2019 00:05:27 +0200
Subject: [PATCH 02/46] Improve readability of api() calls
---
src/js/yunohost/controllers/apps.js | 80 +++++++++----------
src/js/yunohost/controllers/backup.js | 24 +++---
src/js/yunohost/controllers/domains.js | 44 +++++------
src/js/yunohost/controllers/firewall.js | 12 +--
src/js/yunohost/controllers/home.js | 8 +-
src/js/yunohost/controllers/monitor.js | 14 ++--
src/js/yunohost/controllers/postinstall.js | 4 +-
src/js/yunohost/controllers/services.js | 14 ++--
src/js/yunohost/controllers/tools.js | 90 ++++++++++------------
src/js/yunohost/controllers/users.js | 28 +++----
src/js/yunohost/events.js | 4 +-
src/js/yunohost/filters.js | 4 +-
src/js/yunohost/helpers.js | 2 +-
src/js/yunohost/main.js | 2 +-
src/views/tools/tools_log.ms | 2 +-
15 files changed, 162 insertions(+), 170 deletions(-)
diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js
index 26630ddc..c1874982 100644
--- a/src/js/yunohost/controllers/apps.js
+++ b/src/js/yunohost/controllers/apps.js
@@ -10,7 +10,7 @@
// List installed apps
app.get('#/apps', function (c) {
- c.api('/apps?installed', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
+ c.api('GET', '/apps?installed', {}, function(data) {
var apps = data['apps'];
c.arraySortById(apps);
c.view('app/app_list', {apps: apps});
@@ -109,8 +109,8 @@
// List available apps
app.get('#/apps/install', function (c) {
- c.api('/apps', function (data) { // http://api.yunohost.org/#!/app/app_list_get_8
- c.api('/apps?raw', function (dataraw) { // http://api.yunohost.org/#!/app/app_list_get_8
+ c.api('GET', '/apps', {}, function (data) {
+ c.api('GET', '/apps?raw', {}, function (dataraw) {
var apps = []
$.each(data['apps'], function(k, v) {
app = dataraw[v['id']];
@@ -201,7 +201,7 @@
// Get app information
app.get('#/apps/:app', function (c) {
- c.api('/apps/'+c.params['app']+'?raw', function(data) { // http://api.yunohost.org/#!/app/app_info_get_9
+ c.api('GET', '/apps/'+c.params['app']+'?raw', {}, function(data) {
// Presentation
data.settings.allowed_users = (data.settings.allowed_users) ? data.settings.allowed_users.replace(',', ', ')+"." : y18n.t('everyone_has_access');
@@ -221,14 +221,14 @@
// Get app debug page
app.get('#/apps/:app/debug', function (c) {
- c.api('/apps/'+c.params['app']+'/debug', function(data) {
+ c.api('GET', '/apps/'+c.params['app']+'/debug', {}, function(data) {
c.view('app/app_debug', data);
});
});
// Get app actions list
app.get('#/apps/:app/actions', function (c) {
- c.api('/apps/'+c.params['app']+'/actions', function(data) {
+ c.api('GET', '/apps/'+c.params['app']+'/actions', {}, function(data) {
$.each(data.actions, function(_, action) {
formatYunoHostStyleArguments(action.arguments, c.params);
@@ -264,14 +264,14 @@
'args': c.serialize(c.params.toHash())
}
- c.api('/apps/'+app_id+'/actions/'+action_id, function() { // http://api.yunohost.org/#!/app/app_install_post_2
+ c.api('PUT', '/apps/'+app_id+'/actions/'+action_id, params, function() {
c.redirect('#/apps/'+app_id+'/actions');
- }, 'PUT', params);
+ });
});
// Get app config panel
app.get('#/apps/:app/config-panel', function (c) {
- c.api('/apps/'+c.params['app']+'/config-panel', function(data) {
+ c.api('GET', '/apps/'+c.params['app']+'/config-panel', {}, function(data) {
$.each(data.config_panel.panel, function(_, panel) {
$.each(panel.sections, function(_, section) {
formatYunoHostStyleArguments(section.options, c.params);
@@ -297,9 +297,9 @@
'args': c.serialize(c.params.toHash())
}
- c.api('/apps/'+app_id+'/config', function() { // http://api.yunohost.org/#!/app/app_install_post_2
+ c.api('POST', '/apps/'+app_id+'/config', params, function() {
c.redirect('#/apps/'+app_id+'/config-panel');
- }, 'POST', params);
+ });
})
// Special case for custom app installation.
@@ -477,7 +477,7 @@
// App installation form
app.get('#/apps/install/:app', function (c) {
- c.api('/apps?raw', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
+ c.api('GET', '/apps?raw', {}, function(data) {
var app_name = c.params["app"];
var app_infos = data[app_name];
if (app_infos['state'] === "validated")
@@ -543,9 +543,9 @@
delete params['args'];
}
- c.api('/apps', function() { // http://api.yunohost.org/#!/app/app_install_post_2
+ c.api('POST', '/apps', params, function() {
c.redirect('#/apps');
- }, 'POST', params);
+ });
}
else {
c.flash('warning', y18n.t('app_install_cancel'));
@@ -608,9 +608,9 @@
y18n.t('applications'),
y18n.t('confirm_uninstall', [c.params['app']]),
function() {
- c.api('/apps/'+ c.params['app'], function() { // http://api.yunohost.org/#!/app/app_remove_delete_4
+ c.api('DELETE', '/apps/'+ c.params['app'], {}, function() { // http://api.yunohost.org/#!/app/app_remove_delete_4
c.redirect('#/apps');
- }, 'DELETE');
+ });
},
function() {
store.clear('slide');
@@ -621,8 +621,8 @@
// Manage app access
app.get('#/apps/:app/access', function (c) {
- c.api('/apps/'+c.params['app']+'?raw', function(data) { // http://api.yunohost.org/#!/app/app_info_get_9
- c.api('/users', function(dataUsers) {
+ c.api('GET', '/apps/'+c.params['app']+'?raw', {}, function(data) {
+ c.api('GET', '/users', {}, function(dataUsers) {
// allowed_users as array
if (typeof data.settings.allowed_users !== 'undefined') {
@@ -674,10 +674,10 @@
apps: c.params['app'],
users: []
};
- c.api('/access?'+c.serialize(params), function(data) { // http://api.yunohost.org/#!/app/app_removeaccess_delete_12
+ c.api('DELETE', '/access?'+c.serialize(params), params, function(data) {
store.clear('slide');
c.redirect('#/apps/'+ c.params['app']+ '/access');
- }, 'DELETE', params);
+ });
},
function() {
store.clear('slide');
@@ -696,10 +696,10 @@
apps: c.params['app'],
users: c.params['user']
};
- c.api('/access?'+c.serialize(params), function(data) { // http://api.yunohost.org/#!/app/app_removeaccess_delete_12
+ c.api('DELETE', '/access?'+c.serialize(params), params, function(data) {
store.clear('slide');
c.redirect('#/apps/'+ c.params['app']+ '/access');
- }, 'DELETE', params); // passing 'params' here is useless because jQuery doesn't handle ajax datas for DELETE requests. Passing parameters through uri.
+ });
},
function() {
store.clear('slide');
@@ -718,10 +718,10 @@
apps: c.params['app'],
users: null
};
- c.api('/access', function() { // http://api.yunohost.org/#!/app/app_addaccess_put_13
+ c.api('PUT', '/access', params, function() {
store.clear('slide');
c.redirect('#/apps/'+ c.params['app'] +'/access');
- }, 'PUT', params);
+ });
},
function() {
store.clear('slide');
@@ -736,10 +736,10 @@
users: c.params['user'],
apps: c.params['app']
};
- c.api('/access', function() { // http://api.yunohost.org/#!/app/app_addaccess_put_13
+ c.api('PUT', '/access', params, function() {
store.clear('slide');
c.redirect('#/apps/'+ c.params['app'] +'/access');
- }, 'PUT', params);
+ });
});
// Clear access (reset)
@@ -751,10 +751,10 @@
var params = {
apps: c.params['app']
};
- c.api('/access', function() { //
+ c.api('POST', '/access', params, function() {
store.clear('slide');
c.redirect('#/apps/'+ c.params['app'] +'/access');
- }, 'POST', params);
+ });
},
function() {
store.clear('slide');
@@ -769,10 +769,10 @@
y18n.t('applications'),
y18n.t('confirm_app_default'),
function() {
- c.api('/apps/'+ c.params['app'] +'/default', function() { //
+ c.api('PUT', '/apps/'+c.params['app']+'/default', {}, function() {
store.clear('slide');
c.redirect('#/apps/'+ c.params['app']);
- }, 'PUT');
+ });
},
function() {
store.clear('slide');
@@ -783,28 +783,28 @@
// Get app change label page
app.get('#/apps/:app/changelabel', function (c) {
- c.api('/apps/'+c.params['app']+'?raw', function(app_data) {
- data = {
+ c.api('GET', '/apps/'+c.params['app']+'?raw', {}, function(app_data) {
+ data = {
id: c.params['app'],
label: app_data.settings.label,
- };
- c.view('app/app_changelabel', data);
+ };
+ c.view('app/app_changelabel', data);
});
});
// Change app label
app.post('#/apps/:app/changelabel', function (c) {
params = {'new_label': c.params['label']};
- c.api('/apps/' + c.params['app'] + '/label', function(data) { // Call changelabel API
+ c.api('PUT', '/apps/' + c.params['app'] + '/label', params, function(data) { // Call changelabel API
store.clear('slide');
c.redirect('#/apps/'+ c.params['app']);
- }, 'PUT', params);
+ });
});
// Get app change URL page
app.get('#/apps/:app/changeurl', function (c) {
- c.api('/apps/'+c.params['app']+'?raw', function(app_data) {
- c.api('/domains', function(domain_data) { // http://api.yunohost.org/#!/domain/domain_list_get_2
+ c.api('GET', '/apps/'+c.params['app']+'?raw', {}, function(app_data) {
+ c.api('GET', '/domains', {}, function(domain_data) { // http://api.yunohost.org/#!/domain/domain_list_get_2
// Display a list of available domains
var domains = [];
@@ -836,10 +836,10 @@
y18n.t('confirm_app_change_url', [c.params['app']]),
function() {
params = {'domain': c.params['domain'], 'path': c.params['path']};
- c.api('/apps/' + c.params['app'] + '/changeurl', function(data) { // Call changeurl API
+ c.api('PUT', '/apps/' + c.params['app'] + '/changeurl', params, function(data) { // Call changeurl API
store.clear('slide');
c.redirect('#/apps/'+ c.params['app']);
- }, 'PUT', params);
+ });
},
function() {
store.clear('slide');
diff --git a/src/js/yunohost/controllers/backup.js b/src/js/yunohost/controllers/backup.js
index a4f77b27..3fdc2f91 100644
--- a/src/js/yunohost/controllers/backup.js
+++ b/src/js/yunohost/controllers/backup.js
@@ -50,10 +50,10 @@
id:c.params['storage'],
name:y18n.t('local_archives')
};
- c.api('/hooks/backup', function(hooks) {
+ c.api('GET', '/hooks/backup', {}, function(hooks) {
data['hooks'] = c.groupHooks(hooks['hooks']);
data['apps'] = {};
- c.api('/apps?with_backup', function(apps_list) {
+ c.api('GET', '/apps?with_backup', {}, function(apps_list) {
data['apps'] = apps_list.apps;
c.view('backup/backup_create', data, c.selectAllOrNone);
});
@@ -63,10 +63,10 @@
app.post('#/backup/:storage', function (c) {
var params = c.ungroupHooks(c.params['system_parts'],c.params['apps']);
- c.api('/backup', function() {
+ c.api('POST', '/backup', params, function() {
store.clear('slide');
c.redirect('#/backup/'+ c.params['storage']);
- }, 'POST', params);
+ });
});
// Restore a backup
@@ -77,10 +77,10 @@
$.proxy(function(c){
var params = c.ungroupHooks(c.params['system_parts'],c.params['apps']);
params['force'] = '';
- c.api('/backup/restore/'+c.params['archive'], function(data) {
+ c.api('POST', '/backup/restore/'+c.params['archive'], params, function(data) {
store.clear('slide');
c.redirect('#/backup/'+ c.params['storage']+'/'+c.params['archive']);
- }, 'POST', params);
+ });
}, this, c),
function(){
store.clear('slide');
@@ -95,9 +95,9 @@
y18n.t('backup'),
y18n.t('confirm_delete', [c.params['archive']]),
function(){
- c.api('/backup/archives/'+c.params['archive'], function(data) {
+ c.api('DELETE', '/backup/archives/'+c.params['archive'], {}, function(data) {
c.redirect('#/backup/'+ c.params['storage']);
- }, 'DELETE');
+ });
},
function(){
store.clear('slide');
@@ -108,9 +108,9 @@
// Download a backup
app.get('#/backup/:storage/:archive/download', function (c) {
- c.api('/backup/'+c.params['archive']+'/download', function(data) {
+ c.api('GET', '/backup/'+c.params['archive']+'/download', {}, function(data) {
c.redirect('#/backup/'+ c.params['storage']+'/'+c.params['archive']);
- }, 'GET');
+ });
});
// Copy a backup
@@ -127,7 +127,7 @@
// Get archive info
app.get('#/backup/:storage/:archive', function (c) {
- c.api('/backup/archives/'+c.params['archive']+'?with_details', function(data) {
+ c.api('GET', '/backup/archives/'+c.params['archive']+'?with_details', {}, function(data) {
data.storage = {
id: c.params['storage'],
name: y18n.t('local_archives')
@@ -143,7 +143,7 @@
// Archive list
app.get('#/backup/:storage', function (c) {
- c.api('/backup/archives?with_info', function(data) {
+ c.api('GET', '/backup/archives?with_info', {}, function(data) {
data.storage = {
id: 'local',
name: y18n.t('local_archives')
diff --git a/src/js/yunohost/controllers/domains.js b/src/js/yunohost/controllers/domains.js
index 259b8b08..995a5e61 100644
--- a/src/js/yunohost/controllers/domains.js
+++ b/src/js/yunohost/controllers/domains.js
@@ -10,8 +10,8 @@
// List existing domains
app.get('#/domains', function (c) {
- c.api('/domains', function(data) { // http://api.yunohost.org/#!/domain/domain_list_get_2
- c.api('/domains/main', function(data2) {
+ c.api('GET', '/domains', {}, function(data) {
+ c.api('PUT', '/domains/main', {}, function(data2) {
var domains = [];
$.each(data.domains, function(k, domain) {
domains.push({
@@ -29,7 +29,7 @@
domains: domains,
main_domain_form: main_domain_form
});
- }, 'PUT');
+ });
});
});
@@ -77,15 +77,15 @@
params.domain = c.params['domain'];
}
- c.api('/domains?'+endurl, function(data) { // http://api.yunohost.org/#!/domain/domain_add_post_1
+ c.api('POST', '/domains?'+endurl, params, function(data) {
c.redirect('#/domains');
- }, 'POST', params);
+ });
});
// Get existing domain info
app.get('#/domains/:domain', function (c) {
- c.api('/domains/main', function(dataMain) {
- c.api('/apps?installed', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
+ c.api('PUT', '/domains/main', {}, function(dataMain) {
+ c.api('GET', '/apps?installed', {}, function(data) {
// FIXME - This dirty trick (along with the previous API call
// for apps installed) should be removed once letsencrypt_ynh
@@ -107,12 +107,12 @@
};
c.view('domain/domain_info', domain);
});
- }, 'PUT');
+ });
});
// Domain DNS
app.get('#/domains/:domain/dns', function (c) {
- c.api('/domains/' + c.params['domain'] + '/dns', function(data) {
+ c.api('GET', '/domains/' + c.params['domain'] + '/dns', {}, function(data) {
var domain = {
name: c.params['domain'],
dns: data
@@ -123,7 +123,7 @@
// Domain certificate
app.get('#/domains/:domain/cert-management', function (c) {
- c.api('/domains/cert-status/' + c.params['domain'] + '?full', function(data) {
+ c.api('GET', '/domains/cert-status/' + c.params['domain'] + '?full', {}, function(data) {
var s = data["certificates"][c.params['domain']];
var status_ = {
@@ -209,10 +209,10 @@
y18n.t('certificate'),
y18n.t('confirm_cert_install_LE', [c.params['domain']]),
function(){
- c.api('/domains/cert-install/' + c.params['domain'], function(data) {
+ c.api('POST', '/domains/cert-install/' + c.params['domain'], {}, function(data) {
store.clear('slide');
c.redirect('#/domains/'+c.params['domain']+'/cert-management');
- }, 'POST');
+ });
},
function(){
store.clear('slide');
@@ -227,10 +227,10 @@
y18n.t('certificate'),
y18n.t('confirm_cert_regen_selfsigned', [c.params['domain']]),
function(){
- c.api('/domains/cert-install/' + c.params['domain'] + "?self_signed", function(data) {
+ c.api('POST', '/domains/cert-install/' + c.params['domain'] + "?self_signed", {}, function(data) {
store.clear('slide');
c.redirect('#/domains/'+c.params['domain']+'/cert-management');
- }, 'POST');
+ });
},
function(){
store.clear('slide');
@@ -245,10 +245,10 @@
y18n.t('certificate'),
y18n.t('confirm_cert_manual_renew_LE', [c.params['domain']]),
function(){
- c.api('/domains/cert-renew/' + c.params['domain'] + "?force", function(data) {
+ c.api('POST', '/domains/cert-renew/' + c.params['domain'] + "?force", {}, function(data) {
store.clear('slide');
c.redirect('#/domains/'+c.params['domain']+'/cert-management');
- }, 'POST');
+ });
},
function(){
store.clear('slide');
@@ -263,10 +263,10 @@
y18n.t('certificate'),
y18n.t('confirm_cert_revert_to_selfsigned', [c.params['domain']]),
function(){
- c.api('/domains/cert-install/' + c.params['domain'] + "?self_signed&force", function(data) {
+ c.api('POST', '/domains/cert-install/' + c.params['domain'] + "?self_signed&force", {}, function(data) {
store.clear('slide');
c.redirect('#/domains/'+c.params['domain']+'/cert-management');
- }, 'POST');
+ });
},
function(){
store.clear('slide');
@@ -282,10 +282,10 @@
y18n.t('domains'),
y18n.t('confirm_delete', [c.params['domain']]),
function(){
- c.api('/domains/'+ c.params['domain'], function(data) { // http://api.yunohost.org/#!/domain/domain_remove_delete_3
+ c.api('DELETE', '/domains/'+ c.params['domain'], {}, function(data) {
store.clear('slide');
c.redirect('#/domains');
- }, 'DELETE');
+ });
},
function(){
store.clear('slide');
@@ -308,10 +308,10 @@
var params = {
new_domain: c.params['domain']
};
- c.api('/domains/main', function(data) { // http://api.yunohost.org/#!/tools/tools_maindomain_put_1
+ c.api('PUT', '/domains/main', params, function(data) {
store.clear('slide');
c.redirect('#/domains');
- }, 'PUT', params);
+ });
// Wait 15s and refresh the page
var refreshDomain = window.setTimeout(function(){
diff --git a/src/js/yunohost/controllers/firewall.js b/src/js/yunohost/controllers/firewall.js
index beeff865..5da5bdfd 100644
--- a/src/js/yunohost/controllers/firewall.js
+++ b/src/js/yunohost/controllers/firewall.js
@@ -10,7 +10,7 @@
// Firewall status
app.get('#/tools/firewall', function (c) {
- c.api('/firewall?raw', function(data) {
+ c.api('GET', '/firewall?raw', {}, function(data) {
var firewall = {
ports: {},
upnp: false
@@ -44,10 +44,10 @@
var params = {
action : c.params['action']
};
- c.api('/firewall/upnp', function(data) {
+ c.api('GET', '/firewall/upnp', params, function(data) {
store.clear('slide');
c.redirect('#/tools/firewall');
- }, 'GET', params);
+ });
},
function(){
store.clear('slide');
@@ -115,10 +115,10 @@
port : port,
protocol : protocol
};
- c.api('/firewall/port?'+endurl, function(data) {
+ c.api(method, '/firewall/port?'+endurl, params, function(data) {
store.clear('slide');
c.redirect('#/tools/firewall');
- }, method, params);
+ });
}
else {
store.clear('slide');
@@ -169,4 +169,4 @@
);
});
-})();
\ No newline at end of file
+})();
diff --git a/src/js/yunohost/controllers/home.js b/src/js/yunohost/controllers/home.js
index ac315c21..54e201d6 100644
--- a/src/js/yunohost/controllers/home.js
+++ b/src/js/yunohost/controllers/home.js
@@ -80,7 +80,7 @@
var params = {
password: c.params['password']
};
- c.api('/login', function(data) {
+ c.api('POST', '/login', params, function(data) {
store.set('connected', true);
c.trigger('login');
$('#masthead .logout-btn').fadeIn();
@@ -90,19 +90,19 @@
} else {
c.redirect('#/');
}
- }, 'POST', params, false);
+ }, undefined, false);
});
app.get('#/logout', function (c) {
- c.api('/logout', function (data) {
+ c.api('GET', '/logout', {}, function (data) {
store.clear('url');
store.clear('connected');
store.set('path', '#/');
c.trigger('logout');
c.flash('success', y18n.t('logged_out'));
c.redirect('#/login');
- }, 'GET', {}, false);
+ }, undefined, false);
});
})();
diff --git a/src/js/yunohost/controllers/monitor.js b/src/js/yunohost/controllers/monitor.js
index 527e466c..990300d8 100644
--- a/src/js/yunohost/controllers/monitor.js
+++ b/src/js/yunohost/controllers/monitor.js
@@ -13,29 +13,28 @@
var monitorData = {};
// Why this method ?
- c.api('/services/glances', function(data) { // ?
+ c.api('GET', '/services/glances', {}, function(data) {
monitorData.status = true;
if (data.status == 'running') {
- c.api('/monitor/system', function(data) {
+ c.api('GET', '/monitor/system', {}, function(data) {
monitorData.system = data;
- c.api('/monitor/disk', function(data) {
+ c.api('GET', '/monitor/disk', {}, function(data) {
monitorData.disk = data;
- c.api('/monitor/network', function(data) {
+ c.api('GET', '/monitor/network', {}, function(data) {
monitorData.network = data;
// Remove useless interface
delete monitorData.network.usage.lo;
// Get YunoHost versions too
- c.api('/diagnosis', function(diagnosis) {
+ c.api('GET', '/diagnosis', {}, function(diagnosis) {
monitorData.versions = diagnosis.packages;
c.view('tools/tools_monitoring', monitorData);
});
});
-
});
});
}
@@ -43,8 +42,7 @@
monitorData.status = false;
c.view('tools/tools_monitoring', monitorData);
}
-
- }, 'GET');
+ });
});
})();
diff --git a/src/js/yunohost/controllers/postinstall.js b/src/js/yunohost/controllers/postinstall.js
index 04f7d7e9..6880cc87 100644
--- a/src/js/yunohost/controllers/postinstall.js
+++ b/src/js/yunohost/controllers/postinstall.js
@@ -92,9 +92,9 @@
store.set('url', window.location.hostname +'/yunohost/api');
store.set('user', 'admin');
- c.api('/postinstall', function(data) { // http://api.yunohost.org/#!/tools/tools_postinstall_post_0
+ c.api('POST', '/postinstall', params, function(data) {
c.redirect('#/login');
- }, 'POST', params);
+ });
},
function(){
}
diff --git a/src/js/yunohost/controllers/services.js b/src/js/yunohost/controllers/services.js
index e3de3554..71b97e55 100644
--- a/src/js/yunohost/controllers/services.js
+++ b/src/js/yunohost/controllers/services.js
@@ -10,7 +10,7 @@
// All services status
app.get('#/services', function (c) {
- c.api('/services', function(data) { // ?
+ c.api('GET', '/services', {}, function(data) {
var data2 = {
services: []
};
@@ -45,7 +45,7 @@
// Status & actions for a service
app.get('#/services/:service', function (c) {
- c.api('/services/'+ c.params['service'], function(data) { // ?
+ c.api('GET', '/services/'+ c.params['service'], {}, function(data) { // ?
var data2 = {
service: data
};
@@ -66,7 +66,7 @@
}
store.clear('slide');
c.view('service/service_info', data2);
- }, 'GET');
+ });
});
// Service log
@@ -74,14 +74,14 @@
var params = {
number: 50
};
- c.api('/services/'+ c.params['service'] +'/log', function(data) { // ?
+ c.api('GET', '/services/'+ c.params['service'] +'/log', params, function(data) { // ?
data2 = { 'logs': [], 'name': c.params['service'] };
$.each(data, function(k, v) {
data2.logs.push({filename: k, filecontent: v.join('\n')});
});
c.view('service/service_log', data2);
- }, 'GET', params);
+ });
});
// Enable/Disable & Start/Stop service
@@ -116,10 +116,10 @@
}
if (method && endurl) {
- c.api('/services/'+ endurl, function(data) {
+ c.api(method, '/services/'+ endurl, {}, function(data) {
store.clear('slide');
c.redirect('#/services/'+ c.params['service']);
- }, method);
+ });
}
else {
store.clear('slide');
diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js
index 8c7fb36c..2b0d5220 100644
--- a/src/js/yunohost/controllers/tools.js
+++ b/src/js/yunohost/controllers/tools.js
@@ -33,24 +33,24 @@
store.clear('slide');
c.redirect('#/tools/adminpw');
} else {
- c.api('/login', function(data) {
+ c.api('POST', '/login', { 'password': params['old_password'] }, function(data) {
// Remove useless variable
delete params['old_password'];
delete params['confirm_new_password'];
// Update password and redirect to the home
- c.api('/adminpw', function(data) { // http://api.yunohost.org/#!/tools/tools_adminpw_put_3
+ c.api('PUT', '/adminpw', params, function(data) {
c.redirect('#/logout');
- }, 'PUT', params);
- }, 'POST', { 'password': params['old_password'] }, false);
+ });
+ }, undefined, false);
}
});
// System update & upgrade
app.get('#/update', function (c) {
- c.api('/update', function(data) {
+ c.api('PUT', '/update', {}, function(data) {
c.view('update/update', data);
- }, 'PUT');
+ });
});
// Upgrade apps or packages
@@ -60,12 +60,10 @@
// confirm_update_apps and confirm_update_packages
y18n.t('confirm_update_' + c.params['type'].toLowerCase()),
function(){
- c.api('/upgrade?'+c.params["type"],
- function(data) {
+ c.api('PUT', '/upgrade?'+c.params["type"], {}, function(data) {
store.clear('slide');
c.redirect('#/tools/logs');
- },
- 'PUT');
+ });
},
function(){
store.clear('slide');
@@ -80,12 +78,10 @@
y18n.t('tools'),
y18n.t('confirm_update_specific_app', [c.params['app']]),
function(){
- c.api('/upgrade/apps?app='+c.params['app'].toLowerCase(),
- function(data) {
- store.clear('slide');
- c.redirect('#/tools/logs');
- },
- 'PUT');
+ c.api('PUT', '/upgrade/apps?app='+c.params['app'].toLowerCase(), {}, function(data) {
+ store.clear('slide');
+ c.redirect('#/tools/logs');
+ });
},
function(){
store.clear('slide');
@@ -96,7 +92,7 @@
// Display journals list
app.get('#/tools/logs', function (c) {
- c.api("/logs?limit=25&with_details", function(categories) {
+ c.api('GET', "/logs?limit=25&with_details", {}, function(categories) {
data = [];
category_icons = {
'operation': 'wrench',
@@ -139,7 +135,7 @@
var number = (c.params["number"])?c.params["number"]:50;
params += "&number=" + number;
- c.api("/logs/display" + params, function(log) {
+ c.api('GET', "/logs/display" + params, {}, function(log) {
if ('metadata' in log) {
if (!'env' in log.metadata && 'args' in log.metadata) {
log.metadata.env = log.metadata.args
@@ -222,10 +218,10 @@
// confirm_reboot_action_reboot or confirm_reboot_action_shutdown
y18n.t('confirm_reboot_action_' + action),
function(){
- c.api('/'+action+'?force', function(data) {
+ c.api('PUT', '/'+action+'?force', {}, function(data) {
// This code is not executed due to 502 response (reboot or shutdown)
c.redirect('#/logout');
- }, 'PUT', {}, false, function (xhr) {
+ }, function (xhr) {
c.flash('success', y18n.t('tools_' + action + '_done'))
// Disconnect from the webadmin
store.clear('url');
@@ -249,7 +245,7 @@
// Force scrollTop on page load
$('html, body').scrollTop(0);
store.clear('slide');
- });
+ }, false);
},
function(){
@@ -271,7 +267,7 @@
var private = (c.params.splat[0] == 'private');
var endurl = (private) ? '?private' : '';
- c.api('/diagnosis'+endurl, function(diagnosis) {
+ c.api('GET', '/diagnosis'+endurl, {}, function(diagnosis) {
c.view('tools/tools_diagnosis', {
'diagnosis' : JSON.stringify(diagnosis, undefined, 4),
'raw' : diagnosis,
@@ -282,8 +278,8 @@
// Reboot or shutdown button
app.get('#/tools/migrations', function (c) {
- c.api('/migrations?pending', function(pending_migrations) {
- c.api('/migrations?done', function(done_migrations) {
+ c.api('GET', '/migrations?pending', {}, function(pending_migrations) {
+ c.api('GET', '/migrations?done', {}, function(done_migrations) {
pending_migrations = pending_migrations.migrations;
done_migrations = done_migrations.migrations;
@@ -331,19 +327,17 @@
// /tools/migrations/run page "directly" somehow ...
if (withAcceptDisclaimerFlag)
{
- c.api('/migrations/migrate?accept_disclaimer',
- function (data) {
- store.clear('slide');
- c.redirect('#/tools/migrations');
- }, 'POST')
+ c.api('POST', '/migrations/migrate?accept_disclaimer', {}, function (data) {
+ store.clear('slide');
+ c.redirect('#/tools/migrations');
+ })
}
else
{
- c.api('/migrations/migrate',
- function (data) {
- store.clear('slide');
- c.redirect('#/tools/migrations');
- }, 'POST')
+ c.api('POST', '/migrations/migrate', {}, function (data) {
+ store.clear('slide');
+ c.redirect('#/tools/migrations');
+ })
}
});
@@ -352,10 +346,10 @@
y18n.t('migrations'),
y18n.t('confirm_migrations_skip'),
function(){
- c.api('/migrations/migrate?skip&targets=' + c.params['migration_id'], function(data) {
+ c.api('POST', '/migrations/migrate?skip&targets=' + c.params['migration_id'], {}, function(data) {
store.clear('slide');
c.redirect('#/tools/migrations');
- }, 'POST');
+ });
},
function(){
store.clear('slide');
@@ -366,7 +360,7 @@
// List available apps lists
app.get('#/tools/appslists', function (c) {
- c.api('/appslists', function(data) {
+ c.api('GET', '/appslists', {}, function(data) {
list = [];
$.each(data, function(listname, listinfo) {
list.push({
@@ -379,7 +373,7 @@
c.view('tools/tools_appslists_list', {
appslists: list
});
- }, 'GET');
+ });
});
// Add a new apps list
@@ -389,15 +383,15 @@
'url' : c.params['appslist_url']
}
- c.api('/appslists', function(data) {
+ c.api('PUT', '/appslists', list, function(data) {
store.clear('slide');
c.redirect('#/tools/appslists/' + list.name);
- }, 'PUT', list);
+ });
});
// Show appslist info and operations
app.get('#/tools/appslists/:appslist', function (c) {
- c.api('/appslists', function(data) {
+ c.api('GET', '/appslists', {}, function(data) {
if (typeof data[c.params['appslist']] !== 'undefined') {
list = {
'name' : c.params['appslist'],
@@ -412,22 +406,22 @@
store.clear('slide');
c.redirect('#/tools/appslists');
}
- }, 'GET');
+ });
});
// Refresh available apps list
app.get('#/tools/appslists/refresh', function (c) {
- c.api('/appslists', function(data) {
+ c.api('PUT', '/appslists', {}, function(data) {
// c.redirect(store.get('path'));
c.redirect('#/apps/install');
- }, 'PUT');
+ });
});
// Refresh specific apps list
app.get('#/tools/appslists/:appslist/refresh', function (c) {
- c.api('/appslists', function(data) {
+ c.api('PUT', '/appslists', {'name' : c.params['appslist']}, function(data) {
c.redirect('#/tools/appslists');
- }, 'PUT', {'name' : c.params['appslist']});
+ });
});
// Remove apps list
@@ -436,9 +430,9 @@
y18n.t('appslist'),
y18n.t('appslists_confirm_remove', [c.params['app']]),
function() {
- c.api('/appslists', function() {
+ c.api('DELETE', '/appslists', {'name' : c.params['appslist']}, function() {
c.redirect('#/tools/appslists');
- }, 'DELETE', {'name' : c.params['appslist']});
+ });
},
function() {
store.clear('slide');
diff --git a/src/js/yunohost/controllers/users.js b/src/js/yunohost/controllers/users.js
index 92e235ad..96a8bc75 100644
--- a/src/js/yunohost/controllers/users.js
+++ b/src/js/yunohost/controllers/users.js
@@ -12,14 +12,14 @@
// List existing users
app.get('#/users', function (c) {
- c.api('/users', function(data) { // http://api.yunohost.org/#!/user/user_list_get_3
+ c.api('GET', '/users', {}, function(data) {
c.view('user/user_list', data);
});
});
// Create user form
app.get('#/users/create', function (c) {
- c.api('/domains', function(data) { // http://api.yunohost.org/#!/domain/domain_list_get_2
+ c.api('GET', '/domains', {}, function(data) {
// Password min length
data.password_min_length = PASSWORD_MIN_LENGTH;
@@ -52,9 +52,9 @@
// Compute email field
c.params['mail'] = c.params['email'] + c.params['domain'];
- c.api('/users', function(data) { // http://api.yunohost.org/#!/user/user_create_post_2
+ c.api('POST', '/users', c.params.toHash(), function(data) {
c.redirect('#/users');
- }, 'POST', c.params.toHash());
+ });
}
} else {
c.flash('fail', y18n.t('passwords_dont_match'));
@@ -65,15 +65,15 @@
// Show user information
app.get('#/users/:user', function (c) {
- c.api('/users/'+ c.params['user'], function(data) { // http://api.yunohost.org/#!/user/user_info_get_0
+ c.api('GET', '/users/'+ c.params['user'], {}, function(data) {
c.view('user/user_info', data);
});
});
// Edit user form
app.get('#/users/:user/edit', function (c) {
- c.api('/users/'+ c.params['user'], function(data) { // http://api.yunohost.org/#!/user/user_info_get_0
- c.api('/domains', function(dataDomains) { // http://api.yunohost.org/#!/domain/domain_list_get_2
+ c.api('GET', '/users/'+ c.params['user'], {}, function(data) {
+ c.api('GET', '/domains', {}, function(dataDomains) {
// Password min length
data.password_min_length = PASSWORD_MIN_LENGTH;
@@ -124,7 +124,7 @@
// Update user information
app.put('#/users/:user', function (c) {
// Get full user object
- c.api('/users/'+ c.params['user'], function(user) {
+ c.api('GET', '/users/'+ c.params['user'], {}, function(user) {
// Force unit or disable quota
if (c.params['mailbox_quota']) {
c.params['mailbox_quota'] += "M";
@@ -175,9 +175,9 @@
}
else {
params['change_password'] = params['password'];
- c.api('/users/'+ c.params['user'], function(data) { // http://api.yunohost.org/#!/user/user_update_put_1
+ c.api('PUT', '/users/'+ c.params['user'], params, function(data) {
c.redirect('#/users/'+ c.params['user']);
- }, 'PUT', params);
+ });
}
} else {
c.flash('fail', y18n.t('passwords_dont_match'));
@@ -186,9 +186,9 @@
}
}
else {
- c.api('/users/'+ c.params['user'], function(data) { // http://api.yunohost.org/#!/user/user_update_put_1
+ c.api('PUT', '/users/'+ c.params['user'], params, function(data) {
c.redirect('#/users/'+ c.params['user']);
- }, 'PUT', params);
+ });
}
}
}, 'GET');
@@ -209,9 +209,9 @@
y18n.t('users'),
confirmModalContent,
function(){
- c.api('/users/'+ c.params['user'], function(data) { // http://api.yunohost.org/#!/user/user_delete_delete_4
+ c.api('DELETE', '/users/'+ c.params['user'], params, function(data) {
c.redirect('#/users');
- }, 'DELETE', params);
+ });
},
function(){
store.clear('slide');
diff --git a/src/js/yunohost/events.js b/src/js/yunohost/events.js
index 8b9abb4c..28e121db 100644
--- a/src/js/yunohost/events.js
+++ b/src/js/yunohost/events.js
@@ -8,7 +8,7 @@
*
*/
app.bind('login', function(e, data) {
- c.api('/users', function(data) {
+ c.api('GET', '/users', {}, function(data) {
// Warn admin if no users are created.
if (typeof data.users !== 'undefined' && data.users.length === 0) {
c.flash('warning', y18n.t('warning_first_user'));
@@ -69,7 +69,7 @@
c.flash('fail', y18n.t('error_retrieve_feed', [securityFeed]));
});
- c.api("/diagnosis", function(data) {
+ c.api("GET", "/diagnosis", {}, function(data) {
versions = data.packages;
$('#yunohost-version').html(y18n.t('footer_version', [versions.yunohost.version, versions.yunohost.repo]));
if (data.security["CVE-2017-5754"].vulnerable) {
diff --git a/src/js/yunohost/filters.js b/src/js/yunohost/filters.js
index 0b793580..c35a9450 100644
--- a/src/js/yunohost/filters.js
+++ b/src/js/yunohost/filters.js
@@ -12,7 +12,7 @@
function prefetchDomains(req) {
// Preload domains list.
req.params.domains = [];
- req.api('/domains', function(data) {
+ req.api('GET', '/domains', {}, function(data) {
req.params.domains = data.domains;
});
}
@@ -20,7 +20,7 @@
function prefetchUsers(req){
// Preload users lists.
req.params.users = [];
- req.api('/users', function(data) {
+ req.api('GET', '/users', {}, function(data) {
req.params.users = data.users;
});
}
diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js
index 30fae9e2..13e1eb4a 100644
--- a/src/js/yunohost/helpers.js
+++ b/src/js/yunohost/helpers.js
@@ -85,7 +85,7 @@
},
// API call
- api: function(uri, callback, method, data, websocket, callbackOnFailure) {
+ api: function(method, uri, data, callback, callbackOnFailure, websocket) {
c = this;
method = typeof method !== 'undefined' ? method : 'GET';
diff --git a/src/js/yunohost/main.js b/src/js/yunohost/main.js
index ea00fe6c..e33bbf7e 100644
--- a/src/js/yunohost/main.js
+++ b/src/js/yunohost/main.js
@@ -150,7 +150,7 @@
sam.store.set('url', window.location.hostname + '/yunohost/api');
if (sam.store.get('connected')) {
- this.api('/diagnosis', function(diagnosis) {
+ this.api('GET', '/diagnosis', {}, function(diagnosis) {
versions = diagnosis.packages;
$('#yunohost-version').html(y18n.t('footer_version', [versions.yunohost.version, versions.yunohost.repo]));
});
diff --git a/src/views/tools/tools_log.ms b/src/views/tools/tools_log.ms
index f701b755..c37aea1f 100644
--- a/src/views/tools/tools_log.ms
+++ b/src/views/tools/tools_log.ms
@@ -10,7 +10,7 @@
From e2dcb1765f582201962408562e69ebd370c47972 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Mon, 14 Oct 2019 02:12:39 +0200
Subject: [PATCH 03/46] Fix sliders bugs...
---
src/css/style.less | 7 +++
src/js/yunohost/helpers.js | 89 ++++++++++++++++++++++++++++++++++++++
2 files changed, 96 insertions(+)
diff --git a/src/css/style.less b/src/css/style.less
index 5bc11ee1..3450a7c5 100644
--- a/src/css/style.less
+++ b/src/css/style.less
@@ -826,3 +826,10 @@ input[type='radio'].nice-radio {
float: none !important;
}
}
+
+.notransition {
+ -webkit-transition: none !important;
+ -moz-transition: none !important;
+ -o-transition: none !important;
+ transition: none !important;
+}
diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js
index 13e1eb4a..a4350a3b 100644
--- a/src/js/yunohost/helpers.js
+++ b/src/js/yunohost/helpers.js
@@ -3,6 +3,46 @@
var app = Sammy.apps['#main'];
var store = app.store;
+ // The logic used to temporily disable transition is from
+ // https://stackoverflow.com/a/16575811
+ function whichTransitionEvent(){
+ var t;
+ var el = document.createElement('fakeelement');
+ var transitions = {
+ 'transition':'transitionend',
+ 'OTransition':'oTransitionEnd',
+ 'MozTransition':'transitionend',
+ 'WebkitTransition':'webkitTransitionEnd'
+ }
+
+ for(t in transitions){
+ if( el.style[t] !== undefined ){
+ return transitions[t];
+ }
+ }
+ };
+ var transitionEvent = whichTransitionEvent();
+
+ function resetSliders()
+ {
+ // Disable transition effects
+ $('#slider-container').addClass('notransition');
+ // Delete the left/right temporary stuff only used during animation
+ $('#slideTo').css('display', 'none');
+ $('#slideBack').css('display', 'none');
+ // Set the margin-left back to 0
+ $('#slider-container').css('margin-left', '0');
+ // c.f. the stackoverflow thread
+ $('#slider-container')[0].offsetHeight;
+ // Remove the binding to this event handler for next times
+ //$("#slider-container").off(transitionEvent);
+ // Re-enable transition effects
+ $('#slider-container').removeClass('notransition');
+ }
+ // Now we add the transition event to detect the end of the transition effect
+ transitionEvent && $("#slider-container").on(transitionEvent, resetSliders)
+
+
/**
* Helpers
*
@@ -282,20 +322,69 @@
// Slide back effect
if (enableSlide && store.get('slide') == 'back') {
+
store.clear('slide');
+ // Disable transition while we tweak CSS
+ $('#slider-container').addClass('notransition');
+ // "Delete" the left part of the slider
$('#slideBack').css('display', 'none');
+
+ // Push the slider to the left
$('#slider-container').css('margin-left', '-100%');
+ // slideTo is the right part, and should contain the old view,
+ // so we copypasta what's in the "center" slider (#main)
$('#slideTo').show().html($('#main').html());
+ // leSwap will put the new view in the "center" slider (#main)
leSwap();
+
+ // So now things look like:
+ // | |
+ // | the screen |
+ // | |
+ //
+ // . #main . #slideTo .
+ // . the new view . the old view .
+ // ^ ^
+ // margin-left: -100% currently shown
+ //
+ // =====>>> sliiiiide =====>>>
+
+ // Re-add transition effect
+ $('#slider-container').removeClass('notransition');
+ // And actually play the transition effect that will move the container from left to right
$('#slider-container').css('margin-left', '0px');
}
// Slide to effect
else if (enableSlide && store.get('slide') == 'to') {
store.clear('slide');
+ // Disable transition while we tweak CSS
+ $('#slider-container').addClass('notransition');
+ // "Delete" the right part of the slider
$('#slideTo').css('display', 'none');
+ // Push the slider to the right
$('#slider-container').css('margin-left', '0px');
+ // slideBack should contain the old view,
+ // so we copypasta what's in the "center" slider (#main)
$('#slideBack').show().html($('#main').html());
leSwap();
+
+ // So now things look like:
+ //
+ // | |
+ // | the screen |
+ // | |
+ //
+ // . . #slideBack . #main .
+ // . . the old view . the new view .
+ // ^ ^ ^
+ // margin-left: -100% currently shown
+ //
+ // <<<===== sliiiiide <<<=======
+
+
+ // Re-add transition effect
+ $('#slider-container').removeClass('notransition');
+ // And actually play the transition effect that will move the container from right to left
$('#slider-container').css('margin-left', '-100%');
}
// No slideing effect
From 46c5e1c4ad3acf0a37593179d314ebcc12da1555 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Mon, 14 Oct 2019 03:40:55 +0200
Subject: [PATCH 04/46] Try to clean up the whole weird store.clear('slide')
mess, make it more semantic
---
src/js/yunohost/controllers/apps.js | 68 ++++++++--------------
src/js/yunohost/controllers/backup.js | 25 +++-----
src/js/yunohost/controllers/domains.js | 52 ++++++-----------
src/js/yunohost/controllers/firewall.js | 24 +++-----
src/js/yunohost/controllers/postinstall.js | 11 ++--
src/js/yunohost/controllers/services.js | 13 ++---
src/js/yunohost/controllers/tools.js | 59 +++++++------------
src/js/yunohost/controllers/users.js | 23 +++-----
src/js/yunohost/helpers.js | 23 ++++++++
9 files changed, 121 insertions(+), 177 deletions(-)
diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js
index c1874982..312dddc3 100644
--- a/src/js/yunohost/controllers/apps.js
+++ b/src/js/yunohost/controllers/apps.js
@@ -245,7 +245,7 @@
});
});
- // Perform application
+ // Perform app action
app.put('#/apps/:app/actions/:action', function(c) {
// taken from app install
$.each(c.params, function(k, v) {
@@ -265,7 +265,7 @@
}
c.api('PUT', '/apps/'+app_id+'/actions/'+action_id, params, function() {
- c.redirect('#/apps/'+app_id+'/actions');
+ c.redirect_to('#/apps/'+app_id+'/actions', {slide:false});
});
});
@@ -298,7 +298,7 @@
}
c.api('POST', '/apps/'+app_id+'/config', params, function() {
- c.redirect('#/apps/'+app_id+'/config-panel');
+ c.redirect_to('#/apps/'+app_id+'/config-panel', {slide:false});
});
})
@@ -306,7 +306,7 @@
app.get('#/apps/install/custom', function (c) {
// If we try to GET /apps/install/custom, it means that installation fail.
// Need to redirect to apps/install to get rid of pacamn and see the log.
- c.redirect('#/apps/install');
+ c.redirect_to('#/apps/install');
});
// Helper function that formats YunoHost style arguments for generating a form
@@ -502,7 +502,7 @@
},
function(){
$('div.loader').remove();
- c.redirect('#/apps/install');
+ c.redirect_to('#/apps/install', {slide:false});
}
);
}
@@ -544,13 +544,12 @@
}
c.api('POST', '/apps', params, function() {
- c.redirect('#/apps');
+ c.redirect_to('#/apps');
});
}
else {
c.flash('warning', y18n.t('app_install_cancel'));
- store.clear('slide');
- c.redirect('#/apps/install');
+ c.redirect_to('#/apps/install', {slide: false});
}
});
@@ -590,14 +589,12 @@
})
.fail(function(xhr) {
c.flash('fail', y18n.t('app_install_custom_no_manifest'));
- store.clear('slide');
- c.redirect('#/apps/install');
+ c.redirect_to('#/apps/install', {slide:false});
});
},
function(){
c.flash('warning', y18n.t('app_install_cancel'));
- store.clear('slide');
- c.redirect('#/apps/install');
+ c.redirect_to('#/apps/install');
}
);
});
@@ -609,12 +606,11 @@
y18n.t('confirm_uninstall', [c.params['app']]),
function() {
c.api('DELETE', '/apps/'+ c.params['app'], {}, function() { // http://api.yunohost.org/#!/app/app_remove_delete_4
- c.redirect('#/apps');
+ c.redirect_to('#/apps');
});
},
function() {
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app']);
+ c.redirect_to('#/apps/'+ c.params['app'], {slide:false});
}
);
});
@@ -675,13 +671,11 @@
users: []
};
c.api('DELETE', '/access?'+c.serialize(params), params, function(data) {
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app']+ '/access');
+ c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false});
});
},
function() {
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app']+ '/access');
+ c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false});
}
);
});
@@ -697,13 +691,11 @@
users: c.params['user']
};
c.api('DELETE', '/access?'+c.serialize(params), params, function(data) {
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app']+ '/access');
+ c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false});
});
},
function() {
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app']+ '/access');
+ c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false});
}
);
});
@@ -719,13 +711,11 @@
users: null
};
c.api('PUT', '/access', params, function() {
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app'] +'/access');
+ c.redirect_to('#/apps/'+ c.params['app'] +'/access', {slide:false});
});
},
function() {
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app']+ '/access');
+ c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false});
}
);
});
@@ -737,8 +727,7 @@
apps: c.params['app']
};
c.api('PUT', '/access', params, function() {
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app'] +'/access');
+ c.redirect_to('#/apps/'+ c.params['app'] +'/access', {slide:false});
});
});
@@ -752,13 +741,11 @@
apps: c.params['app']
};
c.api('POST', '/access', params, function() {
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app'] +'/access');
+ c.redirect_to('#/apps/'+ c.params['app'] +'/access', {slide:false});
});
},
function() {
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app']+ '/access');
+ c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false});
}
);
});
@@ -770,13 +757,11 @@
y18n.t('confirm_app_default'),
function() {
c.api('PUT', '/apps/'+c.params['app']+'/default', {}, function() {
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app']);
+ c.redirect_to('#/apps/'+ c.params['app'], {slide:false});
});
},
function() {
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app']);
+ c.redirect_to('#/apps/'+ c.params['app'], {slide:false});
}
);
});
@@ -796,8 +781,7 @@
app.post('#/apps/:app/changelabel', function (c) {
params = {'new_label': c.params['label']};
c.api('PUT', '/apps/' + c.params['app'] + '/label', params, function(data) { // Call changelabel API
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app']);
+ c.redirect_to('#/apps/'+ c.params['app']);
});
});
@@ -837,13 +821,11 @@
function() {
params = {'domain': c.params['domain'], 'path': c.params['path']};
c.api('PUT', '/apps/' + c.params['app'] + '/changeurl', params, function(data) { // Call changeurl API
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app']);
+ c.redirect_to('#/apps/'+ c.params['app']);
});
},
function() {
- store.clear('slide');
- c.redirect('#/apps/'+ c.params['app'] + '/changeurl');
+ c.redirect_to('#/apps/'+ c.params['app'] + '/changeurl', {slide:false});
}
);
});
diff --git a/src/js/yunohost/controllers/backup.js b/src/js/yunohost/controllers/backup.js
index 3fdc2f91..197960ed 100644
--- a/src/js/yunohost/controllers/backup.js
+++ b/src/js/yunohost/controllers/backup.js
@@ -39,8 +39,7 @@
// Create a storage
app.post('#/storages', function (c) {
- store.clear('slide');
- c.redirect('#/storages');
+ c.redirect_to('#/storages');
});
// Create a backup
@@ -64,8 +63,7 @@
app.post('#/backup/:storage', function (c) {
var params = c.ungroupHooks(c.params['system_parts'],c.params['apps']);
c.api('POST', '/backup', params, function() {
- store.clear('slide');
- c.redirect('#/backup/'+ c.params['storage']);
+ c.redirect_to('#/backup/'+ c.params['storage']);
});
});
@@ -78,13 +76,11 @@
var params = c.ungroupHooks(c.params['system_parts'],c.params['apps']);
params['force'] = '';
c.api('POST', '/backup/restore/'+c.params['archive'], params, function(data) {
- store.clear('slide');
- c.redirect('#/backup/'+ c.params['storage']+'/'+c.params['archive']);
+ c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive']);
});
}, this, c),
function(){
- store.clear('slide');
- c.redirect('#/backup/'+ c.params['storage']+'/'+c.params['archive']);
+ c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false});
}
);
});
@@ -96,12 +92,11 @@
y18n.t('confirm_delete', [c.params['archive']]),
function(){
c.api('DELETE', '/backup/archives/'+c.params['archive'], {}, function(data) {
- c.redirect('#/backup/'+ c.params['storage']);
+ c.redirect_to('#/backup/'+ c.params['storage']);
});
},
function(){
- store.clear('slide');
- c.redirect('#/backup/'+ c.params['storage']+'/'+c.params['archive']);
+ c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false});
}
);
});
@@ -109,20 +104,18 @@
// Download a backup
app.get('#/backup/:storage/:archive/download', function (c) {
c.api('GET', '/backup/'+c.params['archive']+'/download', {}, function(data) {
- c.redirect('#/backup/'+ c.params['storage']+'/'+c.params['archive']);
+ c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false});
});
});
// Copy a backup
app.get('#/backup/:storage/:archive/copy', function (c) {
- store.clear('slide');
- c.redirect('#/backup/'+ c.params['storage']+'/'+c.params['archive']);
+ c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false});
});
// Upload a backup
app.get('#/backup/:storage/:archive/upload', function (c) {
- store.clear('slide');
- c.redirect('#/backup/'+ c.params['storage']+'/'+c.params['archive']);
+ c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false});
});
// Get archive info
diff --git a/src/js/yunohost/controllers/domains.js b/src/js/yunohost/controllers/domains.js
index 995a5e61..488f170d 100644
--- a/src/js/yunohost/controllers/domains.js
+++ b/src/js/yunohost/controllers/domains.js
@@ -68,8 +68,7 @@
if (c.params['domain'] === '') {
if (c.params['ddomain'] === '') {
c.flash('fail', y18n.t('error_select_domain'));
- store.clear('slide');
- c.redirect('#/domains/add');
+ c.redirect_to('#/domains/add');
}
params.domain = c.params['ddomain'] + c.params['ddomain-ext'];
endurl = 'dyndns';
@@ -78,7 +77,7 @@
}
c.api('POST', '/domains?'+endurl, params, function(data) {
- c.redirect('#/domains');
+ c.redirect_to('#/domains');
});
});
@@ -210,13 +209,11 @@
y18n.t('confirm_cert_install_LE', [c.params['domain']]),
function(){
c.api('POST', '/domains/cert-install/' + c.params['domain'], {}, function(data) {
- store.clear('slide');
- c.redirect('#/domains/'+c.params['domain']+'/cert-management');
+ c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
});
},
function(){
- store.clear('slide');
- c.redirect('#/domains/'+c.params['domain']+'/cert-management');
+ c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
}
);
});
@@ -228,13 +225,11 @@
y18n.t('confirm_cert_regen_selfsigned', [c.params['domain']]),
function(){
c.api('POST', '/domains/cert-install/' + c.params['domain'] + "?self_signed", {}, function(data) {
- store.clear('slide');
- c.redirect('#/domains/'+c.params['domain']+'/cert-management');
+ c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
});
},
function(){
- store.clear('slide');
- c.redirect('#/domains/'+c.params['domain']+'/cert-management');
+ c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
}
);
});
@@ -246,13 +241,11 @@
y18n.t('confirm_cert_manual_renew_LE', [c.params['domain']]),
function(){
c.api('POST', '/domains/cert-renew/' + c.params['domain'] + "?force", {}, function(data) {
- store.clear('slide');
- c.redirect('#/domains/'+c.params['domain']+'/cert-management');
+ c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
});
},
function(){
- store.clear('slide');
- c.redirect('#/domains/'+c.params['domain']+'/cert-management');
+ c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
}
);
});
@@ -264,13 +257,11 @@
y18n.t('confirm_cert_revert_to_selfsigned', [c.params['domain']]),
function(){
c.api('POST', '/domains/cert-install/' + c.params['domain'] + "?self_signed&force", {}, function(data) {
- store.clear('slide');
- c.redirect('#/domains/'+c.params['domain']+'/cert-management');
+ c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
});
},
function(){
- store.clear('slide');
- c.redirect('#/domains/'+c.params['domain']+'/cert-management');
+ c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
}
);
});
@@ -283,23 +274,19 @@
y18n.t('confirm_delete', [c.params['domain']]),
function(){
c.api('DELETE', '/domains/'+ c.params['domain'], {}, function(data) {
- store.clear('slide');
- c.redirect('#/domains');
+ c.redirect_to('#/domains');
});
},
function(){
- store.clear('slide');
- c.redirect('#/domains');
- }
- );
+ c.redirect_to('#/domains/' + c.params["domain"], {slide:false});
+ })
});
// Set default domain
app.post('#/domains', function (c) {
if (c.params['domain'] === '') {
c.flash('fail', y18n.t('error_select_domain'));
- store.clear('slide');
- c.redirect('#/domains');
+ c.redirect_to('#/domains', {slide:false});
} else {
c.confirm(
y18n.t('domains'),
@@ -309,19 +296,18 @@
new_domain: c.params['domain']
};
c.api('PUT', '/domains/main', params, function(data) {
- store.clear('slide');
- c.redirect('#/domains');
+ c.redirect_to('#/domains');
});
+ // WTF ... why is this hack needed v_v
+
// Wait 15s and refresh the page
var refreshDomain = window.setTimeout(function(){
- store.clear('slide');
- c.redirect('#/domains');
+ c.redirect_to('#/domains');
}, 15000);
},
function(){
- store.clear('slide');
- c.redirect('#/domains');
+ c.redirect_to('#/domains', {slide:false});
}
);
}
diff --git a/src/js/yunohost/controllers/firewall.js b/src/js/yunohost/controllers/firewall.js
index 5da5bdfd..6550fb41 100644
--- a/src/js/yunohost/controllers/firewall.js
+++ b/src/js/yunohost/controllers/firewall.js
@@ -45,13 +45,11 @@
action : c.params['action']
};
c.api('GET', '/firewall/upnp', params, function(data) {
- store.clear('slide');
- c.redirect('#/tools/firewall');
+ c.redirect_to('#/tools/firewall');
});
},
function(){
- store.clear('slide');
- c.redirect('#/tools/firewall');
+ c.redirect_to('#/tools/firewall', {slide: false});
}
);
});
@@ -65,8 +63,7 @@
if (port != parseInt(port) || port < 0 || port > 65535) {
c.flash('fail', y18n.t('unknown_argument', [port]));
- store.clear('slide');
- c.redirect('#/tools/firewall');
+ c.redirect_to('#/tools/firewall', {slide: false});
}
switch (connection) {
@@ -98,8 +95,7 @@
break;
default:
c.flash('fail', y18n.t('unknown_action', [action]));
- store.clear('slide');
- c.redirect('#/tools/firewall');
+ c.redirect_to('#/tools/firewall', {slide: false});
}
if (method !== null && protocol !== null && port !== null) {
@@ -116,13 +112,11 @@
protocol : protocol
};
c.api(method, '/firewall/port?'+endurl, params, function(data) {
- store.clear('slide');
- c.redirect('#/tools/firewall');
+ c.redirect_to('#/tools/firewall');
});
}
else {
- store.clear('slide');
- c.redirect('#/tools/firewall');
+ c.redirect_to('#/tools/firewall');
}
return;
});
@@ -143,8 +137,7 @@
);
},
function(){
- store.clear('slide');
- c.redirect('#/tools/firewall');
+ c.redirect_to('#/tools/firewall', {slide: false});
}
);
});
@@ -163,8 +156,7 @@
);
},
function(){
- store.clear('slide');
- c.redirect('#/tools/firewall');
+ c.redirect_to('#/tools/firewall', {slide: false});
}
);
});
diff --git a/src/js/yunohost/controllers/postinstall.js b/src/js/yunohost/controllers/postinstall.js
index 6880cc87..a255154d 100644
--- a/src/js/yunohost/controllers/postinstall.js
+++ b/src/js/yunohost/controllers/postinstall.js
@@ -13,7 +13,7 @@
$('#masthead').hide();
c.checkInstall(function(isInstalled) {
if (isInstalled || typeof isInstalled === 'undefined') {
- c.redirect('#/login');
+ c.redirect_to('#/login');
} else {
c.view('postinstall/postinstall_1');
}
@@ -41,7 +41,6 @@
if ($('#domain').val() === '') {
if ($('#ddomain').val() === '') {
e.preventDefault();
- store.clear('slide');
c.flash('fail', y18n.t('error_select_domain'));
} else {
domain = $('#ddomain').val() + $('select[name="ddomain-ext"]').val();
@@ -59,8 +58,7 @@
app.get('#/postinstall/password', function(c) {
$('#masthead').hide();
if (!store.get('maindomain')) {
- store.clear('slide');
- c.redirect('#/postinstall/domain');
+ c.redirect_to('#/postinstall/domain');
} else {
c.view('postinstall/postinstall_3', { 'domain': store.get('maindomain').toLowerCase() },
function() { },
@@ -76,8 +74,7 @@
else if (c.params['password'] == c.params['confirmation']) {
if (c.params['domain'] === '') {
c.flash('fail', y18n.t('error_select_domain'));
- store.clear('slide');
- c.redirect('#/postinstall/domain');
+ c.redirect_to('#/postinstall/domain', {slide: false});
} else {
var params = {
domain: c.params['domain'].toLowerCase()
@@ -93,7 +90,7 @@
store.set('url', window.location.hostname +'/yunohost/api');
store.set('user', 'admin');
c.api('POST', '/postinstall', params, function(data) {
- c.redirect('#/login');
+ c.redirect_to('#/login');
});
},
function(){
diff --git a/src/js/yunohost/controllers/services.js b/src/js/yunohost/controllers/services.js
index 71b97e55..a7b252a9 100644
--- a/src/js/yunohost/controllers/services.js
+++ b/src/js/yunohost/controllers/services.js
@@ -64,7 +64,6 @@
{
data2.service.active_at = 0;
}
- store.clear('slide');
c.view('service/service_info', data2);
});
});
@@ -111,24 +110,20 @@
break;
default:
c.flash('fail', y18n.t('unknown_action', [c.params['action']]));
- store.clear('slide');
- c.redirect('#/services/'+ c.params['service']);
+ c.redirect_to('#/services/'+ c.params['service'], {slide: false});
}
if (method && endurl) {
c.api(method, '/services/'+ endurl, {}, function(data) {
- store.clear('slide');
- c.redirect('#/services/'+ c.params['service']);
+ c.redirect_to('#/services/'+ c.params['service'], {slide: false});
});
}
else {
- store.clear('slide');
- c.redirect('#/services/'+ c.params['service']);
+ c.redirect_to('#/services/'+ c.params['service'], {slide: false});
}
},
function(){
- store.clear('slide');
- c.redirect('#/services/'+ c.params['service']);
+ c.redirect_to('#/services/'+ c.params['service'], {slide: false});
}
);
});
diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js
index 2b0d5220..bf563adc 100644
--- a/src/js/yunohost/controllers/tools.js
+++ b/src/js/yunohost/controllers/tools.js
@@ -26,12 +26,10 @@
});
if ($.isEmptyObject(params)) {
c.flash('fail', y18n.t('error_modify_something'));
- store.clear('slide');
- c.redirect('#/tools/adminpw');
+ c.redirect_to('#/tools/adminpw', {slide: false});
} else if (params['new_password'] !== params['confirm_new_password']) {
c.flash('fail', y18n.t('passwords_dont_match'));
- store.clear('slide');
- c.redirect('#/tools/adminpw');
+ c.redirect_to('#/tools/adminpw', {slide: false});
} else {
c.api('POST', '/login', { 'password': params['old_password'] }, function(data) {
// Remove useless variable
@@ -40,7 +38,7 @@
// Update password and redirect to the home
c.api('PUT', '/adminpw', params, function(data) {
- c.redirect('#/logout');
+ c.redirect_to('#/logout');
});
}, undefined, false);
}
@@ -61,13 +59,11 @@
y18n.t('confirm_update_' + c.params['type'].toLowerCase()),
function(){
c.api('PUT', '/upgrade?'+c.params["type"], {}, function(data) {
- store.clear('slide');
- c.redirect('#/tools/logs');
+ c.redirect_to('#/tools/logs');
});
},
function(){
- store.clear('slide');
- c.redirect('#/update');
+ c.redirect_to('#/update', {slide: false});
}
);
});
@@ -79,13 +75,11 @@
y18n.t('confirm_update_specific_app', [c.params['app']]),
function(){
c.api('PUT', '/upgrade/apps?app='+c.params['app'].toLowerCase(), {}, function(data) {
- store.clear('slide');
- c.redirect('#/tools/logs');
+ c.redirect_to('#/tools/logs');
});
},
function(){
- store.clear('slide');
- c.redirect('#/update');
+ c.redirect_to('#/update', {slide: false});
}
);
});
@@ -220,7 +214,7 @@
function(){
c.api('PUT', '/'+action+'?force', {}, function(data) {
// This code is not executed due to 502 response (reboot or shutdown)
- c.redirect('#/logout');
+ c.redirect_to('#/logout');
}, function (xhr) {
c.flash('success', y18n.t('tools_' + action + '_done'))
// Disconnect from the webadmin
@@ -244,20 +238,17 @@
// Force scrollTop on page load
$('html, body').scrollTop(0);
- store.clear('slide');
}, false);
},
function(){
- store.clear('slide');
- c.redirect('#/tools/reboot');
+ c.redirect_to('#/tools/reboot', {slide: false});
}
);
}
else {
c.flash('fail', y18n.t('unknown_action', [action]));
- store.clear('slide');
- c.redirect('#/tools/reboot');
+ c.redirect_to('#/tools/reboot', {slide: false});
}
});
@@ -313,7 +304,7 @@
{
// FIXME / TODO i18n
c.flash('fail', "Some of these migrations require you to acknowledge a disclaimer before running them.");
- c.redirect('#/tools/migrations');
+ c.redirect_to('#/tools/migrations', {slide: false});
return;
}
else
@@ -328,15 +319,13 @@
if (withAcceptDisclaimerFlag)
{
c.api('POST', '/migrations/migrate?accept_disclaimer', {}, function (data) {
- store.clear('slide');
- c.redirect('#/tools/migrations');
+ c.redirect_to('#/tools/migrations', {slide: false});
})
}
else
{
c.api('POST', '/migrations/migrate', {}, function (data) {
- store.clear('slide');
- c.redirect('#/tools/migrations');
+ c.redirect_to('#/tools/migrations', {slide: false});
})
}
});
@@ -347,13 +336,11 @@
y18n.t('confirm_migrations_skip'),
function(){
c.api('POST', '/migrations/migrate?skip&targets=' + c.params['migration_id'], {}, function(data) {
- store.clear('slide');
- c.redirect('#/tools/migrations');
+ c.redirect_to('#/tools/migrations', {slide: false});
});
},
function(){
- store.clear('slide');
- c.redirect('#/tools/migrations');
+ c.redirect_to('#/tools/migrations', {slide: false});
}
);
});
@@ -384,8 +371,7 @@
}
c.api('PUT', '/appslists', list, function(data) {
- store.clear('slide');
- c.redirect('#/tools/appslists/' + list.name);
+ c.redirect_to('#/tools/appslists/' + list.name);
});
});
@@ -403,8 +389,7 @@
}
else {
c.flash('warning', y18n.t('appslists_unknown_list', [c.params['appslist']]));
- store.clear('slide');
- c.redirect('#/tools/appslists');
+ c.redirect_to('#/tools/appslists', {slide: false});
}
});
});
@@ -412,15 +397,14 @@
// Refresh available apps list
app.get('#/tools/appslists/refresh', function (c) {
c.api('PUT', '/appslists', {}, function(data) {
- // c.redirect(store.get('path'));
- c.redirect('#/apps/install');
+ c.redirect_to('#/apps/install', {slide: false});
});
});
// Refresh specific apps list
app.get('#/tools/appslists/:appslist/refresh', function (c) {
c.api('PUT', '/appslists', {'name' : c.params['appslist']}, function(data) {
- c.redirect('#/tools/appslists');
+ c.redirect_to('#/tools/appslists', {slide: false});
});
});
@@ -431,12 +415,11 @@
y18n.t('appslists_confirm_remove', [c.params['app']]),
function() {
c.api('DELETE', '/appslists', {'name' : c.params['appslist']}, function() {
- c.redirect('#/tools/appslists');
+ c.redirect_to('#/tools/appslists');
});
},
function() {
- store.clear('slide');
- c.redirect('#/tools/appslists/'+ c.params['appslist']);
+ c.redirect_to('#/tools/appslists/'+ c.params['appslist'], {slide: false});
}
);
});
diff --git a/src/js/yunohost/controllers/users.js b/src/js/yunohost/controllers/users.js
index 96a8bc75..61a59fd1 100644
--- a/src/js/yunohost/controllers/users.js
+++ b/src/js/yunohost/controllers/users.js
@@ -40,7 +40,6 @@
if (c.params['password'] == c.params['confirmation']) {
if (c.params['password'].length < PASSWORD_MIN_LENGTH) {
c.flash('fail', y18n.t('password_too_short'));
- store.clear('slide');
}
else {
// Force unit or disable quota
@@ -53,13 +52,11 @@
c.params['mail'] = c.params['email'] + c.params['domain'];
c.api('POST', '/users', c.params.toHash(), function(data) {
- c.redirect('#/users');
+ c.redirect_to('#/users');
});
}
} else {
c.flash('fail', y18n.t('passwords_dont_match'));
- store.clear('slide');
- //c.redirect('#/users/create');
}
});
@@ -163,31 +160,28 @@
if ($.isEmptyObject(params)) {
c.flash('fail', y18n.t('error_modify_something'));
- store.clear('slide');
- c.redirect('#/users/'+ c.params['user'] + '/edit');
+ c.redirect_to('#/users/'+ c.params['user'] + '/edit', {slide: false});
} else {
if (params['password']) {
if (params['password'] == params['confirmation']) {
if (params['password'].length < PASSWORD_MIN_LENGTH) {
c.flash('fail', y18n.t('password_too_short'));
- store.clear('slide');
- c.redirect('#/users/'+ c.params['user'] + '/edit');
+ c.redirect_to('#/users/'+ c.params['user'] + '/edit', {slide: false});
}
else {
params['change_password'] = params['password'];
c.api('PUT', '/users/'+ c.params['user'], params, function(data) {
- c.redirect('#/users/'+ c.params['user']);
+ c.redirect_to('#/users/'+ c.params['user']);
});
}
} else {
c.flash('fail', y18n.t('passwords_dont_match'));
- store.clear('slide');
- c.redirect('#/users/'+ c.params['user'] + '/edit');
+ c.redirect_to('#/users/'+ c.params['user'] + '/edit', {slide: false});
}
}
else {
c.api('PUT', '/users/'+ c.params['user'], params, function(data) {
- c.redirect('#/users/'+ c.params['user']);
+ c.redirect_to('#/users/'+ c.params['user']);
});
}
}
@@ -210,12 +204,11 @@
confirmModalContent,
function(){
c.api('DELETE', '/users/'+ c.params['user'], params, function(data) {
- c.redirect('#/users');
+ c.redirect_to('#/users');
});
},
function(){
- store.clear('slide');
- c.redirect('#/users/'+ c.params['user']);
+ c.redirect_to('#/users/'+ c.params['user'], {slide: false});
}
);
diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js
index a4350a3b..e45d34ce 100644
--- a/src/js/yunohost/helpers.js
+++ b/src/js/yunohost/helpers.js
@@ -565,6 +565,29 @@
$('div.loader').remove();
});
});
+ },
+
+ redirect_to: function(destination, options) {
+
+ options = options !== undefined ? options : {};
+
+ // If destination if the same as current url,
+ // we don't want to display the slide animation
+ // (or if the code explicitly state to disable slide animation)
+ if ((c.path.split("#")[1] == destination.split("#")[1]) || (options.slide == false))
+ {
+ store.clear('slide');
+ }
+
+ c = this;
+ // This is a copy-pasta of some of the redirect/refresh code of
+ // sammy.js because for some reason calling the original
+ // redirect/refresh function in some context does not work >.>
+ // (e.g. if you're already on the page)
+ c.trigger('redirect', {to: destination});
+ c.app.last_location = c.path;
+ c.app.setLocation(destination);
+ c.app.trigger('location-changed');
}
});
From b58ea7a34c3a1aadd531ba1570c8cc4c77046ac2 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Mon, 14 Oct 2019 04:04:24 +0200
Subject: [PATCH 05/46] We don't need all those cancel callbacks, just staying
on the page where we are is fine...
---
src/js/yunohost/controllers/apps.js | 31 ++--------------------
src/js/yunohost/controllers/backup.js | 8 +-----
src/js/yunohost/controllers/domains.js | 21 ++-------------
src/js/yunohost/controllers/firewall.js | 9 -------
src/js/yunohost/controllers/postinstall.js | 2 --
src/js/yunohost/controllers/services.js | 3 ---
src/js/yunohost/controllers/tools.js | 16 -----------
src/js/yunohost/controllers/users.js | 3 ---
8 files changed, 5 insertions(+), 88 deletions(-)
diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js
index 312dddc3..28b2c08a 100644
--- a/src/js/yunohost/controllers/apps.js
+++ b/src/js/yunohost/controllers/apps.js
@@ -490,6 +490,8 @@
if ((is_safe_for_install_color === "warning") || (is_safe_for_install_color === "danger"))
{
+ // Disable the pacman while we ask for confirmation
+ $('div.loader').remove();
c.confirm(
y18n.t("applications"),
y18n.t("confirm_install_app_"+is_safe_for_install_color),
@@ -499,10 +501,6 @@
app_infos.manifest,
c.params
);
- },
- function(){
- $('div.loader').remove();
- c.redirect_to('#/apps/install', {slide:false});
}
);
}
@@ -591,10 +589,6 @@
c.flash('fail', y18n.t('app_install_custom_no_manifest'));
c.redirect_to('#/apps/install', {slide:false});
});
- },
- function(){
- c.flash('warning', y18n.t('app_install_cancel'));
- c.redirect_to('#/apps/install');
}
);
});
@@ -608,9 +602,6 @@
c.api('DELETE', '/apps/'+ c.params['app'], {}, function() { // http://api.yunohost.org/#!/app/app_remove_delete_4
c.redirect_to('#/apps');
});
- },
- function() {
- c.redirect_to('#/apps/'+ c.params['app'], {slide:false});
}
);
});
@@ -673,9 +664,6 @@
c.api('DELETE', '/access?'+c.serialize(params), params, function(data) {
c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false});
});
- },
- function() {
- c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false});
}
);
});
@@ -693,9 +681,6 @@
c.api('DELETE', '/access?'+c.serialize(params), params, function(data) {
c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false});
});
- },
- function() {
- c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false});
}
);
});
@@ -713,9 +698,6 @@
c.api('PUT', '/access', params, function() {
c.redirect_to('#/apps/'+ c.params['app'] +'/access', {slide:false});
});
- },
- function() {
- c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false});
}
);
});
@@ -743,9 +725,6 @@
c.api('POST', '/access', params, function() {
c.redirect_to('#/apps/'+ c.params['app'] +'/access', {slide:false});
});
- },
- function() {
- c.redirect_to('#/apps/'+ c.params['app']+ '/access', {slide:false});
}
);
});
@@ -759,9 +738,6 @@
c.api('PUT', '/apps/'+c.params['app']+'/default', {}, function() {
c.redirect_to('#/apps/'+ c.params['app'], {slide:false});
});
- },
- function() {
- c.redirect_to('#/apps/'+ c.params['app'], {slide:false});
}
);
});
@@ -823,9 +799,6 @@
c.api('PUT', '/apps/' + c.params['app'] + '/changeurl', params, function(data) { // Call changeurl API
c.redirect_to('#/apps/'+ c.params['app']);
});
- },
- function() {
- c.redirect_to('#/apps/'+ c.params['app'] + '/changeurl', {slide:false});
}
);
});
diff --git a/src/js/yunohost/controllers/backup.js b/src/js/yunohost/controllers/backup.js
index 197960ed..0c97d740 100644
--- a/src/js/yunohost/controllers/backup.js
+++ b/src/js/yunohost/controllers/backup.js
@@ -78,10 +78,7 @@
c.api('POST', '/backup/restore/'+c.params['archive'], params, function(data) {
c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive']);
});
- }, this, c),
- function(){
- c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false});
- }
+ }, this, c)
);
});
@@ -94,9 +91,6 @@
c.api('DELETE', '/backup/archives/'+c.params['archive'], {}, function(data) {
c.redirect_to('#/backup/'+ c.params['storage']);
});
- },
- function(){
- c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false});
}
);
});
diff --git a/src/js/yunohost/controllers/domains.js b/src/js/yunohost/controllers/domains.js
index 488f170d..b9cf8d37 100644
--- a/src/js/yunohost/controllers/domains.js
+++ b/src/js/yunohost/controllers/domains.js
@@ -211,9 +211,6 @@
c.api('POST', '/domains/cert-install/' + c.params['domain'], {}, function(data) {
c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
});
- },
- function(){
- c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
}
);
});
@@ -227,9 +224,6 @@
c.api('POST', '/domains/cert-install/' + c.params['domain'] + "?self_signed", {}, function(data) {
c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
});
- },
- function(){
- c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
}
);
});
@@ -243,9 +237,6 @@
c.api('POST', '/domains/cert-renew/' + c.params['domain'] + "?force", {}, function(data) {
c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
});
- },
- function(){
- c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
}
);
});
@@ -259,9 +250,6 @@
c.api('POST', '/domains/cert-install/' + c.params['domain'] + "?self_signed&force", {}, function(data) {
c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
});
- },
- function(){
- c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
}
);
});
@@ -276,10 +264,8 @@
c.api('DELETE', '/domains/'+ c.params['domain'], {}, function(data) {
c.redirect_to('#/domains');
});
- },
- function(){
- c.redirect_to('#/domains/' + c.params["domain"], {slide:false});
- })
+ }
+ );
});
// Set default domain
@@ -305,9 +291,6 @@
var refreshDomain = window.setTimeout(function(){
c.redirect_to('#/domains');
}, 15000);
- },
- function(){
- c.redirect_to('#/domains', {slide:false});
}
);
}
diff --git a/src/js/yunohost/controllers/firewall.js b/src/js/yunohost/controllers/firewall.js
index 6550fb41..5ccd5964 100644
--- a/src/js/yunohost/controllers/firewall.js
+++ b/src/js/yunohost/controllers/firewall.js
@@ -47,9 +47,6 @@
c.api('GET', '/firewall/upnp', params, function(data) {
c.redirect_to('#/tools/firewall');
});
- },
- function(){
- c.redirect_to('#/tools/firewall', {slide: false});
}
);
});
@@ -135,9 +132,6 @@
c.params['connection'],
c.params['action']
);
- },
- function(){
- c.redirect_to('#/tools/firewall', {slide: false});
}
);
});
@@ -154,9 +148,6 @@
c.params['connection'],
c.params['action']
);
- },
- function(){
- c.redirect_to('#/tools/firewall', {slide: false});
}
);
});
diff --git a/src/js/yunohost/controllers/postinstall.js b/src/js/yunohost/controllers/postinstall.js
index a255154d..b2c5cc05 100644
--- a/src/js/yunohost/controllers/postinstall.js
+++ b/src/js/yunohost/controllers/postinstall.js
@@ -92,8 +92,6 @@
c.api('POST', '/postinstall', params, function(data) {
c.redirect_to('#/login');
});
- },
- function(){
}
);
} else {
diff --git a/src/js/yunohost/controllers/services.js b/src/js/yunohost/controllers/services.js
index a7b252a9..3ed25951 100644
--- a/src/js/yunohost/controllers/services.js
+++ b/src/js/yunohost/controllers/services.js
@@ -121,9 +121,6 @@
else {
c.redirect_to('#/services/'+ c.params['service'], {slide: false});
}
- },
- function(){
- c.redirect_to('#/services/'+ c.params['service'], {slide: false});
}
);
});
diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js
index bf563adc..6b895765 100644
--- a/src/js/yunohost/controllers/tools.js
+++ b/src/js/yunohost/controllers/tools.js
@@ -61,9 +61,6 @@
c.api('PUT', '/upgrade?'+c.params["type"], {}, function(data) {
c.redirect_to('#/tools/logs');
});
- },
- function(){
- c.redirect_to('#/update', {slide: false});
}
);
});
@@ -77,9 +74,6 @@
c.api('PUT', '/upgrade/apps?app='+c.params['app'].toLowerCase(), {}, function(data) {
c.redirect_to('#/tools/logs');
});
- },
- function(){
- c.redirect_to('#/update', {slide: false});
}
);
});
@@ -239,10 +233,6 @@
// Force scrollTop on page load
$('html, body').scrollTop(0);
}, false);
-
- },
- function(){
- c.redirect_to('#/tools/reboot', {slide: false});
}
);
}
@@ -338,9 +328,6 @@
c.api('POST', '/migrations/migrate?skip&targets=' + c.params['migration_id'], {}, function(data) {
c.redirect_to('#/tools/migrations', {slide: false});
});
- },
- function(){
- c.redirect_to('#/tools/migrations', {slide: false});
}
);
});
@@ -417,9 +404,6 @@
c.api('DELETE', '/appslists', {'name' : c.params['appslist']}, function() {
c.redirect_to('#/tools/appslists');
});
- },
- function() {
- c.redirect_to('#/tools/appslists/'+ c.params['appslist'], {slide: false});
}
);
});
diff --git a/src/js/yunohost/controllers/users.js b/src/js/yunohost/controllers/users.js
index 61a59fd1..e66aa2c0 100644
--- a/src/js/yunohost/controllers/users.js
+++ b/src/js/yunohost/controllers/users.js
@@ -206,9 +206,6 @@
c.api('DELETE', '/users/'+ c.params['user'], params, function(data) {
c.redirect_to('#/users');
});
- },
- function(){
- c.redirect_to('#/users/'+ c.params['user'], {slide: false});
}
);
From e054675230bc7d9375e1e9d3cf7937e99b55fd4a Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Mon, 14 Oct 2019 04:49:35 +0200
Subject: [PATCH 06/46] Remove residual comments about old doc
---
src/js/yunohost/controllers/apps.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js
index 28b2c08a..870545d3 100644
--- a/src/js/yunohost/controllers/apps.js
+++ b/src/js/yunohost/controllers/apps.js
@@ -599,7 +599,7 @@
y18n.t('applications'),
y18n.t('confirm_uninstall', [c.params['app']]),
function() {
- c.api('DELETE', '/apps/'+ c.params['app'], {}, function() { // http://api.yunohost.org/#!/app/app_remove_delete_4
+ c.api('DELETE', '/apps/'+ c.params['app'], {}, function() {
c.redirect_to('#/apps');
});
}
@@ -756,7 +756,7 @@
// Change app label
app.post('#/apps/:app/changelabel', function (c) {
params = {'new_label': c.params['label']};
- c.api('PUT', '/apps/' + c.params['app'] + '/label', params, function(data) { // Call changelabel API
+ c.api('PUT', '/apps/' + c.params['app'] + '/label', params, function(data) {
c.redirect_to('#/apps/'+ c.params['app']);
});
});
@@ -764,7 +764,7 @@
// Get app change URL page
app.get('#/apps/:app/changeurl', function (c) {
c.api('GET', '/apps/'+c.params['app']+'?raw', {}, function(app_data) {
- c.api('GET', '/domains', {}, function(domain_data) { // http://api.yunohost.org/#!/domain/domain_list_get_2
+ c.api('GET', '/domains', {}, function(domain_data) {
// Display a list of available domains
var domains = [];
@@ -796,7 +796,7 @@
y18n.t('confirm_app_change_url', [c.params['app']]),
function() {
params = {'domain': c.params['domain'], 'path': c.params['path']};
- c.api('PUT', '/apps/' + c.params['app'] + '/changeurl', params, function(data) { // Call changeurl API
+ c.api('PUT', '/apps/' + c.params['app'] + '/changeurl', params, function(data) {
c.redirect_to('#/apps/'+ c.params['app']);
});
}
From 713a9529d6ce4c692ea50cf86091add289633afd Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Mon, 14 Oct 2019 05:11:22 +0200
Subject: [PATCH 07/46] Remove the whole monitoring / glances stuff
---
src/js/yunohost/controllers/monitor.js | 50 -----
src/locales/en.json | 37 ----
src/views/tools/tools_list.ms | 4 -
src/views/tools/tools_monitoring.ms | 283 -------------------------
4 files changed, 374 deletions(-)
delete mode 100644 src/js/yunohost/controllers/monitor.js
delete mode 100644 src/views/tools/tools_monitoring.ms
diff --git a/src/js/yunohost/controllers/monitor.js b/src/js/yunohost/controllers/monitor.js
deleted file mode 100644
index 527e466c..00000000
--- a/src/js/yunohost/controllers/monitor.js
+++ /dev/null
@@ -1,50 +0,0 @@
-(function() {
- // Get application context
- var app = Sammy.apps['#main'];
- var store = app.store;
-
- /**
- * Monitor
- *
- */
-
- // Server monitoring
- app.get('#/tools/monitor', function (c) {
- var monitorData = {};
-
- // Why this method ?
- c.api('/services/glances', function(data) { // ?
- monitorData.status = true;
-
- if (data.status == 'running') {
- c.api('/monitor/system', function(data) {
- monitorData.system = data;
-
- c.api('/monitor/disk', function(data) {
- monitorData.disk = data;
-
- c.api('/monitor/network', function(data) {
- monitorData.network = data;
-
- // Remove useless interface
- delete monitorData.network.usage.lo;
-
- // Get YunoHost versions too
- c.api('/diagnosis', function(diagnosis) {
- monitorData.versions = diagnosis.packages;
- c.view('tools/tools_monitoring', monitorData);
- });
- });
-
- });
- });
- }
- else {
- monitorData.status = false;
- c.view('tools/tools_monitoring', monitorData);
- }
-
- }, 'GET');
- });
-
-})();
diff --git a/src/locales/en.json b/src/locales/en.json
index cd0d4c4b..ce41ad6f 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -46,7 +46,6 @@
"application": "Application",
"applications": "Applications",
"archive_empty": "Empty archive",
- "available": "Available",
"available_apps": "Available apps",
"backup": "Backup",
"backup_action": "Backup",
@@ -62,12 +61,9 @@
"backup_type": "Type",
"backups_no": "No backup",
"begin": "Begin",
- "bit_rate": "Bit rate",
"both": "Both",
"cancel": "Cancel",
"check": "Check",
- "check_mx": "MX record",
- "check_stmp": "port 25 access",
"close": "Close",
"confirm_access_add": "Are you sure you want to add access to %s for all users?",
"confirm_access_clear": "Are you sure you want to clear all access to %s?",
@@ -100,10 +96,7 @@
"confirm_reboot_action_shutdown": "Are you sure you want to shutdown your server?",
"connection": "Connection",
"copy": "Copy",
- "count_min": "%s min",
- "cpu_load": "CPU Load",
"created_at": "Created at",
- "cumulative_usage": "Cumulative usage",
"current_maintainer_title": "Current maintainer of this package",
"custom_app_install": "Install custom app",
"custom_app_url_only_github": "Currently only from GitHub",
@@ -117,7 +110,6 @@
"diagnosis_with_private": "Diagnosis with private data",
"disable": "Disable",
"disabled": "Disabled",
- "disk": "Disk",
"dns": "DNS",
"domain": "Domain",
"domain_add": "Add domain",
@@ -148,14 +140,11 @@
"error_connection_interrupted": "The server closed the connection instead of answering it. Has nginx or the yunohost-api been restarted or stoppted for some reason? (Error code/message: %s)",
"everyone_has_access": "Everyone has access.",
"experimental_warning": "Warning: this feature is experimental and not consider stable, you shouldn't be using it except if you know what you are doing.",
- "filesystem": "Filesystem",
"firewall": "Firewall",
"footer_version": "Powered by YunoHost %s (%s).",
"form_input_example": "Example: %s",
"free": "Free",
"from_to": "from %s to %s",
- "fs_type": "FS Type",
- "gateway": "Gateway: ",
"good_practices_about_admin_password": "You are now about to define a new admin password. The password should be at least 8 characters - though it is good practice to use longer password (i.e. a passphrase) and/or to use various kind of characters (uppercase, lowercase, digits and special characters).",
"good_practices_about_user_password": "You are now about to define a new user password. The password should be at least 8 characters - though it is good practice to use longer password (i.e. a passphrase) and/or to use various kind of characters (uppercase, lowercase, digits and special characters).",
"home": "Home",
@@ -174,7 +163,6 @@
"hook_data_home_desc": "User data located in /home/USER",
"hook_data_mail": "Mail",
"hook_data_mail_desc": "Raw emails stored on the server",
- "hostname": "Hostname",
"id": "ID",
"inactive": "Inactive",
"infos": "Info",
@@ -185,9 +173,7 @@
"installed": "Installed",
"installed_apps": "Installed apps",
"installing": "Installing",
- "interface": "Interface",
"internal_exception": "Yunohost encountered an internal error:/ Really sorry about that. You should look for help on the forum or the chat to fix the situation, or report the bug on the bugtracker . The following information might be useful for the person helping you:Action %s%s Traceback %s ",
- "io": "I/O",
"ipv4": "IPv4",
"ipv6": "IPv6",
"label": "Label",
@@ -196,7 +182,6 @@
"license": "License",
"loading": "Loading …",
"local_archives": "Local archives",
- "local_ip": "Local IP",
"log": "Log",
"logged_in": "Logged in",
"logged_out": "Logged out",
@@ -209,7 +194,6 @@
"manage_apps": "Manage apps",
"manage_domains": "Manage domains",
"manage_users": "Manage users",
- "memory": "Memory",
"menu": "Menu",
"migrations": "Migrations",
"migrations_pending": "Pending migrations",
@@ -217,14 +201,9 @@
"migrations_no_pending": "No pending migrations",
"migrations_no_done": "No previous migrations",
"mode": "Mode",
- "monitoring": "Monitoring",
- "monitoring_check_glances": "Check glances service status.",
- "monitoring_disabled": "Monitoring is not enabled.",
- "mount_point": "Mount point",
"multi_instance": "Multi instance",
"myserver": "myserver",
"myserver_org": "myserver.org",
- "network": "Network",
"next": "Next",
"no": "No",
"no_allowed_users": "No allowed users.",
@@ -240,7 +219,6 @@
"operations": "Operations",
"orphaned": "not maintained",
"orphaned_details": "This app is not maintained anymore. It may still be working but won't receive any upgrade. Feel free to come and revive it!",
- "os": "OS",
"password": "Password",
"password_confirmation": "Password confirmation",
"password_description": "Password must be at least %s characters long.",
@@ -280,13 +258,8 @@
"postinstall_intro_3": "You can obtain more information by visiting the appropriate documentation page ",
"postinstall_password": "This password will be used to manage everything on your server. Take the time to choose it wisely.",
"previous": "Previous",
- "process": "Process",
"protocol": "Protocol",
- "public_ip": "Public IP: ",
- "ram": "RAM",
- "read": "Read",
"read_more": "Read more",
- "reception": "Reception",
"refresh_app_list": "Refresh list",
"remove_access": "Remove access",
"request_adoption": "waiting adoption",
@@ -295,7 +268,6 @@
"request_help_details": "The current maintainer would like some help with the maintainance of this app. Feel free to come contribute on it!",
"restore": "Restore",
"run": "Run",
- "running": "Running",
"save": "Save",
"search_for_apps": "Search for apps...",
"select_user": "Select user",
@@ -317,7 +289,6 @@
"storage_create": "Add remote storage",
"storages_new": "New remote storage",
"storages_no": "No storages.",
- "swap": "Swap",
"system": "System",
"system_apps": "Apps",
"system_apps_nothing": "There are no apps to upgrade.",
@@ -329,7 +300,6 @@
"system_upgrade_all_applications_btn": "Upgrade all applications",
"system_upgrade_all_packages_btn": "Upgrade all packages",
"tcp": "TCP",
- "time_since_update": "Time since update: ",
"tools": "Tools",
"tools_adminpw": "Change administration password",
"tools_adminpw_confirm_placeholder": "Confirm the new password",
@@ -351,8 +321,6 @@
"tools_shutdown_done": "Shutting down...",
"tools_shuttingdown": "Your server is powering off. As long as your server is off, you won't be able to use the web administration.",
"tools_shutdown_reboot": "Shutdown/Reboot",
- "total": "Total",
- "transmission": "Transmission",
"udp": "UDP",
"unauthorized": "Unauthorized",
"uninstall": "Uninstall",
@@ -364,10 +332,7 @@
"upnp": "UPnP",
"upnp_disabled": "UPnP is disabled.",
"upnp_enabled": "UPnP is enabled.",
- "uptime": "Uptime",
"url": "URL",
- "usage": "Usage",
- "used": "Used",
"user_email": "Email",
"user_emailaliases": "Mail aliases",
"user_emailforward": "Mail forward",
@@ -383,11 +348,9 @@
"users_list": "User list",
"users_new": "New user",
"users_no": "No users.",
- "versions": "Versions",
"version": "Version",
"view_user_profile": "View %s's profile",
"warning_first_user": "You probably need to create a user first.",
- "write": "Write",
"wrong_password": "Wrong password",
"yes": "Yes",
"certificate_alert_not_valid": "CRITICAL: Current certificate is not valid! HTTPS won't work at all!",
diff --git a/src/views/tools/tools_list.ms b/src/views/tools/tools_list.ms
index 1442b625..91923dd3 100644
--- a/src/views/tools/tools_list.ms
+++ b/src/views/tools/tools_list.ms
@@ -34,10 +34,6 @@
{{t 'advanced'}}
-
-
- {{t 'monitoring'}}
-
{{t 'firewall'}}
diff --git a/src/views/tools/tools_monitoring.ms b/src/views/tools/tools_monitoring.ms
deleted file mode 100644
index 1593be1b..00000000
--- a/src/views/tools/tools_monitoring.ms
+++ /dev/null
@@ -1,283 +0,0 @@
-
-
-
-
-{{#if status}}
-
-
-
{{t 'infos'}}
-
-
-
- {{t 'hostname'}}
- {{system.infos.hostname}}
- {{t 'os'}}
- {{ucwords system.infos.linux_distro}} {{system.infos.platform}} ({{system.infos.os_name}} {{system.infos.os_version}})
- {{t 'uptime'}}
- {{system.uptime}}
-
-
-
-
-
-
-
{{t 'versions'}}
-
-
-
- {{#each versions}}
- {{@key}}
- {{version}} ({{repo}})
- {{/each}}
-
-
-
-
-
-
-
-
-
-
-
- {{t 'check_stmp'}}
- {{network.check.smtp_check}}
- {{t 'check_mx'}}
-
- {{#if network.check.mx_check.mx0}}
-
- {{#each network.check.mx_check}}
- {{this}}
- {{/each}}
-
- {{else}}
- {{network.check.mx_check}}
- {{/if}}
-
-
-
-
-
-
-
-
-
-
-
-
-
{{t 'memory'}}
-
{{t 'ram'}}
-
-
- {{t 'used'}}
- {{humanSize system.memory.ram.used}} ({{system.memory.ram.percent}} %)
-
-
- {{t 'free'}}
- {{humanSize system.memory.ram.free}}
-
-
- {{t 'total'}}
- {{humanSize system.memory.ram.total}}
-
-
-
-
{{t 'swap'}}
-
-
- {{t 'used'}}
- {{humanSize system.memory.swap.used}} ({{system.memory.swap.percent}} %)
-
-
- {{t 'free'}}
- {{humanSize system.memory.swap.free}}
-
-
- {{t 'total'}}
- {{humanSize system.memory.swap.total}}
-
-
-
-
-
-
{{t 'cpu_load'}}
-
-
- {{t 'count_min' "1"}}
- {{system.cpu.load.min1}}
-
-
- {{t 'count_min' "5"}}
- {{system.cpu.load.min5}}
-
-
- {{t 'count_min' "15"}}
- {{system.cpu.load.min15}}
-
-
-
-
-
-
{{t 'process'}}
-
-
- {{t 'running'}}
- {{system.process.running}}
-
-
- {{t 'sleeping'}}
- {{system.process.sleeping}}
-
-
- {{t 'total'}}
- {{system.process.total}}
-
-
-
-
-
-
-
-
-
-
-
-
{{t 'public_ip'}} {{network.infos.public_ip}}
-
-
{{t 'gateway'}} {{network.infos.gateway}}
-
-
{{t 'local_ip'}}
-
-
-
- {{t 'interface'}}
- {{t 'ipv4'}}
- {{t 'ipv6'}}
-
-
-
- {{#each network.infos.local_ip}}
-
- {{@key}}
- {{ ipv4 }}
- {{ ipv6 }}
-
- {{/each}}
-
-
-
-
{{t 'usage'}}
- {{#each network.usage}}
-
-
-
-
-
-
- {{@key}}
- {{t 'time_since_update'}}{{humanTime time_since_update}}
-
-
- {{t 'bit_rate'}}
- {{t 'cumulative_usage'}}
-
-
-
-
- {{t 'transmission'}}
- {{bitRate tx time_since_update}}
- {{humanSize cumulative_tx}}
-
-
- {{t 'reception'}}
- {{bitRate rx time_since_update}}
- {{humanSize cumulative_rx}}
-
-
-
-
- {{/each}}
-
-
-
-
-
-
-
-
- {{#each disk}}
-
-
{{@key}}
-
-
-
{{t 'filesystem'}}
-
-
- {{t 'fs_type'}} {{ filesystem.fs_type }}
-
-
- {{t 'mount_point'}} {{ filesystem.mnt_point }}
-
-
- {{t 'size'}} {{humanSize filesystem.size }}
-
-
- {{t 'used'}} {{humanSize filesystem.used }}
-
-
- {{t 'available'}} {{humanSize filesystem.avail }}
-
-
-
-
-
{{t 'io'}} {{t 'time_since_update'}}{{humanTime io.time_since_update }}
-
-
- {{t 'read'}} {{humanSize io.read_bytes }}
-
-
- {{t 'write'}} {{humanSize io.write_bytes }}
-
-
-
-
- {{/each}}
-
-
-
-
-
-
-{{else}}
-
-
- {{t 'monitoring_disabled'}}
-
- {{t 'monitoring_check_glances'}}
-
-
-{{/if}}
From e5ce0ac19d30b0eb96647d28e1c6079d070dc71c Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Wed, 16 Oct 2019 22:45:44 +0200
Subject: [PATCH 08/46] Buttons are healthier than , in particular here to
avoid ugly js in the middle of the template
---
src/js/yunohost/controllers/tools.js | 13 +++++++++++--
src/views/tools/tools_log.ms | 4 ++--
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js
index 6b895765..6d40f4b5 100644
--- a/src/js/yunohost/controllers/tools.js
+++ b/src/js/yunohost/controllers/tools.js
@@ -122,7 +122,7 @@
var params = "?path=" + c.params["splat"][0];
var number = (c.params["number"])?c.params["number"]:50;
params += "&number=" + number;
-
+
c.api('GET', "/logs/display" + params, {}, function(log) {
if ('metadata' in log) {
if (!'env' in log.metadata && 'args' in log.metadata) {
@@ -133,10 +133,19 @@
"log": log,
"next_number": log.logs.length == number ? number * 10:false,
"locale": y18n.locale
+ }, function() {
+ // Configure behavior for the button to share log on Yunohost (it calls display --share)
+ $("#share-with-yunopaste").on("click", function() {
+ c.api('GET', '/logs/display?path='+$(this).data('log-id')+'&share', {},
+ function(data) {
+ $('div.loader').remove();
+ window.open(data.url, '_blank');
+ });
+ });
});
});
});
-
+
// Download SSL Certificate Authority
app.get('#/tools/ca', function (c) {
diff --git a/src/views/tools/tools_log.ms b/src/views/tools/tools_log.ms
index c37aea1f..07ddc3a0 100644
--- a/src/views/tools/tools_log.ms
+++ b/src/views/tools/tools_log.ms
@@ -10,9 +10,9 @@
From eab2e2c368b233b04e20c6ae41266f2aaf905053 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Wed, 16 Oct 2019 23:26:27 +0200
Subject: [PATCH 09/46] Buttons make more sense for this interface
---
src/js/yunohost/controllers/services.js | 89 +++++++++++++------------
src/views/service/service_info.ms | 16 ++---
2 files changed, 53 insertions(+), 52 deletions(-)
diff --git a/src/js/yunohost/controllers/services.js b/src/js/yunohost/controllers/services.js
index 3ed25951..c81c43d4 100644
--- a/src/js/yunohost/controllers/services.js
+++ b/src/js/yunohost/controllers/services.js
@@ -45,7 +45,7 @@
// Status & actions for a service
app.get('#/services/:service', function (c) {
- c.api('GET', '/services/'+ c.params['service'], {}, function(data) { // ?
+ c.api('GET', '/services/'+ c.params['service'], {}, function(data) {
var data2 = {
service: data
};
@@ -64,7 +64,50 @@
{
data2.service.active_at = 0;
}
- c.view('service/service_info', data2);
+ c.view('service/service_info', data2, function() {
+
+ // Configure behavior for enable/disable and start/stop buttons
+ $('button[data-action]').on('click', function() {
+
+ var service = $(this).data('service');
+ var action = $(this).data('action');
+
+ c.confirm("Service", y18n.t('confirm_service_' + action, [service]), function(){
+
+ var method = null,
+ endurl = service;
+
+ switch (action) {
+ case 'start':
+ method = 'PUT';
+ break;
+ case 'stop':
+ method = 'DELETE';
+ break;
+ case 'enable':
+ method = 'PUT';
+ endurl += '/enable';
+ break;
+ case 'disable':
+ method = 'DELETE';
+ endurl += '/enable';
+ break;
+ default:
+ c.flash('fail', y18n.t('unknown_action', [action]));
+ c.redirect_to('#/services/'+ service, {slide: false});
+ }
+
+ if (method && endurl) {
+ c.api(method, '/services/'+ endurl, {}, function(data) {
+ c.redirect_to('#/services/'+ service, {slide: false});
+ });
+ }
+ else {
+ c.redirect_to('#/services/'+ service, {slide: false});
+ }
+ });
+ });
+ });
});
});
@@ -83,46 +126,4 @@
});
});
- // Enable/Disable & Start/Stop service
- app.get('#/services/:service/:action', function (c) {
- c.confirm(
- "Service",
- // confirm_service_start, confirm_service_stop, confirm_service_enable and confirm_service_disable
- y18n.t('confirm_service_' + c.params['action'].toLowerCase(), [c.params['service']]),
- function(){
- var method = null,
- endurl = c.params['service'];
-
- switch (c.params['action']) {
- case 'start':
- method = 'PUT';
- break;
- case 'stop':
- method = 'DELETE';
- break;
- case 'enable':
- method = 'PUT';
- endurl += '/enable';
- break;
- case 'disable':
- method = 'DELETE';
- endurl += '/enable';
- break;
- default:
- c.flash('fail', y18n.t('unknown_action', [c.params['action']]));
- c.redirect_to('#/services/'+ c.params['service'], {slide: false});
- }
-
- if (method && endurl) {
- c.api(method, '/services/'+ endurl, {}, function(data) {
- c.redirect_to('#/services/'+ c.params['service'], {slide: false});
- });
- }
- else {
- c.redirect_to('#/services/'+ c.params['service'], {slide: false});
- }
- }
- );
- });
-
})();
diff --git a/src/views/service/service_info.ms b/src/views/service/service_info.ms
index 3b8c7e19..2e78941d 100644
--- a/src/views/service/service_info.ms
+++ b/src/views/service/service_info.ms
@@ -53,25 +53,25 @@
{{#is_loaded}}
-
+
{{t 'disable'}}
-
+
{{/is_loaded}}
{{^is_loaded}}
-
+
{{t 'enable'}}
-
+
{{/is_loaded}}
{{#is_running}}
-
+
{{t 'stop'}}
-
+
{{/is_running}}
{{^is_running}}
-
+
{{t 'start'}}
-
+
{{/is_running}}
{{t 'log'}}
From 52b4623222dd0b4450ff9afde379b705f5ffe6cc Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Thu, 17 Oct 2019 00:06:23 +0200
Subject: [PATCH 10/46] Mooooar buttons (update view)
---
src/js/yunohost/controllers/tools.js | 61 +++++++++++++++-------------
src/views/update/update.ms | 6 +--
2 files changed, 36 insertions(+), 31 deletions(-)
diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js
index 6d40f4b5..03f6f1a7 100644
--- a/src/js/yunohost/controllers/tools.js
+++ b/src/js/yunohost/controllers/tools.js
@@ -47,37 +47,42 @@
// System update & upgrade
app.get('#/update', function (c) {
c.api('PUT', '/update', {}, function(data) {
- c.view('update/update', data);
+ c.view('update/update', data, function() {
+ // Configure buttons behaviors
+ $("button[data-upgrade]").on("click", function() {
+
+ var what = $(this).data("upgrade").toLowerCase();
+
+ // Upgrade all apps or the system
+
+ if ((what == "system") || (what == "system"))
+ {
+ var confirm_message = y18n.t('confirm_update_' + what);
+ var api_url = '/upgrade?'+what;
+ }
+
+ // Upgrade a specific apps
+
+ else
+ {
+ var confirm_message = y18n.t('confirm_update_specific_app', [what]);
+ var api_url = '/upgrade/apps?app='+what;
+ }
+
+ c.confirm(
+ y18n.t('tools'),
+ confirm_message,
+ function(){
+ c.api('PUT', api_url, {}, function(data) {
+ c.redirect_to('#/tools/logs');
+ });
+ }
+ );
+ });
+ });
});
});
- // Upgrade apps or packages
- app.get('#/upgrade/:type', function (c) {
- c.confirm(
- y18n.t('tools'),
- // confirm_update_apps and confirm_update_packages
- y18n.t('confirm_update_' + c.params['type'].toLowerCase()),
- function(){
- c.api('PUT', '/upgrade?'+c.params["type"], {}, function(data) {
- c.redirect_to('#/tools/logs');
- });
- }
- );
- });
-
- // Upgrade a specific apps
- app.get('#/upgrade/apps/:app', function (c) {
- c.confirm(
- y18n.t('tools'),
- y18n.t('confirm_update_specific_app', [c.params['app']]),
- function(){
- c.api('PUT', '/upgrade/apps?app='+c.params['app'].toLowerCase(), {}, function(data) {
- c.redirect_to('#/tools/logs');
- });
- }
- );
- });
-
// Display journals list
app.get('#/tools/logs', function (c) {
c.api('GET', "/logs?limit=25&with_details", {}, function(categories) {
diff --git a/src/views/update/update.ms b/src/views/update/update.ms
index 62a44b50..0be7740a 100644
--- a/src/views/update/update.ms
+++ b/src/views/update/update.ms
@@ -20,7 +20,7 @@
{{/system}}
{{else}}
@@ -37,14 +37,14 @@
{{else}}
From 266e349d1f310860771506113c21e393bea97d56 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Thu, 17 Oct 2019 17:36:29 +0200
Subject: [PATCH 11/46] Moaaar buttons (reboot/poweroff)
---
src/js/yunohost/controllers/tools.js | 75 +++++++++++++---------------
src/views/tools/tools_reboot.ms | 8 +--
2 files changed, 38 insertions(+), 45 deletions(-)
diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js
index 03f6f1a7..3f2e08c5 100644
--- a/src/js/yunohost/controllers/tools.js
+++ b/src/js/yunohost/controllers/tools.js
@@ -208,52 +208,45 @@
// Reboot or shutdown button
app.get('#/tools/reboot', function (c) {
- c.view('tools/tools_reboot');
- });
+ c.view('tools/tools_reboot', {}, function() {
+ // Configure reboot/shutdown buttons behavior
+ $("button[data-action]").on("click", function() {
+ var action = $(this).data("action");
- // Reboot or shutdown actions
- app.get('#/tools/reboot/:action', function (c) {
- var action = c.params['action'].toLowerCase();
- if (action == 'reboot' || action == 'shutdown') {
- c.confirm(
- y18n.t('tools_' + action),
- // confirm_reboot_action_reboot or confirm_reboot_action_shutdown
- y18n.t('confirm_reboot_action_' + action),
- function(){
- c.api('PUT', '/'+action+'?force', {}, function(data) {
- // This code is not executed due to 502 response (reboot or shutdown)
- c.redirect_to('#/logout');
- }, function (xhr) {
- c.flash('success', y18n.t('tools_' + action + '_done'))
- // Disconnect from the webadmin
- store.clear('url');
- store.clear('connected');
- store.set('path', '#/');
+ c.confirm(
+ y18n.t('tools_' + action),
+ y18n.t('confirm_reboot_action_' + action),
+ function(){
+ c.api('PUT', '/'+action+'?force', {}, function(data) {
+ // This code is not executed due to 502 response (reboot or shutdown)
+ c.redirect_to('#/logout');
+ }, function (xhr) {
+ c.flash('success', y18n.t('tools_' + action + '_done'))
+ // Disconnect from the webadmin
+ store.clear('url');
+ store.clear('connected');
+ store.set('path', '#/');
- // Rename the page to allow refresh without ask for rebooting
- window.location.href = window.location.href.split('#')[0] + '#/';
- // Display reboot or shutdown info
- // We can't use template because now the webserver is off
- if (action == 'reboot') {
- $('#main').replaceWith(' ' + y18n.t('tools_rebooting') + '
');
- }
- else {
- $('#main').replaceWith(' ' + y18n.t('tools_shuttingdown') + '
');
- }
+ // Rename the page to allow refresh without ask for rebooting
+ window.location.href = window.location.href.split('#')[0] + '#/';
+ // Display reboot or shutdown info
+ // We can't use template because now the webserver is off
+ if (action == 'reboot') {
+ $('#main').replaceWith(' ' + y18n.t('tools_rebooting') + '
');
+ }
+ else {
+ $('#main').replaceWith(' ' + y18n.t('tools_shuttingdown') + '
');
+ }
- // Remove loader if any
- $('div.loader').remove();
+ // Remove loader if any
+ $('div.loader').remove();
- // Force scrollTop on page load
- $('html, body').scrollTop(0);
+ // Force scrollTop on page load
+ $('html, body').scrollTop(0);
}, false);
- }
- );
- }
- else {
- c.flash('fail', y18n.t('unknown_action', [action]));
- c.redirect_to('#/tools/reboot', {slide: false});
- }
+ });
+ });
+ });
});
// Diagnosis
diff --git a/src/views/tools/tools_reboot.ms b/src/views/tools/tools_reboot.ms
index c66bc0a0..ef184eaf 100644
--- a/src/views/tools/tools_reboot.ms
+++ b/src/views/tools/tools_reboot.ms
@@ -15,14 +15,14 @@
From 3f8aff1a99124bcb0cc15a19a8f8a65bd61f3563 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Thu, 17 Oct 2019 18:50:31 +0200
Subject: [PATCH 12/46] Moaaaar buttons (certificate management view)
---
src/js/yunohost/controllers/domains.js | 93 +++++++++++---------------
src/views/domain/domain_cert.ms | 16 ++---
2 files changed, 48 insertions(+), 61 deletions(-)
diff --git a/src/js/yunohost/controllers/domains.js b/src/js/yunohost/controllers/domains.js
index b9cf8d37..bfd41e2f 100644
--- a/src/js/yunohost/controllers/domains.js
+++ b/src/js/yunohost/controllers/domains.js
@@ -198,62 +198,49 @@
status: status_,
actions_enabled : actions_enabled
};
- c.view('domain/domain_cert', data_);
+ c.view('domain/domain_cert', data_, function() {
+ // Configure install / renew buttons behavior
+ $("button[data-action]").on("click", function () {
+ var action = $(this).data("action"),
+ domain = $(this).data("domain"),
+ confirm_key = "",
+ api_url = "";
+
+ switch (action) {
+ case 'install-LE':
+ confirm_key = 'confirm_cert_install_LE';
+ api_url = '/domains/cert-install/' + domain;
+ break;
+ case 'regen-selfsigned':
+ confirm_key = 'confirm_cert_regen_selfsigned';
+ api_url = '/domains/cert-install/' + domain + "?self_signed";
+ break;
+ case 'renew-letsencrypt':
+ confirm_key = 'confirm_cert_manual_renew_LE';
+ api_url = '/domains/cert-renew/' + domain + "?force";
+ break;
+ case 'replace-with-selfsigned':
+ confirm_key = 'confirm_cert_revert_to_selfsigned';
+ api_url = '/domains/cert-install/' + domain + "?self_signed&force";
+ break;
+ default:
+ c.flash('fail', y18n.t('unknown_action', [action]));
+ return
+ }
+
+ c.confirm(
+ y18n.t('certificate'),
+ y18n.t(confirm_key, [domain]),
+ function(){
+ c.api('POST', api_url, {}, function(data) {
+ c.redirect_to('#/domains/'+domain+'/cert-management', {slide:false});
+ });
+ });
+ });
+ });
});
});
- // Install let's encrypt certificate on domain
- app.get('#/domains/:domain/cert-install-LE', function (c) {
- c.confirm(
- y18n.t('certificate'),
- y18n.t('confirm_cert_install_LE', [c.params['domain']]),
- function(){
- c.api('POST', '/domains/cert-install/' + c.params['domain'], {}, function(data) {
- c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
- });
- }
- );
- });
-
- // Regenerate a self-signed certificate
- app.get('#/domains/:domain/cert-regen-selfsigned', function (c) {
- c.confirm(
- y18n.t('certificate'),
- y18n.t('confirm_cert_regen_selfsigned', [c.params['domain']]),
- function(){
- c.api('POST', '/domains/cert-install/' + c.params['domain'] + "?self_signed", {}, function(data) {
- c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
- });
- }
- );
- });
-
- // Manually renew a Let's Encrypt certificate
- app.get('#/domains/:domain/cert-renew-letsencrypt', function (c) {
- c.confirm(
- y18n.t('certificate'),
- y18n.t('confirm_cert_manual_renew_LE', [c.params['domain']]),
- function(){
- c.api('POST', '/domains/cert-renew/' + c.params['domain'] + "?force", {}, function(data) {
- c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
- });
- }
- );
- });
-
- // Replace valid cert with self-signed
- app.get('#/domains/:domain/cert-replace-with-selfsigned', function (c) {
- c.confirm(
- y18n.t('certificate'),
- y18n.t('confirm_cert_revert_to_selfsigned', [c.params['domain']]),
- function(){
- c.api('POST', '/domains/cert-install/' + c.params['domain'] + "?self_signed&force", {}, function(data) {
- c.redirect_to('#/domains/'+c.params['domain']+'/cert-management', {slide:false});
- });
- }
- );
- });
-
// Remove existing domain
app.get('#/domains/:domain/delete', function (c) {
diff --git a/src/views/domain/domain_cert.ms b/src/views/domain/domain_cert.ms
index 663f17ea..3969dfa3 100644
--- a/src/views/domain/domain_cert.ms
+++ b/src/views/domain/domain_cert.ms
@@ -46,36 +46,36 @@
{{t 'domain_not_eligible_for_ACME'}}
{{/if}}
-
+
{{t 'install_letsencrypt_cert'}}
-
+
{{/if}}
{{#if actions_enabled.manual_renew_letsencrpt}}
{{/if}}
{{#if actions_enabled.regen_selfsigned}}
{{/if}}
{{#if actions_enabled.replace_with_selfsigned}}
{{/if}}
From 1f4afe63e71a488c871842179581608b1942cb4a Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Thu, 17 Oct 2019 19:01:16 +0200
Subject: [PATCH 13/46] Fix ambiguity for selectors (now other button
configuration are relyin on button[data-action] but we don't want it to
affect the nodal window
---
src/index.html | 4 ++--
src/js/yunohost/helpers.js | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/index.html b/src/index.html
index 4d032f17..19ceb663 100644
--- a/src/index.html
+++ b/src/index.html
@@ -76,8 +76,8 @@
- Cancel
- OK
+ Cancel
+ OK
diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js
index e45d34ce..e5756f72 100644
--- a/src/js/yunohost/helpers.js
+++ b/src/js/yunohost/helpers.js
@@ -424,7 +424,7 @@
.modal('hide');
// Do corresponding callback
- if ($(this).data('action') == 'confirm') {
+ if ($(this).data('modal-action') == 'confirm') {
confirmCallback();
}
else {
From 6a4ca127a4b1c6b9977635a41201b6b977cd9dad Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Thu, 17 Oct 2019 19:56:36 +0200
Subject: [PATCH 14/46] Moooar buttons (domain info view)
---
src/js/yunohost/controllers/domains.js | 84 ++++++++++++--------------
src/views/domain/domain_info.ms | 13 ++--
2 files changed, 45 insertions(+), 52 deletions(-)
diff --git a/src/js/yunohost/controllers/domains.js b/src/js/yunohost/controllers/domains.js
index bfd41e2f..17df4f75 100644
--- a/src/js/yunohost/controllers/domains.js
+++ b/src/js/yunohost/controllers/domains.js
@@ -97,14 +97,52 @@
}
});
-
var domain = {
name: c.params['domain'],
main: (c.params['domain'] == dataMain.current_main_domain) ? true : false,
url: "https://"+c.params['domain'],
enable_cert_management: enable_cert_management_
};
- c.view('domain/domain_info', domain);
+ c.view('domain/domain_info', domain, function() {
+
+ // Configure "set default" button
+ $('button[data-action="set_default"]').on("click", function() {
+ var domain = $(this).data("domain");
+ c.confirm(
+ y18n.t('domains'),
+ y18n.t('confirm_change_maindomain'),
+ function() {
+ var params = {
+ new_domain: c.params['domain']
+ };
+ c.api('PUT', '/domains/main', params, function(data) {
+ c.redirect_to('#/domains');
+ });
+
+ // WTF ... why is this hack needed v_v
+
+ // Wait 15s and refresh the page
+ var refreshDomain = window.setTimeout(function(){
+ c.redirect_to('#/domains');
+ }, 15000);
+ }
+ );
+ });
+
+ // Configure delete button
+ $('button[data-action="delete"]').on("click", function() {
+ var domain = $(this).data("domain");
+ c.confirm(
+ y18n.t('domains'),
+ y18n.t('confirm_delete', [domain]),
+ function(){
+ c.api('DELETE', '/domains/'+ domain, {}, function(data) {
+ c.redirect_to('#/domains');
+ });
+ }
+ );
+ });
+ });
});
});
});
@@ -241,46 +279,4 @@
});
});
-
- // Remove existing domain
- app.get('#/domains/:domain/delete', function (c) {
- c.confirm(
- y18n.t('domains'),
- y18n.t('confirm_delete', [c.params['domain']]),
- function(){
- c.api('DELETE', '/domains/'+ c.params['domain'], {}, function(data) {
- c.redirect_to('#/domains');
- });
- }
- );
- });
-
- // Set default domain
- app.post('#/domains', function (c) {
- if (c.params['domain'] === '') {
- c.flash('fail', y18n.t('error_select_domain'));
- c.redirect_to('#/domains', {slide:false});
- } else {
- c.confirm(
- y18n.t('domains'),
- y18n.t('confirm_change_maindomain'),
- function(){
- var params = {
- new_domain: c.params['domain']
- };
- c.api('PUT', '/domains/main', params, function(data) {
- c.redirect_to('#/domains');
- });
-
- // WTF ... why is this hack needed v_v
-
- // Wait 15s and refresh the page
- var refreshDomain = window.setTimeout(function(){
- c.redirect_to('#/domains');
- }, 15000);
- }
- );
- }
- });
-
})();
diff --git a/src/views/domain/domain_info.ms b/src/views/domain/domain_info.ms
index 6eed7627..f22bd3c0 100644
--- a/src/views/domain/domain_info.ms
+++ b/src/views/domain/domain_info.ms
@@ -40,12 +40,9 @@
{{t 'domain_default_desc'}}
-
+
+ {{t 'set_default'}}
+
{{/unless}}
@@ -70,9 +67,9 @@
From 2f8422a18e9b6c0bef86e7d3e8b21167041db4e8 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Thu, 17 Oct 2019 20:01:43 +0200
Subject: [PATCH 15/46] Move icon as prefix instead of suffix for consistency
with other views
---
src/views/domain/domain_info.ms | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/views/domain/domain_info.ms b/src/views/domain/domain_info.ms
index f22bd3c0..237952c8 100644
--- a/src/views/domain/domain_info.ms
+++ b/src/views/domain/domain_info.ms
@@ -33,7 +33,7 @@
{{#unless main}}
@@ -41,7 +41,7 @@
{{t 'domain_default_desc'}}
- {{t 'set_default'}}
+ {{t 'set_default'}}
{{/unless}}
@@ -49,7 +49,7 @@
@@ -61,14 +61,14 @@
{{/unless}}
- {{t 'ssl_certificate'}}
+ {{t 'ssl_certificate'}}
{{t 'domain_delete_longdesc' name}}
- {{t 'delete'}}
+ {{t 'delete'}}
From 65e615133e7beb1702315aaad70a873f93c6f40f Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Thu, 17 Oct 2019 20:19:56 +0200
Subject: [PATCH 16/46] Simplify the domain info view ?
---
src/views/domain/domain_info.ms | 25 ++++++-------------------
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/src/views/domain/domain_info.ms b/src/views/domain/domain_info.ms
index 237952c8..6724dcf2 100644
--- a/src/views/domain/domain_info.ms
+++ b/src/views/domain/domain_info.ms
@@ -12,23 +12,6 @@
{{name}}
-
- {{#if main}}
-
- {{t 'domain_default_longdesc'}}
-
- {{/if}}
-
{{url}}
-
-
-
-
-
-
-
- {{t 'operations'}}
-
-
{{t 'domain_visit_url' url}}
@@ -36,15 +19,19 @@
{{t 'domain_visit'}}
- {{#unless main}}
{{t 'domain_default_desc'}}
+ {{#if main}}
+
+ {{t 'domain_default_longdesc'}}
+
+ {{else}}
{{t 'set_default'}}
+ {{/if}}
- {{/unless}}
{{t 'domain_dns_longdesc'}}
From a73f87575b481c71409adfd502545bb4c24a6430 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Thu, 17 Oct 2019 20:23:24 +0200
Subject: [PATCH 17/46] Remove legacy code from 2017, old letsencrypt_ynh app
---
src/js/yunohost/controllers/domains.js | 14 +-------------
src/views/domain/domain_info.ms | 7 +------
2 files changed, 2 insertions(+), 19 deletions(-)
diff --git a/src/js/yunohost/controllers/domains.js b/src/js/yunohost/controllers/domains.js
index 17df4f75..d1ab6922 100644
--- a/src/js/yunohost/controllers/domains.js
+++ b/src/js/yunohost/controllers/domains.js
@@ -86,22 +86,10 @@
c.api('PUT', '/domains/main', {}, function(dataMain) {
c.api('GET', '/apps?installed', {}, function(data) {
- // FIXME - This dirty trick (along with the previous API call
- // for apps installed) should be removed once letsencrypt_ynh
- // is not used by many people anymore. Probably around 07/2017
- // or end of 2017...
- var enable_cert_management_ = true;
- $.each(data['apps'], function(k, v) {
- if (v.id == "letsencrypt") {
- enable_cert_management_ = false;
- }
- });
-
var domain = {
name: c.params['domain'],
main: (c.params['domain'] == dataMain.current_main_domain) ? true : false,
- url: "https://"+c.params['domain'],
- enable_cert_management: enable_cert_management_
+ url: "https://"+c.params['domain']
};
c.view('domain/domain_info', domain, function() {
diff --git a/src/views/domain/domain_info.ms b/src/views/domain/domain_info.ms
index 6724dcf2..50c341d1 100644
--- a/src/views/domain/domain_info.ms
+++ b/src/views/domain/domain_info.ms
@@ -42,12 +42,7 @@
{{t 'certificate_manage'}}
- {{#unless enable_cert_management}}
-
- {{t 'certificate_old_letsencrypt_app_conflict'}}
-
- {{/unless}}
-
+
{{t 'ssl_certificate'}}
From 119d485a0511a1866aef27dc0ba37d02e29b6042 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Fri, 18 Oct 2019 19:52:55 +0200
Subject: [PATCH 18/46] Moaaar buttons (migration view)
---
src/js/yunohost/controllers/tools.js | 85 ++++++++++++----------------
src/views/tools/tools_migrations.ms | 4 +-
2 files changed, 38 insertions(+), 51 deletions(-)
diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js
index 3f2e08c5..da834dbb 100644
--- a/src/js/yunohost/controllers/tools.js
+++ b/src/js/yunohost/controllers/tools.js
@@ -264,7 +264,7 @@
});
});
- // Reboot or shutdown button
+ // Migrations
app.get('#/tools/migrations', function (c) {
c.api('GET', '/migrations?pending', {}, function(pending_migrations) {
c.api('GET', '/migrations?done', {}, function(done_migrations) {
@@ -286,59 +286,46 @@
c.view('tools/tools_migrations', {
'pending_migrations' : pending_migrations.reverse(),
'done_migrations' : done_migrations.reverse()
+ }, function() {
+
+ // Configure button 'Run'
+ $('button[data-action="run"]').on("click", function() {
+
+ var disclaimerAcks = $(".disclaimer-ack");
+ for (var i = 0 ; i < disclaimerAcks.length ; i++)
+ {
+ if (! $(disclaimerAcks[i]).find("input:checked").val())
+ {
+ // FIXME / TODO i18n
+ c.flash('fail', "Some of these migrations require you to acknowledge a disclaimer before running them.");
+ c.redirect_to('#/tools/migrations', {slide: false});
+ return;
+ }
+ };
+
+ c.api('POST', '/migrations/migrate?accept_disclaimer', {}, function (data) {
+ c.redirect_to('#/tools/migrations', {slide: false});
+ });
+ });
+
+ // Configure buttons 'Skip'
+ $('button[data-action="skip"]').on("click", function() {
+ var migration_id = $(this).data("migration");
+ c.confirm(
+ y18n.t('migrations'),
+ y18n.t('confirm_migrations_skip'),
+ function(){
+ c.api('POST', '/migrations/migrate?skip&targets=' + migration_id, {}, function(data) {
+ c.redirect_to('#/tools/migrations', {slide: false});
+ });
+ }
+ );
+ });
});
});
});
});
- app.get('#/tools/migrations/run', function (c) {
- var disclaimerAcks = $(".disclaimer-ack");
- var withAcceptDisclaimerFlag = false;
- for (var i = 0 ; i < disclaimerAcks.length ; i++)
- {
- console.log($(disclaimerAcks[i]).find("input:checked").val());
- if (! $(disclaimerAcks[i]).find("input:checked").val())
- {
- // FIXME / TODO i18n
- c.flash('fail', "Some of these migrations require you to acknowledge a disclaimer before running them.");
- c.redirect_to('#/tools/migrations', {slide: false});
- return;
- }
- else
- {
- withAcceptDisclaimerFlag = true;
- }
- };
-
- // Not sure if necessary, but this distinction is to avoid accidentally
- // triggering a migration with a disclaimer if one goes to the
- // /tools/migrations/run page "directly" somehow ...
- if (withAcceptDisclaimerFlag)
- {
- c.api('POST', '/migrations/migrate?accept_disclaimer', {}, function (data) {
- c.redirect_to('#/tools/migrations', {slide: false});
- })
- }
- else
- {
- c.api('POST', '/migrations/migrate', {}, function (data) {
- c.redirect_to('#/tools/migrations', {slide: false});
- })
- }
- });
-
- app.get('#/tools/migrations/skip/:migration_id', function (c) {
- c.confirm(
- y18n.t('migrations'),
- y18n.t('confirm_migrations_skip'),
- function(){
- c.api('POST', '/migrations/migrate?skip&targets=' + c.params['migration_id'], {}, function(data) {
- c.redirect_to('#/tools/migrations', {slide: false});
- });
- }
- );
- });
-
// List available apps lists
app.get('#/tools/appslists', function (c) {
c.api('GET', '/appslists', {}, function(data) {
diff --git a/src/views/tools/tools_migrations.ms b/src/views/tools/tools_migrations.ms
index 8ffbcedf..3536aee7 100644
--- a/src/views/tools/tools_migrations.ms
+++ b/src/views/tools/tools_migrations.ms
@@ -11,7 +11,7 @@
{{t 'migrations_pending'}}
{{#if pending_migrations}}
{{/if}}
@@ -24,7 +24,7 @@
{{ number }}. {{ description }}
{{#if disclaimer }}
From 30b2985314438cc1036cae9d6bbc159ade7b2530 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Fri, 18 Oct 2019 19:56:37 +0200
Subject: [PATCH 19/46] This view ain't used anymore
---
src/views/upgrade/upgrade.ms | 18 ------------------
1 file changed, 18 deletions(-)
delete mode 100644 src/views/upgrade/upgrade.ms
diff --git a/src/views/upgrade/upgrade.ms b/src/views/upgrade/upgrade.ms
deleted file mode 100644
index cf8d087f..00000000
--- a/src/views/upgrade/upgrade.ms
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-{{#if logs}}
-
-{{#logs}}
- {{.}}
-{{/logs}}
-
- {{t 'upload'}}
-{{else}}
- {{t 'no_log'}}
-{{/if}}
From 1bc384bb1f46cb79043c2815716d11a686d20ee7 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Fri, 18 Oct 2019 19:58:38 +0200
Subject: [PATCH 20/46] These aren't used anywhere...
---
src/views/tools/tools_rebooting.ms | 1 -
src/views/tools/tools_shuttingdown.ms | 1 -
2 files changed, 2 deletions(-)
delete mode 100644 src/views/tools/tools_rebooting.ms
delete mode 100644 src/views/tools/tools_shuttingdown.ms
diff --git a/src/views/tools/tools_rebooting.ms b/src/views/tools/tools_rebooting.ms
deleted file mode 100644
index 1d4d95cc..00000000
--- a/src/views/tools/tools_rebooting.ms
+++ /dev/null
@@ -1 +0,0 @@
- {{t 'tools_rebooting'}}
diff --git a/src/views/tools/tools_shuttingdown.ms b/src/views/tools/tools_shuttingdown.ms
deleted file mode 100644
index e7294efd..00000000
--- a/src/views/tools/tools_shuttingdown.ms
+++ /dev/null
@@ -1 +0,0 @@
- {{t 'tools_shuttingdown'}}
From 3619f5e9bb51206347d94ca90e11b2ba24df95c7 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Fri, 18 Oct 2019 20:06:38 +0200
Subject: [PATCH 21/46] Move this view to tools/ to avoid having a decidated
folder for just one file...
---
src/js/yunohost/controllers/tools.js | 2 +-
src/views/{update/update.ms => tools/tools_update.ms} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename src/views/{update/update.ms => tools/tools_update.ms} (100%)
diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js
index da834dbb..84ac1b6f 100644
--- a/src/js/yunohost/controllers/tools.js
+++ b/src/js/yunohost/controllers/tools.js
@@ -47,7 +47,7 @@
// System update & upgrade
app.get('#/update', function (c) {
c.api('PUT', '/update', {}, function(data) {
- c.view('update/update', data, function() {
+ c.view('tools/tools_update', data, function() {
// Configure buttons behaviors
$("button[data-upgrade]").on("click", function() {
diff --git a/src/views/update/update.ms b/src/views/tools/tools_update.ms
similarity index 100%
rename from src/views/update/update.ms
rename to src/views/tools/tools_update.ms
From b7a8edb352f18f6d8451e4814f87a4b52cf933b7 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Fri, 18 Oct 2019 20:14:04 +0200
Subject: [PATCH 22/46] Should have a slide effect when clicking on a log in
the log list
---
src/views/tools/tools_logs.ms | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/views/tools/tools_logs.ms b/src/views/tools/tools_logs.ms
index b7f4d7b2..2b719534 100644
--- a/src/views/tools/tools_logs.ms
+++ b/src/views/tools/tools_logs.ms
@@ -22,7 +22,7 @@
From 7ac8f61cdb0b6c4de3bc1bc9e27dd3a39ee5f54e Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Fri, 18 Oct 2019 21:04:06 +0200
Subject: [PATCH 23/46] Use the thing with data- now used elsewhere
---
src/js/yunohost/controllers/tools.js | 2 +-
src/views/tools/tools_log.ms | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js
index 84ac1b6f..1daf691e 100644
--- a/src/js/yunohost/controllers/tools.js
+++ b/src/js/yunohost/controllers/tools.js
@@ -140,7 +140,7 @@
"locale": y18n.locale
}, function() {
// Configure behavior for the button to share log on Yunohost (it calls display --share)
- $("#share-with-yunopaste").on("click", function() {
+ $('button[data-action="share"]').on("click", function() {
c.api('GET', '/logs/display?path='+$(this).data('log-id')+'&share', {},
function(data) {
$('div.loader').remove();
diff --git a/src/views/tools/tools_log.ms b/src/views/tools/tools_log.ms
index 07ddc3a0..44891631 100644
--- a/src/views/tools/tools_log.ms
+++ b/src/views/tools/tools_log.ms
@@ -10,7 +10,7 @@
-
+
{{t 'logs_share_with_yunopaste'}}
From 4b5d64f8efce65c8477a9d1acf9a3bed91f3956a Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Fri, 18 Oct 2019 21:36:05 +0200
Subject: [PATCH 24/46] Mooooar buttons (firewall view)
---
src/js/yunohost/controllers/firewall.js | 85 ++++++++++++-------------
src/views/tools/tools_firewall.ms | 20 +++---
2 files changed, 51 insertions(+), 54 deletions(-)
diff --git a/src/js/yunohost/controllers/firewall.js b/src/js/yunohost/controllers/firewall.js
index 5ccd5964..f1055638 100644
--- a/src/js/yunohost/controllers/firewall.js
+++ b/src/js/yunohost/controllers/firewall.js
@@ -30,23 +30,53 @@
// Get UPnP status
firewall.upnp = data.uPnP.enabled;
- c.view('tools/tools_firewall', firewall);
+ c.view('tools/tools_firewall', firewall, function() {
+
+ // Buttons in the 'ports' panel to open/close specific ports
+ $("button[data-port]").on("click", function() {
+
+ var port = $(this).data("port");
+ var action = $(this).data("action");
+ var protocol = $(this).data("protocol");
+ var connection = $(this).data("connection");
+ c.confirm(
+ y18n.t('firewall'),
+ // confirm_firewall_open and confirm_firewall_close
+ y18n.t('confirm_firewall_' + action, [ port, y18n.t(protocol), y18n.t(connection)]),
+ function(){ c.togglePort(port, protocol, connection, action); }
+ );
+ });
+
+ // Buttons to enable / disable UPnP
+ $("button[data-upnp]").on("click", function() {
+ var action = $(this).data("upnp");
+ c.confirm(
+ y18n.t('firewall'),
+ // confirm_upnp_enable and confirm_upnp_disable
+ y18n.t('confirm_upnp_' + action),
+ function(){
+ c.api('GET', '/firewall/upnp', {action: action}, function(data) {
+ c.redirect_to('#/tools/firewall');
+ });
+ }
+ );
+ });
+ });
});
});
- // Enable/Disable UPnP
- app.get('#/tools/firewall/upnp/:action', function (c) {
+ // Update port status from form
+ app.post('#/tools/firewall/port', function (c) {
c.confirm(
y18n.t('firewall'),
- // confirm_upnp_enable and confirm_upnp_disable
- y18n.t('confirm_upnp_' + c.params['action'].toLowerCase()),
+ y18n.t('confirm_firewall_' + c.params['action'].toLowerCase(), [ c.params['port'], y18n.t(c.params['protocol']), y18n.t(c.params['connection']) ]),
function(){
- var params = {
- action : c.params['action']
- };
- c.api('GET', '/firewall/upnp', params, function(data) {
- c.redirect_to('#/tools/firewall');
- });
+ c.togglePort(
+ c.params['port'],
+ c.params['protocol'],
+ c.params['connection'],
+ c.params['action']
+ );
}
);
});
@@ -118,38 +148,5 @@
return;
});
- // Update port status from direct link
- // #/firewall/port/{{@key}}/tcp/ipv4/close
- app.get('#/tools/firewall/port/:port/:protocol/:connection/:action', function (c) {
- c.confirm(
- y18n.t('firewall'),
- // confirm_firewall_open and confirm_firewall_close
- y18n.t( 'confirm_firewall_' + c.params['action'].toLowerCase(), [ c.params['port'], y18n.t(c.params['protocol']), y18n.t(c.params['connection'])]),
- function(){
- c.togglePort(
- c.params['port'],
- c.params['protocol'],
- c.params['connection'],
- c.params['action']
- );
- }
- );
- });
-
- // Update port status from form
- app.post('#/tools/firewall/port', function (c) {
- c.confirm(
- y18n.t('firewall'),
- y18n.t('confirm_firewall_' + c.params['action'].toLowerCase(), [ c.params['port'], y18n.t(c.params['protocol']), y18n.t(c.params['connection']) ]),
- function(){
- c.togglePort(
- c.params['port'],
- c.params['protocol'],
- c.params['connection'],
- c.params['action']
- );
- }
- );
- });
})();
diff --git a/src/views/tools/tools_firewall.ms b/src/views/tools/tools_firewall.ms
index a22ef665..c03c03d3 100644
--- a/src/views/tools/tools_firewall.ms
+++ b/src/views/tools/tools_firewall.ms
@@ -29,20 +29,20 @@
{{#if this.ipv4}}
- {{t 'close'}}
+ {{t 'close'}}
{{else}}
- {{t 'open'}}
+ {{t 'open'}}
{{/if}}
{{#if this.ipv6}}
- {{t 'close'}}
+ {{t 'close'}}
{{else}}
- {{t 'open'}}
+ {{t 'open'}}
{{/if}}
@@ -75,20 +75,20 @@
{{#if this.ipv4}}
- {{t 'close'}}
+ {{t 'close'}}
{{else}}
- {{t 'open'}}
+ {{t 'open'}}
{{/if}}
{{#if this.ipv6}}
- {{t 'close'}}
+ {{t 'close'}}
{{else}}
- {{t 'open'}}
+ {{t 'open'}}
{{/if}}
@@ -168,10 +168,10 @@
{{#if upnp}}
{{t 'upnp_enabled'}}
-
{{t 'disable'}}
+
{{t 'disable'}}
{{else}}
{{t 'upnp_disabled'}}
-
{{t 'enable'}}
+
{{t 'enable'}}
{{/if}}
From 1ba6fa9b1aee26750a10e17e7ae70f778c11bba9 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Fri, 18 Oct 2019 22:12:17 +0200
Subject: [PATCH 25/46] Mooooarr buttons (app info page)
---
src/js/yunohost/controllers/apps.js | 65 +++++++++++++++++------------
src/views/app/app_info.ms | 8 ++--
2 files changed, 42 insertions(+), 31 deletions(-)
diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js
index 870545d3..f7fc2edb 100644
--- a/src/js/yunohost/controllers/apps.js
+++ b/src/js/yunohost/controllers/apps.js
@@ -215,7 +215,36 @@
data.manifest.multi_instance = data.manifest.multi_instance ? y18n.t('yes') : y18n.t('no');
data.install_time = new Date(data.settings.install_time * 1000);
- c.view('app/app_info', data);
+ c.view('app/app_info', data, function() {
+
+ // Button to set the app as default
+ $('button[data-action="set-as-default"]').on("click", function() {
+ var app = $(this).data("app");
+ c.confirm(
+ y18n.t('applications'),
+ y18n.t('confirm_app_default'),
+ function() {
+ c.api('PUT', '/apps/'+app+'/default', {}, function() {
+ c.redirect_to('#/apps/'+ app, {slide:false});
+ });
+ }
+ );
+ });
+
+ // Button to uninstall the app
+ $('button[data-action="uninstall"]').on("click", function() {
+ var app = $(this).data("app");
+ c.confirm(
+ y18n.t('applications'),
+ y18n.t('confirm_uninstall', [app]),
+ function() {
+ c.api('DELETE', '/apps/'+ app, {}, function() {
+ c.redirect_to('#/apps');
+ });
+ }
+ );
+ });
+ });
});
});
@@ -226,6 +255,10 @@
});
});
+ //
+ // App actions
+ //
+
// Get app actions list
app.get('#/apps/:app/actions', function (c) {
c.api('GET', '/apps/'+c.params['app']+'/actions', {}, function(data) {
@@ -269,6 +302,10 @@
});
});
+ //
+ // App config panel
+ //
+
// Get app config panel
app.get('#/apps/:app/config-panel', function (c) {
c.api('GET', '/apps/'+c.params['app']+'/config-panel', {}, function(data) {
@@ -593,19 +630,6 @@
);
});
- // Remove installed app
- app.get('#/apps/:app/uninstall', function (c) {
- c.confirm(
- y18n.t('applications'),
- y18n.t('confirm_uninstall', [c.params['app']]),
- function() {
- c.api('DELETE', '/apps/'+ c.params['app'], {}, function() {
- c.redirect_to('#/apps');
- });
- }
- );
- });
-
// Manage app access
app.get('#/apps/:app/access', function (c) {
c.api('GET', '/apps/'+c.params['app']+'?raw', {}, function(data) {
@@ -729,19 +753,6 @@
);
});
- // Make app default
- app.get('#/apps/:app/default', function (c) {
- c.confirm(
- y18n.t('applications'),
- y18n.t('confirm_app_default'),
- function() {
- c.api('PUT', '/apps/'+c.params['app']+'/default', {}, function() {
- c.redirect_to('#/apps/'+ c.params['app'], {slide:false});
- });
- }
- );
- });
-
// Get app change label page
app.get('#/apps/:app/changelabel', function (c) {
c.api('GET', '/apps/'+c.params['app']+'?raw', {}, function(app_data) {
diff --git a/src/views/app/app_info.ms b/src/views/app/app_info.ms
index 4ccfa1dc..17a71c75 100644
--- a/src/views/app/app_info.ms
+++ b/src/views/app/app_info.ms
@@ -56,9 +56,9 @@
@@ -78,9 +78,9 @@
From 8f2c959cddda7d648e3363d614f6f6d7abed9013 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Fri, 18 Oct 2019 22:48:59 +0200
Subject: [PATCH 26/46] Introduce a refresh() function to simplify code / make
it more semantic
---
src/js/yunohost/controllers/apps.js | 10 ++----
src/js/yunohost/controllers/domains.js | 23 +++----------
src/js/yunohost/controllers/firewall.js | 46 ++++++++++---------------
src/js/yunohost/controllers/services.js | 12 ++-----
src/js/yunohost/controllers/tools.js | 43 +++++++++++------------
src/js/yunohost/helpers.js | 6 ++++
6 files changed, 56 insertions(+), 84 deletions(-)
diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js
index f7fc2edb..e3bf8432 100644
--- a/src/js/yunohost/controllers/apps.js
+++ b/src/js/yunohost/controllers/apps.js
@@ -223,11 +223,7 @@
c.confirm(
y18n.t('applications'),
y18n.t('confirm_app_default'),
- function() {
- c.api('PUT', '/apps/'+app+'/default', {}, function() {
- c.redirect_to('#/apps/'+ app, {slide:false});
- });
- }
+ function() { c.api('PUT', '/apps/'+app+'/default', {}, function() { c.refresh() }); }
);
});
@@ -584,7 +580,7 @@
}
else {
c.flash('warning', y18n.t('app_install_cancel'));
- c.redirect_to('#/apps/install', {slide: false});
+ c.refresh();
}
});
@@ -624,7 +620,7 @@
})
.fail(function(xhr) {
c.flash('fail', y18n.t('app_install_custom_no_manifest'));
- c.redirect_to('#/apps/install', {slide:false});
+ c.refresh();
});
}
);
diff --git a/src/js/yunohost/controllers/domains.js b/src/js/yunohost/controllers/domains.js
index d1ab6922..c6e5281c 100644
--- a/src/js/yunohost/controllers/domains.js
+++ b/src/js/yunohost/controllers/domains.js
@@ -100,21 +100,9 @@
y18n.t('domains'),
y18n.t('confirm_change_maindomain'),
function() {
- var params = {
- new_domain: c.params['domain']
- };
- c.api('PUT', '/domains/main', params, function(data) {
- c.redirect_to('#/domains');
- });
-
- // WTF ... why is this hack needed v_v
-
- // Wait 15s and refresh the page
- var refreshDomain = window.setTimeout(function(){
- c.redirect_to('#/domains');
- }, 15000);
+ c.api('PUT', '/domains/main', {new_domain: domain}, function() { c.refresh() });
}
- );
+ )
});
// Configure delete button
@@ -257,11 +245,8 @@
c.confirm(
y18n.t('certificate'),
y18n.t(confirm_key, [domain]),
- function(){
- c.api('POST', api_url, {}, function(data) {
- c.redirect_to('#/domains/'+domain+'/cert-management', {slide:false});
- });
- });
+ function(){ c.api('POST', api_url, {}, function() { c.refresh() }); }
+ );
});
});
});
diff --git a/src/js/yunohost/controllers/firewall.js b/src/js/yunohost/controllers/firewall.js
index f1055638..013d2511 100644
--- a/src/js/yunohost/controllers/firewall.js
+++ b/src/js/yunohost/controllers/firewall.js
@@ -54,11 +54,7 @@
y18n.t('firewall'),
// confirm_upnp_enable and confirm_upnp_disable
y18n.t('confirm_upnp_' + action),
- function(){
- c.api('GET', '/firewall/upnp', {action: action}, function(data) {
- c.redirect_to('#/tools/firewall');
- });
- }
+ function(){ c.api('GET', '/firewall/upnp', {action: action}, function() { c.refresh() }); }
);
});
});
@@ -90,7 +86,7 @@
if (port != parseInt(port) || port < 0 || port > 65535) {
c.flash('fail', y18n.t('unknown_argument', [port]));
- c.redirect_to('#/tools/firewall', {slide: false});
+ c.refresh();
}
switch (connection) {
@@ -122,29 +118,25 @@
break;
default:
c.flash('fail', y18n.t('unknown_action', [action]));
- c.redirect_to('#/tools/firewall', {slide: false});
+ c.refresh();
}
- if (method !== null && protocol !== null && port !== null) {
- // port:
- // protocol:
- // - UDP
- // - TCP
- // - Both
- // --ipv4-only:
- // --ipv6-only:
- // --no-upnp:
- var params = {
- port : port,
- protocol : protocol
- };
- c.api(method, '/firewall/port?'+endurl, params, function(data) {
- c.redirect_to('#/tools/firewall');
- });
- }
- else {
- c.redirect_to('#/tools/firewall');
- }
+ // port:
+ // protocol:
+ // - UDP
+ // - TCP
+ // - Both
+ // --ipv4-only:
+ // --ipv6-only:
+ // --no-upnp:
+ var params = {
+ port : port,
+ protocol : protocol
+ };
+
+ c.api(method, '/firewall/port?'+endurl, params, function() { c.refresh() });
+
+
return;
});
diff --git a/src/js/yunohost/controllers/services.js b/src/js/yunohost/controllers/services.js
index c81c43d4..113c34fc 100644
--- a/src/js/yunohost/controllers/services.js
+++ b/src/js/yunohost/controllers/services.js
@@ -94,17 +94,11 @@
break;
default:
c.flash('fail', y18n.t('unknown_action', [action]));
- c.redirect_to('#/services/'+ service, {slide: false});
+ c.refresh();
+ return;
}
- if (method && endurl) {
- c.api(method, '/services/'+ endurl, {}, function(data) {
- c.redirect_to('#/services/'+ service, {slide: false});
- });
- }
- else {
- c.redirect_to('#/services/'+ service, {slide: false});
- }
+ c.api(method, '/services/'+ endurl, {}, function() { c.refresh(); });
});
});
});
diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js
index 1daf691e..52c69133 100644
--- a/src/js/yunohost/controllers/tools.js
+++ b/src/js/yunohost/controllers/tools.js
@@ -26,22 +26,25 @@
});
if ($.isEmptyObject(params)) {
c.flash('fail', y18n.t('error_modify_something'));
- c.redirect_to('#/tools/adminpw', {slide: false});
- } else if (params['new_password'] !== params['confirm_new_password']) {
- c.flash('fail', y18n.t('passwords_dont_match'));
- c.redirect_to('#/tools/adminpw', {slide: false});
- } else {
- c.api('POST', '/login', { 'password': params['old_password'] }, function(data) {
- // Remove useless variable
- delete params['old_password'];
- delete params['confirm_new_password'];
-
- // Update password and redirect to the home
- c.api('PUT', '/adminpw', params, function(data) {
- c.redirect_to('#/logout');
- });
- }, undefined, false);
+ c.refresh();
+ return;
}
+ if (params['new_password'] !== params['confirm_new_password']) {
+ c.flash('fail', y18n.t('passwords_dont_match'));
+ c.refresh();
+ return;
+ }
+
+ c.api('POST', '/login', { 'password': params['old_password'] }, function(data) {
+ // Remove useless variable
+ delete params['old_password'];
+ delete params['confirm_new_password'];
+
+ // Update password and redirect to the home
+ c.api('PUT', '/adminpw', params, function(data) {
+ c.redirect_to('#/logout');
+ });
+ }, undefined, false);
});
// System update & upgrade
@@ -298,14 +301,12 @@
{
// FIXME / TODO i18n
c.flash('fail', "Some of these migrations require you to acknowledge a disclaimer before running them.");
- c.redirect_to('#/tools/migrations', {slide: false});
+ c.refresh();
return;
}
};
- c.api('POST', '/migrations/migrate?accept_disclaimer', {}, function (data) {
- c.redirect_to('#/tools/migrations', {slide: false});
- });
+ c.api('POST', '/migrations/migrate?accept_disclaimer', {}, function() { c.refresh(); });
});
// Configure buttons 'Skip'
@@ -315,9 +316,7 @@
y18n.t('migrations'),
y18n.t('confirm_migrations_skip'),
function(){
- c.api('POST', '/migrations/migrate?skip&targets=' + migration_id, {}, function(data) {
- c.redirect_to('#/tools/migrations', {slide: false});
- });
+ c.api('POST', '/migrations/migrate?skip&targets=' + migration_id, {}, function() { c.refresh() });
}
);
});
diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js
index e5756f72..a43aa396 100644
--- a/src/js/yunohost/helpers.js
+++ b/src/js/yunohost/helpers.js
@@ -588,7 +588,13 @@
c.app.last_location = c.path;
c.app.setLocation(destination);
c.app.trigger('location-changed');
+ },
+
+ refresh: function() {
+ c = this;
+ c.redirect_to(c.path, {slide: false});
}
+
});
})();
From 392a4de64a9309047382f67181ea2cf8de30026c Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Sat, 19 Oct 2019 03:09:13 +0200
Subject: [PATCH 27/46] Manipulate the loader pacman with semantic helpers
---
src/js/yunohost/controllers/apps.js | 2 --
src/js/yunohost/controllers/home.js | 15 ++++-------
src/js/yunohost/controllers/tools.js | 5 ++--
src/js/yunohost/events.js | 2 +-
src/js/yunohost/helpers.js | 40 +++++++++++++++++++---------
5 files changed, 35 insertions(+), 29 deletions(-)
diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js
index e3bf8432..b27c59c3 100644
--- a/src/js/yunohost/controllers/apps.js
+++ b/src/js/yunohost/controllers/apps.js
@@ -523,8 +523,6 @@
if ((is_safe_for_install_color === "warning") || (is_safe_for_install_color === "danger"))
{
- // Disable the pacman while we ask for confirmation
- $('div.loader').remove();
c.confirm(
y18n.t("applications"),
y18n.t("confirm_install_app_"+is_safe_for_install_color),
diff --git a/src/js/yunohost/controllers/home.js b/src/js/yunohost/controllers/home.js
index 54e201d6..d3361df6 100644
--- a/src/js/yunohost/controllers/home.js
+++ b/src/js/yunohost/controllers/home.js
@@ -24,20 +24,17 @@
$('#masthead').show()
.find('.logout-btn').hide();
store.set('path-1', '#/login');
- if ($('div.loader').length === 0) {
- $('#main').append('
');
- }
+
+ c.showLoader();
c.checkInstall(function(isInstalled) {
if (isInstalled) {
- // Remove loader
- $('div.loader').remove();
+ c.hideLoader();
// Pass domain to hide form field
c.view('login', { 'domain': window.location.hostname });
} else if (typeof isInstalled === 'undefined') {
if (app.isInstalledTry > 0) {
app.isInstalledTry--;
- app.loaded = false; // Show pacman
setTimeout(function() {
c.redirect('#/');
}, 5000);
@@ -56,12 +53,10 @@
$(document).off('ajaxError');
});
- // Remove pacman
- app.loaded = true;
- $('div.loader').remove();
+ c.hideLoader();
}
} else {
- $('div.loader').remove();
+ c.hideLoader();
c.redirect('#/postinstall');
}
});
diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js
index 52c69133..4e62c693 100644
--- a/src/js/yunohost/controllers/tools.js
+++ b/src/js/yunohost/controllers/tools.js
@@ -146,7 +146,7 @@
$('button[data-action="share"]').on("click", function() {
c.api('GET', '/logs/display?path='+$(this).data('log-id')+'&share', {},
function(data) {
- $('div.loader').remove();
+ c.hideLoader();
window.open(data.url, '_blank');
});
});
@@ -241,8 +241,7 @@
$('#main').replaceWith(' ' + y18n.t('tools_shuttingdown') + '
');
}
- // Remove loader if any
- $('div.loader').remove();
+ c.hideLoader();
// Force scrollTop on page load
$('html, body').scrollTop(0);
diff --git a/src/js/yunohost/events.js b/src/js/yunohost/events.js
index 28e121db..5cfb10c4 100644
--- a/src/js/yunohost/events.js
+++ b/src/js/yunohost/events.js
@@ -75,7 +75,7 @@
if (data.security["CVE-2017-5754"].vulnerable) {
c.flash('danger', y18n.t('meltdown'));
}
- $('div.loader').remove();
+ c.hideLoader();
});
});
});
diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js
index a43aa396..1617e371 100644
--- a/src/js/yunohost/helpers.js
+++ b/src/js/yunohost/helpers.js
@@ -133,10 +133,9 @@
if (window.navigator && window.navigator.language && (typeof data.locale === 'undefined')) {
data.locale = y18n.locale || window.navigator.language.substr(0, 2);
}
- app.loaded = false;
- if ($('div.loader').length === 0) {
- $('#main').append('
');
- }
+
+ c.showLoader();
+
call = function(uri, callback, method, data, callbackOnFailure) {
var args = data;
@@ -152,6 +151,10 @@
callbackOnFailure = function(xhr) {
// Postinstall is a custom case, we have to wait that
// operation is done before doing anything
+ //
+ // TODO / FIXME : maybe we should add this as a
+ // callbackonfailure during the actual api call instead
+ // of hard-coding it here...
if ((uri === '/postinstall') && (post_installing)) {
interval = window.location.hostname === args.domain ? 20000 : 5000;
checkInstall = setInterval(function () {
@@ -216,8 +219,7 @@
console.log(xhr);
}
- // Remove loader if any
- $('div.loader').remove();
+ c.hideLoader();
// Force scrollTop on page load
$('html, body').scrollTop(0);
@@ -285,10 +287,8 @@
callback = typeof callback !== 'undefined' ? callback : function() {};
enableSlide = (typeof enableSlide !== 'undefined') ? enableSlide : true; // Change to false to disable animation
- app.loaded = true;
-
// Hide loader and modal
- $('div.loader').remove();
+ c.hideLoader();
$('#modal').modal('hide');
// Render content
@@ -394,10 +394,14 @@
},
confirm: function(title, content, confirmCallback, cancelCallback) {
+ c = this;
+
// Default callbacks
confirmCallback = typeof confirmCallback !== 'undefined' ? confirmCallback : function() {};
cancelCallback = typeof cancelCallback !== 'undefined' ? cancelCallback : function() {};
+ c.hideLoader();
+
// Get modal element
var box = $('#modal');
@@ -436,6 +440,18 @@
return box.modal('show');
},
+ showLoader: function() {
+ app.loaded = false; // Not sure if that's really useful ... this is from old code with no explanation what it really does ...
+ if ($('div.loader').length === 0) {
+ $('#main').append('
');
+ }
+ },
+
+ hideLoader: function() {
+ app.loaded = true; // Not sure if that's really useful ... this is from old code with no explanation what it really does ...
+ $('div.loader').remove();
+ },
+
selectAllOrNone: function () {
// Remove active style from buttons
$(".select_all-none input").click(function(){ $(this).toggleClass("active"); });
@@ -545,8 +561,7 @@
// Get paste content element
var preElement = $($(this).data('paste-content'));
- // Add pacman loader
- $('#main').append('
');
+ c.showLoader();
// Send to paste.yunohost.org
$.ajax({
@@ -561,8 +576,7 @@
c.flash('fail', y18n.t('paste_error'));
})
.always(function(){
- // Remove pacman
- $('div.loader').remove();
+ c.hideLoader();
});
});
},
From 72b4e66a7fb72640a028b2449c6a1f2615dea9d6 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Sat, 19 Oct 2019 03:33:10 +0200
Subject: [PATCH 28/46] Simplify postinstall code...
---
src/js/yunohost/controllers/postinstall.js | 56 ++++++++++++----------
1 file changed, 32 insertions(+), 24 deletions(-)
diff --git a/src/js/yunohost/controllers/postinstall.js b/src/js/yunohost/controllers/postinstall.js
index b2c5cc05..6e99a520 100644
--- a/src/js/yunohost/controllers/postinstall.js
+++ b/src/js/yunohost/controllers/postinstall.js
@@ -68,35 +68,43 @@
// Execute post-installation
app.post('#/postinstall', function (c) {
- if (c.params['password'] === '' || c.params['confirmation'] === '') {
+
+ var password = c.params['password'];
+ var confirmation = c.params['confirmation'];
+ var domain = c.params['domain'].toLowerCase();
+
+ // Check password ain't empty
+ if (password === '' || confirmation === '') {
c.flash('fail', y18n.t('password_empty'));
+ return;
}
- else if (c.params['password'] == c.params['confirmation']) {
- if (c.params['domain'] === '') {
- c.flash('fail', y18n.t('error_select_domain'));
- c.redirect_to('#/postinstall/domain', {slide: false});
- } else {
- var params = {
- domain: c.params['domain'].toLowerCase()
- };
- }
- c.confirm(
- y18n.t('postinstall'),
- y18n.t('confirm_postinstall', [c.params['domain']]),
- function(){
- params.password = c.params['password'];
-
- store.set('url', window.location.hostname +'/yunohost/api');
- store.set('user', 'admin');
- c.api('POST', '/postinstall', params, function(data) {
- c.redirect_to('#/login');
- });
- }
- );
- } else {
+ // Check password matches confirmation
+ if (password !== confirmation) {
c.flash('fail', y18n.t('passwords_dont_match'));
+ return;
}
+
+ // Check domain ain't empty...
+ if (domain === '') {
+ c.flash('fail', y18n.t('error_select_domain'));
+ c.redirect_to('#/postinstall/domain', {slide: false});
+ return;
+ }
+
+ // Ask confirmation to the user
+ c.confirm(
+ y18n.t('postinstall'),
+ y18n.t('confirm_postinstall', [c.params['domain']]),
+ // Start the actual postinstall process
+ function(){
+ store.set('url', window.location.hostname +'/yunohost/api');
+ store.set('user', 'admin');
+ c.api('POST', '/postinstall', {domain: domain, password: password}, function() {
+ c.redirect_to('#/login');
+ });
+ }
+ );
});
})();
From e16e822a89f028e0dda42599b6d197e2cff920d5 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Sat, 19 Oct 2019 03:43:33 +0200
Subject: [PATCH 29/46] Simplify /login route code...
---
src/js/yunohost/controllers/home.js | 48 +++++++++++++----------------
1 file changed, 22 insertions(+), 26 deletions(-)
diff --git a/src/js/yunohost/controllers/home.js b/src/js/yunohost/controllers/home.js
index d3361df6..9038ed76 100644
--- a/src/js/yunohost/controllers/home.js
+++ b/src/js/yunohost/controllers/home.js
@@ -27,37 +27,33 @@
c.showLoader();
+ // We gonna retry 3 times to check if yunohost is installed
+ if (app.isInstalledTry === undefined) {
+ app.isInstalledTry = 3;
+ }
+
c.checkInstall(function(isInstalled) {
+
if (isInstalled) {
- c.hideLoader();
- // Pass domain to hide form field
c.view('login', { 'domain': window.location.hostname });
- } else if (typeof isInstalled === 'undefined') {
- if (app.isInstalledTry > 0) {
- app.isInstalledTry--;
- setTimeout(function() {
- c.redirect('#/');
- }, 5000);
- }
- else {
- // Reset count
- app.isInstalledTry = 3;
+ return;
+ }
- // API is not responding after 3 try
- $( document ).ajaxError(function( event, request, settings ) {
- // Display error if status != 200.
- // .ajaxError fire even with status code 200 because json is sometimes not valid.
- if (request.status !== 200) c.flash('fail', y18n.t('api_not_responding', [request.status+' '+request.statusText] ));
-
- // Unbind directly
- $(document).off('ajaxError');
- });
-
- c.hideLoader();
- }
- } else {
- c.hideLoader();
+ if (typeof isInstalled !== 'undefined') {
c.redirect('#/postinstall');
+ return;
+ }
+
+ // If the retry counter is still up, retry this function 5 sec
+ // later
+ if (app.isInstalledTry > 0) {
+ app.isInstalledTry--;
+ setTimeout(function() {
+ c.redirect('#/');
+ }, 5000);
+ }
+ else {
+ c.flash('fail', y18n.t('api_not_responding'));
}
});
});
From ca6c6358853c1bb5a09485db6032c820b565b73e Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Sat, 19 Oct 2019 03:44:33 +0200
Subject: [PATCH 30/46] Typo, gotta define c sooner
---
src/js/yunohost/helpers.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js
index 1617e371..519e6565 100644
--- a/src/js/yunohost/helpers.js
+++ b/src/js/yunohost/helpers.js
@@ -582,6 +582,7 @@
},
redirect_to: function(destination, options) {
+ c = this;
options = options !== undefined ? options : {};
@@ -593,7 +594,6 @@
store.clear('slide');
}
- c = this;
// This is a copy-pasta of some of the redirect/refresh code of
// sammy.js because for some reason calling the original
// redirect/refresh function in some context does not work >.>
From 071b343635b9b7fbaf742e4d0631cf815bf35a72 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Sat, 19 Oct 2019 03:52:35 +0200
Subject: [PATCH 31/46] Move this groupHook black magic closer to the backup
code where it's actually used...
---
src/js/yunohost/controllers/backup.js | 79 +++++++++++++++++++++++++--
src/js/yunohost/helpers.js | 69 -----------------------
2 files changed, 75 insertions(+), 73 deletions(-)
diff --git a/src/js/yunohost/controllers/backup.js b/src/js/yunohost/controllers/backup.js
index 0c97d740..4a4e2117 100644
--- a/src/js/yunohost/controllers/backup.js
+++ b/src/js/yunohost/controllers/backup.js
@@ -50,7 +50,7 @@
name:y18n.t('local_archives')
};
c.api('GET', '/hooks/backup', {}, function(hooks) {
- data['hooks'] = c.groupHooks(hooks['hooks']);
+ data['hooks'] = groupHooks(hooks['hooks']);
data['apps'] = {};
c.api('GET', '/apps?with_backup', {}, function(apps_list) {
data['apps'] = apps_list.apps;
@@ -61,7 +61,7 @@
app.post('#/backup/:storage', function (c) {
- var params = c.ungroupHooks(c.params['system_parts'],c.params['apps']);
+ var params = ungroupHooks(c.params['system_parts'],c.params['apps']);
c.api('POST', '/backup', params, function() {
c.redirect_to('#/backup/'+ c.params['storage']);
});
@@ -73,7 +73,7 @@
y18n.t('backup'),
y18n.t('confirm_restore', [c.params['archive']]),
$.proxy(function(c){
- var params = c.ungroupHooks(c.params['system_parts'],c.params['apps']);
+ var params = ungroupHooks(c.params['system_parts'],c.params['apps']);
params['force'] = '';
c.api('POST', '/backup/restore/'+c.params['archive'], params, function(data) {
c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive']);
@@ -121,7 +121,7 @@
};
data.other_storages = [];
data.name = c.params['archive'];
- data.system_parts = c.groupHooks(Object.keys(data['system']),data['system']);
+ data.system_parts = groupHooks(Object.keys(data['system']),data['system']);
data.items = (data['system']!={} || data['apps']!=[]);
data.locale = y18n.locale
c.view('backup/backup_info', data, c.selectAllOrNone);
@@ -146,4 +146,75 @@
});
});
+ function groupHooks(hooks, raw_infos) {
+ var data = {};
+ var rules = [
+ {
+ id:'configuration',
+ isIn:function (hook) {
+ return hook.indexOf('conf_')==0
+ }
+ }
+ ];
+
+ $.each(hooks, function(i, hook) {
+ var group_id=hook;
+ var hook_size=(raw_infos && raw_infos[hook] && raw_infos[hook].size)?raw_infos[hook].size:0;
+ $.each(rules, function(i, rule) {
+ if (rule.isIn(hook)) {
+ group_id = 'adminjs_group_'+rule.id;
+ return false;
+ }
+ });
+
+ if(group_id in data) {
+ data[group_id] = {
+ name:y18n.t('hook_'+group_id),
+ value:data[group_id].value+','+hook,
+ description:data[group_id].description+', '+y18n.t('hook_'+hook),
+ size:data[group_id].size + hook_size
+ };
+ }
+ else {
+ data[group_id] = {
+ name:y18n.t('hook_'+group_id),
+ value:hook,
+ description:(group_id==hook)?y18n.t('hook_'+hook+'_desc'):y18n.t('hook_'+hook),
+ size:hook_size
+ };
+ }
+ });
+ return data;
+ };
+
+ function ungroupHooks(system_parts, apps) {
+
+ var data = {};
+ data['apps'] = apps || [];
+ data['system'] = system_parts || [];
+
+ if (data['system'].constructor !== Array) {
+ data['system'] = [data['system']];
+ }
+ if (data['apps'].constructor !== Array) {
+ data['apps'] = [data['apps']];
+ }
+
+ // Some hook value contains multiple hooks separated by commas
+ var split_hooks = [];
+ $.each(data['system'], function(i, hook) {
+ split_hooks = split_hooks.concat(hook.split(','));
+ });
+ data['system'] = split_hooks;
+
+ if (data['system'].length == 0) {
+ delete data['system'];
+ }
+ if (data['apps'].length == 0) {
+ delete data['apps'];
+ }
+ return data;
+ };
+
+
})();
diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js
index 519e6565..dc15ca49 100644
--- a/src/js/yunohost/helpers.js
+++ b/src/js/yunohost/helpers.js
@@ -485,75 +485,6 @@
});
},
- groupHooks: function(hooks, raw_infos){
- var data = {};
- var rules = [
- {
- id:'configuration',
- isIn:function (hook) {
- return hook.indexOf('conf_')==0
- }
- }
- ];
-
- $.each(hooks, function(i, hook) {
- var group_id=hook;
- var hook_size=(raw_infos && raw_infos[hook] && raw_infos[hook].size)?raw_infos[hook].size:0;
- $.each(rules, function(i, rule) {
- if (rule.isIn(hook)) {
- group_id = 'adminjs_group_'+rule.id;
- return false;
- }
- });
-
- if(group_id in data) {
- data[group_id] = {
- name:y18n.t('hook_'+group_id),
- value:data[group_id].value+','+hook,
- description:data[group_id].description+', '+y18n.t('hook_'+hook),
- size:data[group_id].size + hook_size
- };
- }
- else {
- data[group_id] = {
- name:y18n.t('hook_'+group_id),
- value:hook,
- description:(group_id==hook)?y18n.t('hook_'+hook+'_desc'):y18n.t('hook_'+hook),
- size:hook_size
- };
- }
- });
- return data;
- },
-
- ungroupHooks: function(system_parts,apps) {
- var data = {};
- data['apps'] = apps || [];
- data['system'] = system_parts || [];
-
- if (data['system'].constructor !== Array) {
- data['system'] = [data['system']];
- }
- if (data['apps'].constructor !== Array) {
- data['apps'] = [data['apps']];
- }
-
- // Some hook value contains multiple hooks separated by commas
- var split_hooks = [];
- $.each(data['system'], function(i, hook) {
- split_hooks = split_hooks.concat(hook.split(','));
- });
- data['system'] = split_hooks;
-
- if (data['system'].length == 0) {
- delete data['system'];
- }
- if (data['apps'].length == 0) {
- delete data['apps'];
- }
- return data;
- },
-
// Paste
prePaste: function() {
var pasteButtons = $('button[data-paste-content],a[data-paste-content]');
From 1347589eec3eca8f18d59a2d9b180bdf0cc4c68e Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Sat, 19 Oct 2019 04:01:50 +0200
Subject: [PATCH 32/46] Reorganize helpers order
---
src/js/yunohost/helpers.js | 269 ++++++++++++++++++++-----------------
1 file changed, 143 insertions(+), 126 deletions(-)
diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js
index dc15ca49..d329831c 100644
--- a/src/js/yunohost/helpers.js
+++ b/src/js/yunohost/helpers.js
@@ -49,14 +49,20 @@
*/
app.helpers({
- // Serialize an object
- serialize : function(obj) {
- var str = [];
- for(var p in obj)
- if (obj.hasOwnProperty(p)) {
- str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
+ //
+ // Pacman loader management
+ //
+
+ showLoader: function() {
+ app.loaded = false; // Not sure if that's really useful ... this is from old code with no explanation what it really does ...
+ if ($('div.loader').length === 0) {
+ $('#main').append('
');
}
- return str.join("&");
+ },
+
+ hideLoader: function() {
+ app.loaded = true; // Not sure if that's really useful ... this is from old code with no explanation what it really does ...
+ $('div.loader').remove();
},
// Flash helper to diplay instant notifications
@@ -279,6 +285,56 @@
},
+
+ // Ask confirmation to the user through the modal window
+ confirm: function(title, content, confirmCallback, cancelCallback) {
+ c = this;
+
+ // Default callbacks
+ confirmCallback = typeof confirmCallback !== 'undefined' ? confirmCallback : function() {};
+ cancelCallback = typeof cancelCallback !== 'undefined' ? cancelCallback : function() {};
+
+ c.hideLoader();
+
+ // Get modal element
+ var box = $('#modal');
+
+ // Modal title
+ if (typeof title === 'string' && title.length) {
+ $('.title', box).html(title);
+ }
+ else {
+ box.addClass('no-title');
+ }
+
+ // Modal content
+ $('.content', box).html(content);
+
+ // Handle buttons
+ $('footer button', box)
+ .click(function(e){
+ e.preventDefault();
+
+ $('#modal footer button').unbind( "click" );
+ // Reset & Hide modal
+ box
+ .removeClass('no-title')
+ .modal('hide');
+
+ // Do corresponding callback
+ if ($(this).data('modal-action') == 'confirm') {
+ confirmCallback();
+ }
+ else {
+ cancelCallback();
+ }
+ });
+
+ // Show modal
+ return box.modal('show');
+ },
+
+
// Render view (cross-browser)
view: function (view, data, callback, enableSlide) {
c = this;
@@ -393,125 +449,6 @@
}
},
- confirm: function(title, content, confirmCallback, cancelCallback) {
- c = this;
-
- // Default callbacks
- confirmCallback = typeof confirmCallback !== 'undefined' ? confirmCallback : function() {};
- cancelCallback = typeof cancelCallback !== 'undefined' ? cancelCallback : function() {};
-
- c.hideLoader();
-
- // Get modal element
- var box = $('#modal');
-
- // Modal title
- if (typeof title === 'string' && title.length) {
- $('.title', box).html(title);
- }
- else {
- box.addClass('no-title');
- }
-
- // Modal content
- $('.content', box).html(content);
-
- // Handle buttons
- $('footer button', box)
- .click(function(e){
- e.preventDefault();
-
- $('#modal footer button').unbind( "click" );
- // Reset & Hide modal
- box
- .removeClass('no-title')
- .modal('hide');
-
- // Do corresponding callback
- if ($(this).data('modal-action') == 'confirm') {
- confirmCallback();
- }
- else {
- cancelCallback();
- }
- });
-
- // Show modal
- return box.modal('show');
- },
-
- showLoader: function() {
- app.loaded = false; // Not sure if that's really useful ... this is from old code with no explanation what it really does ...
- if ($('div.loader').length === 0) {
- $('#main').append('
');
- }
- },
-
- hideLoader: function() {
- app.loaded = true; // Not sure if that's really useful ... this is from old code with no explanation what it really does ...
- $('div.loader').remove();
- },
-
- selectAllOrNone: function () {
- // Remove active style from buttons
- $(".select_all-none input").click(function(){ $(this).toggleClass("active"); });
- // Select all checkbox in this panel
- $(".select_all").click(function(){
- $(this).parents(".panel").children(".list-group").find("input").prop("checked", true);
- });
- // Deselect all checkbox in this panel
- $(".select_none").click(function(){
- $(this).parents(".panel").children(".list-group").find("input").prop("checked", false);
- });
- },
-
- arraySortById: function(arr) {
- arr.sort(function(a, b){
- if (a.id > b.id) {
- return 1;
- }
- else if (a.id < b.id) {
- return -1;
- }
- return 0;
- });
- },
-
- arrayDiff: function(arr1, arr2) {
- arr1 = arr1 || [];
- arr2 = arr2 || [];
- return arr1.filter(function (a) {
- return ((arr2.indexOf(a) == -1) && (a !== ""));
- });
- },
-
- // Paste
- prePaste: function() {
- var pasteButtons = $('button[data-paste-content],a[data-paste-content]');
- pasteButtons.on('click', function(){
- // Get paste content element
- var preElement = $($(this).data('paste-content'));
-
- c.showLoader();
-
- // Send to paste.yunohost.org
- $.ajax({
- type: "POST",
- url: 'https://paste.yunohost.org/documents',
- data: preElement.text(),
- })
- .success(function(data, textStatus, jqXHR) {
- window.open('https://paste.yunohost.org/' + data.key, '_blank');
- })
- .fail(function() {
- c.flash('fail', y18n.t('paste_error'));
- })
- .always(function(){
- c.hideLoader();
- });
- });
- },
-
redirect_to: function(destination, options) {
c = this;
@@ -538,6 +475,86 @@
refresh: function() {
c = this;
c.redirect_to(c.path, {slide: false});
+ },
+
+ //
+ // Array / object helpers
+ //
+
+ arraySortById: function(arr) {
+ arr.sort(function(a, b){
+ if (a.id > b.id) {
+ return 1;
+ }
+ else if (a.id < b.id) {
+ return -1;
+ }
+ return 0;
+ });
+ },
+
+ arrayDiff: function(arr1, arr2) {
+ arr1 = arr1 || [];
+ arr2 = arr2 || [];
+ return arr1.filter(function (a) {
+ return ((arr2.indexOf(a) == -1) && (a !== ""));
+ });
+ },
+
+ // Serialize an object
+ serialize : function(obj) {
+ var str = [];
+ for(var p in obj)
+ if (obj.hasOwnProperty(p)) {
+ str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
+ }
+ return str.join("&");
+ },
+
+
+ //
+ // Misc helpers used in views etc..
+ //
+
+ selectAllOrNone: function () {
+ // Remove active style from buttons
+ $(".select_all-none input").click(function(){ $(this).toggleClass("active"); });
+ // Select all checkbox in this panel
+ $(".select_all").click(function(){
+ $(this).parents(".panel").children(".list-group").find("input").prop("checked", true);
+ });
+ // Deselect all checkbox in this panel
+ $(".select_none").click(function(){
+ $(this).parents(".panel").children(".list-group").find("input").prop("checked", false);
+ });
+ },
+
+
+ // Paste
+ prePaste: function() {
+ var pasteButtons = $('button[data-paste-content],a[data-paste-content]');
+ pasteButtons.on('click', function(){
+ // Get paste content element
+ var preElement = $($(this).data('paste-content'));
+
+ c.showLoader();
+
+ // Send to paste.yunohost.org
+ $.ajax({
+ type: "POST",
+ url: 'https://paste.yunohost.org/documents',
+ data: preElement.text(),
+ })
+ .success(function(data, textStatus, jqXHR) {
+ window.open('https://paste.yunohost.org/' + data.key, '_blank');
+ })
+ .fail(function() {
+ c.flash('fail', y18n.t('paste_error'));
+ })
+ .always(function(){
+ c.hideLoader();
+ });
+ });
}
});
From 79fc66558c06baf8d921a4f5ae0ba6ba78282e5d Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Sat, 19 Oct 2019 04:20:41 +0200
Subject: [PATCH 33/46] We don't need all that custom madness for the
postinstall ...
---
src/js/yunohost/controllers/postinstall.js | 1 +
src/js/yunohost/helpers.js | 135 ++++++++-------------
2 files changed, 54 insertions(+), 82 deletions(-)
diff --git a/src/js/yunohost/controllers/postinstall.js b/src/js/yunohost/controllers/postinstall.js
index 6e99a520..b356844d 100644
--- a/src/js/yunohost/controllers/postinstall.js
+++ b/src/js/yunohost/controllers/postinstall.js
@@ -101,6 +101,7 @@
store.set('url', window.location.hostname +'/yunohost/api');
store.set('user', 'admin');
c.api('POST', '/postinstall', {domain: domain, password: password}, function() {
+ c.flash('success', y18n.t('installation_complete'));
c.redirect_to('#/login');
});
}
diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js
index d329831c..5256d624 100644
--- a/src/js/yunohost/helpers.js
+++ b/src/js/yunohost/helpers.js
@@ -144,93 +144,64 @@
call = function(uri, callback, method, data, callbackOnFailure) {
- var args = data;
- // TODO: change this code
- if (uri === '/postinstall') {
- var post_installing = false;
- setInterval(function () {
- post_installing = true;
- }, 1500);
- }
-
+ // Define default callback for failures
if (typeof callbackOnFailure !== 'function') {
callbackOnFailure = function(xhr) {
- // Postinstall is a custom case, we have to wait that
- // operation is done before doing anything
- //
- // TODO / FIXME : maybe we should add this as a
- // callbackonfailure during the actual api call instead
- // of hard-coding it here...
- if ((uri === '/postinstall') && (post_installing)) {
- interval = window.location.hostname === args.domain ? 20000 : 5000;
- checkInstall = setInterval(function () {
- c.checkInstall(function(isInstalled) {
- if (isInstalled || typeof isInstalled === 'undefined') {
- c.flash('success', y18n.t('installation_complete'));
- clearInterval(checkInstall);
- window.location.href = 'https://'+ window.location.hostname +'/yunohost/admin/';
- }
- });
- }, interval);
+ if (xhr.status == 200) {
+ // Fail with 200, WTF
+ callback({});
}
- // Regular errors
+ // Unauthorized or wrong password
+ else if (xhr.status == 401) {
+ if (uri === '/login') {
+ c.flash('fail', y18n.t('wrong_password'));
+ } else {
+ c.flash('fail', y18n.t('unauthorized'));
+ c.redirect('#/login');
+ }
+ }
+ // 500
+ else if (xhr.status == 500) {
+ try {
+ error_log = JSON.parse(xhr.responseText);
+ error_log.route = error_log.route.join(' ') + '\n';
+ error_log.arguments = JSON.stringify(error_log.arguments);
+ }
+ catch (e)
+ {
+ error_log = {};
+ error_log.route = "Failed to parse route";
+ error_log.arguments = "Failed to parse arguments";
+ error_log.traceback = xhr.responseText;
+ }
+ c.flash('fail', y18n.t('internal_exception', [error_log.route, error_log.arguments, error_log.traceback]));
+ }
+ // 502 Bad gateway means API is down
+ else if (xhr.status == 502) {
+ c.flash('fail', y18n.t('api_not_responding'));
+ }
+ // More verbose error messages first
+ else if (typeof xhr.responseText !== 'undefined') {
+ c.flash('fail', xhr.responseText);
+ }
+ // 0 mean "the connexion has been closed" apparently
+ else if (xhr.status == 0) {
+ var errorMessage = xhr.status+' '+xhr.statusText;
+ c.flash('fail', y18n.t('error_connection_interrupted', [errorMessage]));
+ console.log(xhr);
+ }
+ // Return HTTP error code at least
else {
- if (xhr.status == 200) {
- // Fail with 200, WTF
- callback({});
- }
- // Unauthorized or wrong password
- else if (xhr.status == 401) {
- if (uri === '/login') {
- c.flash('fail', y18n.t('wrong_password'));
- } else {
- c.flash('fail', y18n.t('unauthorized'));
- c.redirect('#/login');
- }
- }
- // 500
- else if (xhr.status == 500) {
- try {
- error_log = JSON.parse(xhr.responseText);
- error_log.route = error_log.route.join(' ') + '\n';
- error_log.arguments = JSON.stringify(error_log.arguments);
- }
- catch (e)
- {
- error_log = {};
- error_log.route = "Failed to parse route";
- error_log.arguments = "Failed to parse arguments";
- error_log.traceback = xhr.responseText;
- }
- c.flash('fail', y18n.t('internal_exception', [error_log.route, error_log.arguments, error_log.traceback]));
- }
- // 502 Bad gateway means API is down
- else if (xhr.status == 502) {
- c.flash('fail', y18n.t('api_not_responding'));
- }
- // More verbose error messages first
- else if (typeof xhr.responseText !== 'undefined') {
- c.flash('fail', xhr.responseText);
- }
- // 0 mean "the connexion has been closed" apparently
- else if (xhr.status == 0) {
- var errorMessage = xhr.status+' '+xhr.statusText;
- c.flash('fail', y18n.t('error_connection_interrupted', [errorMessage]));
- console.log(xhr);
- }
- // Return HTTP error code at least
- else {
- var errorMessage = xhr.status+' '+xhr.statusText;
- c.flash('fail', y18n.t('error_server_unexpected', [errorMessage]));
- console.log(xhr);
- }
-
- c.hideLoader();
-
- // Force scrollTop on page load
- $('html, body').scrollTop(0);
- store.clear('slide');
+ var errorMessage = xhr.status+' '+xhr.statusText;
+ c.flash('fail', y18n.t('error_server_unexpected', [errorMessage]));
+ console.log(xhr);
}
+
+ c.hideLoader();
+
+ // Force scrollTop on page load
+ $('html, body').scrollTop(0);
+ store.clear('slide');
};
}
From 787204b178a988d72f0ff41f2526a7ad5adf6f8a Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Sat, 19 Oct 2019 05:09:07 +0200
Subject: [PATCH 34/46] Fix the sliders again ... which in turns is a much
better fix for the postinstall buggy sliders, and also now we don't really
need to be able to diable slider anymore ...
---
src/js/yunohost/controllers/postinstall.js | 6 +--
src/js/yunohost/helpers.js | 50 +++++++++++++---------
2 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/src/js/yunohost/controllers/postinstall.js b/src/js/yunohost/controllers/postinstall.js
index b356844d..d8fc96a7 100644
--- a/src/js/yunohost/controllers/postinstall.js
+++ b/src/js/yunohost/controllers/postinstall.js
@@ -50,7 +50,7 @@
}
store.set('maindomain', domain);
});
- }, false); // We disable enableSlide because that causes some issues with accordion when using the 'previous' button
+ });
});
});
@@ -60,9 +60,7 @@
if (!store.get('maindomain')) {
c.redirect_to('#/postinstall/domain');
} else {
- c.view('postinstall/postinstall_3', { 'domain': store.get('maindomain').toLowerCase() },
- function() { },
- false); // We disable enableSlide because that causes some issues with accordion when using the 'previous' button
+ c.view('postinstall/postinstall_3', { 'domain': store.get('maindomain').toLowerCase() });
}
});
diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js
index 5256d624..0ba638e2 100644
--- a/src/js/yunohost/helpers.js
+++ b/src/js/yunohost/helpers.js
@@ -29,19 +29,17 @@
$('#slider-container').addClass('notransition');
// Delete the left/right temporary stuff only used during animation
$('#slideTo').css('display', 'none');
+ $('#slideTo').html("");
$('#slideBack').css('display', 'none');
+ $('#slideBack').html("");
// Set the margin-left back to 0
$('#slider-container').css('margin-left', '0');
// c.f. the stackoverflow thread
$('#slider-container')[0].offsetHeight;
// Remove the binding to this event handler for next times
- //$("#slider-container").off(transitionEvent);
// Re-enable transition effects
$('#slider-container').removeClass('notransition');
}
- // Now we add the transition event to detect the end of the transition effect
- transitionEvent && $("#slider-container").on(transitionEvent, resetSliders)
-
/**
* Helpers
@@ -307,12 +305,11 @@
// Render view (cross-browser)
- view: function (view, data, callback, enableSlide) {
+ view: function (view, data, callback) {
c = this;
// Default
callback = typeof callback !== 'undefined' ? callback : function() {};
- enableSlide = (typeof enableSlide !== 'undefined') ? enableSlide : true; // Change to false to disable animation
// Hide loader and modal
c.hideLoader();
@@ -324,17 +321,17 @@
// Update content helper
var leSwap = function() {
rendered.swap(function() {
- // Slide direction
- if (enableSlide) {
- $('.slide, .btn-breadcrumb a:not(:last-child)').on('click', function() {
- $(this).addClass('active');
- if ($(this).hasClass('back') || $(this).parent('.btn-breadcrumb').length) {
- store.set('slide', 'back');
- } else {
- store.set('slide', 'to');
- }
- });
- }
+ // Clicking on those kind of CSS elements will trigger a
+ // slide effect i.e. the next view rendering will have
+ // store.get('slide') set to 'back' or 'to'
+ $('.slide, .btn-breadcrumb a:not(:last-child)').on('click', function() {
+ $(this).addClass('active');
+ if ($(this).hasClass('back') || $(this).parent('.btn-breadcrumb').length) {
+ store.set('slide', 'back');
+ } else {
+ store.set('slide', 'to');
+ }
+ });
// Paste helper
c.prePaste();
@@ -348,7 +345,7 @@
};
// Slide back effect
- if (enableSlide && store.get('slide') == 'back') {
+ if (store.get('slide') == 'back') {
store.clear('slide');
// Disable transition while we tweak CSS
@@ -378,12 +375,18 @@
// Re-add transition effect
$('#slider-container').removeClass('notransition');
+
+ // add the transition event to detect the end of the transition effect
+ transitionEvent
+ && $("#slider-container").off(transitionEvent)
+ && $("#slider-container").on(transitionEvent, resetSliders);
+
// And actually play the transition effect that will move the container from left to right
$('#slider-container').css('margin-left', '0px');
}
// Slide to effect
- else if (enableSlide && store.get('slide') == 'to') {
- store.clear('slide');
+ else if (store.get('slide') == 'to') {
+
// Disable transition while we tweak CSS
$('#slider-container').addClass('notransition');
// "Delete" the right part of the slider
@@ -411,6 +414,13 @@
// Re-add transition effect
$('#slider-container').removeClass('notransition');
+
+ // add the transition event to detect the end of the transition effect
+ var transitionEvent = whichTransitionEvent();
+ transitionEvent
+ && $("#slider-container").off(transitionEvent)
+ && $("#slider-container").on(transitionEvent, resetSliders);
+
// And actually play the transition effect that will move the container from right to left
$('#slider-container').css('margin-left', '-100%');
}
From 49bd488e5e8f65623e64d18042ea23550b090e1e Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Sat, 19 Oct 2019 05:26:05 +0200
Subject: [PATCH 35/46] Improve message when API is not responding?
---
src/locales/en.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/locales/en.json b/src/locales/en.json
index cd0d4c4b..a4a70211 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -7,7 +7,7 @@
"administration_password": "Administration password",
"allowed_users": "Allowed users",
"all_apps": "All apps",
- "api_not_responding": "API is not responding",
+ "api_not_responding": "The YunoHost API is not responding. Maybe 'yunohost-api' is down or got restarted?",
"app_access": "Access",
"app_access_addall_btn": "Enable access to all",
"app_access_addall_desc": "All existing users will have access to %s.",
From 7ea2f37b89598b87cd462c98211b3d624cb19a38 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Tue, 29 Oct 2019 20:19:53 +0100
Subject: [PATCH 36/46] Moooaaar button (user delete)
---
src/js/yunohost/controllers/users.js | 76 ++++++++++++++--------------
src/locales/en.json | 2 +-
src/views/user/user_info.ms | 2 +-
3 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/src/js/yunohost/controllers/users.js b/src/js/yunohost/controllers/users.js
index e66aa2c0..abcd04ae 100644
--- a/src/js/yunohost/controllers/users.js
+++ b/src/js/yunohost/controllers/users.js
@@ -63,7 +63,44 @@
// Show user information
app.get('#/users/:user', function (c) {
c.api('GET', '/users/'+ c.params['user'], {}, function(data) {
- c.view('user/user_info', data);
+ c.view('user/user_info', data, function() {
+
+ // Configure delete button behavior
+ $('button[data-action="delete"]').on("click", function() {
+ var user = $(this).data("user");
+
+ var params = {};
+
+ // make confirm content
+ var purgeCheckbox = ' '+ y18n.t('purge_user_data_checkbox', [user]) +'
';
+ var purgeAlertMessage = '⚠ '+ y18n.t('purge_user_data_warning') +'
';
+ var confirmModalContent = $(''+ y18n.t('confirm_delete', [user]) +' '+ purgeCheckbox +' '+ purgeAlertMessage +'
');
+
+ // display confirm modal
+ c.confirm(
+ y18n.t('users'),
+ confirmModalContent,
+ function(){
+ c.api('DELETE', '/users/'+ user, params, function(data) {
+ c.redirect_to('#/users');
+ });
+ }
+ );
+
+ // toggle purge warning and parameter
+ confirmModalContent.find("input").click(function(){
+
+ if (confirmModalContent.find("input").is(':checked')) {
+ params.purge = "";
+ confirmModalContent.find(".danger").show();
+ }
+ else {
+ delete params.purge;
+ confirmModalContent.find(".danger").hide();
+ };
+ });
+ });
+ });
});
});
@@ -188,41 +225,4 @@
}, 'GET');
});
- // Remove existing user
- app.get('#/users/:user/delete', function (c) {
-
- var params = {};
-
- // make confirm content
- var purgeCheckbox = ' '+ y18n.t('purge_user_data_checkbox', [c.params['user']]) +'
';
- var purgeAlertMessage = '⚠ '+ y18n.t('purge_user_data_warning') +'
';
- var confirmModalContent = $(''+ y18n.t('confirm_delete', [c.params['user']]) +' '+ purgeCheckbox +' '+ purgeAlertMessage +'
');
-
- // display confirm modal
- c.confirm(
- y18n.t('users'),
- confirmModalContent,
- function(){
- c.api('DELETE', '/users/'+ c.params['user'], params, function(data) {
- c.redirect_to('#/users');
- });
- }
- );
-
- // toggle purge warning and parameter
- confirmModalContent.find("input").click(function(){
-
- if (confirmModalContent.find("input").is(':checked')) {
- params.purge = "";
- confirmModalContent.find(".warning").show();
- }
- else {
- delete params.purge;
- confirmModalContent.find(".warning").hide();
- };
-
- });
-
- });
-
})();
diff --git a/src/locales/en.json b/src/locales/en.json
index a4a70211..13cc943a 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -428,6 +428,6 @@
"appslists_last_update": "Last update",
"appslists_unknown_list": "Unknown apps list: %s",
"name": "Name",
- "purge_user_data_checkbox": "Purge %s's data? (This will remove the content of it's home and mail directories.)",
+ "purge_user_data_checkbox": "Purge %s's data? (This will remove the content of its home and mail directories.)",
"purge_user_data_warning": "Purging user's data is not reversible. Be sure you know what you're doing!"
}
diff --git a/src/views/user/user_info.ms b/src/views/user/user_info.ms
index ccca3788..7262aa89 100644
--- a/src/views/user/user_info.ms
+++ b/src/views/user/user_info.ms
@@ -62,7 +62,7 @@
{{t 'user_username_edit' username}}
- {{t 'delete'}}
+ {{t 'delete'}}
From 4f544de332d5e9b8b699cd09f97aa011ebdd2b51 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Tue, 29 Oct 2019 20:39:01 +0100
Subject: [PATCH 37/46] This code is commented / not useful for now ... we'll
see when this is actually implemented.
---
src/js/yunohost/controllers/backup.js | 94 ++++++++++-----------------
src/views/backup/backup.ms | 6 --
src/views/backup/backup_info.ms | 30 ---------
src/views/backup/storage_create.ms | 52 ---------------
4 files changed, 33 insertions(+), 149 deletions(-)
delete mode 100644 src/views/backup/storage_create.ms
diff --git a/src/js/yunohost/controllers/backup.js b/src/js/yunohost/controllers/backup.js
index 4a4e2117..7c0001dc 100644
--- a/src/js/yunohost/controllers/backup.js
+++ b/src/js/yunohost/controllers/backup.js
@@ -32,17 +32,25 @@
c.view('backup/backup', {'storages':storages});
});
- // Storage list
- app.get('#/storages/create', function (c) {
- c.view('backup/storage_create', {});
+ // Archive list
+ app.get('#/backup/:storage', function (c) {
+ c.api('GET', '/backup/archives?with_info', {}, function(data) {
+ data.storage = {
+ id: 'local',
+ name: y18n.t('local_archives')
+ };
+ data.archives2 = [];
+ $.each(data['archives'], function(name, info) {
+ info.name = name;
+ data.archives2.unshift(info)
+ });
+ data.archives = data.archives2;
+ data.locale = y18n.locale
+ c.view('backup/backup_list', data);
+ });
});
- // Create a storage
- app.post('#/storages', function (c) {
- c.redirect_to('#/storages');
- });
-
- // Create a backup
+ // View to create a backup
app.get('#/backup/:storage/create', function (c) {
var data = [];
data['storage'] = {
@@ -59,7 +67,7 @@
});
});
-
+ // Actually creating the backup
app.post('#/backup/:storage', function (c) {
var params = ungroupHooks(c.params['system_parts'],c.params['apps']);
c.api('POST', '/backup', params, function() {
@@ -67,6 +75,21 @@
});
});
+ // Get archive info
+ app.get('#/backup/:storage/:archive', function (c) {
+ c.api('GET', '/backup/archives/'+c.params['archive']+'?with_details', {}, function(data) {
+ data.storage = {
+ id: c.params['storage'],
+ name: y18n.t('local_archives')
+ };
+ data.name = c.params['archive'];
+ data.system_parts = groupHooks(Object.keys(data['system']),data['system']);
+ data.items = (data['system']!={} || data['apps']!=[]);
+ data.locale = y18n.locale;
+ c.view('backup/backup_info', data, c.selectAllOrNone);
+ });
+ });
+
// Restore a backup
app.post('#/backup/:storage/:archive/restore', function (c) {
c.confirm(
@@ -95,57 +118,6 @@
);
});
- // Download a backup
- app.get('#/backup/:storage/:archive/download', function (c) {
- c.api('GET', '/backup/'+c.params['archive']+'/download', {}, function(data) {
- c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false});
- });
- });
-
- // Copy a backup
- app.get('#/backup/:storage/:archive/copy', function (c) {
- c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false});
- });
-
- // Upload a backup
- app.get('#/backup/:storage/:archive/upload', function (c) {
- c.redirect_to('#/backup/'+ c.params['storage']+'/'+c.params['archive'], {slide: false});
- });
-
- // Get archive info
- app.get('#/backup/:storage/:archive', function (c) {
- c.api('GET', '/backup/archives/'+c.params['archive']+'?with_details', {}, function(data) {
- data.storage = {
- id: c.params['storage'],
- name: y18n.t('local_archives')
- };
- data.other_storages = [];
- data.name = c.params['archive'];
- data.system_parts = groupHooks(Object.keys(data['system']),data['system']);
- data.items = (data['system']!={} || data['apps']!=[]);
- data.locale = y18n.locale
- c.view('backup/backup_info', data, c.selectAllOrNone);
- });
- });
-
- // Archive list
- app.get('#/backup/:storage', function (c) {
- c.api('GET', '/backup/archives?with_info', {}, function(data) {
- data.storage = {
- id: 'local',
- name: y18n.t('local_archives')
- };
- data.archives2 = [];
- $.each(data['archives'], function(name, info) {
- info.name = name;
- data.archives2.unshift(info)
- });
- data.archives = data.archives2;
- data.locale = y18n.locale
- c.view('backup/backup_list', data);
- });
- });
-
function groupHooks(hooks, raw_infos) {
var data = {};
var rules = [
diff --git a/src/views/backup/backup.ms b/src/views/backup/backup.ms
index 4da53a75..e4bd4b0c 100644
--- a/src/views/backup/backup.ms
+++ b/src/views/backup/backup.ms
@@ -3,12 +3,6 @@
{{t 'backup'}}
-
-
-
-
diff --git a/src/views/backup/backup_info.ms b/src/views/backup/backup_info.ms
index ae42c67a..6cf5fb44 100644
--- a/src/views/backup/backup_info.ms
+++ b/src/views/backup/backup_info.ms
@@ -83,41 +83,11 @@
-
- {{#if other_storages}}
-
-
-
{{t 'backup_archive_copy'}}
-
-
- {{/if}}
diff --git a/src/views/backup/storage_create.ms b/src/views/backup/storage_create.ms
deleted file mode 100644
index bc07a003..00000000
--- a/src/views/backup/storage_create.ms
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
-
From b49621f0cadc07bb54e853610cfb4607b1c46acf Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Tue, 29 Oct 2019 21:03:10 +0100
Subject: [PATCH 38/46] Moar buttons (backup delete)
---
src/js/yunohost/controllers/backup.js | 33 +++++++++++++++------------
src/views/backup/backup_info.ms | 4 ++--
2 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/src/js/yunohost/controllers/backup.js b/src/js/yunohost/controllers/backup.js
index 7c0001dc..1eaf5777 100644
--- a/src/js/yunohost/controllers/backup.js
+++ b/src/js/yunohost/controllers/backup.js
@@ -86,7 +86,25 @@
data.system_parts = groupHooks(Object.keys(data['system']),data['system']);
data.items = (data['system']!={} || data['apps']!=[]);
data.locale = y18n.locale;
- c.view('backup/backup_info', data, c.selectAllOrNone);
+ c.view('backup/backup_info', data, function() {
+
+ c.selectAllOrNone();
+
+ // Delete button
+ $('button[data-action="delete"]').on('click', function() {
+ var storage = $(this).data('storage');
+ var archive = $(this).data('archive');
+ c.confirm(
+ y18n.t('backup'),
+ y18n.t('confirm_delete', [archive]),
+ function(){
+ c.api('DELETE', '/backup/archives/'+archive, {}, function(data) {
+ c.redirect_to('#/backup/'+ storage);
+ });
+ }
+ );
+ });
+ });
});
});
@@ -105,19 +123,6 @@
);
});
- // Delete a backup
- app.get('#/backup/:storage/:archive/delete', function (c) {
- c.confirm(
- y18n.t('backup'),
- y18n.t('confirm_delete', [c.params['archive']]),
- function(){
- c.api('DELETE', '/backup/archives/'+c.params['archive'], {}, function(data) {
- c.redirect_to('#/backup/'+ c.params['storage']);
- });
- }
- );
- });
-
function groupHooks(hooks, raw_infos) {
var data = {};
var rules = [
diff --git a/src/views/backup/backup_info.ms b/src/views/backup/backup_info.ms
index 6cf5fb44..117558a7 100644
--- a/src/views/backup/backup_info.ms
+++ b/src/views/backup/backup_info.ms
@@ -85,9 +85,9 @@
From 44c27a5d386e5b5b1e1e54d1cd11e7af4b962032 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Tue, 29 Oct 2019 21:26:12 +0100
Subject: [PATCH 39/46] No need to define a custom helper for selectAllOrNone,
have this directly in backup's controllers
---
src/js/yunohost/controllers/backup.js | 29 +++++++++++++++++++++++++--
src/js/yunohost/helpers.js | 14 -------------
2 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/src/js/yunohost/controllers/backup.js b/src/js/yunohost/controllers/backup.js
index 1eaf5777..42a5d455 100644
--- a/src/js/yunohost/controllers/backup.js
+++ b/src/js/yunohost/controllers/backup.js
@@ -62,7 +62,21 @@
data['apps'] = {};
c.api('GET', '/apps?with_backup', {}, function(apps_list) {
data['apps'] = apps_list.apps;
- c.view('backup/backup_create', data, c.selectAllOrNone);
+ c.view('backup/backup_create', data, function() {
+
+ // Configure buttons "select all" and "select none"
+
+ // Remove active style from buttons
+ $(".select_all-none input").click(function(){ $(this).toggleClass("active"); });
+ // Select all checkbox in this panel
+ $(".select_all").click(function(){
+ $(this).parents(".panel").children(".list-group").find("input").prop("checked", true);
+ });
+ // Deselect all checkbox in this panel
+ $(".select_none").click(function(){
+ $(this).parents(".panel").children(".list-group").find("input").prop("checked", false);
+ });
+ });
});
});
});
@@ -88,7 +102,18 @@
data.locale = y18n.locale;
c.view('backup/backup_info', data, function() {
- c.selectAllOrNone();
+ // Configure buttons "select all" and "select none"
+
+ // Remove active style from buttons
+ $(".select_all-none input").click(function(){ $(this).toggleClass("active"); });
+ // Select all checkbox in this panel
+ $(".select_all").click(function(){
+ $(this).parents(".panel").children(".list-group").find("input").prop("checked", true);
+ });
+ // Deselect all checkbox in this panel
+ $(".select_none").click(function(){
+ $(this).parents(".panel").children(".list-group").find("input").prop("checked", false);
+ });
// Delete button
$('button[data-action="delete"]').on('click', function() {
diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js
index 0ba638e2..0798820a 100644
--- a/src/js/yunohost/helpers.js
+++ b/src/js/yunohost/helpers.js
@@ -497,20 +497,6 @@
// Misc helpers used in views etc..
//
- selectAllOrNone: function () {
- // Remove active style from buttons
- $(".select_all-none input").click(function(){ $(this).toggleClass("active"); });
- // Select all checkbox in this panel
- $(".select_all").click(function(){
- $(this).parents(".panel").children(".list-group").find("input").prop("checked", true);
- });
- // Deselect all checkbox in this panel
- $(".select_none").click(function(){
- $(this).parents(".panel").children(".list-group").find("input").prop("checked", false);
- });
- },
-
-
// Paste
prePaste: function() {
var pasteButtons = $('button[data-paste-content],a[data-paste-content]');
From 73c57c71f23585524f82d65e8266540d01f81c75 Mon Sep 17 00:00:00 2001
From: Alexandre Aubin
Date: Fri, 1 Nov 2019 20:42:12 +0100
Subject: [PATCH 40/46] Remove app debug button, follow-up of corresponding PR
on yunohost core
---
src/js/yunohost/controllers/apps.js | 7 ------
src/locales/en.json | 2 --
src/views/app/app_debug.ms | 39 -----------------------------
src/views/app/app_info.ms | 7 ------
4 files changed, 55 deletions(-)
delete mode 100644 src/views/app/app_debug.ms
diff --git a/src/js/yunohost/controllers/apps.js b/src/js/yunohost/controllers/apps.js
index 3bff1be4..a9694ae0 100644
--- a/src/js/yunohost/controllers/apps.js
+++ b/src/js/yunohost/controllers/apps.js
@@ -222,13 +222,6 @@
});
});
- // Get app debug page
- app.get('#/apps/:app/debug', function (c) {
- c.api('/apps/'+c.params['app']+'/debug', function(data) {
- c.view('app/app_debug', data);
- });
- });
-
// Get app actions list
app.get('#/apps/:app/actions', function (c) {
c.api('/apps/'+c.params['app']+'/actions', function(data) {
diff --git a/src/locales/en.json b/src/locales/en.json
index f6c5c577..3ce01cd2 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -9,8 +9,6 @@
"api_not_responding": "The YunoHost API is not responding. Maybe 'yunohost-api' is down or got restarted?",
"app_change_label": "Change Label",
"app_change_url": "Change URL",
- "app_debug_no_logs": "Application's logs are not available",
- "app_debug_tab": "Display debug information",
"app_info_access_desc": "Groups / users currently allowed to access this app:",
"app_info_changelabel_desc": "Change app label in the portal.",
"app_info_debug_desc": "Display debugging information for this application.",
diff --git a/src/views/app/app_debug.ms b/src/views/app/app_debug.ms
deleted file mode 100644
index d233f1be..00000000
--- a/src/views/app/app_debug.ms
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-{{#if services}}
-
-{{#services}}
-
-
-
-
- {{#logs}}
-
{{file_name}}
-
{{file_content}}
-
{{t 'upload'}}
- {{/logs}}
-
-
-
-{{/services}}
-
-
-{{else}}
-
-
- {{t 'app_debug_no_logs'}}
-
-{{/if}}
diff --git a/src/views/app/app_info.ms b/src/views/app/app_info.ms
index 53525c05..8d46c7ca 100644
--- a/src/views/app/app_info.ms
+++ b/src/views/app/app_info.ms
@@ -83,13 +83,6 @@
{{t 'uninstall'}}
-
-
{{load_tooltips}}
From 2b95f435206e597d5833b1d14232bfe2a48d08d5 Mon Sep 17 00:00:00 2001
From: xaloc33
Date: Sun, 3 Nov 2019 22:28:27 +0000
Subject: [PATCH 41/46] Translated using Weblate (Catalan)
Currently translated at 100.0% (423 of 423 strings)
Translation: YunoHost/admin
Translate-URL: https://translate.yunohost.org/projects/yunohost/admin/ca/
---
src/locales/ca.json | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/locales/ca.json b/src/locales/ca.json
index e9d0a8de..edd9af72 100644
--- a/src/locales/ca.json
+++ b/src/locales/ca.json
@@ -18,7 +18,7 @@
"app_change_url": "Canvia l'URL",
"app_debug_no_logs": "Els registres de l'aplicació no estan disponibles",
"app_debug_tab": "Mostra la informació de depuració",
- "app_info_access_desc": "Administrar l'accés d'usuaris. Usuaris permesos: %s",
+ "app_info_access_desc": "Grups / usuaris autoritzats actualment a accedir a aquesta aplicació:",
"app_info_changelabel_desc": "Canvia l'etiqueta de l'aplicació al portal.",
"app_info_debug_desc": "Mostrar la informació de depuració per aquesta aplicació.",
"app_info_default_desc": "Redirigeix l'arrel del domini a aquesta aplicació (%s).",
@@ -437,5 +437,20 @@
"request_help": "ajuda necessària",
"request_help_details": "El desenvolupador actual necessita ajuda per mantenir aquesta aplicació. Podeu contribuir-hi!",
"advanced": "Avançat",
- "from_to": "de %s fins a %s"
+ "from_to": "de %s fins a %s",
+ "group": "Grup",
+ "group_name": "Nom del grup",
+ "group_all_users": "Tots els usuaris",
+ "group_visitors": "Visitants",
+ "group_format_name_help": "Podeu utilitzar caràcters alfanumèrics i l'espai",
+ "group_add_member": "Afegir usuari",
+ "group_explain_all_users": "Aquest és un grup especial que conté tots els comptes d'usuari del servidor",
+ "group_add_permission": "Afegir permís",
+ "group_new": "Nou grup",
+ "group_explain_visitors": "Aquest és un grup especial que representa els visitants anònims",
+ "group_specific_permissions": "Permisos específics de l'usuari",
+ "groups_and_permissions": "Grups i permisos",
+ "groups_and_permissions_manage": "Gestionar grups i usuaris",
+ "permissions": "Permisos",
+ "nobody": "Ningú"
}
From 01bcbdad68a513a84405a64065f20320d927042d Mon Sep 17 00:00:00 2001
From: advocatux
Date: Fri, 1 Nov 2019 09:06:23 +0000
Subject: [PATCH 42/46] Translated using Weblate (Spanish)
Currently translated at 100.0% (423 of 423 strings)
Translation: YunoHost/admin
Translate-URL: https://translate.yunohost.org/projects/yunohost/admin/es/
---
src/locales/es.json | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/locales/es.json b/src/locales/es.json
index 99a4f2cb..e543f4b0 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -14,7 +14,7 @@
"app_access_title": "Acceso %s 4",
"app_debug_no_logs": "Los registros de la aplicación no están disponibles",
"app_debug_tab": "Mostrar información de depuración",
- "app_info_access_desc": "Administrar el acceso de usuarios. Usuarios permitidos: %s 5",
+ "app_info_access_desc": "Grupos / usuarios actualmente autorizados a acceder a esta aplicación:",
"app_info_debug_desc": "Mostrar información de depuración para esta aplicación.",
"app_info_default_desc": "Redirigir la raíz del dominio para esta aplicación (%s 6).",
"app_info_uninstall_desc": "Eliminar a esta aplicación.",
@@ -440,5 +440,20 @@
"appslists_confirm_remove": "¿Seguro que quiere eliminar esta lista de aplicaciones?",
"level": "nivel",
"system_upgrade_all_applications_btn": "Actualizar todas las aplicaciones",
- "select_all": "Seleccionar todo"
+ "select_all": "Seleccionar todo",
+ "group_explain_all_users": "Este es un grupo especial que contiene todas las cuentas de usuarios en el servidor",
+ "group": "Grupo",
+ "group_name": "Nombre del grupo",
+ "group_all_users": "Todos los usuarios",
+ "group_visitors": "Visitantes",
+ "group_format_name_help": "Puede usar caracteres alfanuméricos y espacio",
+ "group_add_member": "Añadir un usuario",
+ "group_add_permission": "Añadir permiso",
+ "group_new": "Nuevo grupo",
+ "group_explain_visitors": "Este es un grupo especial que representa a los visitantes anónimos",
+ "group_specific_permissions": "Permisos específicos de usuario",
+ "groups_and_permissions": "Grupos y permisos",
+ "groups_and_permissions_manage": "Gestionar grupos y permisos",
+ "permissions": "Permisos",
+ "nobody": "Nadie"
}
From ae84b8aadd1ef7fcbcec93673c125367524a2769 Mon Sep 17 00:00:00 2001
From: amirale qt
Date: Tue, 5 Nov 2019 07:15:43 +0000
Subject: [PATCH 43/46] Translated using Weblate (Esperanto)
Currently translated at 100.0% (384 of 384 strings)
Translation: YunoHost/admin
Translate-URL: https://translate.yunohost.org/projects/yunohost/admin/eo/
---
src/locales/eo.json | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/locales/eo.json b/src/locales/eo.json
index 98d15947..9457a628 100644
--- a/src/locales/eo.json
+++ b/src/locales/eo.json
@@ -124,7 +124,7 @@
"domain_dns_config": "Agordo DNS",
"cpu_load": "CPU Ŝarĝo",
"form_input_example": "Ekzemplo: %s",
- "app_info_access_desc": "Administri la aliron de uzanto. Permesitaj uzantoj : %s",
+ "app_info_access_desc": "Grupoj/uzantoj nuntempe rajtas aliri ĉi tiun programon:",
"diagnosis_with_private": "Diagnozo kun privataj datumoj",
"install_name": "Instalu %s",
"domain_default": "Defaŭlta domajno",
@@ -425,5 +425,20 @@
"name": "Nomo",
"udp": "UDP",
"swap": "Interŝanĝu",
- "user_interface_link": "Uzantinterfaco"
+ "user_interface_link": "Uzantinterfaco",
+ "group_format_name_help": "Vi povas uzi alfa-numerikajn signojn kaj spacon",
+ "group_add_member": "Aldonu uzanton",
+ "group": "Grupo",
+ "group_name": "Grupo nomo",
+ "group_all_users": "Ĉiuj uzantoj",
+ "groups_and_permissions": "Grupoj kaj permesoj",
+ "groups_and_permissions_manage": "Administri grupojn kaj permesojn",
+ "group_visitors": "Vizitantoj",
+ "group_explain_all_users": "Jen speciala grupo enhavanta ĉiujn uzantajn kontojn en la servilo",
+ "group_add_permission": "Aldonu permeson",
+ "group_new": "Nova grupo",
+ "group_explain_visitors": "Ĉi tio estas speciala grupo reprezentanta anonimajn vizitantojn",
+ "group_specific_permissions": "Uzaj specifaj permesoj",
+ "permissions": "Permesoj",
+ "nobody": "Neniu"
}
From 5d1c32701c4bdc8ed53e5ece9fb9c2f36dae38c9 Mon Sep 17 00:00:00 2001
From: amirale qt
Date: Tue, 5 Nov 2019 07:09:05 +0000
Subject: [PATCH 44/46] Translated using Weblate (French)
Currently translated at 100.0% (384 of 384 strings)
Translation: YunoHost/admin
Translate-URL: https://translate.yunohost.org/projects/yunohost/admin/fr/
---
src/locales/fr.json | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/locales/fr.json b/src/locales/fr.json
index 3b0964ba..fb4550c4 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -14,7 +14,7 @@
"app_access_title": "Accès à %s",
"app_debug_no_logs": "Les journaux de cette application ne sont pas disponibles",
"app_debug_tab": "Afficher les informations de débogage",
- "app_info_access_desc": "Gestion des droits d'accès. Utilisateurs autorisés : %s",
+ "app_info_access_desc": "Groupes / utilisateurs actuellement autorisés à accéder à cette application :",
"app_info_debug_desc": "Afficher les informations de débogage pour cette application.",
"app_info_default_desc": "Redirige la racine du domaine vers cette application (%s).",
"app_info_uninstall_desc": "Supprimer cette application.",
@@ -444,5 +444,20 @@
"request_help": "besoin d'assistance",
"request_help_details": "Le responsable actuel aimerait de l'aide pour la maintenance de cette application. N'hésitez pas à y contribuer !",
"advanced": "Avancée",
- "from_to": "de %s à %s"
+ "from_to": "de %s à %s",
+ "group_name": "Nom du groupe",
+ "nobody": "Personne",
+ "group": "Groupe",
+ "group_all_users": "Tous les utilisateurs",
+ "group_visitors": "Visiteurs",
+ "group_format_name_help": "Vous pouvez utiliser des caractères alphanumériques et des espaces",
+ "group_add_member": "Ajouter un utilisateur",
+ "group_add_permission": "Ajouter une permission",
+ "group_new": "Nouveau groupe",
+ "group_explain_all_users": "Ceci est un groupe spécial contenant tous les comptes d'utilisateurs sur le serveur",
+ "group_explain_visitors": "Ceci est un groupe spécial représentant les visiteurs anonymes",
+ "group_specific_permissions": "Autorisations spécifiques à l'utilisateur",
+ "groups_and_permissions": "Groupes et autorisations",
+ "groups_and_permissions_manage": "Gérer les groupes et les autorisations",
+ "permissions": "Permissions"
}
From 06c721cea15228aa65a8622fb110a1e946a4fe5d Mon Sep 17 00:00:00 2001
From: amirale qt
Date: Tue, 5 Nov 2019 07:21:59 +0000
Subject: [PATCH 45/46] Translated using Weblate (Basque)
Currently translated at 1.0% (4 of 384 strings)
Translation: YunoHost/admin
Translate-URL: https://translate.yunohost.org/projects/yunohost/admin/eu/
---
src/locales/eu.json | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/locales/eu.json b/src/locales/eu.json
index 0967ef42..74824cde 100644
--- a/src/locales/eu.json
+++ b/src/locales/eu.json
@@ -1 +1,6 @@
-{}
+{
+ "password": "Pasahitza",
+ "ok": "Ados",
+ "cancel": "Utzi",
+ "logged_out": "Saioa amaitu"
+}
From 2f26421110a5fe0cde295ea83738d21337fc6887 Mon Sep 17 00:00:00 2001
From: amirale qt
Date: Tue, 5 Nov 2019 09:08:29 +0000
Subject: [PATCH 46/46] Translated using Weblate (Turkish)
Currently translated at 17.2% (66 of 384 strings)
Translation: YunoHost/admin
Translate-URL: https://translate.yunohost.org/projects/yunohost/admin/tr/
---
src/locales/tr.json | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/locales/tr.json b/src/locales/tr.json
index e50ea99e..696dcc83 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -3,7 +3,7 @@
"administration_password": "Yönetici parolası",
"api_not_responding": "API cevap vermiyor",
"both": "İkisi birden",
- "cancel": "İptal et",
+ "cancel": "İptal etmek",
"close": "Kapat",
"confirm_access_add": "%s için bütünn kullanıcılara erişim vermek istediğinizden emin misiniz ?",
"confirm_access_remove_all": "%s'e bütün erişimleri kaldırmak istediğinizden emin misiniz ?",
@@ -70,5 +70,6 @@
"url": "URL",
"warning_first_user": "Büyük ihtimalle önce kullanıcı oluşturmanız gerekiyor.",
"wrong_password": "Yanlış parola",
- "yes": "Evet"
+ "yes": "Evet",
+ "ok": "Tamam"
}