mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Moaaar buttons (migration view)
This commit is contained in:
parent
a73f87575b
commit
119d485a05
2 changed files with 38 additions and 51 deletions
|
@ -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,17 +286,14 @@
|
|||
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() {
|
||||
|
||||
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
|
||||
|
@ -304,40 +301,30 @@
|
|||
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) {
|
||||
// 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=' + c.params['migration_id'], {}, function(data) {
|
||||
c.api('POST', '/migrations/migrate?skip&targets=' + migration_id, {}, function(data) {
|
||||
c.redirect_to('#/tools/migrations', {slide: false});
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// List available apps lists
|
||||
app.get('#/tools/appslists', function (c) {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<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="#/tools/migrations/run" class="btn btn-sm btn-success"><span class="fa-fw fa-play"></span> {{t 'run'}}</a>
|
||||
<button class="btn btn-sm btn-success" data-action="run"><span class="fa-fw fa-play"></span> {{t 'run'}}</button>
|
||||
</div>
|
||||
{{/if}}
|
||||
</h2>
|
||||
|
@ -24,7 +24,7 @@
|
|||
<h3 class="list-group-item-heading">
|
||||
{{ number }}. {{ description }}
|
||||
<div class="btn-toolbar pull-right">
|
||||
<a href="#/tools/migrations/skip/{{ id }}" class="btn btn-xs btn-warning" style="color:white;"><span class="fa-fw fa-close"></span> {{t 'skip'}}</a>
|
||||
<button class="btn btn-xs btn-warning" style="color:white;" data-action="skip" data-migration="{{id}}"><span class="fa-fw fa-close"></span> {{t 'skip'}}</button>
|
||||
</div>
|
||||
</h3>
|
||||
{{#if disclaimer }}
|
||||
|
|
Loading…
Reference in a new issue