Skip to content

Commit 8cccaeb

Browse files
committed
Refactored Code
1 parent 3956217 commit 8cccaeb

File tree

6 files changed

+39
-24
lines changed

6 files changed

+39
-24
lines changed

src/main/java/com/kafkastream/events/EventsListener.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ public static void main(String[] args)
120120
{
121121
streams.start();
122122
final HostInfo restEndpoint = new HostInfo(KafkaConstants.REST_PROXY_HOST, KafkaConstants.REST_PROXY_PORT);
123-
final StateStoreRestService restService = startRestProxy(streams, restEndpoint);
124-
customerOrderList = restService.getAllCustomersOrders();
123+
startRestProxy(streams, restEndpoint);
125124
latch.await();
126125
}
127126
catch (Exception e)

src/main/resources/templates/customer-orders.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div class="container container-fluid">
1717
<h1> Customer Orders List</h1>
1818
<br/> <br/>
19-
<table class="table table-bordered">
19+
<table class="table table-bordered" th:if="!${customerorders.empty}">
2020
<thead class="font-weight-bold">
2121
<tr>
2222
<td> Customer Id</td>
@@ -31,9 +31,6 @@ <h1> Customer Orders List</h1>
3131
</tr>
3232
</thead>
3333
<tbody>
34-
<tr th:if="${customerorders.empty}">
35-
<td colspan="2"> No Customers Available </td>
36-
</tr>
3734
<tr th:each="customerorder: ${customerorders}">
3835
<td th:text="${customerorder.customerId}"></td>
3936
<td th:text="${customerorder.firstName}">/td>
@@ -48,9 +45,12 @@ <h1> Customer Orders List</h1>
4845
</tbody>
4946
</table>
5047

48+
<div th:if="${customerorders.empty}">
49+
<p> No Customer Orders Available </p>
50+
</div>
5151
<br/> <br/>
5252
<p>
53-
<a href="/home" th:href="@{/}">Home</a>
53+
<a th:href="@{/}">Home</a>
5454
</p>
5555
</div>
5656
</body>

src/main/resources/templates/customers.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<div class="container container-fluid">
1818
<h1> Customers List</h1>
1919
<br/> <br/>
20-
<table class="table table-bordered">
20+
<table class="table table-bordered" th:if="!${customers.empty}">
2121
<thead class="font-weight-bold">
2222
<tr>
2323
<td> Customer Id</td>
@@ -41,10 +41,17 @@ <h1> Customers List</h1>
4141
</tbody>
4242
</table>
4343

44-
<br/> <br/>
45-
<p>
46-
<a href="/home" th:href="@{/}">Home</a>
47-
</p>
44+
<div th:if="${customers.empty}">
45+
<p> No Customers Available </p>
46+
</div>
47+
48+
<br> <br>
49+
<div>
50+
<p>
51+
<a href="/create-customer" style="margin: 10px">Create New</a>
52+
<a href="/home" style="margin: 10px">Home</a>
53+
</p>
54+
</div>
4855
</div>
4956
</body>
5057
</html>

src/main/resources/templates/greetings.html

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,33 @@
1717
<div class="container container-fluid">
1818
<h1> Greetings List</h1>
1919
<br/> <br/>
20-
<table class="table table-bordered">
20+
<table class="table table-bordered" th:if="!${greetings.empty}">
2121
<thead class="font-weight-bold">
2222
<tr>
2323
<td> Message </td>
2424
<td> Time Stamp</td>
2525
</tr>
2626
</thead>
2727
<tbody>
28-
<tr th:if="${greetings.empty}">
29-
<td colspan="2"> No Greetings Available </td>
30-
</tr>
3128
<tr th:each="greeting: ${greetings}">
3229
<td th:text="${greeting.message}"></td>
3330
<td th:text="${greeting.timestamp}"></td>
3431
</tr>
3532
</tbody>
3633
</table>
3734

38-
<br/> <br/>
39-
<p>
40-
<a href="/home" th:href="@{/}">Home</a>
41-
</p>
35+
<div th:if="${greetings.empty}">
36+
<p> No Greetings Available </p>
37+
</div>
38+
39+
40+
<br> <br>
41+
<div>
42+
<p>
43+
<a href="/create-greeting" style="margin: 10px">Create New</a>
44+
<a href="/home" style="margin: 10px">Home</a>
45+
</p>
46+
</div>
4247
</div>
4348
</body>
4449
</html>

src/main/resources/templates/orders.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ <h1> Order List</h1>
4242
<p> No Orders Available </p>
4343
</div>
4444

45-
<br/> <br/>
46-
<p>
47-
<a href="/home" th:href="@{/}">Home</a>
48-
</p>
45+
46+
<br> <br>
47+
<div>
48+
<p>
49+
<a href="/create-order" style="margin: 10px">Create New</a>
50+
<a href="/home" style="margin: 10px">Home</a>
51+
</p>
52+
</div>
4953
</div>
5054
</body>
5155
</html>

0 commit comments

Comments
 (0)