Skip to content

Commit

Permalink
Tc
Browse files Browse the repository at this point in the history
  • Loading branch information
msune committed Jun 19, 2024
1 parent 68a198f commit c76283c
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 45 deletions.
90 changes: 57 additions & 33 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,44 +89,68 @@
<iframe class="h-100 w-100 border-0" src="home.html" id="main-iframe"/></iframe>
</main>
</div>
<div class="modal fade" id="modal-dashboard" tabindex="-1" role="dialog" aria-labelledby="createAdashboard" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Create a Dashboard</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form>
<div class="name-group">
<label for="modal-dashboard-id" class="col-form-label">Id:</label>
<input type="text" class="form-control" id="modal-dashboard-id" disabled>
</div>
<div class="name-group">
<label for="modal-dashboard-name" class="col-form-label">Name:</label>
<input type="text" class="form-control" id="modal-dashboard-name">

<div class="modal fade" id="modal-dashboard" tabindex="-1" role="dialog" aria-labelledby="createadashboard" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="examplemodallabel">create a dashboard</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="form-group">
<label for="modal-dashboard-description" class="col-form-label">Description:</label>
<textarea class="form-control" id="modal-dashboard-description"></textarea>
<div class="modal-body">
<form>
<div class="name-group">
<label for="modal-dashboard-id" class="col-form-label">id:</label>
<input type="text" class="form-control" id="modal-dashboard-id" disabled>
</div>
<div class="name-group">
<label for="modal-dashboard-name" class="col-form-label">name:</label>
<input type="text" class="form-control" id="modal-dashboard-name">
</div>
<div class="form-group">
<label for="modal-dashboard-description" class="col-form-label">description:</label>
<textarea class="form-control" id="modal-dashboard-description"></textarea>
</div>
<div class="form-group">
<label for="modal-dashboard-url" class="col-form-label">url:</label>
<textarea class="form-control" id="modal-dashboard-url" disabled></textarea>
</div>
</form>
</div>
<div class="form-group">
<label for="modal-dashboard-url" class="col-form-label">URL:</label>
<textarea class="form-control" id="modal-dashboard-url" disabled></textarea>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modal-dashboard-close">close</button>
<button type="button" class="btn btn-danger" data-dismiss="modal" id="modal-dashboard-delete">delete</button>
<button type="button" class="btn btn-primary" id="modal-dashboard-create">create</button>
<button type="button" class="btn btn-primary" id="modal-dashboard-update">update</button>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modal-dashboard-close">Close</button>
<button type="button" class="btn btn-danger" data-dismiss="modal" id="modal-dashboard-delete">Delete</button>
<button type="button" class="btn btn-primary" id="modal-dashboard-create">Create</button>
<button type="button" class="btn btn-primary" id="modal-dashboard-update">Update</button>
</div>
</div>
</div>
</div>
</div>

<div class="modal fade" id="modal-confirm" tabindex="-1" role="dialog" aria-labelledby="createadashboard" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="examplemodallabel">delete a dashboard</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>Are you sure you want to delete dashboard '<span id="modal-confirm-dashboard-name"></span>'?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
<button type="button" class="btn btn-danger confirm_delete" data-dismiss="modal">Yes</button>
</div>
</div>
</div>
</div>
</div>

<footer class="footer w-100">
Copyright &#169; datahangar.io 2024. All rights reserved.
</footer>
Expand Down
35 changes: 23 additions & 12 deletions src/js/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,30 @@ $("#modal-dashboard-delete").on("click", function(){
id = $("#modal-dashboard-id").val();
name = $("#modal-dashboard-name").val();
url = '/rest/turnilo/dashboards/'+id;
$.ajax({
url: url,
type: 'DELETE',
crossDomain: true,
headers: {'Content-Type': 'application/json'},
success: function(dashboard, status) {
console.log("Dashboard successfully deleted in the backend...");
$("#modal-dashboard").modal("hide");
notify_success("Deleted dashboard '"+name+"'");

timer_query_rest(true);
timer_update_labels(true);
}
//Be kind
$("#modal-confirm-dashboard-name").html(name);
$("#modal-confirm button.confirm_delete").attr('data-url', url);
$("#modal-confirm button.confirm_delete").attr('data-name', url);
$("#modal-confirm").modal("show");

$("#modal-confirm button.confirm_delete").on("click", function(){
url = $(this).attr('data-url');
name = $(this).attr('data-name');
$.ajax({
url: url,
type: 'DELETE',
crossDomain: true,
headers: {'Content-Type': 'application/json'},
success: function(status) {
console.log("Dashboard successfully deleted in the backend...");
$("#modal-dashboard").modal("hide");
notify_success("Deleted dashboard '"+name+"'");

timer_query_rest(true);
timer_update_labels(true);
}
});
});
});

Expand Down

0 comments on commit c76283c

Please sign in to comment.