From 7600f7fd03fff3ffe3c5dd379e2762a8c87c6fa4 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Sat, 5 Mar 2016 10:14:01 -0300 Subject: [PATCH] Closes #134; Reload current server instead of all application --- app/scripts/menus.js | 25 +++++++++++++++++++++++-- app/scripts/sidebar.js | 7 +++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/app/scripts/menus.js b/app/scripts/menus.js index e007981d17..44c00b2556 100644 --- a/app/scripts/menus.js +++ b/app/scripts/menus.js @@ -3,6 +3,7 @@ import { remote } from 'electron'; import { servers } from './servers'; import { sidebar } from './sidebar'; +import { webview } from './webview'; import config from './config'; import '../branding/branding.js'; @@ -104,8 +105,18 @@ if (process.platform === 'darwin') { label: 'View', submenu: [ { - label: 'Reload', + label: 'Reload current server', accelerator: 'Command+R', + click: function() { + const activeWebview = webview.getActive(); + if (activeWebview) { + activeWebview.reload(); + } + } + }, + { + label: 'Reload application', + accelerator: 'Command+Shift+R', click: function() { remote.getCurrentWindow().reload(); } @@ -217,8 +228,18 @@ if (process.platform === 'darwin') { label: 'View', submenu: [ { - label: 'Reload', + label: 'Reload current server', accelerator: 'Ctrl+R', + click: function() { + const activeWebview = webview.getActive(); + if (activeWebview) { + activeWebview.reload(); + } + } + }, + { + label: 'Reload application', + accelerator: 'Ctrl+Shift+R', click: function() { remote.getCurrentWindow().reload(); } diff --git a/app/scripts/sidebar.js b/app/scripts/sidebar.js index 43ba7a8e2b..772921ffa8 100644 --- a/app/scripts/sidebar.js +++ b/app/scripts/sidebar.js @@ -1,6 +1,7 @@ import { EventEmitter } from 'events'; import { remote } from 'electron'; import { servers } from './servers'; +import { webview } from './webview'; import { menuTemplate } from './menus'; var Menu = remote.Menu; @@ -233,6 +234,12 @@ export var sidebar = new SideBar(); var selectedInstance = null; var instanceMenu = remote.Menu.buildFromTemplate([{ + label: 'Reload server', + click: function() { + const activeWebview = webview.getByUrl(selectedInstance.dataset.host); + activeWebview.reload(); + } +}, { label: 'Remove server', click: function() { servers.removeHost(selectedInstance.dataset.host);