Add Admin Logging
This commit is contained in:
parent
5d6aff13a5
commit
e117f24d8d
7 changed files with 79 additions and 7 deletions
|
|
@ -54,6 +54,11 @@
|
|||
</exclusions>
|
||||
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.vaadin</groupId>
|
||||
<artifactId>vaadin-push</artifactId>
|
||||
<version>7.7.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import org.springframework.context.annotation.PropertySource;
|
|||
|
||||
@Configuration
|
||||
@SpringBootApplication
|
||||
|
||||
//@ComponentScan({"com.assurfleet.front.courtier.petiteflotte.maj","com.assurfleet.jms.services"})
|
||||
@PropertySource("classpath:application.properties")
|
||||
@ImportResource("classpath:applicationContext.xml")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
package org.chtijbug.drools.console;
|
||||
|
||||
import com.vaadin.ui.PopupView;
|
||||
import com.vaadin.ui.Table;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
|
||||
public class WorkOnGoingView extends PopupView {
|
||||
|
||||
private Table table;
|
||||
|
||||
|
||||
public WorkOnGoingView() {
|
||||
super("Logging", new VerticalLayout());
|
||||
|
||||
|
||||
//this.
|
||||
|
||||
VerticalLayout verticalLayout = (VerticalLayout) this.getContent().getPopupComponent();
|
||||
this.table = new Table("Logging");
|
||||
table = new Table();
|
||||
table.setSizeFull();
|
||||
table.setPageLength(0);
|
||||
table.setSelectable(false);
|
||||
table.setColumnCollapsingAllowed(false);
|
||||
table.setColumnReorderingAllowed(false);
|
||||
table.setImmediate(true);
|
||||
table.setNullSelectionAllowed(false);
|
||||
table.setColumnHeaderMode(Table.ColumnHeaderMode.HIDDEN);
|
||||
table.addContainerProperty("Message", String.class, null);
|
||||
verticalLayout.addComponent(table);
|
||||
}
|
||||
|
||||
public void addRow(String textToAdd) {
|
||||
String[] cells = new String[1];
|
||||
cells[0] = textToAdd;
|
||||
table.addItem(cells, "Message");
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package org.chtijbug.drools.console.service;
|
|||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.chtijbug.drools.console.DroolsAdminConsole;
|
||||
import org.chtijbug.drools.console.service.model.kie.JobStatus;
|
||||
import org.chtijbug.drools.console.service.model.kie.Space;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -52,7 +53,7 @@ public class KieRepositoryService {
|
|||
return reponseMoteur;
|
||||
}
|
||||
|
||||
public JobStatus buildProject(String url, String username, String password, String space, String project, String command) {
|
||||
public JobStatus buildProject(String url, String username, String password, String space, String project, String command, DroolsAdminConsole workOnGoingView) {
|
||||
String completeurl = url + "/spaces/" + space + "/projects/" + project + "/maven/" + command;
|
||||
logger.info("url Maven install : " + completeurl);
|
||||
ResponseEntity<JobStatus> response = restTemplateKiewb
|
||||
|
|
@ -70,6 +71,7 @@ public class KieRepositoryService {
|
|||
JobStatus reponseMoteur;
|
||||
|
||||
reponseMoteur = response.getBody();
|
||||
workOnGoingView.addRow(reponseMoteur.toString());
|
||||
return reponseMoteur;
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +116,7 @@ public class KieRepositoryService {
|
|||
};
|
||||
}
|
||||
|
||||
public String waitForJobToBeEnded(String url, String username, String password, String jobID) {
|
||||
public String waitForJobToBeEnded(String url, String username, String password, String jobID, DroolsAdminConsole workOnGoingView) {
|
||||
String isJobDone = "NO";
|
||||
while ("NO".equals(isJobDone)) {
|
||||
JobStatus jobStatus = this.getStatusJobID(url,
|
||||
|
|
@ -123,11 +125,11 @@ public class KieRepositoryService {
|
|||
if ("DUPLICATE_RESOURCE".equals(jobStatus.getStatus())
|
||||
|| "SUCCESS".equals(jobStatus.getStatus())) {
|
||||
isJobDone = "YES";
|
||||
System.out.println("JonId=" + jobID + " finished");
|
||||
workOnGoingView.addRow("JobID=" + jobID + " finished");
|
||||
} else if ("ACCEPTED".equals(jobStatus.getStatus())
|
||||
|| ("APPROVED".equals(jobStatus.getStatus()))) {
|
||||
try {
|
||||
System.out.println("JonId=" + jobID + " not yet finished");
|
||||
workOnGoingView.addRow("JobID=" + jobID + " not yet finished");
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.chtijbug.drools.console.service;
|
|||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.chtijbug.drools.console.DroolsAdminConsole;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieContainerInfo;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieContainerRequest;
|
||||
import org.chtijbug.drools.console.service.model.kie.KieServerJobStatus;
|
||||
|
|
@ -74,7 +75,7 @@ public class KieServerRepositoryService {
|
|||
return results;
|
||||
}
|
||||
|
||||
public KieServerJobStatus stopContainer(String url, String username, String password, String containerId) {
|
||||
public KieServerJobStatus stopContainer(String url, String username, String password, String containerId, DroolsAdminConsole workOnGoingView) {
|
||||
KieServerJobStatus results = null;
|
||||
String completeurl = url + "/containers/" + containerId;
|
||||
logger.info("url kie server container : " + completeurl);
|
||||
|
|
@ -92,10 +93,11 @@ public class KieServerRepositoryService {
|
|||
});
|
||||
KieServerJobStatus reponseMoteur;
|
||||
reponseMoteur = response.getBody();
|
||||
workOnGoingView.addRow(reponseMoteur.toString());
|
||||
return reponseMoteur;
|
||||
}
|
||||
|
||||
public KieContainerInfo createContainer(String url, String username, String password, String containerId, KieContainerRequest request) {
|
||||
public KieContainerInfo createContainer(String url, String username, String password, String containerId, KieContainerRequest request, DroolsAdminConsole workOnGoingView) {
|
||||
String completeurl = url + "/containers/" + containerId;
|
||||
logger.info("url kie server container : " + completeurl);
|
||||
ResponseEntity<Map<String, Object>> response = restTemplateKiewb
|
||||
|
|
@ -117,7 +119,7 @@ public class KieServerRepositoryService {
|
|||
Map<String, Object> reponseMoteur;
|
||||
|
||||
reponseMoteur = response.getBody();
|
||||
|
||||
workOnGoingView.addRow(reponseMoteur.toString());
|
||||
KieContainerInfo result = new KieContainerInfo();
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
public class JobStatus {
|
||||
|
|
@ -11,6 +12,19 @@ public class JobStatus {
|
|||
private Date lastModified;
|
||||
private String detailedResult[];
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("JobStatus{");
|
||||
sb.append("status='").append(status).append('\'');
|
||||
sb.append(", jobId='").append(jobId).append('\'');
|
||||
sb.append(", spaceName='").append(spaceName).append('\'');
|
||||
sb.append(", projectName='").append(projectName).append('\'');
|
||||
sb.append(", result='").append(result).append('\'');
|
||||
sb.append(", lastModified=").append(lastModified);
|
||||
sb.append(", detailedResult=").append(detailedResult == null ? "null" : Arrays.asList(detailedResult).toString());
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
|
|
|
|||
|
|
@ -28,4 +28,14 @@ public class KieServerJobStatus {
|
|||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("KieServerJobStatus{");
|
||||
sb.append("type='").append(type).append('\'');
|
||||
sb.append(", msg='").append(msg).append('\'');
|
||||
sb.append(", result='").append(result).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue