'use strict';
'require view';
'require ui';
'require 7dollar.common as td';
/* Every plugin page the router has, as tiles. The theme depends on none of them. */
const T = td.T, icon = td.icon, esc = td.esc;
return view.extend({
load() {
if (!td.active) {
location.replace(L.url('admin/services'));
return new Promise(() => {});
}
return td.loadMenu();
},
render(tree) {
const pages = td.flatten(tree).filter(p => p.group == 'apps' && p.path != 'admin/apps');
const CAT = { services: T('服务', 'Service'), vpn: 'VPN', nas: T('存储', 'Storage'), docker: T('容器', 'Container'), statistics: T('统计', 'Statistics') };
const tiles = pages.map((p, i) => {
const cat = CAT[p.path.split('/')[1]] || T('插件', 'Plugin');
return `
${esc(T('应用', 'Apps'))}
${esc(pages.length ? T(`共 ${pages.length} 个`, `${pages.length} installed`) : T('还没有安装插件。', 'No plugins installed yet.'))}