Skip to content

Commit

Permalink
Remove unused code, make dev ui properties immutable, hide empty tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher-Chianelli committed Jul 20, 2021
1 parent 4d03167 commit e9ff622
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,6 @@ SolverConfigBuildStep recordAndRegisterBeans(OptaPlannerRecorder recorder, Recor
GizmoMemberAccessorEntityEnhancer.getDroolsInitializer(recorderContext)))
.done());

StringWriter effectiveSolverConfigXMLWriter = new StringWriter();
SolverConfigIO solverConfigIO = new SolverConfigIO();
solverConfigIO.write(solverConfig, effectiveSolverConfigXMLWriter);

syntheticBeanBuildItemBuildProducer.produce(SyntheticBeanBuildItem.configure(SolverManagerConfig.class)
.scope(Singleton.class)
.defaultBean()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
<div class="card-header bg-primary text-light">Solution: {info:solverConfigProperties.optaPlannerModelProperties.solutionClass}</div>
<div class="card-body">
{#for entityClass in info:solverConfigProperties.optaPlannerModelProperties.entityClassList}
<div class="card h-100 shadow">
<div class="card h-100 shadow">
<div class="card-header">Entity: {entityClass}</div>
<div class="card-body">
{#if !info:solverConfigProperties.optaPlannerModelProperties.entityClassToGenuineVariableListMap.get(entityClass).isEmpty()}
<table class="table table-striped">
<thead class="thead-dark">
<tr>
Expand All @@ -53,6 +54,8 @@
{/for}
</tbody>
</table>
{/if}
{#if !info:solverConfigProperties.optaPlannerModelProperties.entityClassToShadowVariableListMap.get(entityClass).isEmpty()}
<table class="table table-striped">
<thead class="thead-dark">
<tr>
Expand All @@ -65,6 +68,7 @@
{/for}
</tbody>
</table>
{/if}
</div>
</div>
{/for}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,10 @@
-->
{#include main}

{#style}
.solver-config {
white-space: pre-wrap;
}
{/style}

{#title}Solver Configuration{/title}

<!--
~ Copyright 2021 Red Hat, Inc. and/or its affiliates.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

{#body}
<div class="solver-config">
{info:solverConfigProperties.effectiveSolverConfig}
</div>
<pre>
{info:solverConfigProperties.effectiveSolverConfig}
</pre>
{/body}
{/include}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void testSolverConfigPage() throws ParserConfigurationException, SAXExcep
Node node = xmlParser.parseText(body);
String solverConfig = ((Node) (node.getAt(QName.valueOf("body"))
.getAt(QName.valueOf("div"))
.getAt(QName.valueOf("div"))
.getAt(QName.valueOf("pre"))
.get(0))).text();
assertThat(solverConfig).isEqualToIgnoringWhitespace(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import java.util.List;

public class OptaPlannerDevUIProperties {
OptaPlannerModelProperties optaPlannerModelProperties;
String effectiveSolverConfigXML;
List<String> constraintList;
private final OptaPlannerModelProperties optaPlannerModelProperties;
private final String effectiveSolverConfigXML;
private final List<String> constraintList;

public OptaPlannerDevUIProperties(OptaPlannerModelProperties optaPlannerModelProperties, String effectiveSolverConfigXML,
List<String> constraintList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import io.quarkus.arc.Arc;

public class OptaPlannerDevUIPropertiesSupplier implements Supplier<OptaPlannerDevUIProperties> {
String effectiveSolverConfigXml;
private String effectiveSolverConfigXml;

public OptaPlannerDevUIPropertiesSupplier() {
this.effectiveSolverConfigXml = null;
Expand All @@ -49,6 +49,7 @@ public OptaPlannerDevUIPropertiesSupplier(String effectiveSolverConfigXml) {
this.effectiveSolverConfigXml = effectiveSolverConfigXml;
}

// Needed for Quarkus Dev UI serialization
public String getEffectiveSolverConfigXml() {
return effectiveSolverConfigXml;
}
Expand Down

0 comments on commit e9ff622

Please sign in to comment.