Skip to content

Commit

Permalink
Tc
Browse files Browse the repository at this point in the history
  • Loading branch information
msune committed Jun 22, 2024
1 parent cc253db commit 5a59449
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ <h6 class="dropdown-header">Preset</h6>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span data-feather="user"></span> Root
<span data-feather="user"></span> <span id="username">Root</span>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="User">
<a class="dropdown-item" href="#"><span data-feather="edit-2"></span>&nbsp;&nbsp;Edit</a>
Expand Down
4 changes: 4 additions & 0 deletions src/js/alerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ function rand_str(){

function _notify(content, type){
id="div_" + rand_str();

var err = new Error('stack trace');
console.log(err.stack);
console.log("Generated id: "+id)
$("#notifications").append(
'<div class="alert alert-'+type+'" style="display:none" role="alert" id="'+id+'">'+content+'</div>'
)
Expand Down
15 changes: 13 additions & 2 deletions src/js/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function create_update_dashboard(create){
notify_success(op_str+"d dashboard '"+name+"'");

timer_query_rest(true);
timer_update_labels(true);
timer_update_views(true);
},
error: function(xhr, status, error) {
notify_error("Failed: "+op_str+" dashboard '"+name+"'");
Expand Down Expand Up @@ -167,7 +167,7 @@ $("#modal-dashboard-delete").on("click", function(){
notify_success("Deleted dashboard '"+name+"'");

timer_query_rest(true);
timer_update_labels(true);
timer_update_views(true);
},
error: function(xhr, status, error) {
notify_error("Failed: deleting dashboard '"+name+"'");
Expand Down Expand Up @@ -263,6 +263,16 @@ function set_current_dashboard(){
label.text(label_text);
}

function set_username(){
auth = new URLSearchParams(window.location.search).get('auth');
if(auth){
username = auth.split(':')[0];
}else{
username = "Unknown";
}
$("span #username").html(username);
}

function timer_query_rest(){
rest_query_datacubes();
rest_query_dashboards();
Expand All @@ -283,4 +293,5 @@ $( document ).ready(function(){
//Update labels
setInterval(timer_update_views, 250);
timer_update_views();
set_username();
});

0 comments on commit 5a59449

Please sign in to comment.