Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup and UI improvements #8

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
143736e
homepage overhaul
ukhwaja May 31, 2024
13f7058
imrpoved blink animation
Jun 1, 2024
ff43f87
reverse records order
Jun 2, 2024
05b8ca8
detail selected test
Jun 4, 2024
dcf71cb
ledger table redesign
Jun 5, 2024
bb0e814
better transaction details
Jun 5, 2024
98652f4
close details X
Jun 5, 2024
3aa7684
minor fixed and restore node names
Jun 5, 2024
8a79db3
small UI improvements
Jun 5, 2024
d0a0eae
improved loading animations
Jun 5, 2024
131ca2c
pointer cursor on details close
Jun 5, 2024
4eb625f
different logo
Jun 5, 2024
d81a72a
keep highlighted row as active
Jun 5, 2024
e8bad35
clear filter button cursor pointer
Jun 5, 2024
07e7d62
close detail on update or clear
Jun 5, 2024
9d63833
fix html tags trees
Jun 5, 2024
1d086b6
collapse raw data on close
Jun 5, 2024
a3ec69e
code cleanup
Jun 6, 2024
d803da2
ledger table header color
Jun 6, 2024
a14011a
seperate page to register new did
Jun 7, 2024
981988e
show unreachable hosts
Jun 7, 2024
7c71aa2
reset selected on page click
Jun 7, 2024
a4e62d9
minor color improvements and fixes
Jun 8, 2024
0b6f4b1
fix detail close bug
Jun 8, 2024
9686f88
improved responsiveness
Jun 8, 2024
7896cd5
more responsiveness improvements
Jun 8, 2024
7ed31ce
message when no details selected
Jun 8, 2024
6c3c2d6
move 100vh from wrapper to detail_right
Jun 8, 2024
36f308e
single transaction page
Jun 10, 2024
3910fa0
raw data modal
Jun 10, 2024
414864d
add footer
Jun 11, 2024
c153316
style newdid page
Jun 11, 2024
9c036c4
delete livejs script
Jun 11, 2024
fb46063
ledger margin and page number color
Jun 11, 2024
d00e17d
improved margin from footer
Jun 12, 2024
7c20ceb
transaction id has max-width
Jun 13, 2024
874024e
remove unneeded links
Jun 13, 2024
3a998fe
ledger count margin
Jun 14, 2024
c8b7cf5
better footer links
Jun 15, 2024
3ad4277
minor ui improvements
Jun 15, 2024
d703f52
additional condition for modal
Jun 17, 2024
c502abb
clear footer links to configs
Jun 17, 2024
b37fd95
new home graphic
Jun 18, 2024
cb2340d
more improved graphic
Jun 18, 2024
8516d30
improved validations
Jun 20, 2024
09bf108
UI improvements
Jun 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion server/anchor.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,12 +882,15 @@ async def get_txn_search(
if txn_type:
sql += " AND txn.txntype = ?"
params = (*params, txn_type)
# add order by clause
sql += " ORDER BY txn.seqno DESC"
select_sql = (sql + " LIMIT ? OFFSET ?").format(select_fields)
async with await self.query(select_sql, (*params, limit, offset)) as cursor:
while True:
rows = await cursor.fetchmany()
for row in rows:
result.append(row)
# change append to insert
result.insert(0, row)
if not rows:
break
if count:
Expand Down
31 changes: 26 additions & 5 deletions server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ async def index(request):
"INFO_SITE_URL": INFO_SITE_URL,
}

@ROUTES.get("/newdid")
@aiohttp_jinja2.template("newdid.html")
async def index(request):
return {
"REGISTER_NEW_DIDS": TRUST_ANCHOR._register_dids,
"LEDGER_INSTANCE_NAME": LEDGER_INSTANCE_NAME,
"WEB_ANALYTICS_SCRIPT": WEB_ANALYTICS_SCRIPT,
"INFO_SITE_TEXT": INFO_SITE_TEXT,
"INFO_SITE_URL": INFO_SITE_URL,
}


@ROUTES.get("/browse/{ledger_ident:.*}")
@aiohttp_jinja2.template("ledger.html")
Expand Down Expand Up @@ -131,10 +142,18 @@ async def ledger_json(request):
if not TRUST_ANCHOR.ready:
return not_ready()

count = await TRUST_ANCHOR.get_max_seqno(request.match_info["ledger_name"])
page = int(request.query.get("page", 1))
page_size = int(request.query.get("page_size", 100))
start = (page - 1) * page_size + 1
end = start + page_size - 1
start = count - (page - 1) * page_size
if page_size > start:
end = 1
else:
end = start - page_size + 1
# original ends
# start = (page - 1) * page_size + 1
# end = start + page_size - 1
o_start = (page - 1) * page_size + 1
query = request.query.get("query")
if query is not None and not query.strip():
query = None
Expand All @@ -144,11 +163,12 @@ async def ledger_json(request):

if txn_type is not None or query is not None:
rows, count = await TRUST_ANCHOR.get_txn_search(
request.match_info["ledger_name"], query, txn_type, page_size, start - 1
request.match_info["ledger_name"], query, txn_type, page_size, o_start - 1
)
else:
rows = await TRUST_ANCHOR.get_txn_range(
request.match_info["ledger_name"], start, end
# ends swapped
request.match_info["ledger_name"], end, start
)
count = await TRUST_ANCHOR.get_max_seqno(request.match_info["ledger_name"])
last_modified = None
Expand All @@ -158,7 +178,8 @@ async def ledger_json(request):
last_modified = max(last_modified, row[1]) if last_modified else row[1]
except TypeError:
last_modified = row[1]
results.append(json.loads(row[3]))
# change append to insert
results.insert(0, json.loads(row[3]))
if not results and page > 1:
data = {"detail": "Invalid page."}
response = json_response(data, status=404)
Expand Down
23 changes: 23 additions & 0 deletions server/static/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<footer>
<div class="footer_wrapper">
<div>
<p>Copyright &copy; 2024, NJIT</p>
</div>
<div>
<ul>
<li>About</li>
<li>
<a href="https://vdkms.app" target="_blank">Project home</a>
</li>
</ul>
</div>
<!-- <div>
<ul>
<li>Ledger configs</li>
<li><a href="/browse/pool">Pool</a></li>
<li><a href="/genesis">Genesis</a></li>
<li><a href="/status/text">Detailed Status</a></li>
</ul>
</div> -->
</div>
</footer>
35 changes: 15 additions & 20 deletions server/static/header.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
<style type="text/tailwindcss">
@layer components {
.header-padding {
@apply py-[8px] px-[16px] sm:pt-[10px] sm:pr-[32px] sm:pb-[10px] sm:pl-[35.2px] border-0;
}
}
</style>

<header class="header-padding">
<div class="flex items-center">
<a href="/">
<div class="flex items-center">
<p class="lead">
<span
class="lead-title text-[20px] md:text-[28px] text-white ml-2 font-semibold"
>{{ LEDGER_INSTANCE_NAME }} Blockchain Ledger</span
>
</p>
</div>
</a>
<header>
<div class="container">
<div class="logo"><a href="/"><span class="logo-img"><img src="/include/img/ledger.png" alt="ledger"></span>
<span class="logo-text">
{{ LEDGER_INSTANCE_NAME }}
<br>Blockchain Ledger</span></a></div>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/browse/domain">Domain</a></li>
<!-- <li><a href="/browse/pool">Pool</a></li>
<li><a href="/browse/config">Config</a></li>
<li><a href="/genesis">Genesis</a></li> -->
</ul>
</nav>
</div>
</header>

Expand Down
Loading