Added access to congif page from service page
This commit is contained in:
parent
e63a4cc086
commit
78cb41a39c
3 changed files with 36 additions and 15 deletions
|
|
@ -1,20 +1,30 @@
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="panel panel-primary">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">Service Status</div>
|
<div class="panel-heading">Service Status</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<table class="table hdd-detail">
|
<table class="table table-hover">
|
||||||
<thead><tr>
|
<thead><tr>
|
||||||
<th data-field="service">Service</th>
|
<th data-field="service">Service</th>
|
||||||
<th data-field="status">Status</th>
|
<th data-field="desc">Description</th>
|
||||||
<th data-field="action" >Action</th>
|
<th data-field="action" class="text-right">Actions</th>
|
||||||
</tr></thead>
|
</tr></thead>
|
||||||
<tr>
|
{{! #data}}
|
||||||
|
<tr {{^.enabled}}class="active"{{/.enabled}}>
|
||||||
<td>{{.getName()}}</td>
|
<td>{{.getName()}}</td>
|
||||||
<td></td>
|
<td>{{.getValue()}}</td>
|
||||||
<td>[EDIT][DISABLE][REMOVE]</td>
|
<td class="text-right">
|
||||||
|
<button type="button" class="btn btn-primary btn-xs">Edit</button>
|
||||||
|
{{^.enabled}}<button type="button" class="btn btn-default btn-xs">Disable</button>{{/.enabled}}
|
||||||
|
{{#.enabled}}<button type="button" class="btn btn-success btn-xs">Activate</button>{{/.enabled}}
|
||||||
|
<button type="button" class="btn btn-danger btn-xs">Remove</button>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{{! /data}}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-footer">Panel footer</div>
|
<div class="panel-footer text-right">
|
||||||
|
<button type="button" class="btn btn-primary">Cancel</button>
|
||||||
|
<button type="button" class="btn btn-success">Save</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -50,11 +50,13 @@ public class ServicePage implements WAPage {
|
||||||
private ServiceStatusPage rootStatusPage;
|
private ServiceStatusPage rootStatusPage;
|
||||||
private ArrayList<WAService> services;
|
private ArrayList<WAService> services;
|
||||||
private ArrayList<ServiceStatusPage> statusPages;
|
private ArrayList<ServiceStatusPage> statusPages;
|
||||||
|
private ArrayList<ConfigPage> configPages;
|
||||||
|
|
||||||
public ServicePage(PluginManager pluginManager){
|
public ServicePage(PluginManager pluginManager){
|
||||||
this.services = pluginManager.toArray(WAService.class);
|
this.services = pluginManager.toArray(WAService.class);
|
||||||
this.rootStatusPage = new ServiceStatusPage(pluginManager);
|
this.rootStatusPage = new ServiceStatusPage(pluginManager);
|
||||||
this.statusPages = new ArrayList<>();
|
this.statusPages = new ArrayList<>();
|
||||||
|
this.configPages = new ArrayList<>();
|
||||||
|
|
||||||
WANavigation nav = WANavigation.createRootNav(NAVIGATION_NAME);
|
WANavigation nav = WANavigation.createRootNav(NAVIGATION_NAME);
|
||||||
nav.setResource(this);
|
nav.setResource(this);
|
||||||
|
|
@ -64,8 +66,10 @@ public class ServicePage implements WAPage {
|
||||||
WANavigation serviceNav = nav.createSubNav(plugin.getName());
|
WANavigation serviceNav = nav.createSubNav(plugin.getName());
|
||||||
serviceNav.setResource(plugin);
|
serviceNav.setResource(plugin);
|
||||||
for(WAServiceConfig conf : plugin.getConfigurations()){
|
for(WAServiceConfig conf : plugin.getConfigurations()){
|
||||||
|
ConfigPage page = new ConfigPage(conf);
|
||||||
|
configPages.add(page);
|
||||||
serviceNav.createSubNav(conf.getName())
|
serviceNav.createSubNav(conf.getName())
|
||||||
.setResource(new ConfigPage(conf));
|
.setResource(page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -79,15 +83,20 @@ public class ServicePage implements WAPage {
|
||||||
Map<String, String> request) {
|
Map<String, String> request) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Object resource = context.getBreadcrumb().get(context.getBreadcrumb().size()-1).getResource();
|
||||||
int index = services.indexOf(context.getBreadcrumb().get(1).getResource());
|
int index;
|
||||||
if (index >= 0) {
|
if((index = configPages.indexOf(resource)) >= 0){
|
||||||
|
return configPages.get(index).htmlResponse(context, client_info, session, cookie, request);
|
||||||
|
}
|
||||||
|
else if ((index = services.indexOf(resource)) >= 0) {
|
||||||
WAService obj = services.get(index);
|
WAService obj = services.get(index);
|
||||||
ServiceStatusPage statusPage = statusPages.get(index);
|
ServiceStatusPage statusPage = statusPages.get(index);
|
||||||
|
|
||||||
Templator tmpl = new Templator(FileUtil.find(TMPL_FILE));
|
Templator tmpl = new Templator(FileUtil.find(TMPL_FILE));
|
||||||
tmpl.set("service_status",
|
tmpl.set("service_status",
|
||||||
statusPage.htmlResponse(context, client_info, session, cookie, request).compile());
|
statusPage.htmlResponse(context, client_info, session, cookie, request).compile());
|
||||||
|
//tmpl.set("service_logs",
|
||||||
|
// statusPage.htmlResponse(context, client_info, session, cookie, request).compile());
|
||||||
return tmpl;
|
return tmpl;
|
||||||
}
|
}
|
||||||
else{ // root page
|
else{ // root page
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,7 @@ public class ApacheService implements WAService {
|
||||||
|
|
||||||
private ApacheStatus status;
|
private ApacheStatus status;
|
||||||
private ApacheInstaller installer;
|
private ApacheInstaller installer;
|
||||||
private WAServiceConfig[] config = new WAServiceConfig[]{
|
private WAServiceConfig[] config;
|
||||||
new ApacheConfigVirtualHost()
|
|
||||||
};
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
@ -64,6 +62,10 @@ public class ApacheService implements WAService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WAServiceConfig[] getConfigurations() {
|
public WAServiceConfig[] getConfigurations() {
|
||||||
|
if(config == null)
|
||||||
|
config = new WAServiceConfig[]{
|
||||||
|
new ApacheConfigVirtualHost()
|
||||||
|
};
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue