mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
[enh] display actions
This commit is contained in:
parent
37c289aa72
commit
54f3c77ff6
3 changed files with 88 additions and 0 deletions
|
@ -160,6 +160,25 @@
|
|||
});
|
||||
});
|
||||
|
||||
// Get app actions list
|
||||
app.get('#/apps/:app/actions', function (c) {
|
||||
c.api('/apps/'+c.params['app']+'/actions', function(data) {
|
||||
$.each(data.actions, function(_, action) {
|
||||
formatYunoHostStyleArguments(action.arguments, c.params);
|
||||
|
||||
// Multilingual description
|
||||
action.description = (typeof action.description[y18n.locale] !== 'undefined') ?
|
||||
action.description[y18n.locale] :
|
||||
action.description['en']
|
||||
;
|
||||
|
||||
});
|
||||
|
||||
c.view('app/app_actions', data);
|
||||
return;
|
||||
});
|
||||
});
|
||||
|
||||
// Get app config panel
|
||||
app.get('#/apps/:app/config-panel', function (c) {
|
||||
c.api('/apps/'+c.params['app']+'/config-panel', function(data) {
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
"app_install_custom_no_manifest": "No manifest.json file",
|
||||
"app_list": "App list",
|
||||
"app_make_default": "Make default",
|
||||
"app_no_actions": "This application doesn't have any actions",
|
||||
"app_repository": "Application origin: ",
|
||||
"app_state": "Application state: ",
|
||||
"app_state_inprogress": "In progress",
|
||||
|
|
68
src/views/app/app_actions.ms
Normal file
68
src/views/app/app_actions.ms
Normal file
|
@ -0,0 +1,68 @@
|
|||
<div class="btn-breadcrumb">
|
||||
<a href="#/" ><i class="fa-home"></i><span class="sr-only">{{t 'home'}}</span></a>
|
||||
<a href="#/apps">{{t 'applications'}}</a>
|
||||
<a href="#/apps/{{app_id}}">{{app_name}}</a>
|
||||
<a href="#/apps/{{app_id}}/actions">{{t 'app_actions'}}</a>
|
||||
</div>
|
||||
|
||||
<div class="separator"></div>
|
||||
|
||||
<div class="alert alert-warning" role="alert">{{t 'experimental_warning'}}</div>
|
||||
|
||||
{{#if actions}}
|
||||
{{#actions}}
|
||||
<form action="#/apps" method="POST" class="form-horizontal form-app-install">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">{{name}}</h2>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>{{description}}</p>
|
||||
{{#if arguments}}
|
||||
{{#arguments}}
|
||||
<div class="form-group">
|
||||
<label for="{{name}}" class="col-sm-12">{{label}}</label>
|
||||
|
||||
{{#if helpText}}
|
||||
<span class="help-block help-block--help col-sm-12">{{{helpText}}}</span>
|
||||
{{/if}}
|
||||
|
||||
<div class="col-sm-12">
|
||||
|
||||
{{#if choices}}
|
||||
<select id="{{name}}" name="{{name}}" required class="form-control" {{{attributes}}}>
|
||||
{{#choices}}<option value="{{value}}" {{#if selected}}selected{{/if}}>{{label}}</option>{{/choices}}
|
||||
</select>
|
||||
{{else}}
|
||||
<input type="{{inputType}}" id="{{name}}" name="{{name}}" class="form-control" value="{{default}}" placeholder="{{example}}" {{required}} {{{attributes}}}>
|
||||
{{/if}}
|
||||
|
||||
{{#if helpLink}}
|
||||
<span class="help-block help-block--link">{{{helpLink}}}</span>
|
||||
{{/if}}
|
||||
|
||||
{{#if example}}
|
||||
<span class="help-block help-block--example">{{t 'form_input_example' example}}</span>
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{{/arguments}}
|
||||
<hr>
|
||||
{{/if}}
|
||||
<input type="hidden" name="app" value="{{id}}">
|
||||
<div class="text-center">
|
||||
<input type="submit" class="btn btn-success slide back" value="{{t 'perform'}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{{/actions}}
|
||||
|
||||
{{else}}
|
||||
<div class="alert alert-warning">
|
||||
<span class="fa-exclamation-triangle"></span>
|
||||
{{t 'app_no_actions'}}
|
||||
</div>
|
||||
{{/if}}
|
Loading…
Reference in a new issue