mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
App management (wip)
This commit is contained in:
parent
31332119d1
commit
1a8def8c7f
4 changed files with 110 additions and 6 deletions
23
js/app.js
23
js/app.js
|
@ -396,25 +396,40 @@ app = Sammy('#main', function (sam) {
|
|||
*/
|
||||
|
||||
sam.get('#/apps', function (c) {
|
||||
c.api('/app/list', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
c.api('/apps', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
// Keep only installed apps
|
||||
data2 = { 'Apps': [], 'Installed': true }
|
||||
$.each(data['Apps'], function(k, v) {
|
||||
if (v['Installed'] !== 'No') data2['Apps'].push(v);
|
||||
if (v['Installed']) data2['Apps'].push(v);
|
||||
});
|
||||
c.view('app_list', data2);
|
||||
});
|
||||
});
|
||||
|
||||
sam.get('#/apps/install', function (c) {
|
||||
c.api('/app/list', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
c.api('/apps', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
c.api('/apps?raw=true', function(dataraw) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
// Keep only uninstalled apps
|
||||
data2 = { 'Apps': [] }
|
||||
$.each(data['Apps'], function(k, v) {
|
||||
if (v['Installed'] !== 'Yes') data2['Apps'].push(v);
|
||||
if (dataraw[v['ID']].manifest.multi_instance) v['Installed'] = false;
|
||||
if (!v['Installed']) data2['Apps'].push(v);
|
||||
});
|
||||
c.view('app_list', data2);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
sam.get('#/apps/:app', function (c) {
|
||||
c.api('/app/'+c.params['app']+'?raw=true', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
c.view('app_info', data);
|
||||
});
|
||||
});
|
||||
|
||||
sam.get('#/apps/install/:app', function (c) {
|
||||
c.api('/apps?raw=true', function(data) { // http://api.yunohost.org/#!/app/app_list_get_8
|
||||
c.view('app_install', data[c.params['app']]);
|
||||
});
|
||||
});
|
||||
|
||||
sam.get('#/apps/refresh', function (c) {
|
||||
|
|
38
views/app_info.ms
Normal file
38
views/app_info.ms
Normal file
|
@ -0,0 +1,38 @@
|
|||
<div class="pull-left">
|
||||
<a href="#/apps" class="btn btn-default slide back"><span class="glyphicon glyphicon-chevron-left"></span> App list</a>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a href="#/apps/{{settings.id}}/access" class="btn btn-info slide"><span class="glyphicon glyphicon-lock"></span> Access</a>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<div class="view-title">{{settings.label}}</div>
|
||||
|
||||
<div class="br"></div>
|
||||
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-sm-3 text-right hidden-xs"><strong>ID</strong></div>
|
||||
<div class="col-sm-3 visible-xs"><strong>ID</strong></div>
|
||||
<div class="col-sm-9"> {{settings.id}}</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-sm-3 text-right hidden-xs"><strong>Description</strong></div>
|
||||
<div class="col-sm-3 visible-xs"><strong>Description</strong></div>
|
||||
<div class="col-sm-9"> {{manifest.description.en}}</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-sm-3 text-right hidden-xs"><strong>URL</strong></div>
|
||||
<div class="col-sm-3 visible-xs"><strong>URL</strong></div>
|
||||
<div class="col-sm-9"> <a href="http://{{settings.domain}}{{settings.path}}" target="_blank">http://{{settings.domain}}{{settings.path}}</a></div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="text-center">
|
||||
<a href="#/apps/{{settings.id}}/uninstall" class="btn btn-danger slide back"><span class="glyphicon glyphicon-trash"></span> Uninstall</a>
|
||||
</div>
|
51
views/app_install.ms
Normal file
51
views/app_install.ms
Normal file
|
@ -0,0 +1,51 @@
|
|||
<div class="pull-left">
|
||||
<a href="#/apps/install" class="btn btn-default slide back"><span class="glyphicon glyphicon-chevron-left"></span> App list</a>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<div class="view-title">Install {{manifest.name}}</div>
|
||||
|
||||
<div class="br"></div>
|
||||
|
||||
<form action="#/apps" method="POST" class="form-horizontal">
|
||||
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-sm-3 text-right hidden-xs"><strong>ID</strong></div>
|
||||
<div class="col-sm-3 visible-xs"><strong>ID</strong></div>
|
||||
<div class="col-sm-9"> {{manifest.id}}</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-sm-3 text-right hidden-xs"><strong>Description</strong></div>
|
||||
<div class="col-sm-3 visible-xs"><strong>Description</strong></div>
|
||||
<div class="col-sm-9"> {{manifest.description.en}}</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<br>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<label for="label" class="col-sm-12">Label for {{manifest.name}}</label>
|
||||
<div class="col-sm-12">
|
||||
<input type="text" name="label" class="form-control" value="{{manifest.name}}" required>
|
||||
</div>
|
||||
</div>
|
||||
{{#manifest.arguments.install}}
|
||||
<div class="form-group">
|
||||
<label for="{{name}}" class="col-sm-12">{{ask.en}}</label>
|
||||
<div class="col-sm-12">
|
||||
<input type="text" name="{{name}}" class="form-control" value="{{default}}" placeholder="{{example}}" required>
|
||||
</div>
|
||||
</div>
|
||||
{{/manifest.arguments.install}}
|
||||
<hr>
|
||||
<div class="text-center">
|
||||
<input type="submit" class="btn btn-success slide back" value="Install">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
<div class="list-group">
|
||||
{{#Apps}}
|
||||
<a href="#/apps/{{ID}}" class="list-group-item slide">
|
||||
<a href="#/apps/{{^Installed}}install/{{/Installed}}{{ID}}" class="list-group-item slide">
|
||||
<h4 class="pull-left list-group-item-heading">{{Name}} <small>{{ID}}</small></h4>
|
||||
<span class="glyphicon glyphicon-chevron-right pull-right"></span>
|
||||
<div class="clearfix"></div>
|
||||
<p class="list-group-item-text">{{Description}}</p>
|
||||
<p class="list-group-item-text">{{Description.en}}</p>
|
||||
</a>
|
||||
{{/Apps}}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue