mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Handle run/skip actions
This commit is contained in:
parent
263ac4e804
commit
de5be0fd58
3 changed files with 64 additions and 9 deletions
|
@ -95,7 +95,7 @@
|
|||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Upgrade a specific apps
|
||||
app.get('#/upgrade/apps/:app', function (c) {
|
||||
c.confirm(
|
||||
|
@ -197,15 +197,15 @@
|
|||
c.redirect('#/logout');
|
||||
}, 'PUT', {}, false, function (xhr) {
|
||||
c.flash('success', y18n.t('tools_' + action + '_done'))
|
||||
// Disconnect from the webadmin
|
||||
// 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
|
||||
// We can't use template because now the webserver is off
|
||||
if (action == 'reboot') {
|
||||
$('#main').replaceWith('<div id="main"><div class="alert alert-warning"><i class="fa-refresh"></i> ' + y18n.t('tools_rebooting') + '</div></div>');
|
||||
}
|
||||
|
@ -252,11 +252,8 @@
|
|||
|
||||
// Reboot or shutdown button
|
||||
app.get('#/tools/migrations', function (c) {
|
||||
console.log("test");
|
||||
c.api('/migrations?pending', function(pending_migrations) {
|
||||
c.api('/migrations?done', function(done_migrations) {
|
||||
console.log(pending_migrations);
|
||||
console.log(done_migrations);
|
||||
c.view('tools/tools_migrations', {
|
||||
'pending_migrations' : pending_migrations.migrations.reverse(),
|
||||
'done_migrations' : done_migrations.migrations.reverse()
|
||||
|
@ -265,5 +262,62 @@
|
|||
});
|
||||
});
|
||||
|
||||
app.get('#/tools/migrations/run', function (c) {
|
||||
c.api('/migrations?pending', function(pending_migrations) {
|
||||
var disclaimers = [];
|
||||
var migrationsLength = pending_migrations.length;
|
||||
for(var i = 0; i < migrationsLength; i++) {
|
||||
if (pending_migrations[i].disclaimer)
|
||||
{
|
||||
disclaimers.push(pending_migrations[i].disclaimer);
|
||||
console.log("Disclaimer found !");
|
||||
}
|
||||
};
|
||||
console.log(disclaimers);
|
||||
if (disclaimers.length)
|
||||
{
|
||||
c.confirm(
|
||||
y18n.t('migrations'),
|
||||
disclaimers.join('<hr>'),
|
||||
function(){
|
||||
c.api('/migrations/migrate?accept-disclaimer',
|
||||
function (data) {
|
||||
store.clear('slide');
|
||||
c.redirect('#/tools/migrations');
|
||||
}, 'POST')
|
||||
},
|
||||
function(){
|
||||
store.clear('slide');
|
||||
c.redirect('#/tools/migrations');
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
c.api('/migrations/migrate',
|
||||
function (data) {
|
||||
store.clear('slide');
|
||||
c.redirect('#/tools/migrations');
|
||||
}, 'POST')
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
app.get('#/tools/migrations/skip', function (c) {
|
||||
c.confirm(
|
||||
y18n.t('migrations'),
|
||||
y18n.t('confirm_migrations_skip'),
|
||||
function(){
|
||||
c.api('/migrations/migrate?skip', function(data) {
|
||||
store.clear('slide');
|
||||
c.redirect('#/tools/migrations');
|
||||
}, 'POST');
|
||||
},
|
||||
function(){
|
||||
store.clear('slide');
|
||||
c.redirect('#/tools/migrations');
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
"confirm_firewall_close": "Are you sure you want to close port %s? (protocol: %s, connection: %s)",
|
||||
"confirm_install_custom_app": "Installing 3rd party applications may compromise the security of your system. Use at your own risk.",
|
||||
"confirm_install_domain_root": "You will not be able to install any other app on %s. Continue ?",
|
||||
"confirm_migrations_skip": "Skipping migrations is not recommended. Are you sure you want to do that?",
|
||||
"confirm_postinstall": "You are about to launch the post-installation process on the domain %s. It may take a few minutes, *do not interrupt the operation*.",
|
||||
"confirm_restore": "Are you sure you want to restore %s ?",
|
||||
"confirm_service_start": "Are you sure you want to start %s?",
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
<h2 class="panel-title"><span class="fa-fw fa-cogs"></span> {{t 'migrations_pending'}}
|
||||
{{#if pending_migrations}}
|
||||
<div class="btn-toolbar pull-right">
|
||||
<a href="#" class="btn btn-success" style="margin-top: -3px"><span class="fa-fw fa-play"></span> {{t 'run'}}</a>
|
||||
<a href="#" class="btn btn-warning" style="margin-top: -3px"><span class="fa-fw fa-close"></span> {{t 'skip'}}</a>
|
||||
<a href="#/tools/migrations/run" class="btn btn-success" style="margin-top: -3px"><span class="fa-fw fa-play"></span> {{t 'run'}}</a>
|
||||
<a href="#/tools/migrations/skip" class="btn btn-warning" style="margin-top: -3px"><span class="fa-fw fa-close"></span> {{t 'skip'}}</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
</h2>
|
||||
|
|
Loading…
Add table
Reference in a new issue