commit
f3a1407e00
7 changed files with 356 additions and 13 deletions
|
|
@ -9,17 +9,35 @@ import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
|||
@StyleSheet("css/composantperso/dialog.css")
|
||||
public class DialogPerso extends Dialog {
|
||||
|
||||
private HorizontalLayout bar;
|
||||
|
||||
private Button close;
|
||||
|
||||
public DialogPerso(){
|
||||
HorizontalLayout bar = new HorizontalLayout();
|
||||
Button close = new Button();
|
||||
bar = new HorizontalLayout();
|
||||
close = new Button();
|
||||
close.setIcon(VaadinIcon.CLOSE.create());
|
||||
close.addClassName("DialogClose");
|
||||
bar.addClassName("DialogBar");
|
||||
bar.add(close);
|
||||
add(bar);
|
||||
setCloseOnEsc(false);
|
||||
setCloseOnOutsideClick(false);
|
||||
|
||||
close.addClickListener(buttonClickEvent -> close());
|
||||
}
|
||||
|
||||
public HorizontalLayout getBar() {
|
||||
return bar;
|
||||
}
|
||||
|
||||
public void setBar(HorizontalLayout bar) {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
public Button getClose() {
|
||||
return close;
|
||||
}
|
||||
|
||||
public void setClose(Button close) {
|
||||
this.close = close;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package org.chtijbug.drools.console.vaadinComponent.componentView;
|
||||
|
||||
import com.vaadin.flow.component.checkbox.Checkbox;
|
||||
import com.vaadin.flow.component.grid.Grid;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.component.textfield.TextField;
|
||||
import com.vaadin.flow.data.provider.ConfigurableFilterDataProvider;
|
||||
|
|
@ -15,6 +17,7 @@ import org.chtijbug.drools.indexer.persistence.model.BusinessTransactionAction;
|
|||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
||||
|
|
@ -27,6 +30,8 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
|||
|
||||
private TextField packageName;
|
||||
|
||||
private TextField ruleFlowGroup;
|
||||
|
||||
|
||||
|
||||
private String strEventType ="EventType";
|
||||
|
|
@ -37,6 +42,7 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
|||
|
||||
private String strPackageName ="Package";
|
||||
|
||||
private String strRuleFlowGroup="RuleFlouwGroup";
|
||||
|
||||
private ListDataProvider<BusinessTransactionAction> dataProvider;
|
||||
private ConfigurableFilterDataProvider<BusinessTransactionAction,Void,SerializablePredicate<BusinessTransactionAction>> filterDataProvider;
|
||||
|
|
@ -53,16 +59,23 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
|||
|
||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||
|
||||
VerticalLayout verticalLayout=new VerticalLayout();
|
||||
|
||||
SimpleDateFormat simpleDateFormat=new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss");
|
||||
Label label=new Label();
|
||||
if(runtimePersist.getRuleExecution()!=null) {
|
||||
Label label = new Label("Starting ->" + runtimePersist.getRuleExecution().getStartDate());
|
||||
verticalLayout.add(label);
|
||||
Label label2 = new Label("Ending ->" + runtimePersist.getRuleExecution().getEndDate());
|
||||
verticalLayout.add(label2);
|
||||
label.setText(simpleDateFormat.format(runtimePersist.getRuleExecution().getStartDate()));
|
||||
}
|
||||
return verticalLayout;
|
||||
})).setHeader("Date");
|
||||
return label;
|
||||
})).setHeader("Début");
|
||||
|
||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||
|
||||
SimpleDateFormat simpleDateFormat=new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss");
|
||||
Label label=new Label();
|
||||
if(runtimePersist.getRuleExecution()!=null) {
|
||||
label.setText(simpleDateFormat.format(runtimePersist.getRuleExecution().getEndDate()));
|
||||
}
|
||||
return label;
|
||||
})).setHeader("Fin");
|
||||
|
||||
|
||||
Grid.Column<BusinessTransactionAction> enventTypeC=addColumn(runtimePersist -> runtimePersist.getEventType());
|
||||
|
|
@ -81,6 +94,7 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
|||
refreshtGrid(positionExecution.getValue(), strPositionExecution);
|
||||
});
|
||||
positionC.setHeader(positionExecution);
|
||||
positionC.setWidth("3%");
|
||||
|
||||
Grid.Column<BusinessTransactionAction> ruleNameC=addColumn(runtimePersist -> runtimePersist.getRuleExecution()!=null?runtimePersist.getRuleExecution().getRuleName():"");
|
||||
ruleName =new TextField(strRuleName);
|
||||
|
|
@ -98,6 +112,34 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
|||
});
|
||||
versionC.setHeader(packageName);
|
||||
|
||||
Grid.Column<BusinessTransactionAction> ruleflowC=addColumn(runtimePersist -> runtimePersist.getRuleflowGroupName()!=null?runtimePersist.getRuleflowGroupName():"");
|
||||
ruleFlowGroup =new TextField(strRuleFlowGroup);
|
||||
ruleFlowGroup.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
ruleFlowGroup.addValueChangeListener(e -> {
|
||||
refreshtGrid(ruleFlowGroup.getValue(), strRuleFlowGroup);
|
||||
});
|
||||
ruleflowC.setHeader(ruleFlowGroup);
|
||||
|
||||
addColumn(new ComponentRenderer<>(runtimePersist -> {
|
||||
|
||||
Checkbox label=new Checkbox();
|
||||
label.setValue(false);
|
||||
|
||||
if(runtimePersist.getInputData()!=null&&runtimePersist.getInputData().getRealFact()!=null){
|
||||
label.setValue(true);
|
||||
}
|
||||
if(runtimePersist.getFact()!=null&&runtimePersist.getFact().getRealFact()!=null){
|
||||
label.setValue(true);
|
||||
}
|
||||
if(runtimePersist.getRuleExecution()!=null&&runtimePersist.getRuleExecution().getThenFacts()!=null&&runtimePersist.getRuleExecution().getThenFacts().size()>0){
|
||||
label.setValue(true);
|
||||
}
|
||||
if(runtimePersist.getRuleExecution()!=null&&runtimePersist.getRuleExecution().getWhenFacts()!=null&&runtimePersist.getRuleExecution().getWhenFacts().size()>0){
|
||||
label.setValue(true);
|
||||
}
|
||||
return label;
|
||||
})).setHeader("Data?");
|
||||
|
||||
setDataProvider(idRequest);
|
||||
}
|
||||
private void refreshtGrid(String value,String type){
|
||||
|
|
@ -122,6 +164,10 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
|||
else if (type.equals(strPackageName)) {
|
||||
columnPredicate = runtimePersist -> (runtimePersist.getRuleExecution()!=null&&runtimePersist.getRuleExecution().getPackageName()!=null&&runtimePersist.getRuleExecution().getPackageName().toUpperCase().contains(value));
|
||||
}
|
||||
else if (type.equals(strRuleFlowGroup)) {
|
||||
columnPredicate = runtimePersist -> (runtimePersist.getRuleflowGroupName()!=null&&runtimePersist.getRuleflowGroupName().toUpperCase().contains(value));
|
||||
}
|
||||
|
||||
}
|
||||
return columnPredicate;
|
||||
}
|
||||
|
|
@ -145,6 +191,7 @@ public class GridActionLogging extends Grid<BusinessTransactionAction> {
|
|||
ruleName.setValue("");
|
||||
eventType.setValue("");
|
||||
packageName.setValue("");
|
||||
ruleFlowGroup.setValue("");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import org.chtijbug.drools.console.vaadinComponent.componentView.AddRuntime;
|
|||
import org.chtijbug.drools.console.vaadinComponent.componentView.DefineProject;
|
||||
import org.chtijbug.drools.console.vaadinComponent.componentView.GridActionLogging;
|
||||
import org.chtijbug.drools.console.vaadinComponent.componentView.GridLogging;
|
||||
import org.chtijbug.drools.console.view.ActionLoggingView;
|
||||
import org.chtijbug.drools.console.view.LoggingView;
|
||||
import org.chtijbug.drools.indexer.persistence.model.BusinessTransactionPersistence;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
|
@ -75,8 +76,8 @@ public class ActionLogging extends VerticalLayout {
|
|||
|
||||
if(b!=null) {
|
||||
DialogPerso dialog = new DialogPerso();
|
||||
dialog.add(new Label("Transaction Id : "+b.getTransactionId()));
|
||||
dialog.add(new GridActionLogging(b.getId()));
|
||||
|
||||
dialog.add(new ActionLoggingView(b,dialog));
|
||||
dialog.open();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.chtijbug.drools.console.view;
|
||||
|
||||
import com.vaadin.flow.component.UI;
|
||||
import com.vaadin.flow.component.dependency.HtmlImport;
|
||||
import com.vaadin.flow.component.dependency.StyleSheet;
|
||||
import com.vaadin.flow.component.page.Push;
|
||||
import com.vaadin.flow.router.BeforeEnterEvent;
|
||||
|
|
@ -11,6 +12,7 @@ import org.chtijbug.drools.console.vaadinComponent.Squelette.SqueletteComposant;
|
|||
|
||||
@Push(PushMode.AUTOMATIC)
|
||||
@StyleSheet("css/accueil.css")
|
||||
@HtmlImport("frontend://styles/shared-styles.html")
|
||||
@Route("accueil")
|
||||
public class AccueilView extends SqueletteComposant implements BeforeEnterObserver {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,234 @@
|
|||
package org.chtijbug.drools.console.view;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectWriter;
|
||||
import com.vaadin.flow.component.button.Button;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.component.html.Label;
|
||||
import com.vaadin.flow.component.textfield.TextArea;
|
||||
import com.vaadin.flow.component.treegrid.TreeGrid;
|
||||
import com.vaadin.flow.data.provider.ListDataProvider;
|
||||
import org.chtijbug.drools.console.vaadinComponent.ComponentPerso.DialogPerso;
|
||||
import org.chtijbug.drools.console.vaadinComponent.componentView.GridActionLogging;
|
||||
import org.chtijbug.drools.indexer.persistence.model.BusinessTransactionAction;
|
||||
import org.chtijbug.drools.indexer.persistence.model.BusinessTransactionPersistence;
|
||||
import org.chtijbug.drools.logging.Fact;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class ActionLoggingView extends VerticalLayout {
|
||||
|
||||
private Label title;
|
||||
|
||||
private GridActionLogging gridActionLogging;
|
||||
|
||||
private Button inputData;
|
||||
|
||||
private Button realFact;
|
||||
|
||||
private Button whenFact;
|
||||
|
||||
private Button thenFact;
|
||||
|
||||
public ActionLoggingView(BusinessTransactionPersistence businessTransactionPersistence,DialogPerso dialogPerso){
|
||||
|
||||
dialogPerso.getClose().setVisible(false);
|
||||
|
||||
inputData=new Button("View InputData");
|
||||
inputData.setClassName("menu-button");
|
||||
inputData.setEnabled(false);
|
||||
|
||||
|
||||
dialogPerso.getBar().add(inputData);
|
||||
|
||||
realFact=new Button("View RealFact");
|
||||
realFact.setClassName("menu-button");
|
||||
realFact.setEnabled(false);
|
||||
|
||||
dialogPerso.getBar().add(realFact);
|
||||
|
||||
whenFact=new Button("View WhenFact");
|
||||
whenFact.setClassName("menu-button");
|
||||
whenFact.setEnabled(false);
|
||||
|
||||
dialogPerso.getBar().add(whenFact);
|
||||
|
||||
thenFact=new Button("View ThenFact");
|
||||
thenFact.setClassName("menu-button");
|
||||
thenFact.setEnabled(false);
|
||||
|
||||
dialogPerso.getBar().add(thenFact);
|
||||
|
||||
title=new Label("TransactionID : "+businessTransactionPersistence.getId());
|
||||
title.setClassName("creation-runtime-title");
|
||||
|
||||
add(title);
|
||||
|
||||
|
||||
gridActionLogging=new GridActionLogging(businessTransactionPersistence.getId());
|
||||
add(gridActionLogging);
|
||||
|
||||
gridActionLogging.addSelectionListener(selectionEvent -> {
|
||||
|
||||
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
||||
|
||||
if(b!=null){
|
||||
if(b.getInputData()!=null&&b.getInputData().getRealFact()!=null){
|
||||
inputData.setEnabled(true);
|
||||
}else {
|
||||
inputData.setEnabled(false);
|
||||
}
|
||||
if(b.getFact()!=null&&b.getFact().getRealFact()!=null){
|
||||
realFact.setEnabled(true);
|
||||
}else {
|
||||
realFact.setEnabled(false);
|
||||
}
|
||||
if(b.getRuleExecution()!=null&&b.getRuleExecution().getThenFacts()!=null&&b.getRuleExecution().getThenFacts().size()>0){
|
||||
thenFact.setEnabled(true);
|
||||
}else {
|
||||
thenFact.setEnabled(false);
|
||||
}
|
||||
if(b.getRuleExecution()!=null&&b.getRuleExecution().getWhenFacts()!=null&&b.getRuleExecution().getWhenFacts().size()>0){
|
||||
whenFact.setEnabled(true);
|
||||
}else {
|
||||
whenFact.setEnabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
inputData.addClickListener(buttonClickEvent -> {
|
||||
DialogPerso dialogPerso1=new DialogPerso();
|
||||
|
||||
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
||||
|
||||
if(b!=null&&b.getInputData()!=null&&b.getInputData().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.getInputData().getFactType().name());
|
||||
textArea.setClassName("content-log");
|
||||
textArea.setValue(
|
||||
b.getInputData().getRealFact().toString().replaceAll(",",",\n")
|
||||
.replaceAll("\\{","\\{\n")
|
||||
.replaceAll("\\}","\n\\}")
|
||||
.replaceAll("\\[","\n\\[")
|
||||
|
||||
);
|
||||
verticalLayout.add(textArea);
|
||||
|
||||
|
||||
dialogPerso1.add(verticalLayout);
|
||||
}
|
||||
|
||||
dialogPerso1.open();
|
||||
});
|
||||
|
||||
realFact.addClickListener(buttonClickEvent -> {
|
||||
DialogPerso dialogPerso1=new DialogPerso();
|
||||
|
||||
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
||||
|
||||
if(b!=null&&b.getFact()!=null&&b.getFact().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.getFact().getFactType().name());
|
||||
textArea.setClassName("content-log");
|
||||
textArea.setValue(
|
||||
b.getFact().getRealFact().toString().replaceAll(",",",\n")
|
||||
.replaceAll("\\{","\\{\n")
|
||||
.replaceAll("\\}","\n\\}")
|
||||
.replaceAll("\\[","\n\\[")
|
||||
|
||||
);
|
||||
verticalLayout.add(textArea);
|
||||
|
||||
|
||||
dialogPerso1.add(verticalLayout);
|
||||
}
|
||||
|
||||
dialogPerso1.open();
|
||||
});
|
||||
|
||||
thenFact.addClickListener(buttonClickEvent -> {
|
||||
DialogPerso dialogPerso1=new DialogPerso();
|
||||
|
||||
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
||||
|
||||
if(b!=null&&b.getRuleExecution()!=null&&b.getRuleExecution().getThenFacts()!=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");
|
||||
for (Fact fact:b.getRuleExecution().getThenFacts()){
|
||||
if(fact!=null&&fact.getRealFact()!=null){
|
||||
|
||||
TextArea textArea=new TextArea(fact.getFactType().name());
|
||||
textArea.setClassName("content-log");
|
||||
textArea.setValue(
|
||||
fact.getRealFact().toString().replaceAll(",",",\n")
|
||||
.replaceAll("\\{","\\{\n")
|
||||
.replaceAll("\\}","\n\\}")
|
||||
.replaceAll("\\[","\n\\[")
|
||||
|
||||
);
|
||||
verticalLayout.add(textArea);
|
||||
}
|
||||
}
|
||||
dialogPerso1.add(verticalLayout);
|
||||
}
|
||||
|
||||
dialogPerso1.open();
|
||||
});
|
||||
whenFact.addClickListener(buttonClickEvent -> {
|
||||
DialogPerso dialogPerso1=new DialogPerso();
|
||||
|
||||
BusinessTransactionAction b=gridActionLogging.getSelectedItems().stream().findFirst().get();
|
||||
|
||||
if(b!=null&&b.getRuleExecution()!=null&&b.getRuleExecution().getWhenFacts()!=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");
|
||||
for (Fact fact:b.getRuleExecution().getWhenFacts()){
|
||||
if(fact!=null&&fact.getRealFact()!=null){
|
||||
|
||||
TextArea textArea=new TextArea(fact.getFactType().name());
|
||||
textArea.setClassName("content-log");
|
||||
textArea.setValue(
|
||||
fact.getRealFact().toString().replaceAll(",",",\n")
|
||||
.replaceAll("\\{","\\{\n")
|
||||
.replaceAll("\\}","\n\\}")
|
||||
.replaceAll("\\[","\n\\[")
|
||||
|
||||
);
|
||||
verticalLayout.add(textArea);
|
||||
}
|
||||
}
|
||||
dialogPerso1.add(verticalLayout);
|
||||
}
|
||||
|
||||
dialogPerso1.open();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -6,3 +6,32 @@
|
|||
.log-grid-perso{
|
||||
height: 40vw;
|
||||
}
|
||||
.menu-button{
|
||||
background: transparent;
|
||||
width: 100%;
|
||||
font-size: 1vw;
|
||||
margin: 0px;
|
||||
height: 3vw;
|
||||
color: rgb(0,0,0,0.4);
|
||||
border-radius: 0px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.menu-button[disabled][disabled] {
|
||||
pointer-events: none;
|
||||
color: var(--lumo-disabled-text-color);
|
||||
}
|
||||
.content-action-logging{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
.content-log{
|
||||
width: 30vw;
|
||||
height: 19vw;
|
||||
position: relative;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
.vaadin-text-area-container div[part="input-field"]{
|
||||
overflow-y: scroll!important;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
|
||||
|
||||
<dom-module id="my-text-field-styles" theme-for="vaadin-text-area">
|
||||
<template>
|
||||
<style>
|
||||
[part="input-field"] [part="value"]{
|
||||
overflow-y: auto!important;
|
||||
}
|
||||
</style>
|
||||
</template>
|
||||
</dom-module>
|
||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue