Skip to content

Commit

Permalink
feat(vscode): Expose tree view
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmeku authored and vsavkin committed Jan 30, 2019
1 parent a1df664 commit 0484fa1
Show file tree
Hide file tree
Showing 65 changed files with 1,174 additions and 522 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
*.sublime-workspace

# IDE - VSCode
.vscode/*l
.vscode/*
.vscode-test/*
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
Expand Down
28 changes: 25 additions & 3 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"fileReplacements": [
{
"replace": "apps/angular-console/src/environments/environment.ts",
"with": "apps/angular-console/src/environments/environment.prod.ts"
"with": "apps/angular-console/src/environments/environment.electron.ts"
}
],
"outputPath": "dist/apps/electron/assets/public",
Expand All @@ -65,7 +65,7 @@
"fileReplacements": [
{
"replace": "apps/angular-console/src/environments/environment.ts",
"with": "apps/angular-console/src/environments/environment.prod.ts"
"with": "apps/angular-console/src/environments/environment.vscode.ts"
}
],
"outputPath": "dist/apps/vscode/assets/public",
Expand Down Expand Up @@ -152,8 +152,14 @@
"options": {
"outputPath": "dist/apps/vscode",
"main": "apps/vscode/src/main.ts",
"sourceMaps": false,
"externalDependencies": ["vscode"],
"tsConfig": "apps/vscode/tsconfig.app.json",
"assets": ["apps/vscode/src/package.json", "apps/vscode/src/assets"]
"assets": [
"apps/vscode/src/package.json",
"apps/vscode/src/tree-view-icon.svg",
"apps/vscode/src/assets"
]
},
"configurations": {
"production": {
Expand Down Expand Up @@ -413,6 +419,22 @@
}
}
}
},
"environment": {
"root": "libs/environment",
"sourceRoot": "libs/environment/src",
"projectType": "library",
"prefix": "angular-console",
"architect": {
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["libs/environment/tsconfig.lib.json"],
"exclude": ["**/node_modules/**"]
}
}
},
"schematics": {}
}
},
"cli": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Extensions', () => {

goBack();

cy.contains('div.title', 'Add CLI Extensions');
cy.contains('div.title', 'Extensions');
taskListHeaders($p => {
expect(texts($p)[0]).to.equal('Available Extensions');
});
Expand Down
2 changes: 1 addition & 1 deletion apps/angular-console-e2e/src/integration/forms.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Forms', () => {
whitelistGraphql();
openProject(projectPath('proj'));
goToGenerate();
cy.contains('div.title', 'Generate Code');
cy.contains('div.title', 'Generate');

clickOnTask('@schematics/angular', 'component');
cy.contains('div.context-title', '@schematics/angular - component');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Generate Workspace Schematics', () => {
whitelistGraphql();
openProject(projectPath('proj-nx'));
goToGenerate();
cy.contains('div.title', 'Generate Code');
cy.contains('div.title', 'Generate');
});

it('runs a schematic', () => {
Expand Down Expand Up @@ -46,7 +46,7 @@ describe('Generate Workspace Schematics', () => {
openProject(projectPath('proj-nx'));
goToGenerate();

cy.contains('div.title', 'Generate Code');
cy.contains('div.title', 'Generate');
taskListHeaders($p => {
expect(texts($p)[0]).to.equal('Workspace Schematics');
});
Expand Down
4 changes: 2 additions & 2 deletions apps/angular-console-e2e/src/integration/generate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Generate', () => {
whitelistGraphql();
openProject(projectPath('proj'));
goToGenerate();
cy.contains('div.title', 'Generate Code');
cy.contains('div.title', 'Generate');
});

it('filters schematics', () => {
Expand Down Expand Up @@ -77,7 +77,7 @@ describe('Generate', () => {

goBack();

cy.contains('div.title', 'Generate Code');
cy.contains('div.title', 'Generate');
taskListHeaders($p => {
expect(texts($p)[0]).to.equal('@schematics/angular');
});
Expand Down
4 changes: 2 additions & 2 deletions apps/angular-console-e2e/src/integration/projects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
projectNames,
projectPath,
texts,
waitForAnimation,
whitelistGraphql
} from './utils';

Expand Down Expand Up @@ -32,7 +31,8 @@ describe('Projects', () => {
});
});

it('provides navigation to and from command runners', () => {
// TODO: Re-enable when we app routes back to projects page
xit('provides navigation to and from command runners', () => {
cy.contains('Generate Component').click();
cy.get('.exit-action').click();

Expand Down
10 changes: 5 additions & 5 deletions apps/angular-console-e2e/src/integration/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,17 @@ export function projectNames(callback: (s: any) => void) {
}

export function goToGenerate() {
cy.get('button#go-to-generate').click({ force: true });
cy.contains('.title', 'Generate Code');
cy.get('button#go-to-generate').click({ force: true, timeout: 5000 });
cy.contains('.title', 'Generate');
}

export function goToExtensions() {
cy.get('button#go-to-extensions').click({ force: true });
cy.contains('.title', 'Add CLI Extensions');
cy.get('button#go-to-extensions').click({ force: true, timeout: 5000 });
cy.contains('.title', 'Extensions');
}

export function goToTasks() {
cy.get('button#go-to-tasks').click({ force: true });
cy.get('button#go-to-tasks').click({ force: true, timeout: 5000 });
cy.contains('.title', 'Tasks');
}

Expand Down
2 changes: 1 addition & 1 deletion apps/angular-console-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["cypress"]
"types": ["node", "cypress"]
},
"include": ["**/*.ts"]
}
29 changes: 22 additions & 7 deletions apps/angular-console/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { FADE_IN } from '@angular-console/ui';
import { RouterNavigationService, Settings } from '@angular-console/utils';
import { Settings } from '@angular-console/utils';
import { transition, trigger } from '@angular/animations';
import {
ChangeDetectionStrategy,
Component,
OnDestroy,
OnInit,
ViewChild,
ChangeDetectionStrategy
ViewChild
} from '@angular/core';
import { Title } from '@angular/platform-browser';
import { RouterOutlet } from '@angular/router';
import { NavigationEnd, Router, RouterOutlet } from '@angular/router';
import {
Breadcrumb,
ContextualActionBarService
} from '@nrwl/angular-console-enterprise-frontend';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { filter, map } from 'rxjs/operators';

