mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Move appslist manage to tools section
This commit is contained in:
parent
adc00664c5
commit
a24e0743bb
5 changed files with 101 additions and 73 deletions
|
@ -156,71 +156,6 @@
|
|||
}, 'GET');
|
||||
});
|
||||
|
||||
// Add a new apps list
|
||||
app.post('#/apps/lists', function (c) {
|
||||
list = {
|
||||
'name' : c.params['appslist_name'],
|
||||
'url' : c.params['appslist_url']
|
||||
}
|
||||
|
||||
c.api('/appslists', function(data) {
|
||||
store.clear('slide');
|
||||
c.redirect('#/apps/lists/' + list.name);
|
||||
}, 'PUT', list);
|
||||
});
|
||||
|
||||
// Show appslist info and operations
|
||||
app.get('#/apps/lists/:appslist', function (c) {
|
||||
c.api('/appslists', function(data) {
|
||||
if (typeof data[c.params['appslist']] !== 'undefined') {
|
||||
list = {
|
||||
'name' : c.params['appslist'],
|
||||
'url': data[c.params['appslist']]['url'],
|
||||
'lastUpdate': data[c.params['appslist']]['lastUpdate'],
|
||||
'removable' : (c.params['appslist'] !== 'yunohost') ? true : false // Do not remove default apps list
|
||||
};
|
||||
c.view('app/app_appslists_info', {appslist: list});
|
||||
}
|
||||
else {
|
||||
c.flash('warning', y18n.t('appslists_unknown_list', [c.params['appslist']]));
|
||||
store.clear('slide');
|
||||
c.redirect('#/apps/lists');
|
||||
}
|
||||
}, 'GET');
|
||||
});
|
||||
|
||||
// Refresh available apps list
|
||||
app.get('#/apps/lists/refresh', function (c) {
|
||||
c.api('/appslists', function(data) {
|
||||
// c.redirect(store.get('path'));
|
||||
c.redirect('#/apps/install');
|
||||
}, 'PUT');
|
||||
});
|
||||
|
||||
// Refresh specific apps list
|
||||
app.get('#/apps/lists/:appslist/refresh', function (c) {
|
||||
c.api('/appslists', function(data) {
|
||||
c.redirect('#/apps/lists');
|
||||
}, 'PUT', {'name' : c.params['appslist']});
|
||||
});
|
||||
|
||||
// Remove apps list
|
||||
app.get('#/apps/lists/:appslist/remove', function (c) {
|
||||
c.confirm(
|
||||
y18n.t('appslist'),
|
||||
y18n.t('appslists_confirm_remove', [c.params['app']]),
|
||||
function() {
|
||||
c.api('/appslists', function() {
|
||||
c.redirect('#/apps/lists');
|
||||
}, 'DELETE', {'name' : c.params['appslist']});
|
||||
},
|
||||
function() {
|
||||
store.clear('slide');
|
||||
c.redirect('#/apps/lists/'+ c.params['appslist']);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Get app information
|
||||
app.get('#/apps/:app', function (c) {
|
||||
c.api('/apps/'+c.params['app']+'?raw', function(data) { // http://api.yunohost.org/#!/app/app_info_get_9
|
||||
|
|
|
@ -364,4 +364,93 @@
|
|||
);
|
||||
});
|
||||
|
||||
// List available apps lists
|
||||
app.get('#/tools/appslists', function (c) {
|
||||
c.api('/appslists', function(data) {
|
||||
list = [];
|
||||
var has_community_list = false;
|
||||
$.each(data, function(listname, listinfo) {
|
||||
list.push({
|
||||
'name': listname,
|
||||
'url': listinfo['url'],
|
||||
'lastUpdate': listinfo['lastUpdate']
|
||||
});
|
||||
|
||||
// Check for community list
|
||||
if (listname == 'community' || listinfo['url'] == 'https://app.yunohost.org/community.json') {
|
||||
has_community_list = true;
|
||||
}
|
||||
});
|
||||
|
||||
c.view('tools/tools_appslists_list', {
|
||||
appslists: list,
|
||||
has_community_list: has_community_list
|
||||
});
|
||||
}, 'GET');
|
||||
});
|
||||
|
||||
// Add a new apps list
|
||||
app.post('#/tools/appslists', function (c) {
|
||||
list = {
|
||||
'name' : c.params['appslist_name'],
|
||||
'url' : c.params['appslist_url']
|
||||
}
|
||||
|
||||
c.api('/appslists', function(data) {
|
||||
store.clear('slide');
|
||||
c.redirect('#/apps/lists/' + list.name);
|
||||
}, 'PUT', list);
|
||||
});
|
||||
|
||||
// Show appslist info and operations
|
||||
app.get('#/tools/appslists/:appslist', function (c) {
|
||||
c.api('/appslists', function(data) {
|
||||
if (typeof data[c.params['appslist']] !== 'undefined') {
|
||||
list = {
|
||||
'name' : c.params['appslist'],
|
||||
'url': data[c.params['appslist']]['url'],
|
||||
'lastUpdate': data[c.params['appslist']]['lastUpdate'],
|
||||
'removable' : (c.params['appslist'] !== 'yunohost') ? true : false // Do not remove default apps list
|
||||
};
|
||||
c.view('tools/tools_appslists_info', {appslist: list});
|
||||
}
|
||||
else {
|
||||
c.flash('warning', y18n.t('appslists_unknown_list', [c.params['appslist']]));
|
||||
store.clear('slide');
|
||||
c.redirect('#/apps/lists');
|
||||
}
|
||||
}, 'GET');
|
||||
});
|
||||
|
||||
// Refresh available apps list
|
||||
app.get('#/tools/appslists/refresh', function (c) {
|
||||
c.api('/appslists', function(data) {
|
||||
// c.redirect(store.get('path'));
|
||||
c.redirect('#/apps/install');
|
||||
}, 'PUT');
|
||||
});
|
||||
|
||||
// Refresh specific apps list
|
||||
app.get('#/tools/appslists/:appslist/refresh', function (c) {
|
||||
c.api('/appslists', function(data) {
|
||||
c.redirect('#/apps/lists');
|
||||
}, 'PUT', {'name' : c.params['appslist']});
|
||||
});
|
||||
|
||||
// Remove apps list
|
||||
app.get('#/tools/appslists/:appslist/remove', function (c) {
|
||||
c.confirm(
|
||||
y18n.t('appslist'),
|
||||
y18n.t('appslists_confirm_remove', [c.params['app']]),
|
||||
function() {
|
||||
c.api('/appslists', function() {
|
||||
c.redirect('#/apps/lists');
|
||||
}, 'DELETE', {'name' : c.params['appslist']});
|
||||
},
|
||||
function() {
|
||||
store.clear('slide');
|
||||
c.redirect('#/apps/lists/'+ c.params['appslist']);
|
||||
}
|
||||
);
|
||||
});
|
||||
})();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<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/lists">{{t 'appslists'}}</a>
|
||||
<a href="#/apps/lists/{{name}}">{{appslist.name}}</a>
|
||||
<a href="#/tools">{{t 'tools'}}</a>
|
||||
<a href="#/tools/appslists">{{t 'appslists'}}</a>
|
||||
<a href="#/tools/appslists/{{name}}">{{appslist.name}}</a>
|
||||
</div>
|
||||
|
||||
<div class="separator"></div>
|
||||
|
@ -32,7 +32,7 @@
|
|||
<div class="panel-body">
|
||||
<div class="container">
|
||||
<p>{{t 'appslists_info_refresh_desc'}}</p>
|
||||
<a href="#/apps/lists/{{appslist.name}}/refresh" role="button" class="btn btn-info slide">
|
||||
<a href="#/tools/appslists/{{appslist.name}}/refresh" role="button" class="btn btn-info slide">
|
||||
<span class="fa-refresh"></span> {{t 'refresh_app_list'}}
|
||||
</a>
|
||||
</div>
|
||||
|
@ -40,7 +40,7 @@
|
|||
<hr>
|
||||
<div class="container">
|
||||
<p>{{t 'appslists_info_remove_desc'}}</p>
|
||||
<a role="button" href="#/apps/lists/{{appslist.name}}/remove" class="btn btn-danger slide back">
|
||||
<a role="button" href="#/tools/appslists/{{appslist.name}}/remove" class="btn btn-danger slide back">
|
||||
<span class="fa-trash-o"></span> {{t 'remove'}}
|
||||
</a>
|
||||
</div>
|
|
@ -1,7 +1,7 @@
|
|||
<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/lists">{{t 'appslists'}}</a>
|
||||
<a href="#/tools">{{t 'tools'}}</a>
|
||||
<a href="#/tools/appslists">{{t 'appslists'}}</a>
|
||||
</div>
|
||||
|
||||
<div class="separator"></div>
|
||||
|
@ -13,7 +13,7 @@
|
|||
|
||||
<div class="list-group">
|
||||
{{#appslists}}
|
||||
<a href="#/apps/lists/{{name}}" class="list-group-item">
|
||||
<a href="#/tools/appslists/{{name}}" class="list-group-item">
|
||||
<span class="fa-chevron-right pull-right"></span>
|
||||
<h2 class="list-group-item-heading">
|
||||
{{name}}
|
|
@ -46,6 +46,10 @@
|
|||
<span class="fa-chevron-right pull-right"></span>
|
||||
<h2 class="list-group-item-heading">{{t 'tools_adminpw'}}</h2>
|
||||
</a>
|
||||
<a href="#/tools/appslists" class="list-group-item slide clearfix">
|
||||
<span class="pull-right fa-chevron-right"></span>
|
||||
<h2 class="list-group-item-heading">{{t 'appslists'}}</h2>
|
||||
</a>
|
||||
<a href="#/tools/ca" class="list-group-item slide">
|
||||
<span class="fa-chevron-right pull-right"></span>
|
||||
<h2 class="list-group-item-heading">{{t 'tools_download_ca'}}</h2>
|
||||
|
|
Loading…
Reference in a new issue