[enh] Better application managment (access, default).

This commit is contained in:
opi 2014-05-09 11:53:57 +02:00
parent c762e4d900
commit 33569b8fd4
3 changed files with 69 additions and 32 deletions

View file

@ -604,6 +604,8 @@ app = Sammy('#main', function (sam) {
sam.get('#/apps/:app', function (c) { sam.get('#/apps/:app', function (c) {
c.api('/app/'+c.params['app']+'?raw=true', function(data) { // http://api.yunohost.org/#!/app/app_info_get_9 c.api('/app/'+c.params['app']+'?raw=true', function(data) { // http://api.yunohost.org/#!/app/app_info_get_9
// Presentation
data.settings.allowed_users = data.settings.allowed_users.replace(',', ', ');
c.view('app/app_info', data); c.view('app/app_info', data);
}); });
}); });
@ -787,6 +789,19 @@ app = Sammy('#main', function (sam) {
} }
}); });
// Make app default
sam.get('#/apps/:app/default', function (c) {
if (confirm('Are you sure you want to make this app default ?')) {
params = {'app': c.params['app']}
c.api('/app/default', function() { //
store.clear('slide');
c.redirect('#/apps/'+ c.params['app']);
}, 'PUT', params);
} else {
store.clear('slide');
c.redirect('#/apps/'+ c.params['app']);
}
});
/** /**
* Services * Services

View file

@ -12,7 +12,7 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title">Allowed users</h2> <h2 class="panel-title"><span class="fa-fw fa-users"></span> Allowed users</h2>
</div> </div>
{{#if settings.allowed_users}} {{#if settings.allowed_users}}
<div class="list-group"> <div class="list-group">
@ -60,6 +60,7 @@
<div class="panel-heading"> <div class="panel-heading">
<h2 class="panel-title"> <h2 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne"> <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
<span class="fa-fw fa-wrench"></span>
Bulk operations Bulk operations
</a> </a>
</h2> </h2>

View file

@ -4,41 +4,62 @@
</a> </a>
</div> </div>
<div class="pull-right"> <div class="pull-right">
<a href="#/apps/{{settings.id}}/access" class="btn btn-info slide">
<span class="fa-lock"></span> Access
</a>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
<h1 class="view-title">{{settings.label}}</h1> <h1 class="view-title">{{settings.label}}</h1>
<div class="br"></div> <div class="br"></div>
<ul class="list-group"> <div class="panel panel-default">
<li class="list-group-item"> <div class="panel-heading">
<div class="row"> <h2 class="panel-title"><span class="fa-fw fa-info-circle"></span> Infos</h2>
<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> </div>
</li> <div class="panel-body">
<li class="list-group-item"> <dl class="dl-horizontal">
<div class="row"> <dt>ID</dt>
<div class="col-sm-3 text-right hidden-xs"><strong>Description</strong></div> <dd>{{settings.id}}</dd>
<div class="col-sm-3 visible-xs"><strong>Description</strong></div> <dt>Description</dt>
<div class="col-sm-9"> {{manifest.description.en}}</div> <dd>{{manifest.description.en}}</dd>
<dt>Mode</dt>
<dd>{{settings.mode}}</dd>
<dt>URL</dt>
<dd><a href="https://{{settings.domain}}{{settings.path}}" target="_blank">https://{{settings.domain}}{{settings.path}}</a></dd>
</dl>
</div> </div>
</li> </div>
<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="https://{{settings.domain}}{{settings.path}}" target="_blank">https://{{settings.domain}}{{settings.path}}</a></div>
</div>
</li>
</ul>
<div class="text-center"> <div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
<span class="fa-fw fa-wrench"></span> Operations
</a>
</h2>
</div>
<div id="collapseOne" class="panel-collapse collapse">
<div class="panel-body">
<div class="container">
<p>Manage user access. Allowed users: {{settings.allowed_users}}.</p>
<a href="#/apps/{{settings.id}}/access" class="btn btn-info slide">
<span class="fa-lock"></span> Access
</a>
</div>
<hr>
<div class="container">
<p>Redirect domain root to this application ({{settings.domain}}).</p>
<a href="#/apps/{{settings.id}}/default" class="btn btn-success slide">
<span class="fa-star"></span> Make default
</a>
</div>
<hr>
<div class="container">
<p>Remove this application.</p>
<a href="#/apps/{{settings.id}}/uninstall" class="btn btn-danger slide back"> <a href="#/apps/{{settings.id}}/uninstall" class="btn btn-danger slide back">
<span class="fa-trash-o"></span> Uninstall <span class="fa-trash-o"></span> Uninstall
</a> </a>
</div>
</div>
</div>
</div>
</div> </div>