const TITLE_SEPARATOR = ' | ';

Expand Down Expand Up @@ -50,10 +50,25 @@ export class AppComponent implements OnInit, OnDestroy {
settings: Settings,
private readonly contextualActionBarService: ContextualActionBarService,
private readonly titleService: Title,
// Ensures we allow location ext to listen on all router events no matter which route user enters into first.
private readonly routerNavService: RouterNavigationService
router: Router
) {
settings.fetch().subscribe();

router.events
.pipe(filter((e): e is NavigationEnd => e instanceof NavigationEnd))
.subscribe(e => {
if (e.urlAfterRedirects === '/connect') {
// TODO: This logic belong within angular-console-enterprise-frontend
this.contextualActionBarService.breadcrumbs$.next([
{ title: 'Connect' }
]);
} else if (e.urlAfterRedirects === '/settings') {
// TODO: This logic belong within the settings component after electron redesign.
this.contextualActionBarService.breadcrumbs$.next([
{ title: 'Settings' }
]);
}
});
}

private readonly titleSubscription = this.contextualActionBarService.breadcrumbs$
Expand Down
25 changes: 11 additions & 14 deletions apps/angular-console/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import { ENVIRONMENT, Environment } from '@angular-console/environment';
import { FeatureActionBarModule } from '@angular-console/feature-action-bar';
import { FeatureSettingsModule } from '@angular-console/feature-settings';
import {
FeatureWorkspacesModule,
workspaceRoutes
} from '@angular-console/feature-workspaces';
import {
settingsRoutes,
FeatureSettingsModule
} from '@angular-console/feature-settings';
import { UiModule } from '@angular-console/ui';
import {
Telemetry,
IsNodeJsInstalledGuard,
Messenger
Messenger,
Telemetry
} from '@angular-console/utils';
import { HttpClientModule } from '@angular/common/http';
import { NgModule, Inject } from '@angular/core';
import { Inject, NgModule } from '@angular/core';
import {
MatIconModule,
MatListModule,
Expand All @@ -24,17 +22,14 @@ import {
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterModule } from '@angular/router';
import {
AngularConsoleEnterpriseFrontendModule,
connectRootRoutes
} from '@nrwl/angular-console-enterprise-frontend';
import { AngularConsoleEnterpriseFrontendModule } from '@nrwl/angular-console-enterprise-frontend';
import { APOLLO_OPTIONS, ApolloModule } from 'apollo-angular';
import { HttpLink, HttpLinkModule } from 'apollo-angular-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { onError } from 'apollo-link-error';

import { AppComponent } from './app.component';
import { environment } from '../environments/environment';
import { AppComponent } from './app.component';

export function initApollo(
telemetry: Telemetry,
Expand Down Expand Up @@ -102,7 +97,8 @@ export function initApollo(
path: 'install-nodejs',
loadChildren:
'@angular-console/feature-install-node-js#FeatureInstallNodeJsModule'
}
},
{ path: '**', redirectTo: '/workspaces' }
],
{ paramsInheritanceStrategy: 'always' }
)
Expand All @@ -118,7 +114,8 @@ export function initApollo(
provide: APOLLO_OPTIONS,
useFactory: initApollo,
deps: [[new Inject('telemetry')], Messenger, HttpLink]
}
},
{ provide: ENVIRONMENT, useValue: environment as Environment }
],
bootstrap: [AppComponent]
})
Expand Down
Binary file modified apps/angular-console/src/assets/nautilus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/angular-console/src/assets/vscode-insiders.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/angular-console/src/assets/vscode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion apps/angular-console/src/environments/environment.cypress.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Environment } from '@angular-console/environment';
import { GetDirectoryPathGQL } from '@angular-console/feature-workspaces';
import { of } from 'rxjs';

