Add change label option in app info page

This commit is contained in:
Jimmy Monin 2018-01-13 15:46:03 +01:00
parent bd1abcb89d
commit e4e60596e8
4 changed files with 61 additions and 0 deletions

View file

@ -572,4 +572,24 @@
);
});
// Get app change label page
app.get('#/apps/:app/changelabel', function (c) {
c.api('/apps/'+c.params['app']+'?raw', function(app_data) {
data = {
id: c.params['app'],
label: app_data.settings.label,
};
c.view('app/app_changelabel', data);
});
});
// Change app label
app.post('#/apps/:app/changelabel', function (c) {
params = {'new_label': c.params['label']};
c.api('/apps/' + c.params['app'] + '/label', function(data) { // Call changelabel API
store.clear('slide');
c.redirect('#/apps/'+ c.params['app']);
}, 'PUT', params);
});
})();

View file

@ -13,9 +13,11 @@
"app_access_removeall_btn": "Remove all access",
"app_access_removeall_desc": "No users will have access to %s.",
"app_access_title": "%s access",
"app_change_label": "Change Label",
"app_debug_no_logs": "Application's logs are not available",
"app_debug_tab": "Display debug information",
"app_info_access_desc": "Manage user access. Allowed users: %s",
"app_info_changelabel_desc": "Change app label in the portal.",
"app_info_debug_desc": "Display debugging information for this application.",
"app_info_default_desc": "Redirect domain root to this application (%s).",
"app_info_uninstall_desc": "Remove this application.",

View file

@ -0,0 +1,30 @@
<div class="btn-breadcrumb">
<a href="#/" ><i class="fa-home"></i><span class="sr-only">{{t 'home'}}</span></a>
<a href="#/apps" class="hidden-xs">{{t 'applications'}}</a>
<a href="#/apps" class="visible-xs">&hellip;</a>
<a href="#/apps/{{id}}">{{label}}</a>
<a href="#/apps/{{id}}/changelabel">{{t 'app_change_label'}}</a>
</div>
<div class="separator"></div>
<form action="#/apps/{{id}}/changelabel" method="POST" class="form-horizontal form-app-install">
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title"><span class="fa-fw fa-tag"></span> {{t 'app_change_label'}}</h2>
</div>
<div class="panel-body">
<div class="form-group">
<label for="label" class="col-sm-12">{{t 'label'}}</label>
<div class="col-sm-12">
<input class="col-sm-12" type="text" id="label" name="label" class="form-control" value="{{label}}" required="required">
</div>
</div>
<hr>
<input type="hidden" name="app" value="{{id}}">
<div class="text-center">
<input type="submit" class="btn btn-success slide back" value="{{t 'app_change_label'}}">
</div>
</div>
</div>
</form>

View file

@ -15,6 +15,8 @@
<dl class="dl-horizontal">
<dt>{{t 'id'}}</dt>
<dd>{{settings.id}}</dd>
<dt>{{t 'label'}}</dt>
<dd>{{settings.label}}</dd>
<dt>{{t 'description'}}</dt>
<dd>{{description}}</dd>
<dt>{{t 'multi_instance'}}</dt>
@ -34,6 +36,13 @@
</h2>
</div>
<div class="panel-body">
<div class="container">
<p>{{t 'app_info_changelabel_desc' settings.label}}</p>
<a href="#/apps/{{settings.id}}/changelabel" class="btn btn-info slide">
<span class="fa-tag"></span> {{t 'app_change_label'}}
</a>
</div>
<hr>
<div class="container">
<p>{{t 'app_info_access_desc' settings.allowed_users}}</p>
<a href="#/apps/{{settings.id}}/access" class="btn btn-info slide">