Start some documentation
Refactor Admin-UI Finish the "drools-framewok-uberfire-security-service" module #97
This commit is contained in:
parent
3f1187921e
commit
13bd10561b
16 changed files with 270 additions and 101 deletions
|
|
@ -51,7 +51,7 @@ public class KieRepositoryService {
|
|||
logger.info("url updateAssetSource : {}", completeurl);
|
||||
|
||||
restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.POST, requestCallback(assetSource, username, password), clientHttpResponse -> {
|
||||
.execute(completeurl, HttpMethod.PUT, requestCallback(assetSource, username, password), clientHttpResponse -> {
|
||||
String extractedResponse = null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
|
|
@ -125,12 +125,17 @@ public class KieRepositoryService {
|
|||
});
|
||||
UserConnected userConnected = new UserConnected();
|
||||
|
||||
UserLoginInformation responseBody = response.getBody();
|
||||
|
||||
userConnected.setUserName(username);
|
||||
userConnected.setUserPassword(password);
|
||||
userConnected.setUserPassword(password);
|
||||
userConnected.getProjectResponses().addAll(responseBody.getProjects());
|
||||
userConnected.getRoles().addAll(responseBody.getRoles());
|
||||
if (response!= null) {
|
||||
UserLoginInformation responseBody = response.getBody();
|
||||
if (responseBody!= null) {
|
||||
userConnected.getProjectResponses().addAll(responseBody.getProjects());
|
||||
userConnected.getRoles().addAll(responseBody.getRoles());
|
||||
}
|
||||
}
|
||||
userConnected.setUserName(username);
|
||||
userConnected.setKieWorkbenchName(workbenchName);
|
||||
return userConnected;
|
||||
|
|
@ -152,7 +157,7 @@ public class KieRepositoryService {
|
|||
logger.info("url moteur reco : {}" , completeurl);
|
||||
ResponseEntity<UserLoginInformation> response = restTemplateKiewb
|
||||
.execute(completeurl, HttpMethod.GET, requestCallback(null, username, password), clientHttpResponse -> {
|
||||
UserLoginInformation extractedResponse = null;
|
||||
UserLoginInformation extractedResponse =null;
|
||||
if (clientHttpResponse.getBody() != null) {
|
||||
Scanner s = new Scanner(clientHttpResponse.getBody()).useDelimiter("\\A");
|
||||
String result = s.hasNext() ? s.next() : "";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package org.chtijbug.drools.console.service.model.kie;
|
||||
|
||||
public class KieConfigurationData {
|
||||
import java.io.Serializable;
|
||||
|
||||
public class KieConfigurationData implements Serializable {
|
||||
|
||||
private String kiewbUrl;
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public class GridRuntime extends Grid<RuntimePersist> {
|
|||
branch.addValueChangeListener(e -> {
|
||||
refreshtGrid(branch.getValue(), strBranch);
|
||||
});
|
||||
versionCo.setHeader(branch);
|
||||
statusCo.setHeader(branch);
|
||||
|
||||
Grid.Column<RuntimePersist> branchCo = addColumn(runtimePersist -> runtimePersist.getStatus());
|
||||
status = new TextField(strStatus);
|
||||
|
|
@ -156,13 +156,9 @@ public class GridRuntime extends Grid<RuntimePersist> {
|
|||
urlMap.put(runtimePersist.getServerName(), runtimePersist.getServerUrl());
|
||||
RuntimePersist runtimePersist1 = runtimePersist.duplicate();
|
||||
if (projectPersist != null) {
|
||||
runtimeToShow.add(runtimePersist1);
|
||||
if (projectPersist.getServerNames().contains(runtimePersist1.getServerName())) {
|
||||
runtimeToShow.add(runtimePersist1);
|
||||
getSelectionModel().select(runtimePersist1);
|
||||
} else {
|
||||
if (projectPersist.getServerNames().size() == 0){
|
||||
runtimeToShow.add(runtimePersist1);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
runtimeToShow.add(runtimePersist1);
|
||||
|
|
|
|||
|
|
@ -17,12 +17,13 @@ import org.springframework.data.domain.PageRequest;
|
|||
import java.util.List;
|
||||
|
||||
public class ActionLogging extends VerticalLayout {
|
||||
private static String active="active";
|
||||
|
||||
private Button viewAction;
|
||||
|
||||
private TextFieldPerso transactionIdSearch;
|
||||
|
||||
private IndexerService indexerService;
|
||||
private transient IndexerService indexerService;
|
||||
|
||||
public ActionLogging(LoggingView loggingView){
|
||||
|
||||
|
|
@ -78,17 +79,17 @@ public class ActionLogging extends VerticalLayout {
|
|||
|
||||
}
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains("active");
|
||||
return button.getClassNames().contains(active);
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains("active")){
|
||||
button.getClassNames().remove("active");
|
||||
if(button.getClassNames().contains(active)){
|
||||
button.getClassNames().remove(active);
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(viewAction);
|
||||
button.getClassNames().add("active");
|
||||
button.getClassNames().add(active);
|
||||
}
|
||||
|
||||
public Button getViewAction() {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class MenuSecondaireAssets extends HorizontalLayout {
|
|||
TemplateView templateView=new TemplateView();
|
||||
TemplatesAction templatesAction=new TemplatesAction(templateView);
|
||||
templateView.setTemplatesAction(templatesAction);
|
||||
squeletteComposant.navigate(templateView,TemplateView.pageName,templatesAction);
|
||||
squeletteComposant.navigate(templateView,TemplateView.PAGE_NAME,templatesAction);
|
||||
});
|
||||
}
|
||||
private boolean isActive(Button button){
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import org.chtijbug.drools.console.view.LoggingView;
|
|||
|
||||
@StyleSheet("css/accueil.css")
|
||||
public class MenuSecondaireLogging extends HorizontalLayout {
|
||||
private static String active="active";
|
||||
|
||||
private Button logging;
|
||||
|
||||
|
|
@ -30,23 +31,23 @@ public class MenuSecondaireLogging extends HorizontalLayout {
|
|||
|
||||
ActionLogging actionLogging=new ActionLogging(loggingView);
|
||||
loggingView.setActionLogging(actionLogging);
|
||||
squeletteComposant.navigate(loggingView,LoggingView.pageName,actionLogging);
|
||||
squeletteComposant.navigate(loggingView,LoggingView.PAGE_NAME,actionLogging);
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isActive(Button button){
|
||||
return button.getClassNames().contains("active");
|
||||
return button.getClassNames().contains(active);
|
||||
}
|
||||
private void removeActive(Button button) {
|
||||
|
||||
if(button.getClassNames().contains("active")){
|
||||
button.getClassNames().remove("active");
|
||||
if(button.getClassNames().contains(active)){
|
||||
button.getClassNames().remove(active);
|
||||
}
|
||||
}
|
||||
private void active(Button button){
|
||||
removeActive(logging);
|
||||
|
||||
button.getClassNames().add("active");
|
||||
button.getClassNames().add(active);
|
||||
}
|
||||
|
||||
public Button getLogging() {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import org.chtijbug.drools.console.vaadincomponent.leftMenu.Action.ActionLogging
|
|||
@StyleSheet("css/accueil.css")
|
||||
public class LoggingView extends VerticalLayout {
|
||||
|
||||
public static final String pageName="Logging";
|
||||
public static final String PAGE_NAME = "Logging";
|
||||
|
||||
private Label title;
|
||||
|
||||
|
|
@ -17,29 +17,25 @@ public class LoggingView extends VerticalLayout {
|
|||
|
||||
private ActionLogging actionLogging;
|
||||
|
||||
public LoggingView(){
|
||||
public LoggingView() {
|
||||
|
||||
title=new Label("Logging : ");
|
||||
title = new Label("Logging : ");
|
||||
|
||||
add(title);
|
||||
|
||||
gridLogging=new GridLogging();
|
||||
gridLogging = new GridLogging();
|
||||
|
||||
add(gridLogging);
|
||||
|
||||
|
||||
gridLogging.addSelectionListener(selectionEvent -> {
|
||||
gridLogging.addSelectionListener(selectionEvent ->
|
||||
actionLogging.getViewAction().setEnabled(selectionEvent.getFirstSelectedItem().isPresent())
|
||||
|
||||
if(selectionEvent.getFirstSelectedItem().isPresent()) {
|
||||
actionLogging.getViewAction().setEnabled(true);
|
||||
}else {
|
||||
actionLogging.getViewAction().setEnabled(false);
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
public static String getPageName() {
|
||||
return pageName;
|
||||
return PAGE_NAME;
|
||||
}
|
||||
|
||||
public GridLogging getGridLogging() {
|
||||
|
|
|
|||
|
|
@ -30,19 +30,19 @@ import java.util.Set;
|
|||
@StyleSheet("css/accueil.css")
|
||||
public class TemplateView extends VerticalLayout {
|
||||
|
||||
public static final String pageName="Templates";
|
||||
public static final String PAGE_NAME = "Templates";
|
||||
|
||||
private KieConfigurationData config;
|
||||
private transient KieConfigurationData config;
|
||||
|
||||
private KieRepositoryService kieRepositoryService;
|
||||
private transient KieRepositoryService kieRepositoryService;
|
||||
|
||||
private UserConnected userConnected;
|
||||
private transient UserConnected userConnected;
|
||||
|
||||
private UserConnectedService userConnectedService;
|
||||
private transient UserConnectedService userConnectedService;
|
||||
|
||||
private UserGroupsRepository userGroupsRepository;
|
||||
private transient UserGroupsRepository userGroupsRepository;
|
||||
|
||||
private ProjectPersistService projectPersistService;
|
||||
private transient ProjectPersistService projectPersistService;
|
||||
|
||||
private ListDataProvider<Asset> dataProvider;
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ public class TemplateView extends VerticalLayout {
|
|||
|
||||
private TextField searchTemplate;
|
||||
|
||||
private ConfigurableFilterDataProvider<Asset,Void,SerializablePredicate<Asset>> filterDataProvider;
|
||||
private ConfigurableFilterDataProvider<Asset, Void, SerializablePredicate<Asset>> filterDataProvider;
|
||||
|
||||
private TemplatesAction templatesAction;
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ public class TemplateView extends VerticalLayout {
|
|||
|
||||
setClassName("template-content");
|
||||
|
||||
dataProvider=new ListDataProvider<>(new ArrayList<>());
|
||||
dataProvider = new ListDataProvider<>(new ArrayList<>());
|
||||
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||
|
||||
this.kieRepositoryService = AppContext.getApplicationContext().getBean(KieRepositoryService.class);
|
||||
|
|
@ -68,31 +68,27 @@ public class TemplateView extends VerticalLayout {
|
|||
this.projectPersistService = AppContext.getApplicationContext().getBean(ProjectPersistService.class);
|
||||
this.config = AppContext.getApplicationContext().getBean(KieConfigurationData.class);
|
||||
|
||||
assetListGrid = new Grid();
|
||||
assetListGrid = new Grid<>();
|
||||
assetListGrid.setClassName("templates-grid-perso");
|
||||
assetListGrid.setSelectionMode(Grid.SelectionMode.SINGLE);
|
||||
|
||||
Grid.Column<Asset> assetColumn=assetListGrid.addColumn(asset -> asset.getTitle());
|
||||
searchTemplate=new TextField("title");
|
||||
Grid.Column<Asset> assetColumn = assetListGrid.addColumn(Asset::getTitle);
|
||||
searchTemplate = new TextField("title");
|
||||
searchTemplate.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
searchTemplate.addValueChangeListener(e -> {
|
||||
refreshtGrid(searchTemplate.getValue(), "title");
|
||||
});
|
||||
searchTemplate.addValueChangeListener(e ->
|
||||
refreshtGrid(searchTemplate.getValue(), "title")
|
||||
);
|
||||
assetColumn.setHeader(searchTemplate);
|
||||
add(assetListGrid);
|
||||
|
||||
assetListGrid.addSelectionListener(selectionEvent -> {
|
||||
if(assetListGrid.getSelectedItems()==null){
|
||||
templatesAction.getEdit().setEnabled(false);
|
||||
}else {
|
||||
templatesAction.getEdit().setEnabled(true);
|
||||
}
|
||||
});
|
||||
assetListGrid.addSelectionListener(selectionEvent ->
|
||||
templatesAction.getEdit().setEnabled(assetListGrid.getSelectedItems() != null)
|
||||
);
|
||||
}
|
||||
|
||||
public void setDataProvider(ComboBox<ProjectPersist> spaceSelection){
|
||||
public void setDataProvider(ComboBox<ProjectPersist> spaceSelection) {
|
||||
ProjectPersist response = spaceSelection.getValue();
|
||||
if (response!= null) {
|
||||
if (response != null) {
|
||||
UserGroups projectGroups = userGroupsRepository.findUserGroupsByProjectPersist(response);
|
||||
String workspaceName = projectGroups.getWorkspaceUserGroup().getSpaceName();
|
||||
List<Asset> tmp = kieRepositoryService.getListAssets(config.getKiewbUrl(),
|
||||
|
|
@ -111,7 +107,7 @@ public class TemplateView extends VerticalLayout {
|
|||
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||
assetListGrid.setDataProvider(filterDataProvider);
|
||||
reinitFilter();
|
||||
}else{
|
||||
} else {
|
||||
List<Asset> result = new ArrayList<>();
|
||||
dataProvider = new ListDataProvider<>(result);
|
||||
filterDataProvider = dataProvider.withConfigurableFilter();
|
||||
|
|
@ -123,17 +119,17 @@ public class TemplateView extends VerticalLayout {
|
|||
public void refreshList(ComboBox<ProjectPersist> spaceSelection) {
|
||||
spaceSelection.setItems(projectPersistService.findProjectsConnectedUser().values());
|
||||
}
|
||||
public void edit(ComboBox<ProjectPersist> spaceSelection){
|
||||
|
||||
public void edit(ComboBox<ProjectPersist> spaceSelection) {
|
||||
Set<Asset> selectedElements = assetListGrid.getSelectedItems();
|
||||
if (selectedElements.toArray().length > 0) {
|
||||
Optional<Asset> assetOptional = selectedElements.stream().findFirst();
|
||||
if (assetOptional.isPresent()) {
|
||||
String assetName = assetOptional.get().getTitle();
|
||||
if (assetName != null) {
|
||||
//latformProjectData response = spaceSelection.getValue();
|
||||
userConnectedService.addAssetToSession(assetName);
|
||||
UserGroups projectGroups = userGroupsRepository.findUserGroupsByProjectPersist(spaceSelection.getValue());
|
||||
String workspaceName=projectGroups.getWorkspaceUserGroup().getSpaceName();
|
||||
String workspaceName = projectGroups.getWorkspaceUserGroup().getSpaceName();
|
||||
userConnectedService.addProjectToSession(projectGroups.getProjectName());
|
||||
userConnectedService.addSpaceToSession(workspaceName);
|
||||
DialogPerso dialog = new DialogPerso();
|
||||
|
|
@ -144,16 +140,18 @@ public class TemplateView extends VerticalLayout {
|
|||
}
|
||||
}
|
||||
}
|
||||
private void refreshtGrid(String value,String type){
|
||||
|
||||
filterDataProvider.setFilter(filterGrid(value.toUpperCase(),type));
|
||||
private void refreshtGrid(String value, String type) {
|
||||
|
||||
filterDataProvider.setFilter(filterGrid(value.toUpperCase(), type));
|
||||
assetListGrid.getDataProvider().refreshAll();
|
||||
}
|
||||
private SerializablePredicate<Asset> filterGrid(String value, String type){
|
||||
|
||||
private SerializablePredicate<Asset> filterGrid(String value, String type) {
|
||||
SerializablePredicate<Asset> columnPredicate = null;
|
||||
if(value.equals(" ")||type.equals(" ")){
|
||||
if (value.equals(" ") || type.equals(" ")) {
|
||||
columnPredicate = asset -> (true);
|
||||
}else {
|
||||
} else {
|
||||
if (type.equals("Asset Title")) {
|
||||
columnPredicate = asset -> (asset.getTitle().contains(value));
|
||||
}
|
||||
|
|
@ -169,9 +167,11 @@ public class TemplateView extends VerticalLayout {
|
|||
this.userConnectedService = userConnectedService;
|
||||
}
|
||||
|
||||
public void duplicate(){}
|
||||
public void duplicate() {
|
||||
//NOP
|
||||
}
|
||||
|
||||
public void reinitFilter(){
|
||||
public void reinitFilter() {
|
||||
searchTemplate.setValue("");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
server.port=${port:8200}
|
||||
kie-wb.baseurl=${PYMMA_KIE_BASE_URL:http://localhost:18080/kie-wb/rest}
|
||||
kie-wb.mainwbintern=${PYMMA_KIE_MAINWBINTERN:http://localhost:8080/kie-wb}
|
||||
kie-wb.mainwbextern=${PYMMA_KIE_MAINWBEXTERN:http://localhost:8080/kie-wb}
|
||||
kie-wb.mainwbextern=${PYMMA_KIE_MAINWBEXTERN:http://localhost:18080/kie-wb}
|
||||
kie-wb.username=${PYMMA_KIE_USER:admin}
|
||||
kie-wb.password=${PYMMA_KIE_PASSWORD:admin}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue