Skip to content

Commit

Permalink
Closes #134; Reload current server instead of all application
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok committed Mar 5, 2016
1 parent b37214c commit 7600f7f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
25 changes: 23 additions & 2 deletions app/scripts/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand Down
7 changes: 7 additions & 0 deletions app/scripts/sidebar.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7600f7f

Please sign in to comment.