'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 `
${icon(td.appIcon(p.path))}
${esc(p.title)}${esc(cat)}
`; }).join(''); const add = td.software(tree); return td.html(`

${esc(T('应用', 'Apps'))}

${esc(T('已安装的应用', 'Installed apps'))}

${esc(pages.length ? T(`共 ${pages.length} 个`, `${pages.length} installed`) : T('还没有安装插件。', 'No plugins installed yet.'))}

${tiles} ${add ? `
${icon('plus')}
${esc(T('安装更多应用', 'Get more apps'))}${esc(T('前往软件包', 'Open Software'))}
` : ''}
`); }, handleSave: null, handleSaveApply: null, handleReset: null });