Skip to content

Commit

Permalink
nassh: omnibox: allow matching saved profile names
Browse files Browse the repository at this point in the history
The current omnibox supports connecting via a profile-id or a URI.
Feedback from users is that they want to type in a profile name and
connect via that.  We avoided that previously in case the profile
name had the same form as a URI (e.g. "root@foo").  If users do use
such forms, they can rename the profile as they like.

Change-Id: Id3fa2d81c12e76e46161882a0632136462fd68e3
Reviewed-on: https://chromium-review.googlesource.com/718176
Reviewed-by: Brandon Gilmore <[email protected]>
Tested-by: Mike Frysinger <[email protected]>
  • Loading branch information
vapier committed Oct 16, 2017
1 parent b86c7ed commit 5471745
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions nassh/js/nassh_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ nassh.App.prototype.omniboxOnInputChanged_ = function(text, suggest) {
* @param {string} disposition Mode the user wants us to open as.
*/
nassh.App.prototype.omniboxOnInputEntered_ = function(text, disposition) {
// If the user types out the profile name exactly, connect to it. It might
// overlap with a valid URI, but if that's a problem, they can change the
// description to something else.
for (let i = 0; i < this.omniMatches_.length; ++i) {
const match = this.omniMatches_[i];

if (match.desc == text) {
text = 'profile-id:' + match.id;
break;
}
}

var url = chrome.runtime.getURL('html/nassh.html#' + text);
switch (disposition) {
default:
Expand Down

0 comments on commit 5471745

Please sign in to comment.