Skip to content

Commit 4a1d813

Browse files
Result will show in modal instead of window popup (#92)
* Result will show in modal instead of window popup * Width now more responsive
1 parent d2dac7b commit 4a1d813

File tree

4 files changed

+37
-25
lines changed

4 files changed

+37
-25
lines changed

src/functionaltest/java/com/ericsson/ei/frontend/pageobjects/TestRulesPage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ public void clickFindAggregatedObject(String findAggregatedObjectResponse) throw
140140
}
141141

142142
public String getAggregatedResultData() {
143-
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.presenceOfElementLocated(By.id("aggregatedresultData")));
144-
WebElement aggregatedResultDataElement = driver.findElement(By.id("aggregatedresultData"));
143+
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.presenceOfElementLocated(By.id("aggregatedObjectContent")));
144+
WebElement aggregatedResultDataElement = driver.findElement(By.id("aggregatedObjectContent"));
145145
return aggregatedResultDataElement.getAttribute("textContent").replaceAll("[\\n ]", "");
146146
}
147147
}

src/main/resources/static/css/style.css

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,23 @@
7575
white-space: nowrap;
7676
border-radius: .25rem;
7777
}
78-
78+
.modal-height-fit {
79+
max-height: calc(100vh - 200px);
80+
overflow-y: auto;
81+
}
82+
.modal-width-aggregated {
83+
max-width: 750px;
84+
}
85+
.pre {
86+
display: block;
87+
font-family: monospace;
88+
white-space: pre;
89+
margin: 1em;
90+
font-size: medium;
91+
}
7992
.showPasswordButton{
8093
margin-top: 10px;
8194
}
82-
8395
/* Safari */
8496
@-webkit-keyframes spin {
8597
0% { -webkit-transform: rotate(0deg); }

src/main/resources/static/js/testrules.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,21 +118,14 @@ jQuery(document).ready(
118118
beforeSend : function() {
119119
},
120120
success : function(data, textStatus) {
121-
var returnData = data;
122-
if (returnData.length > 0) {
121+
if (data.length > 0) {
123122
$.jGrowl("Successfully aggregated object generated", {
124123
sticky : false,
125124
theme : 'Error'
126125
});
127126

128-
$('#aggregatedresultData').text(JSON.stringify(data, null, 2));
129-
var divText = document.getElementById("aggregatedresult").outerHTML;
130-
var myWindow = window.open('', '', 'width=700,height=1000');
131-
var doc = myWindow.document;
132-
doc.open();
133-
doc.write(divText);
134-
doc.close();
135-
myWindow.focus();
127+
$('#aggregatedObjectContent').text(JSON.stringify(data, null, 2));
128+
$('#aggregatedObjectModal').modal('show');
136129
}
137130
},
138131
error : function(XMLHttpRequest, textStatus, errorThrown) {

src/main/resources/templates/testRules.html

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,23 @@ <h6>
115115
</div>
116116
</div>
117117
</div>
118-
<div style="display: none">
119-
<div id="aggregatedresult">
120-
<h1>
121-
<strong>
122-
<span style="color: #0000ff;">Aggregated Object</span>
123-
</strong>
124-
</h1>
125-
<pre id="aggregatedresultData"></pre>
126-
</div>
127-
</div>
118+
<div id="aggregatedObjectModal" class="modal fade" role="dialog">
119+
<div class="modal-dialog modal-width-aggregated" role="document">
120+
<div class="modal-content">
121+
<div class="modal-header">
122+
<h5 class="modal-title">Aggregated Object</h5>
123+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
124+
<span aria-hidden="true">&times;</span>
125+
</button>
126+
</div>
127+
<div class="modal-body modal-height-fit">
128+
<p id="aggregatedObjectContent" class="pre"></p>
129+
</div>
130+
<div class="modal-footer">
131+
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
132+
</div>
133+
</div>
134+
</div>
135+
</div>
128136
</body>
129-
130137
</html>

0 commit comments

Comments
 (0)