Skip to content

Commit b3b6ee8

Browse files
Add page that displays rules from GET /rules endpoint (#228)
* Add page for the rules under the Eiffel Intelligence Info menu item.
1 parent c233a46 commit b3b6ee8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+138
-66
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
- stage: test
7171
name: integrationTests
7272
script:
73-
- "mvn verify -DskipUTs -Dei.backend.instances.list.json.content=\"[{ 'contextPath': '', 'port': '${EI_BACKEND_PORT}', 'name': 'EI-Backend-1', 'host': 'localhost', 'https': false, 'defaultBackend': true}]\" -B"
73+
- "mvn verify -P integrationTest -DskipUTs -Dei.backend.instances.list.json.content=\"[{ 'contextPath': '', 'port': '${EI_BACKEND_PORT}', 'name': 'EI-Backend-1', 'host': 'localhost', 'https': false, 'defaultBackend': true}]\" -B"
7474
- stage: deploy
7575
name: deployGitHubPages
7676
before_install: skip # do not run again

src/functionaltest/java/com/ericsson/ei/frontend/TestNavigation.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public void before() {
2626
public void testPageNavigationButtons() throws IOException {
2727
indexPage.clickTestRulesPage();
2828
indexPage.clickEiInfoBtn();
29+
indexPage.clickInformationBtn();
30+
indexPage.clickRulesBtn();
2931
indexPage.clickAdminBackendInstancesBtn();
3032
indexPage.clickAddBackendInstanceBtn();
3133
indexPage.clickSwitchBackendInstanceBtn();

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

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public void clickReloadButton() throws IOException {
6666

6767

6868
public void clickAdminBackendInstancesBtn() {
69-
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@href='#confBackend']")));
70-
WebElement adminBackendInstancesBtn = driver.findElement(By.xpath("//a[@href='#confBackend']"));
69+
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@href='#conf-backend']")));
70+
WebElement adminBackendInstancesBtn = driver.findElement(By.xpath("//a[@href='#conf-backend']"));
7171
adminBackendInstancesBtn.click();
7272
}
7373

@@ -89,9 +89,24 @@ public SwitchBackendPage clickSwitchBackendInstanceBtn() throws IOException {
8989
return switchBackendPage;
9090
}
9191

92-
public InfoPage clickEiInfoBtn() {
92+
public void clickEiInfoBtn() {
9393
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@href='#ei-info']")));
94-
WebElement eiInfoBtn = driver.findElement(By.xpath("//a[@href='#ei-info']"));
94+
WebElement eiffelInfoBtn = driver.findElement(By.xpath("//a[@href='#ei-info']"));
95+
eiffelInfoBtn.click();
96+
}
97+
98+
public InfoPage clickInformationBtn() {
99+
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@href='#information']")));
100+
WebElement eiInfoBtn = driver.findElement(By.xpath("//a[@href='#information']"));
101+
eiInfoBtn.click();
102+
InfoPage infoPage = new InfoPage(mockedHttpClient, driver, baseUrl);
103+
waitForJQueryToLoad();
104+
return infoPage;
105+
}
106+
107+
public InfoPage clickRulesBtn() {
108+
new WebDriverWait(driver, TIMEOUT_TIMER).until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@href='#rules']")));
109+
WebElement eiInfoBtn = driver.findElement(By.xpath("//a[@href='#rules']"));
95110
eiInfoBtn.click();
96111
InfoPage infoPage = new InfoPage(mockedHttpClient, driver, baseUrl);
97112
waitForJQueryToLoad();

src/main/java/com/ericsson/ei/frontend/EIRequestsController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class EIRequestsController {
7171
*/
7272
@CrossOrigin
7373
@RequestMapping(value = { "/subscriptions", "/subscriptions/*", "/information", "/download/*", "/auth", "/auth/*",
74-
"/queryAggregatedObject", "/queryMissedNotifications", "/query",
74+
"/queryAggregatedObject", "/queryMissedNotifications", "/query", "/rules",
7575
"/rules/rule-check/testRulePageEnabled" }, method = RequestMethod.GET)
7676
public ResponseEntity<String> getRequests(Model model, HttpServletRequest incomingRequest) {
7777
String eiRequestUrl;

src/main/java/com/ericsson/ei/frontend/WebController.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,32 @@ public String greeting(Model model) {
4343
return "index";
4444
}
4545

46-
@RequestMapping("/subscriptionpage.html")
46+
@RequestMapping("/subscriptions.html")
4747
public String subscription(Model model) {
4848
model.addAttribute("frontendServiceUrl", frontEndUtils.getFrontEndServiceUrl());
49-
return "subscription";
49+
return "subscriptions";
5050
}
5151

52-
@RequestMapping("/testRules.html")
52+
@RequestMapping("/test-rules.html")
5353
public String testRules(Model model) {
5454
model.addAttribute("frontendServiceUrl", frontEndUtils.getFrontEndServiceUrl());
55-
return "testRules";
55+
return "test-rules";
5656
}
5757

58-
@RequestMapping("/eiInfo.html")
59-
public String eiInfo(Model model, HttpServletRequest request) {
58+
@RequestMapping("/information.html")
59+
public String info(Model model, HttpServletRequest request) {
6060
model.addAttribute("frontendServiceUrl", frontEndUtils.getFrontEndServiceUrl());
6161
model.addAttribute("version", frontEndUtils.getVersion());
6262
model.addAttribute("applicationPropertiesVersion", frontEndUtils.getApplicationPropertiesVersion());
6363
model.addAttribute("frontendAppName", frontEndUtils.getApplicationName());
6464
model.addAttribute("backendServerUrl", frontEndUtils.getBackEndServiceUrl(request.getSession()));
65-
return "eiInfo";
65+
return "information";
66+
}
67+
68+
@RequestMapping("/rules.html")
69+
public String rules(Model model, HttpServletRequest request) {
70+
model.addAttribute("frontendServiceUrl", frontEndUtils.getFrontEndServiceUrl());
71+
return "rules";
6672
}
6773

6874
@RequestMapping("/login.html")

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,15 @@
107107
.pre {
108108
display: block;
109109
font-family: monospace;
110-
white-space: pre;
110+
white-space: pre-wrap;
111111
margin: 1em;
112112
font-size: medium;
113113
}
114+
.code-block {
115+
border: 1px solid #e6e6e6;
116+
background: #f7f7f7;
117+
padding: 10px;
118+
}
114119
.showPasswordButton{
115120
margin-top: 10px;
116121
}

src/main/resources/static/js/common.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,22 @@ var routes = {};
111111
routes["subscriptions"] = function () {
112112
updateBackEndInstanceList();
113113
$(".app-header").removeClass("header-bar-hidden");
114-
$(".main").load("subscriptionpage.html");
114+
$(".main").load("subscriptions.html");
115115
};
116116
routes["test-rules"] = function () {
117117
updateBackEndInstanceList();
118118
$(".app-header").removeClass("header-bar-hidden");
119-
$(".main").load("testRules.html");
119+
$(".main").load("test-rules.html");
120120
};
121-
routes["ei-info"] = function () {
121+
routes["information"] = function () {
122122
updateBackEndInstanceList();
123123
$(".app-header").removeClass("header-bar-hidden");
124-
$(".main").load("eiInfo.html");
124+
$(".main").load("information.html");
125+
};
126+
routes["rules"] = function () {
127+
updateBackEndInstanceList();
128+
$(".app-header").removeClass("header-bar-hidden");
129+
$(".main").load("rules.html");
125130
};
126131
routes["switch-backend"] = function () {
127132
$(".app-header").addClass("header-bar-hidden");
@@ -140,7 +145,8 @@ routes["login"] = function () {
140145
router.on({
141146
'subscriptions': routes["subscriptions"],
142147
'test-rules': routes["test-rules"],
143-
'ei-info': routes["ei-info"],
148+
'information': routes["information"],
149+
'rules': routes["rules"],
144150
'switch-backend': routes["switch-backend"],
145151
'add-backend': routes["add-backend"],
146152
'login': routes["login"],

src/main/resources/static/js/global-variables.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var backendEndpoints = {
1717
DOWNLOAD: "/download/",
1818
DOWNLOAD_SUBSCRIPTIONS_TEMPLATE: "/download/subscriptionsTemplate",
1919
INFORMATION: "/information",
20+
RULES: "/rules",
2021
TEST_RULES_PAGE_ENABLED: "/rules/rule-check/testRulePageEnabled",
2122
CHECK_AGGREGATION: "/rules/rule-check/aggregation"
2223
};

0 commit comments

Comments
 (0)