mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
[enh] implement actions form PUT request
This commit is contained in:
parent
54f3c77ff6
commit
3c5a23d7da
2 changed files with 25 additions and 1 deletions
|
@ -179,6 +179,30 @@
|
|||
});
|
||||
});
|
||||
|
||||
// Perform application
|
||||
app.put('#/apps/:app/actions/:action', function(c) {
|
||||
// taken from app install
|
||||
$.each(c.params, function(k, v) {
|
||||
if (typeof(v) === 'object' && Array.isArray(v)) {
|
||||
// And return only first value
|
||||
c.params[k] = v[0];
|
||||
}
|
||||
});
|
||||
|
||||
var app_id = c.params['app'];
|
||||
delete c.params['app'];
|
||||
var action_id = c.params['action'];
|
||||
delete c.params['action'];
|
||||
|
||||
var params = {
|
||||
'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.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) {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
{{#if actions}}
|
||||
{{#actions}}
|
||||
<form action="#/apps" method="POST" class="form-horizontal form-app-install">
|
||||
<form action="#/apps/{{../app_id}}/actions/{{id}}" method="PUT" class="form-horizontal form-app-install">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">{{name}}</h2>
|
||||
|
|
Loading…
Reference in a new issue