Skip to content

Commit 8312feb

Browse files
committed
only list subtokens in subtokens not the actual token; add entry if no subtokens exist
1 parent 39f4f89 commit 8312feb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

internal/server/web/static/js/tokeninfo.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ function tokenlistToHTML(tokenTrees, deleteClass) {
153153
tokenTrees.forEach(function (tokenTree) {
154154
tableEntries = _tokenTreeToHTML(tokenTree, deleteClass, 0) + tableEntries;
155155
});
156+
if (tableEntries === "") {
157+
tableEntries = `<tr><td colSpan="4" class="text-muted text-center">No subtokens</td></tr>`;
158+
}
156159
return '<table class="table table-hover table-grey">' +
157160
'<thead><tr>' +
158161
'<th style="min-width: 50%;">Token Name</th>' +
@@ -207,7 +210,12 @@ function _getSubtokensInfo() {
207210
let copy = $('#tree-copy');
208211
_tokeninfo('subtokens',
209212
function (res) {
210-
msg.html(tokenlistToHTML([res['mytokens']], revocationClassFromSubtokens));
213+
let token = res['mytokens'];
214+
let subtokens = [];
215+
if ('children' in token) {
216+
subtokens = token['children'];
217+
}
218+
msg.html(tokenlistToHTML(subtokens, revocationClassFromSubtokens));
211219
activateTokenList();
212220
msg.removeClass('text-danger');
213221
copy.addClass('d-none');

0 commit comments

Comments
 (0)