Skip to content

Commit

Permalink
feat: add support for notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
vsavkin committed May 31, 2019
1 parent f40bac0 commit 0d5a78f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 14 deletions.
11 changes: 10 additions & 1 deletion apps/electron/src/app/start-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ export async function startServer(
'store',
'selectDirectory',
'pseudoTerminalFactory',
'assetsPath'
'assetsPath',
'showNotification'
];

const showNotification = () => {
// todo, implement this
};

const assetsPath = path.join(__dirname, 'assets/public');
const providers = [
{ provide: 'serverAddress', useValue: `http://localhost:${port}` },
Expand All @@ -49,6 +54,10 @@ export async function startServer(
{
provide: 'assetsPath',
useValue: assetsPath
},
{
provide: 'showNotification',
useValue: showNotification
}
];

Expand Down
29 changes: 26 additions & 3 deletions apps/vscode/src/app/start-server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExtensionContext, window } from 'vscode';
import { commands, ExtensionContext, window } from 'vscode';
import {
createServerModule,
SelectDirectory,
Expand Down Expand Up @@ -43,14 +43,36 @@ export async function startServer(
});
};

const showNotification = (
message: string,
notificationCommands: { label: string; action: any }[]
) => {
window
.showInformationMessage(
message,
...notificationCommands.map(c => c.label)
)
.then(res => {
const selectedCommand = notificationCommands.find(n => n.label === res);
if (selectedCommand) {
commands.executeCommand(
selectedCommand.action.extension,
undefined,
selectedCommand.action.route
);
}
});
};

const pseudoTerminalFactory = getPseudoTerminalFactory(context);

const exports = [
'serverAddress',
'store',
'selectDirectory',
'pseudoTerminalFactory',
'assetsPath'
'assetsPath',
'showNotification'
];

const assetsPath = path.join(context.extensionPath, 'assets', 'public');
Expand All @@ -68,7 +90,8 @@ export async function startServer(
{ provide: 'store', useValue: store },
{ provide: 'selectDirectory', useValue: selectDirectory },
{ provide: 'pseudoTerminalFactory', useValue: pseudoTerminalFactory },
{ provide: 'assetsPath', useValue: assetsPath }
{ provide: 'assetsPath', useValue: assetsPath },
{ provide: 'showNotification', useValue: showNotification }
];

console.log('starting server on port', port);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
"@nestjs/common": "5.7.0",
"@nestjs/core": "5.7.0",
"@nestjs/graphql": "5.5.1",
"@nrwl/angular-console-enterprise-electron": "0.3.548",
"@nrwl/angular-console-enterprise-frontend": "0.3.548",
"@nrwl/angular-console-enterprise-electron": "0.3.555",
"@nrwl/angular-console-enterprise-frontend": "0.3.555",
"@types/d3-hierarchy": "^1.1.6",
"@types/d3-selection": "^1.4.1",
"@types/d3-shape": "^1.3.1",
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -638,10 +638,10 @@
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"
integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==

"@nrwl/[email protected].548":
version "0.3.548"
resolved "https://registry.yarnpkg.com/@nrwl/angular-console-enterprise-electron/-/angular-console-enterprise-electron-0.3.548.tgz#aa038fb26eccdfc2bd99b079e077c4c8f482b8f1"
integrity sha512-MUMlfUaKxLVoy6AsaGhZzg6/HClRR95RGyHAQe2JTZZHVhd10FGDLCdD+gFQ3jba4cZyrzOEGzbu63TMWSjNKA==
"@nrwl/[email protected].555":
version "0.3.555"
resolved "https://registry.yarnpkg.com/@nrwl/angular-console-enterprise-electron/-/angular-console-enterprise-electron-0.3.555.tgz#53d8332a5184e5d6155ec4851c15256b4beb92d1"
integrity sha512-JPsVO6rhuk3Pp45PdD3pMvbIAhw/Rgui5Xbxxr9gUWiiH1BGbXWxJrjjVB7PGy2DVvGoA2mEMZ/ogI8QsN9yuQ==
dependencies:
apollo-cache-inmemory "1.3.10"
apollo-client "^2.3.5"
Expand All @@ -651,10 +651,10 @@
node-fetch "2.3.0"
request "2.88.0"

"@nrwl/[email protected].548":
version "0.3.548"
resolved "https://registry.yarnpkg.com/@nrwl/angular-console-enterprise-frontend/-/angular-console-enterprise-frontend-0.3.548.tgz#d57a7ee52d614f60711620d2c668671112bd63fe"
integrity sha512-mE9WqAdW4H6p8C0LDPudzFukcItCB8+JUSOgTAIlA0SXmgHVsGxAHZ2R8AFdJSGBipAvr69SExqLuENlcFxCMw==
"@nrwl/[email protected].555":
version "0.3.555"
resolved "https://registry.yarnpkg.com/@nrwl/angular-console-enterprise-frontend/-/angular-console-enterprise-frontend-0.3.555.tgz#e2b8d188852326a788e5d38f124594c04671a388"
integrity sha512-W1FTe86+7aBZq4X4401n0pvvckyaMrlw9OwHhB+qCLvMyCnbnxLd0wcipsSCWaBhYFHxztHxoxUCHg6EgS3crQ==
dependencies:
d3-ease "^1.0.5"
d3-format "^1.3.2"
Expand Down

0 comments on commit 0d5a78f

Please sign in to comment.