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

View File

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