added simple copy to clipboard from data-id prop

This commit is contained in:
ldinc 2017-10-14 01:23:53 +03:00
parent 72b9eb443c
commit 0e2926cc85
2 changed files with 12 additions and 5 deletions

View File

@ -190,7 +190,7 @@
<div class="connection-ssh-group">
<hr/>
<div class="form-group">
<label class="col-sm-3 control-label">SSH Host</label>
<div class="col-sm-7">
@ -200,7 +200,7 @@
<input type="text" id="ssh_port" class="form-control" placeholder="22" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">SSH User</label>
<div class="col-sm-9">
@ -244,6 +244,8 @@
<li class="divider"></li>
<li><a href="#" data-action="truncate">Truncate Table</a></li>
<li><a href="#" data-action="delete">Delete Table</a></li>
<li class="divider"></li>
<li><a href="#" data-action="copy">Copy Table Name</a></li>
</ul>
</div>
<div id="databases_context_menu">

View File

@ -191,6 +191,8 @@ function resetTable() {
removeClass("no-crop");
}
var tableNameRegExp = /(?:\.([^.]+))?$/;
function performTableAction(table, action, el) {
if (action == "truncate" || action == "delete") {
var message = "Are you sure you want to " + action + " table " + table + " ?";
@ -224,6 +226,9 @@ function performTableAction(table, action, el) {
var win = window.open(url, "_blank");
win.focus();
break;
case "copy":
copyToClipboard(tableNameRegExp.exec(table)[1]);
break;
}
}
@ -313,7 +318,7 @@ function setCurrentTab(id) {
if (id != "table_content") {
$("#body").removeClass("with-pagination");
}
$("#nav ul li.selected").removeClass("selected");
$("#" + id).addClass("selected");
@ -490,7 +495,7 @@ function showTableStructure() {
}
setCurrentTab("table_structure");
$("#input").hide();
$("#body").prop("class", "full");
@ -1143,7 +1148,7 @@ $(document).ready(function() {
$("#pg_password").val(item.password);
$("#pg_db").val(item.database);
$("#connection_ssl").val(item.ssl);
if (item.ssh && Object.keys(item.ssh).length > 0) {
$("#ssh_host").val(item.ssh.host);
$("#ssh_port").val(item.ssh.port);