mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
[enh] Switch to modal confirmation for postinstall, firewall and tools.
This commit is contained in:
parent
7f42fc03e9
commit
c4d488b87c
3 changed files with 81 additions and 89 deletions
168
js/app.js
168
js/app.js
|
@ -633,15 +633,21 @@ app = Sammy('#main', function (sam) {
|
||||||
params = { 'domain': c.params['domain'] }
|
params = { 'domain': c.params['domain'] }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (confirm(y18n.t('confirm_postinstall', [c.params['domain']]))) {
|
c.confirm(
|
||||||
params['password'] = c.params['password']
|
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('url', window.location.hostname +'/yunohost/api');
|
||||||
store.set('user', 'admin');
|
store.set('user', 'admin');
|
||||||
c.api('/postinstall', function(data) { // http://api.yunohost.org/#!/tools/tools_postinstall_post_0
|
c.api('/postinstall', function(data) { // http://api.yunohost.org/#!/tools/tools_postinstall_post_0
|
||||||
c.redirect('#/login');
|
c.redirect('#/login');
|
||||||
}, 'POST', params);
|
}, 'POST', params);
|
||||||
}
|
},
|
||||||
|
function(){
|
||||||
|
}
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
c.flash('fail', y18n.t('passwords_dont_match'));
|
c.flash('fail', y18n.t('passwords_dont_match'));
|
||||||
}
|
}
|
||||||
|
@ -1402,42 +1408,6 @@ app = Sammy('#main', function (sam) {
|
||||||
c.redirect('#/services/'+ c.params['service']);
|
c.redirect('#/services/'+ c.params['service']);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
/*
|
|
||||||
if (confirm(y18n.t('confirm_service_action', [y18n.t(c.params['action']), c.params['service']]))) {
|
|
||||||
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']]));
|
|
||||||
store.clear('slide');
|
|
||||||
c.redirect('#/services/'+ c.params['service']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (method && endurl) {
|
|
||||||
c.api('/services/'+ endurl, function(data) {
|
|
||||||
store.clear('slide');
|
|
||||||
c.redirect('#/services/'+ c.params['service']);
|
|
||||||
}, method);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
store.clear('slide');
|
|
||||||
c.redirect('#/services/'+ c.params['service']);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -1474,17 +1444,21 @@ app = Sammy('#main', function (sam) {
|
||||||
|
|
||||||
// Enable/Disable UPnP
|
// Enable/Disable UPnP
|
||||||
sam.get('#/firewall/upnp/:action', function (c) {
|
sam.get('#/firewall/upnp/:action', function (c) {
|
||||||
if (confirm(y18n.t('confirm_upnp_action', [y18n.t(c.params['action'])] ))) {
|
c.confirm(
|
||||||
params = {'action' : c.params['action']}
|
y18n.t('firewall'),
|
||||||
c.api('/firewall/upnp', function(data) {
|
y18n.t('confirm_upnp_action', [y18n.t(c.params['action'])]),
|
||||||
|
function(){
|
||||||
|
params = {'action' : c.params['action']}
|
||||||
|
c.api('/firewall/upnp', function(data) {
|
||||||
|
store.clear('slide');
|
||||||
|
c.redirect('#/firewall');
|
||||||
|
}, 'GET', params);
|
||||||
|
},
|
||||||
|
function(){
|
||||||
store.clear('slide');
|
store.clear('slide');
|
||||||
c.redirect('#/firewall');
|
c.redirect('#/firewall');
|
||||||
}, 'GET', params);
|
}
|
||||||
}
|
);
|
||||||
else {
|
|
||||||
store.clear('slide');
|
|
||||||
c.redirect('#/firewall');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Toggle port status helper (available in every controller)
|
// Toggle port status helper (available in every controller)
|
||||||
|
@ -1560,34 +1534,42 @@ app = Sammy('#main', function (sam) {
|
||||||
// Update port status from direct link
|
// Update port status from direct link
|
||||||
// #/firewall/port/{{@key}}/tcp/ipv4/close
|
// #/firewall/port/{{@key}}/tcp/ipv4/close
|
||||||
sam.get('#/firewall/port/:port/:protocol/:connection/:action', function (c) {
|
sam.get('#/firewall/port/:port/:protocol/:connection/:action', function (c) {
|
||||||
if (confirm(y18n.t('confirm_firewall', [ y18n.t(c.params['action']), c.params['port'], y18n.t(c.params['protocol']), y18n.t(c.params['connection']) ]))) {
|
c.confirm(
|
||||||
c.togglePort(
|
y18n.t('firewall'),
|
||||||
c.params['port'],
|
y18n.t( 'confirm_firewall', [ y18n.t(c.params['action']), c.params['port'], y18n.t(c.params['protocol']), y18n.t(c.params['connection'])]),
|
||||||
c.params['protocol'],
|
function(){
|
||||||
c.params['connection'],
|
c.togglePort(
|
||||||
c.params['action']
|
c.params['port'],
|
||||||
);
|
c.params['protocol'],
|
||||||
}
|
c.params['connection'],
|
||||||
else {
|
c.params['action']
|
||||||
store.clear('slide');
|
);
|
||||||
c.redirect('#/firewall');
|
},
|
||||||
}
|
function(){
|
||||||
|
store.clear('slide');
|
||||||
|
c.redirect('#/firewall');
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update port status from form
|
// Update port status from form
|
||||||
sam.post('#/firewall/port', function (c) {
|
sam.post('#/firewall/port', function (c) {
|
||||||
if (confirm(y18n.t('confirm_firewall', [ y18n.t(c.params['action']), c.params['port'], y18n.t(c.params['protocol']), y18n.t(c.params['connection']) ]))) {
|
c.confirm(
|
||||||
c.togglePort(
|
y18n.t('firewall'),
|
||||||
c.params['port'],
|
y18n.t('confirm_firewall', [ y18n.t(c.params['action']), c.params['port'], y18n.t(c.params['protocol']), y18n.t(c.params['connection']) ]),
|
||||||
c.params['protocol'],
|
function(){
|
||||||
c.params['connection'],
|
c.togglePort(
|
||||||
c.params['action']
|
c.params['port'],
|
||||||
);
|
c.params['protocol'],
|
||||||
}
|
c.params['connection'],
|
||||||
else {
|
c.params['action']
|
||||||
store.clear('slide');
|
);
|
||||||
c.redirect('#/firewall');
|
},
|
||||||
}
|
function(){
|
||||||
|
store.clear('slide');
|
||||||
|
c.redirect('#/firewall');
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -1696,19 +1678,27 @@ app = Sammy('#main', function (sam) {
|
||||||
store.clear('slide');
|
store.clear('slide');
|
||||||
c.redirect('#/tools/update');
|
c.redirect('#/tools/update');
|
||||||
}
|
}
|
||||||
else if (confirm(y18n.t('confirm_update_type', [y18n.t('system_'+c.params['type']).toLowerCase()]))) {
|
else {
|
||||||
endurl = '';
|
c.confirm(
|
||||||
if (c.params['type'] == 'packages') {endurl = 'ignore_apps';}
|
y18n.t('tools'),
|
||||||
else if (c.params['type'] == 'apps') {endurl = 'ignore_packages';}
|
y18n.t('confirm_update_type', [y18n.t('system_'+c.params['type']).toLowerCase()]),
|
||||||
|
function(){
|
||||||
|
endurl = '';
|
||||||
|
if (c.params['type'] == 'packages') {endurl = 'ignore_apps';}
|
||||||
|
else if (c.params['type'] == 'apps') {endurl = 'ignore_packages';}
|
||||||
|
|
||||||
c.api('/upgrade?'+endurl, function(data) {
|
c.api('/upgrade?'+endurl, function(data) {
|
||||||
// 'log' is a reserved name, maybe in handlebars
|
// 'log' is a reserved name, maybe in handlebars
|
||||||
data.logs = data.log;
|
data.logs = data.log;
|
||||||
c.view('tools/tools_upgrade', data);
|
c.view('tools/tools_upgrade', data);
|
||||||
}, 'PUT');
|
}, 'PUT');
|
||||||
} else {
|
|
||||||
store.clear('slide');
|
},
|
||||||
c.redirect('#/tools/update');
|
function(){
|
||||||
|
store.clear('slide');
|
||||||
|
c.redirect('#/tools/update');
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
"confirm_service_action" : "Are you sure you want to %s %s ?",
|
"confirm_service_action" : "Are you sure you want to %s %s ?",
|
||||||
"confirm_update_type" : "Are you sure you want update every %s ?",
|
"confirm_update_type" : "Are you sure you want update every %s ?",
|
||||||
|
|
||||||
|
"postinstall" : "Post-installation",
|
||||||
"postinstall_intro_1" : "Congratulations! YunoHost has been successfully installed.",
|
"postinstall_intro_1" : "Congratulations! YunoHost has been successfully installed.",
|
||||||
"postinstall_intro_2" : "Two more configuration steps are required to activate the services of your server.",
|
"postinstall_intro_2" : "Two more configuration steps are required to activate the services of your server.",
|
||||||
"postinstall_intro_3" : "You can obtain more information by visiting the <a href='//yunohost.org/postinstall' target='_blank'>appropriate documentation page</a>",
|
"postinstall_intro_3" : "You can obtain more information by visiting the <a href='//yunohost.org/postinstall' target='_blank'>appropriate documentation page</a>",
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
"confirm_service_action" : "Êtes-vous sur de vouloir %s %s ?",
|
"confirm_service_action" : "Êtes-vous sur de vouloir %s %s ?",
|
||||||
"confirm_update_type" : "Êtes-vous sur de vouloir mettre à jour tous les %s ?",
|
"confirm_update_type" : "Êtes-vous sur de vouloir mettre à jour tous les %s ?",
|
||||||
|
|
||||||
|
"postinstall" : "Post-installation",
|
||||||
"postinstall_intro_1" : "Félicitations ! YunoHost a été installé avec succès.",
|
"postinstall_intro_1" : "Félicitations ! YunoHost a été installé avec succès.",
|
||||||
"postinstall_intro_2" : "Deux étapes de configuration supplémentaires sont nécessaires pour activer les services de votre serveur.",
|
"postinstall_intro_2" : "Deux étapes de configuration supplémentaires sont nécessaires pour activer les services de votre serveur.",
|
||||||
"postinstall_intro_3" : "Vous pouvez obtenir plus d'informations en vous rendant sur <a href='//yunohost.org/postinstall_fr' target='_blank'>la page de documentation appropriée</a>.",
|
"postinstall_intro_3" : "Vous pouvez obtenir plus d'informations en vous rendant sur <a href='//yunohost.org/postinstall_fr' target='_blank'>la page de documentation appropriée</a>.",
|
||||||
|
|
Loading…
Add table
Reference in a new issue