Expand All @@ -13,8 +14,9 @@ class MockGetDirectoryPathGQL extends GetDirectoryPathGQL {
}
}

export const environment = {
export const environment: Environment = {
production: false,
application: 'electron',
providers: [
{ provide: GetDirectoryPathGQL, useClass: MockGetDirectoryPathGQL }
]
Expand Down
7 changes: 7 additions & 0 deletions apps/angular-console/src/environments/environment.electron.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Environment } from '@angular-console/environment';

export const environment: Environment = {
production: true,
providers: [],
application: 'electron'
};
7 changes: 5 additions & 2 deletions apps/angular-console/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export const environment = {
import { Environment } from '@angular-console/environment';

export const environment: Environment = {
production: true,
providers: []
providers: [],
application: 'electron'
};
7 changes: 5 additions & 2 deletions apps/angular-console/src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export const environment = {
import { Environment } from '@angular-console/environment';

export const environment: Environment = {
production: false,
providers: []
providers: [],
application: 'electron'
};
7 changes: 7 additions & 0 deletions apps/angular-console/src/environments/environment.vscode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Environment } from '@angular-console/environment';

export const environment: Environment = {
production: true,
providers: [],
application: 'vscode'
};
12 changes: 6 additions & 6 deletions apps/electron/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
"main": "main.js",
"license": "MIT",
"dependencies": {
"@angular/cli": "7.2.2",
"@angular/cli": "7.2.3",
"@nrwl/angular-console-enterprise-electron": "0.0.40",
"@nrwl/schematics": "7.4.0",
"apollo-server-express": "2.3.1",
"@nrwl/schematics": "7.5.0",
"apollo-server-express": "2.3.2",
"dotenv": "6.2.0",
"electron-store": "2.0.0",
"opn": "^5.4.0",
"electron-updater": "3.1.2",
"@nestjs/common": "5.5.0",
"@nestjs/core": "5.5.0",
"@nestjs/graphql": "5.5.0",
"@nestjs/common": "5.6.2",
"@nestjs/core": "5.6.2",
"@nestjs/graphql": "5.5.1",
"fix-path": "2.1.0",
"get-port": "4.0.0",
"graphql": "^14.0.2",
Expand Down
15 changes: 9 additions & 6 deletions apps/vscode/src/app/start-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export async function startServer(context: ExtensionContext) {
const port = await getPort({ port: 8888 });
const store = {
get: (key: string, defaultValue: any) =>
context.workspaceState.get(key) || defaultValue,
set: (key: string, value: any) => context.workspaceState.update(key, value),
delete: (key: string) => context.workspaceState.update(key, undefined)
context.globalState.get(key) || defaultValue,
set: (key: string, value: any) => context.globalState.update(key, value),
delete: (key: string) => context.globalState.update(key, undefined)
};

const selectDirectory: SelectDirectory = async ({ buttonLabel }) => {
Expand Down Expand Up @@ -56,7 +56,10 @@ export async function startServer(context: ExtensionContext) {

const app = await NestFactory.create(createServerModule(exports, providers));
app.useStaticAssets(assetsPath);
return await app.listen(port, () => {
console.log(`Listening on port ${port}`);
});
return {
server: await app.listen(port, () => {
console.log(`Listening on port ${port}`);
}),
store
};
}
Loading

0 comments on commit 0484fa1

Please sign in to comment.