Display Object in JSON format => Can be put in request for replay
This commit is contained in:
parent
f97a3889a5
commit
9e50b527ca
6 changed files with 120 additions and 47 deletions
|
|
@ -115,10 +115,6 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.vaadin</groupId>
|
|
||||||
<artifactId>vaadin-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.vaadin</groupId>
|
<groupId>com.vaadin</groupId>
|
||||||
<artifactId>vaadin-upload-flow</artifactId>
|
<artifactId>vaadin-upload-flow</artifactId>
|
||||||
|
|
@ -133,11 +129,6 @@
|
||||||
<version>1.1.0</version>
|
<version>1.1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.vaadin</groupId>
|
|
||||||
<artifactId>vaadin-spring</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import java.util.Optional;
|
||||||
@Push(PushMode.AUTOMATIC)
|
@Push(PushMode.AUTOMATIC)
|
||||||
@StyleSheet("css/accueil.css")
|
@StyleSheet("css/accueil.css")
|
||||||
@HtmlImport("frontend://styles/shared-styles.html")
|
@HtmlImport("frontend://styles/shared-styles.html")
|
||||||
@Route("admin/accueil")
|
@Route("accueil")
|
||||||
public class AccueilView extends SqueletteComposant implements BeforeEnterObserver {
|
public class AccueilView extends SqueletteComposant implements BeforeEnterObserver {
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package org.chtijbug.drools.console.view;
|
package org.chtijbug.drools.console.view;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.vaadin.flow.component.button.Button;
|
import com.vaadin.flow.component.button.Button;
|
||||||
import com.vaadin.flow.component.html.Label;
|
import com.vaadin.flow.component.html.Label;
|
||||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||||
|
|
@ -25,6 +27,9 @@ public class ActionLoggingView extends VerticalLayout {
|
||||||
|
|
||||||
private Button thenFact;
|
private Button thenFact;
|
||||||
|
|
||||||
|
private Button outputData;
|
||||||
|
|
||||||
|
private ObjectMapper mapper = new ObjectMapper();
|
||||||
public ActionLoggingView(BusinessTransactionPersistence businessTransactionPersistence, DialogPerso dialogPerso){
|
public ActionLoggingView(BusinessTransactionPersistence businessTransactionPersistence, DialogPerso dialogPerso){
|
||||||
|
|
||||||
dialogPerso.getClose().setVisible(false);
|
dialogPerso.getClose().setVisible(false);
|
||||||
|
|
@ -54,6 +59,13 @@ public class ActionLoggingView extends VerticalLayout {
|
||||||
|
|
||||||
dialogPerso.getBar().add(thenFact);
|
dialogPerso.getBar().add(thenFact);
|
||||||
|
|
||||||
|
outputData=new Button("View OutputData");
|
||||||
|
outputData.setClassName("menu-button");
|
||||||
|
outputData.setEnabled(false);
|
||||||
|
|
||||||
|
|
||||||
|
dialogPerso.getBar().add(outputData);
|
||||||
|
|
||||||
title=new Label("TransactionID : "+businessTransactionPersistence.getId());
|
title=new Label("TransactionID : "+businessTransactionPersistence.getId());
|
||||||
title.setClassName("creation-runtime-title");
|
title.setClassName("creation-runtime-title");
|
||||||
|
|
||||||
|
|
@ -88,6 +100,12 @@ public class ActionLoggingView extends VerticalLayout {
|
||||||
}else {
|
}else {
|
||||||
whenFact.setEnabled(false);
|
whenFact.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
if(b.getOutputData()!=null&&b.getOutputData().getRealFact()!=null){
|
||||||
|
outputData.setEnabled(true);
|
||||||
|
}else {
|
||||||
|
outputData.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,6 +127,10 @@ public class ActionLoggingView extends VerticalLayout {
|
||||||
TextArea textArea=new TextArea(b.getInputData().getFactType().name());
|
TextArea textArea=new TextArea(b.getInputData().getFactType().name());
|
||||||
textArea.setReadOnly(true);
|
textArea.setReadOnly(true);
|
||||||
textArea.setClassName("content-log");
|
textArea.setClassName("content-log");
|
||||||
|
try {
|
||||||
|
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(b.getInputData().getRealFact());
|
||||||
|
textArea.setValue(text);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
textArea.setValue(
|
textArea.setValue(
|
||||||
b.getInputData().getRealFact().toString().replaceAll(",",",\n")
|
b.getInputData().getRealFact().toString().replaceAll(",",",\n")
|
||||||
.replaceAll("\\{","\\{\n")
|
.replaceAll("\\{","\\{\n")
|
||||||
|
|
@ -116,9 +138,8 @@ public class ActionLoggingView extends VerticalLayout {
|
||||||
.replaceAll("\\[","\n\\[")
|
.replaceAll("\\[","\n\\[")
|
||||||
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
verticalLayout.add(textArea);
|
verticalLayout.add(textArea);
|
||||||
|
|
||||||
|
|
||||||
dialogPerso1.add(verticalLayout);
|
dialogPerso1.add(verticalLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,6 +162,10 @@ public class ActionLoggingView extends VerticalLayout {
|
||||||
TextArea textArea=new TextArea(b.getFact().getFactType().name());
|
TextArea textArea=new TextArea(b.getFact().getFactType().name());
|
||||||
textArea.setReadOnly(true);
|
textArea.setReadOnly(true);
|
||||||
textArea.setClassName("content-log");
|
textArea.setClassName("content-log");
|
||||||
|
try {
|
||||||
|
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(b.getFact().getRealFact());
|
||||||
|
textArea.setValue(text);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
textArea.setValue(
|
textArea.setValue(
|
||||||
b.getFact().getRealFact().toString().replaceAll(",",",\n")
|
b.getFact().getRealFact().toString().replaceAll(",",",\n")
|
||||||
.replaceAll("\\{","\\{\n")
|
.replaceAll("\\{","\\{\n")
|
||||||
|
|
@ -148,9 +173,8 @@ public class ActionLoggingView extends VerticalLayout {
|
||||||
.replaceAll("\\[","\n\\[")
|
.replaceAll("\\[","\n\\[")
|
||||||
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
verticalLayout.add(textArea);
|
verticalLayout.add(textArea);
|
||||||
|
|
||||||
|
|
||||||
dialogPerso1.add(verticalLayout);
|
dialogPerso1.add(verticalLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -175,6 +199,10 @@ public class ActionLoggingView extends VerticalLayout {
|
||||||
TextArea textArea=new TextArea(fact.getFactType().name());
|
TextArea textArea=new TextArea(fact.getFactType().name());
|
||||||
textArea.setReadOnly(true);
|
textArea.setReadOnly(true);
|
||||||
textArea.setClassName("content-log");
|
textArea.setClassName("content-log");
|
||||||
|
try {
|
||||||
|
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(fact.getRealFact());
|
||||||
|
textArea.setValue(text);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
textArea.setValue(
|
textArea.setValue(
|
||||||
fact.getRealFact().toString().replaceAll(",",",\n")
|
fact.getRealFact().toString().replaceAll(",",",\n")
|
||||||
.replaceAll("\\{","\\{\n")
|
.replaceAll("\\{","\\{\n")
|
||||||
|
|
@ -182,12 +210,12 @@ public class ActionLoggingView extends VerticalLayout {
|
||||||
.replaceAll("\\[","\n\\[")
|
.replaceAll("\\[","\n\\[")
|
||||||
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
verticalLayout.add(textArea);
|
verticalLayout.add(textArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dialogPerso1.add(verticalLayout);
|
dialogPerso1.add(verticalLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
dialogPerso1.open();
|
dialogPerso1.open();
|
||||||
});
|
});
|
||||||
whenFact.addClickListener(buttonClickEvent -> {
|
whenFact.addClickListener(buttonClickEvent -> {
|
||||||
|
|
@ -208,6 +236,10 @@ public class ActionLoggingView extends VerticalLayout {
|
||||||
TextArea textArea=new TextArea(fact.getFactType().name());
|
TextArea textArea=new TextArea(fact.getFactType().name());
|
||||||
textArea.setReadOnly(true);
|
textArea.setReadOnly(true);
|
||||||
textArea.setClassName("content-log");
|
textArea.setClassName("content-log");
|
||||||
|
try {
|
||||||
|
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(fact.getRealFact());
|
||||||
|
textArea.setValue(text);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
textArea.setValue(
|
textArea.setValue(
|
||||||
fact.getRealFact().toString().replaceAll(",",",\n")
|
fact.getRealFact().toString().replaceAll(",",",\n")
|
||||||
.replaceAll("\\{","\\{\n")
|
.replaceAll("\\{","\\{\n")
|
||||||
|
|
@ -215,6 +247,7 @@ public class ActionLoggingView extends VerticalLayout {
|
||||||
.replaceAll("\\[","\n\\[")
|
.replaceAll("\\[","\n\\[")
|
||||||
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
verticalLayout.add(textArea);
|
verticalLayout.add(textArea);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -223,7 +256,42 @@ public class ActionLoggingView extends VerticalLayout {
|
||||||
|
|
||||||
dialogPerso1.open();
|
dialogPerso1.open();
|
||||||
});
|
});
|
||||||
|
outputData.addClickListener(buttonClickEvent -> {
|
||||||
|
DialogPerso dialogPerso1=new DialogPerso();
|
||||||
|
|
||||||
|
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
||||||
|
|
||||||
|
if(b!=null&&b.getOutputData()!=null&&b.getOutputData().getRealFact()!=null){
|
||||||
|
|
||||||
|
VerticalLayout verticalLayout=new VerticalLayout();
|
||||||
|
Label label=new Label(b.getEventType().name()+" - "+(b.getRuleExecution()!=null&&b.getRuleExecution().getRuleName()!=null?b.getRuleExecution().getRuleName():""));
|
||||||
|
label.setClassName("creation-runtime-title");
|
||||||
|
verticalLayout.add(label);
|
||||||
|
verticalLayout.setClassName("content-action-logging");
|
||||||
|
|
||||||
|
TextArea textArea=new TextArea(b.getOutputData().getFactType().name());
|
||||||
|
textArea.setReadOnly(true);
|
||||||
|
textArea.setClassName("content-log");
|
||||||
|
try {
|
||||||
|
String text = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(b.getOutputData().getRealFact());
|
||||||
|
textArea.setValue(text);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
textArea.setValue(
|
||||||
|
b.getOutputData().getRealFact().toString().replaceAll(",",",\n")
|
||||||
|
.replaceAll("\\{","\\{\n")
|
||||||
|
.replaceAll("\\}","\n\\}")
|
||||||
|
.replaceAll("\\[","\n\\[")
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
verticalLayout.add(textArea);
|
||||||
|
|
||||||
|
|
||||||
|
dialogPerso1.add(verticalLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
dialogPerso1.open();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,16 @@ package org.chtijbug.drools.reverseproxy.mappings;
|
||||||
import com.github.mkopylec.charon.configuration.MappingProperties;
|
import com.github.mkopylec.charon.configuration.MappingProperties;
|
||||||
import com.github.mkopylec.charon.core.http.ForwardedRequestInterceptor;
|
import com.github.mkopylec.charon.core.http.ForwardedRequestInterceptor;
|
||||||
import com.github.mkopylec.charon.core.http.RequestData;
|
import com.github.mkopylec.charon.core.http.RequestData;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CustomForwardedRequestInterceptor implements ForwardedRequestInterceptor {
|
public class CustomForwardedRequestInterceptor implements ForwardedRequestInterceptor {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CustomForwardedRequestInterceptor.class);
|
||||||
@Override
|
@Override
|
||||||
public void intercept(RequestData data, MappingProperties mapping) {
|
public void intercept(RequestData data, MappingProperties mapping) {
|
||||||
System.out.println("tptp");
|
logger.debug(data.toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,12 +3,15 @@ package org.chtijbug.drools.reverseproxy.mappings;
|
||||||
import com.github.mkopylec.charon.configuration.MappingProperties;
|
import com.github.mkopylec.charon.configuration.MappingProperties;
|
||||||
import com.github.mkopylec.charon.core.http.ReceivedResponseInterceptor;
|
import com.github.mkopylec.charon.core.http.ReceivedResponseInterceptor;
|
||||||
import com.github.mkopylec.charon.core.http.ResponseData;
|
import com.github.mkopylec.charon.core.http.ResponseData;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class CustomReceivedResponseInterceptor implements ReceivedResponseInterceptor {
|
public class CustomReceivedResponseInterceptor implements ReceivedResponseInterceptor {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CustomReceivedResponseInterceptor.class);
|
||||||
@Override
|
@Override
|
||||||
public void intercept(ResponseData responseData, MappingProperties mappingProperties) {
|
public void intercept(ResponseData responseData, MappingProperties mappingProperties) {
|
||||||
System.out.println("response");
|
logger.debug(responseData.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,17 +52,22 @@ public class UpdateService {
|
||||||
if (mappingProperties.getPath().equals(update.getPath())) {
|
if (mappingProperties.getPath().equals(update.getPath())) {
|
||||||
found = true;
|
found = true;
|
||||||
mappingProperties.getDestinations().clear();
|
mappingProperties.getDestinations().clear();
|
||||||
|
logger.info("Updating path {}",update.getPath());
|
||||||
for (String destination : update.getServerNames()) {
|
for (String destination : update.getServerNames()) {
|
||||||
mappingProperties.getDestinations().add(destination);
|
mappingProperties.getDestinations().add(destination);
|
||||||
|
logger.info("for path {} adding server {} ",update.getPath(),destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
MappingProperties newMappingProperties = new MappingProperties();
|
MappingProperties newMappingProperties = new MappingProperties();
|
||||||
newMappingProperties.setPath(update.getPath());
|
newMappingProperties.setPath(update.getPath());
|
||||||
|
logger.info("Creating path {}",update.getPath());
|
||||||
for (String destination : update.getServerNames()) {
|
for (String destination : update.getServerNames()) {
|
||||||
newMappingProperties.getDestinations().add(destination);
|
newMappingProperties.getDestinations().add(destination);
|
||||||
|
logger.info("for path {} adding server {} ",update.getPath(),destination);
|
||||||
}
|
}
|
||||||
mappingPropertiesMap.put(update.getPath(), newMappingProperties);
|
mappingPropertiesMap.put(update.getPath(), newMappingProperties);
|
||||||
}
|
}
|
||||||
|
|
@ -115,7 +120,11 @@ public class UpdateService {
|
||||||
if (mappingProperties2.getDestinations().size() > 0) {
|
if (mappingProperties2.getDestinations().size() > 0) {
|
||||||
mappingPropertiesMap.put(mappingProperties2.getPath(), mappingProperties2);
|
mappingPropertiesMap.put(mappingProperties2.getPath(), mappingProperties2);
|
||||||
paths.add(mappingProperties2);
|
paths.add(mappingProperties2);
|
||||||
logger.info("Project " + projectPersist.getContainerID() + " defined on servers - " + mappingProperties2.getDestinations().toString());
|
logger.info("Startup creating path {}",mappingProperties2.getPath());
|
||||||
|
for (String serverName : mappingProperties2.getDestinations()){
|
||||||
|
logger.info("---------for path {} adding server {} ",mappingProperties2.getPath(),serverName);
|
||||||
|
}
|
||||||
|
logger.info("---------Project " + projectPersist.getContainerID() + " defined on servers - " + mappingProperties2.getDestinations().toString());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
logger.error("Project " + projectPersist.getContainerID() + " defined on non existing server");
|
logger.error("Project " + projectPersist.getContainerID() + " defined on non existing server");
|
||||||
|
|
|
||||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue