Skip to content

Commit 9584474

Browse files
committed
Minor layout
1 parent 61c9c3c commit 9584474

File tree

7 files changed

+54
-42
lines changed

7 files changed

+54
-42
lines changed

static/images/msvc_flow.png

215 KB
Loading

static/js/ajax_order.js

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var log_data_autoscroll;
33
var order_id;
44
var status_delivered;
55
var last_result = -1;
6+
var one_last_call = 0;
67

78
$(document).ready(function () {
89
log_data = $("#log_data");
@@ -60,22 +61,29 @@ function update_order_status() {
6061

6162
// Update view order every 1 sec (in a realistic scenario that would be better off using REACT)
6263
function get_logs() {
63-
if (order_id && last_result != status_delivered) {
64-
$.ajax({
65-
type: "PUT",
66-
async: true,
67-
url: "/logs/" + order_id,
68-
success: function (data) {
69-
if (data) {
70-
log_data.html(data);
71-
if (log_data_autoscroll.prop("checked")) {
72-
log_data.scrollTop(log_data[0].scrollHeight);
64+
if (order_id) {
65+
if (one_last_call == 0) {
66+
$.ajax({
67+
type: "PUT",
68+
async: true,
69+
url: "/logs/" + order_id,
70+
success: function (data) {
71+
if (data) {
72+
if (data != log_data.html()) {
73+
log_data.html(data);
74+
if (log_data_autoscroll.prop("checked")) {
75+
log_data.scrollTop(log_data[0].scrollHeight);
76+
}
77+
}
78+
setTimeout(function () {
79+
get_logs();
80+
}, 1000);
7381
}
74-
setTimeout(function () {
75-
get_logs();
76-
}, 1000);
7782
}
78-
}
79-
});
83+
});
84+
}
85+
if (last_result == status_delivered) {
86+
one_last_call += 1;
87+
}
8088
}
8189
}

templates/header.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
<link rel="icon" type="image/png" href="{{ url_for('static', filename='images/favicon.ico') }}">
77
<meta charset="utf-8">
88
<meta name="viewport" content="width=device-width, initial-scale=1">
9-
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}?v=6">
10-
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}?v=6">
11-
<script src="{{ url_for('static', filename='js/jquery.min.js') }}?v=6"></script>
12-
<script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}?v=6"></script>
13-
<script src="{{ url_for('static', filename='js/main.js') }}?v=6"></script>
9+
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}?v=7">
10+
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}?v=7">
11+
<script src="{{ url_for('static', filename='js/jquery.min.js') }}?v=7"></script>
12+
<script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}?v=7"></script>
13+
<script src="{{ url_for('static', filename='js/main.js') }}?v=7"></script>
1414
{% block header %}{% endblock %}
1515
</head>
1616

@@ -21,7 +21,7 @@
2121
{% block content %}{% endblock %}
2222
</div>
2323
</div>
24-
<div class="row mt-3">
24+
<div class="mt-1">
2525
<div class="col-12">
2626
<p class="text-center text-secondary small">Order your pizza with <b>Confluent</b>, powered by <a
2727
href="https://www.confluent.io/confluent-cloud" target="_blank">Confluent Cloud</a>&copy;</p>

templates/login.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% block content %}
44
<form action="/login" class="needs-validation" method="POST">
55
<div class="row justify-content-center mt-3">
6-
<div class="col-6 border p-2 mt-3">
6+
<div class="col-sm-12 col-md-6 border p-2 mt-3">
77
<div class="col-12">
88
<div class="form-group">
99
<label for="username">Username:</label>

