Backend implementation of config objects

This commit is contained in:
Ziver Koc 2015-11-16 17:48:37 +01:00
parent 224372f0ad
commit 2d1a7d647c
13 changed files with 215 additions and 131 deletions

14
src/wa/server/page/ServicePage.java Normal file → Executable file
View file

@ -50,18 +50,21 @@ public class ServicePage implements WAPage {
private ServiceStatusPage rootStatusPage;
private ArrayList<WAService> services;
private ArrayList<ServiceStatusPage> statusPages;
private ArrayList<LogPage> logPages;
private ArrayList<ConfigPage> configPages;
public ServicePage(PluginManager pluginManager){
this.services = pluginManager.toArray(WAService.class);
this.rootStatusPage = new ServiceStatusPage(pluginManager);
this.statusPages = new ArrayList<>();
this.logPages = new ArrayList<>();
this.configPages = new ArrayList<>();
WANavigation nav = WANavigation.createRootNav(NAVIGATION_NAME);
nav.setResource(this);
for(WAService plugin : services) {
statusPages.add(new ServiceStatusPage(plugin.getStatus()));
logPages.add(new LogPage(plugin.getLog()));
WANavigation serviceNav = nav.createSubNav(plugin.getName());
serviceNav.setResource(plugin);
@ -91,12 +94,15 @@ public class ServicePage implements WAPage {
else if ((index = services.indexOf(resource)) >= 0) {
WAService obj = services.get(index);
ServiceStatusPage statusPage = statusPages.get(index);
LogPage logPage = logPages.get(index);
Templator tmpl = new Templator(FileUtil.find(TMPL_FILE));
tmpl.set("service_status",
statusPage.htmlResponse(context, client_info, session, cookie, request).compile());
//tmpl.set("service_logs",
// statusPage.htmlResponse(context, client_info, session, cookie, request).compile());
if(statusPage != null)
tmpl.set("service_status",
statusPage.htmlResponse(context, client_info, session, cookie, request));
if(logPage != null)
tmpl.set("service_logs",
statusPage.htmlResponse(context, client_info, session, cookie, request));
return tmpl;
}
else{ // root page