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="panel panel-primary">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Service Status</div>
|
||||
<div class="panel-body">
|
||||
<table class="table hdd-detail">
|
||||
<table class="table table-hover">
|
||||
<thead><tr>
|
||||
<th data-field="service">Service</th>
|
||||
<th data-field="status">Status</th>
|
||||
<th data-field="action" >Action</th>
|
||||
<th data-field="desc">Description</th>
|
||||
<th data-field="action" class="text-right">Actions</th>
|
||||
</tr></thead>
|
||||
<tr>
|
||||
{{! #data}}
|
||||
<tr {{^.enabled}}class="active"{{/.enabled}}>
|
||||
<td>{{.getName()}}</td>
|
||||
<td></td>
|
||||
<td>[EDIT][DISABLE][REMOVE]</td>
|
||||
<td>{{.getValue()}}</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>
|
||||
{{! /data}}
|
||||
</table>
|
||||
</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>
|
||||
|
|
@ -50,11 +50,13 @@ public class ServicePage implements WAPage {
|
|||
private ServiceStatusPage rootStatusPage;
|
||||
private ArrayList<WAService> services;
|
||||
private ArrayList<ServiceStatusPage> statusPages;
|
||||
private ArrayList<ConfigPage> configPages;
|
||||
|
||||
public ServicePage(PluginManager pluginManager){
|
||||
this.services = pluginManager.toArray(WAService.class);
|
||||
this.rootStatusPage = new ServiceStatusPage(pluginManager);
|
||||
this.statusPages = new ArrayList<>();
|
||||
this.configPages = new ArrayList<>();
|
||||
|
||||
WANavigation nav = WANavigation.createRootNav(NAVIGATION_NAME);
|
||||
nav.setResource(this);
|
||||
|
|
@ -64,8 +66,10 @@ public class ServicePage implements WAPage {
|
|||
WANavigation serviceNav = nav.createSubNav(plugin.getName());
|
||||
serviceNav.setResource(plugin);
|
||||
for(WAServiceConfig conf : plugin.getConfigurations()){
|
||||
ConfigPage page = new ConfigPage(conf);
|
||||
configPages.add(page);
|
||||
serviceNav.createSubNav(conf.getName())
|
||||
.setResource(new ConfigPage(conf));
|
||||
.setResource(page);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -79,15 +83,20 @@ public class ServicePage implements WAPage {
|
|||
Map<String, String> request) {
|
||||
|
||||
try {
|
||||
|
||||
int index = services.indexOf(context.getBreadcrumb().get(1).getResource());
|
||||
if (index >= 0) {
|
||||
Object resource = context.getBreadcrumb().get(context.getBreadcrumb().size()-1).getResource();
|
||||
int index;
|
||||
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);
|
||||
ServiceStatusPage statusPage = statusPages.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());
|
||||
return tmpl;
|
||||
}
|
||||
else{ // root page
|
||||
|
|
|
|||
|
|
@ -39,9 +39,7 @@ public class ApacheService implements WAService {
|
|||
|
||||
private ApacheStatus status;
|
||||
private ApacheInstaller installer;
|
||||
private WAServiceConfig[] config = new WAServiceConfig[]{
|
||||
new ApacheConfigVirtualHost()
|
||||
};
|
||||
private WAServiceConfig[] config;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
|
@ -64,6 +62,10 @@ public class ApacheService implements WAService {
|
|||
|
||||
@Override
|
||||
public WAServiceConfig[] getConfigurations() {
|
||||
if(config == null)
|
||||
config = new WAServiceConfig[]{
|
||||
new ApacheConfigVirtualHost()
|
||||
};
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue