1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Better interaction with view-ssh-key list

This commit is contained in:
Nick O'Leary 2018-01-23 10:25:19 +00:00
parent 757e72100d
commit 1337831061
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 22 additions and 18 deletions

View File

@ -264,14 +264,19 @@ RED.projects.userSettings = (function() {
utils.sendRequest(options);
var formButtons = $('<span class="button-row" style="position: relative; float: right; margin: 10px;"></span>').appendTo(row);
$('<button class="editor-button editor-button-small">Copy to clipboard</button>')
$('<button class="editor-button editor-button-small">Copy public key to clipboard</button>')
.appendTo(formButtons)
.click(function(evt) {
evt.stopPropagation();
evt.preventDefault();
document.getSelection().selectAllChildren(keyBox[0]);
var ret = document.execCommand('copy');
document.getSelection().empty();
try {
evt.stopPropagation();
evt.preventDefault();
document.getSelection().selectAllChildren(keyBox[0]);
var ret = document.execCommand('copy');
document.getSelection().empty();
} catch(err) {
}
});
return row;
@ -282,22 +287,17 @@ RED.projects.userSettings = (function() {
scrollOnAdd: false,
addItem: function(row,index,entry) {
var container = $('<div class="projects-dialog-list-entry">').appendTo(row);
if (entry.empty) {
container.addClass('red-ui-search-empty');
container.text("No SSH keys");
return;
}
$('<span class="entry-icon"><i class="fa fa-key"></i></span>').appendTo(container);
var content = $('<span>').appendTo(container);
var topRow = $('<div>').appendTo(content);
var topRow = $('<div class="projects-dialog-ssh-key-header">').appendTo(container);
$('<span class="entry-icon"><i class="fa fa-key"></i></span>').appendTo(topRow);
$('<span class="entry-name">').text(entry.name).appendTo(topRow);
var tools = $('<span class="button-row entry-tools">').appendTo(container);
var tools = $('<span class="button-row entry-tools">').appendTo(topRow);
var expandedRow;
row.click(function(e) {
topRow.click(function(e) {
if (expandedRow) {
expandedRow.slideUp(200,function() {
expandedRow.remove();

View File

@ -790,10 +790,14 @@ div.projects-dialog-ssh-public-key {
.projects-dialog-ssh-key-list {
li {
cursor: pointer;
padding: 0 !important;
}
li:hover {
background: #f3f3f3;
.projects-dialog-ssh-key-header {
padding: 10px 5px;
cursor: pointer;
&:hover {
background: #f3f3f3;
}
}
}