templates/navbar.html

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
<nav class="navbar navbar-expand-lg navbar-light pb-2">
1+
<nav class="navbar navbar-expand-lg navbar-light mb-n2 pb-0">
22
<p class="navbar-brand"><img src="{{ url_for('static', filename='images/logo.png') }}" width=62
3-
class="map img-resonsive" /></p>
3+
class="map img-responsive" /></p>
44
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
55
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
66
<span class="navbar-toggler-icon"></span>
77
</button>
88
<div class="collapse navbar-collapse" id="navbarSupportedContent">
99
<ul class="navbar-nav mr-auto">
1010
<li class="nav-item active">
11-
<a class="btn btn-outline-dark menu-link m-1" href="/" title="Place your order">View
11+
<a class="btn btn-outline-dark btn-sm menu-link m-1" href="/" title="Place your order">View
1212
Menu</a>
1313
</li>
1414
<li class="nav-item active">
15-
<a class="btn btn-outline-dark menu-link m-1" href="/orders" title="View my orders">My
15+
<a class="btn btn-outline-dark btn-sm menu-link m-1" href="/orders" title="View my orders">My
1616
Orders</a>
1717
</li>
1818
</ul>
19-
<div class="form-inline my-2 my-lg-0">
20-
<input class="form-control mr-sm-2" type="order" placeholder="Order" id="order_id_query" aria-label="Search"
21-
value="{{order_id}}">
22-
<a href="javascript:void(0);" class="btn btn-outline-dark my-2 my-sm-0"
19+
<div class="form-inline">
20+
<input class="form-control form-control-sm" type="order" placeholder="Order" id="order_id_query"
21+
aria-label="Search" value="{{order_id}}">
22+
<a href="javascript:void(0);" class="btn btn-outline-success btn-sm ml-1"
2323
onClick="javascript:viewOrder();">Search</a>
2424
</div>
2525
<ul class="navbar-nav ml-auto">
@@ -28,18 +28,18 @@
2828
{{session.username}}
2929
</a>
3030
<ul class="dropdown-menu">
31-
<li><small class="dropdown-item disabled">Documentation</small></li>
32-
<li><a class="dropdown-item"
31+
<li><a class="dropdown-item small"
3332
href="{{ url_for('static', filename='images/docs/gen_architecture.png') }}"
3433
target="_blank">Demo Architecture</a></li>
35-
<li><a class="dropdown-item" href="{{ url_for('static', filename='images/docs/service_flow.png') }}"
36-
target="_blank">Demo Service Flow</a></li>
37-
<li><a class="dropdown-item" href="https://github.com/ifnesi/python-kafka-microservices"
34+
<li><a class="dropdown-item small"
35+
href="{{ url_for('static', filename='images/docs/service_flow.png') }}" target="_blank">Demo
36+
Service Flow</a></li>
37+
<li><a class="dropdown-item small" href="https://github.com/ifnesi/python-kafka-microservices"
3838
target="_blank">Github repo</a></li>
3939
<li>
4040
<hr class="dropdown-divider">
4141
</li>
42-
<li><a class="dropdown-item" href="/logout">Logout</a></li>
42+
<li><a class="dropdown-item small" href="/logout">Logout</a></li>
4343
</ul>
4444
</li>
4545
</ul>

templates/view_order.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ <h4><span class="badge badge-dark w-100">Order status</span></h4>
99
<p class="font-weight-bold text-danger">{{error}}</p>
1010
{% else %}
1111
{% block header %}
12-
<script src="{{ url_for('static', filename='js/ajax_order.js') }}?v=6"></script>
12+
<script src="{{ url_for('static', filename='js/ajax_order.js') }}?v=7"></script>
1313
{% endblock %}
14-
<table class="table table-striped table-hover">
14+
<table class="table table-striped table-hover table-sm small mb-1">
1515
<thead>
1616
<tr>
1717
<th>Order</th>
@@ -34,11 +34,15 @@ <h4><span class="badge badge-dark w-100">Order status</span></h4>
3434
</tr>
3535
</tbody>
3636
</table>
37+
<div class="row justify-content-center">
38+
<img src="{{ url_for('static', filename='images/msvc_flow.png') }}" class="mt-0 mb-1" title="Microservices flow"
39+
height="144" />
40+
</div>
3741
{% autoescape false %}
38-
<div id="log_data" class="log_data mb-0"></div>
42+
<div id="log_data" class="log_data mb-1"></div>
3943
{% endautoescape %}
40-
<div class="form-check">
41-
<label class="form-check-label">
44+
<div class="form-check mt-n2 pt-0">
45+
<label class="form-check-label small">
4246
<input type="checkbox" class="form-check-input" value="" checked id="log_data_autoscroll">Logs auto scroll
4347
</label>
4448
</div>

templates/view_orders.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<h4><span class="badge badge-dark w-100">My orders&nbsp;&nbsp;<a href="/orders"><img
66
src="{{ url_for('static', filename='images/refresh.png') }}" title="Refresh page" width="24"
77
class="img_border" /></a></span></h4>
8-
<table class="table table-striped table-hover">
8+
<table class="table table-striped table-hover table-sm small">
99
<tbody>
1010
<thead>
1111
<tr>

0 commit comments

Comments
 (0)