Skip to content

Commit

Permalink
fix(eclair): minor fixes fo eclair support
Browse files Browse the repository at this point in the history
  • Loading branch information
jamaljsr committed Mar 17, 2020
1 parent f437918 commit f76de99
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 14 deletions.
3 changes: 3 additions & 0 deletions src/__mocks__/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ module.exports = {
dialog: {
showSaveDialog: jest.fn(),
},
Menu: {
buildFromTemplate: jest.fn(),
},
process: {
env: {},
},
Expand Down
20 changes: 11 additions & 9 deletions src/components/designer/lightning/ConnectTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,17 @@ const ConnectTab: React.FC<Props> = ({ node }) => {
size="small"
onChange={e => setAuthType(e.target.value)}
>
<Radio.Button key="paths" value="paths">
{l('filePaths')}
</Radio.Button>
<Radio.Button key="hex" value="hex">
{l('hexStrings')}
</Radio.Button>
<Radio.Button key="base64" value="base64">
{l('base64Strings')}
</Radio.Button>
{credentials.admin && [
<Radio.Button key="paths" value="paths">
{l('filePaths')}
</Radio.Button>,
<Radio.Button key="hex" value="hex">
{l('hexStrings')}
</Radio.Button>,
<Radio.Button key="base64" value="base64">
{l('base64Strings')}
</Radio.Button>,
]}
{node.implementation === 'LND' && (
<Radio.Button value="lndc">{l('lndConnect')}</Radio.Button>
)}
Expand Down
9 changes: 8 additions & 1 deletion src/components/network/NetworkView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,14 @@ const NetworkView: React.FC<RouteComponentProps<MatchParams>> = ({ match }) => {
return (
<Styled.NetworkView>
{header}
{showNotice && <Alert type="info" message={l('missingImages')} showIcon />}
{showNotice && (
<Alert
type="info"
message={l('missingImages')}
description={missingImages.join(', ')}
showIcon
/>
)}
{toggleAsync.error && (
<Alert
type="error"
Expand Down
18 changes: 18 additions & 0 deletions src/components/terminal/DockerTerminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* istanbul ignore file */
import React, { useEffect, useRef } from 'react';
import { useParams } from 'react-router';
import { remote } from 'electron';
import { debug, info } from 'electron-log';
import styled from '@emotion/styled';
import 'xterm/css/xterm.css';
Expand Down Expand Up @@ -143,6 +144,23 @@ const DockerTerminal: React.FC = () => {
const { type, name } = useParams<RouteParams>();
const termEl = useRef<HTMLDivElement>(null);

// add context menu
useEffect(() => {
window.addEventListener(
'contextmenu',
e => {
e.preventDefault();
const menu = remote.Menu.buildFromTemplate([
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
]);
menu.popup({ window: remote.getCurrentWindow() });
},
false,
);
});

useEffect(() => {
info('Rendering DockerTerminal component');
document.title = `Polar Terminal | ${name} (${type})`;
Expand Down
2 changes: 1 addition & 1 deletion src/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"cmps.common.AdvancedOptionsModal.error": "Failed to update options",
"cmps.common.CopyIcon.message": "Copied {{label}} to clipboard",
"cmps.common.NavMenu.createNetwork": "Create Network",
"cmps.common.NavMenu.manageNodes": "Manage Nodes",
"cmps.common.NavMenu.manageNodes": "Manage Images",
"cmps.common.NavMenu.importNetwork": "Import Network",
"cmps.common.NavMenu.exportNetwork": "Export Network",
"cmps.common.RestartNode.title": "Restart Node",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/docker/dockerService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ describe('DockerService', () => {
it('should create volume dirs when the network is started', async () => {
composeMock.upAll.mockResolvedValue(mockResult);
await dockerService.start(network);
expect(fs.ensureDir).toBeCalledTimes(7);
expect(fsMock.ensureDir).toBeCalledTimes(7);
});

it('should call compose.down when a network is stopped', async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/docker/dockerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class DockerService implements DockerLibrary {
*/
async start(network: Network) {
const { bitcoin, lightning } = network.nodes;
this.ensureDirs(network, [...bitcoin, ...lightning]);
await this.ensureDirs(network, [...bitcoin, ...lightning]);

info(`Starting docker containers for ${network.name}`);
info(` - path: ${network.path}`);
Expand All @@ -140,7 +140,7 @@ class DockerService implements DockerLibrary {
* @param node the node to start
*/
async startNode(network: Network, node: CommonNode) {
this.ensureDirs(network, [node]);
await this.ensureDirs(network, [node]);
// make sure the docker container is stopped. If it is already started in an error state
// then starting it would have no effect
await this.stopNode(network, node);
Expand Down

0 comments on commit f76de99

Please sign in to comment.