Skip to content

Commit

Permalink
fix: build (nrwl#754)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmeku committed Jul 17, 2019
1 parent ad42b1f commit 09717c2
Show file tree
Hide file tree
Showing 20 changed files with 141 additions and 151 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { WorkspaceDefinition } from '@angular-console/schema';
import { join } from 'path';
import { TreeItem } from 'vscode';

import {
WorkspaceRoute,
WorkspaceRouteTitle
} from '../tree-item/workspace-route';
import { AbstractTreeProvider } from './abstract-tree-provider';
import { TreeItem } from 'vscode';
import { join } from 'path';

const SCANNING_FOR_WORKSPACE = new TreeItem(
'Scanning for your Angular Workspace...'
Expand Down Expand Up @@ -87,7 +87,7 @@ export class CurrentWorkspaceTreeProvider extends AbstractTreeProvider<
}
}

return Promise.resolve([
return [
...[
'Projects',
'Generate',
Expand All @@ -105,6 +105,6 @@ export class CurrentWorkspaceTreeProvider extends AbstractTreeProvider<
)
),
SELECT_A_DIFFERENT_WORKSPACE
]);
];
}
}
18 changes: 14 additions & 4 deletions apps/vscode/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { WorkspaceDefinition } from '@angular-console/schema';
import { stream } from 'fast-glob';
import { existsSync } from 'fs';
import { Server } from 'http';
import { join, parse, dirname } from 'path';
import { dirname, join, parse } from 'path';
import {
commands,
ExtensionContext,
TreeView,
ViewColumn,
WebviewPanel,
window,
workspace
} from 'vscode';
Expand All @@ -22,11 +25,11 @@ import {
LOCATE_YOUR_WORKSPACE
} from './app/tree-view/current-workspace-tree-provider';
import { createWebViewPanel } from './app/webview.factory';
import { stream } from 'fast-glob';
import { existsSync } from 'fs';

let server: Promise<Server>;
let currentWorkspace: TreeView<Workspace | WorkspaceRoute>;
let treeDataProvider: CurrentWorkspaceTreeProvider;
let webViewPanel: WebviewPanel | undefined;

export function activate(context: ExtensionContext) {
treeDataProvider = CurrentWorkspaceTreeProvider.create({
Expand Down Expand Up @@ -112,6 +115,9 @@ export function activate(context: ExtensionContext) {
}

function setAngularWorkspace(context: ExtensionContext, workspacePath: string) {
if (webViewPanel) {
webViewPanel.dispose();
}
treeDataProvider.setWorkspacePath(workspacePath);
import('./app/start-server').then(({ startServer }) => {
server = startServer(context, workspacePath);
Expand Down Expand Up @@ -144,7 +150,7 @@ async function main(config: {
throw new Error(`Server address format is unsupported: ${address}`);
}

const webViewPanel = createWebViewPanel(
webViewPanel = createWebViewPanel(
context,
viewColumn,
`http://localhost:${address!.port}/`,
Expand All @@ -154,6 +160,10 @@ async function main(config: {
);
context.subscriptions.push(webViewPanel);

webViewPanel.onDidDispose(() => {
webViewPanel = undefined;
});

webViewPanel.onDidChangeViewState(e => {
if (e.webviewPanel.visible) {
revealWorkspaceRoute(currentWorkspace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
</ui-command-output>
</ui-task-runner>
<ng-template #emptyMessage>
<ui-entity-docs
*ngIf="(docs$ | async) as docks; else noDocs"
[docs]="docs$ | async"
style="margin-left: 15px"
></ui-entity-docs>
<ng-template #noDocs>
Click the Generate button to start this task.
</ng-template>
Expand Down
42 changes: 6 additions & 36 deletions libs/feature-generate/src/lib/schematic/schematic.component.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Schematic } from '@angular-console/schema';
import {
CommandOutputComponent,
FlagsComponent,
TaskRunnerComponent,
CommandOutputComponent
TaskRunnerComponent
} from '@angular-console/ui';
import {
IncrementalCommandOutput,
CommandRunner,
Serializer,
CommandStatus,
Settings
IncrementalCommandOutput,
Serializer
} from '@angular-console/utils';
import {
ChangeDetectionStrategy,
Expand All @@ -31,11 +30,11 @@ import {
tap,
withLatestFrom
} from 'rxjs/operators';

import {
GenerateGQL,
GenerateUsingNmpGQL,
SchematicCollectionsByNameGQL,
SchematicDocsGQL
SchematicCollectionsByNameGQL
} from '../generated/graphql';

const DEBOUNCE_TIME = 300;
Expand Down Expand Up @@ -69,8 +68,6 @@ export class SchematicComponent implements OnInit {
taskRunner: TaskRunnerComponent;
@ViewChild(FlagsComponent, { static: false }) flags: FlagsComponent;

docs$: Observable<any[]>;

hasNeverBeenValid = true;

private readonly ngGen$ = new Subject<void>();
Expand All @@ -84,8 +81,6 @@ export class SchematicComponent implements OnInit {
private readonly contextActionService: ContextualActionBarService,
private readonly generateGQL: GenerateGQL,
private readonly generateUsingNpmGQL: GenerateUsingNmpGQL,
private readonly schematicDocsGQL: SchematicDocsGQL,
private readonly settings: Settings,
private readonly schematicCollectionsByNameGQL: SchematicCollectionsByNameGQL
) {}

Expand Down Expand Up @@ -238,31 +233,6 @@ export class SchematicComponent implements OnInit {
);
})
);

if (this.settings.showDocs) {
this.docs$ = schematicDescription$.pipe(
switchMap((d: any) => {
if (d === null) {
return of(null);
} else {
return this.schematicDocsGQL.fetch({
path: d.path,
collectionName: d.collection,
name: d.schematic
});
}
}),
map(r => {
if (!r) {
return [];
} else {
return r.data.workspace.docs.schematicDocs;
}
})
);
} else {
this.docs$ = of([]);
}
}

private runCommand(
Expand Down
5 changes: 0 additions & 5 deletions libs/feature-run/src/lib/target/target.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,5 @@
</ui-command-output>
</ui-task-runner>
<ng-template #emptyMessage>
<ui-entity-docs
*ngIf="(docs$ | async) as docks; else noDocs"
[docs]="docs$ | async"
style="margin-left: 15px"
></ui-entity-docs>
<ng-template #noDocs> Click the Run button to start this task. </ng-template>
</ng-template>
34 changes: 28 additions & 6 deletions libs/feature-run/src/lib/target/target.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
import { Architect, Project } from '@angular-console/schema';
import { CommandOutputComponent, FlagsComponent, TaskRunnerComponent } from '@angular-console/ui';
import { CommandRunner, IncrementalCommandOutput, Serializer } from '@angular-console/utils';
import { ChangeDetectionStrategy, Component, OnInit, ViewChild } from '@angular/core';
import {
CommandOutputComponent,
FlagsComponent,
TaskRunnerComponent
} from '@angular-console/ui';
import {
CommandRunner,
IncrementalCommandOutput,
Serializer
} from '@angular-console/utils';
import {
ChangeDetectionStrategy,
Component,
OnInit,
ViewChild
} from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ContextualActionBarService } from '@nrwl/angular-console-enterprise-frontend';
import { BehaviorSubject, Observable, of, Subject } from 'rxjs';
import { map, publishReplay, refCount, switchMap, tap, withLatestFrom } from 'rxjs/operators';
import {
map,
publishReplay,
refCount,
switchMap,
tap,
withLatestFrom
} from 'rxjs/operators';

import { ProjectsGQL, RunNgGQL } from '../generated/graphql';

Expand All @@ -29,8 +49,6 @@ export class TargetComponent implements OnInit {
taskRunner: TaskRunnerComponent;
@ViewChild(FlagsComponent, { static: false }) flags: FlagsComponent;

docs$: Observable<any[]> = of();

private readonly ngRun$ = new Subject<any>();
private readonly ngRunDisabled$ = new BehaviorSubject(true);

Expand Down Expand Up @@ -158,6 +176,10 @@ export class TargetComponent implements OnInit {
}

initSourceMapAndStatsJson(architect: Architect) {
if (architect.name !== 'build') {
return;
}

const defaultValues = architect.configurations[0]
? architect.configurations[0].defaultValues
: [];
Expand Down
15 changes: 15 additions & 0 deletions libs/feature-settings/src/lib/settings/settings.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ <h4 mat-line>Disable Animations</h4>
[checked]="settings.useDisableAnimations()"
></mat-slide-toggle>
</div>
<div
fxLayout="row wrap"
*ngIf="!isElectron"
fxFill
fxLayoutAlign="start center"
>
<div fxFlex>
<h4 mat-line>Show Routes Sidenav</h4>
<p mat-line>Pin navigation buttons to the left hand side of console</p>
</div>
<mat-slide-toggle
(change)="settings.setShowRoutesSideNav($event.checked)"
[checked]="settings.showRoutesSideNav()"
></mat-slide-toggle>
</div>
<div fxLayout="row wrap" fxFill fxLayoutAlign="start center">
<div fxFlex>
<h4 mat-line>Use detailed status</h4>
Expand Down
2 changes: 2 additions & 0 deletions libs/feature-settings/src/lib/settings/settings.component.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { IS_ELECTRON } from '@angular-console/environment';
import { Settings, Telemetry } from '@angular-console/utils';
import { Component, Inject, OnDestroy } from '@angular/core';
import { NavigationEnd, Router } from '@angular/router';
Expand All @@ -15,6 +16,7 @@ export class SettingsComponent implements OnDestroy {

constructor(
readonly settings: Settings,
@Inject(IS_ELECTRON) readonly isElectron: boolean,
@Inject('telemetry') private readonly telemetry: Telemetry,
private readonly contextualActionBarService: ContextualActionBarService,
router: Router
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div fxFlex fxLayout="column">
<div class="content" fxLayout="row" fxFlex>
<div
*ngIf="isElectron"
*ngIf="isElectron || settings.showRoutesSideNav"
class="routes-side-nav-container"
[@growShrink]="sideNavAnimationState$ | async"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
trigger
} from '@angular/animations';
import {
ChangeDetectionStrategy,
Component,
Inject,
OnDestroy,
ViewEncapsulation,
ChangeDetectionStrategy
ViewEncapsulation
} from '@angular/core';
import { MediaObserver } from '@angular/flex-layout';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
Expand Down Expand Up @@ -196,9 +196,9 @@ export class WorkspaceComponent implements OnDestroy {
constructor(
@Inject(IS_ELECTRON) readonly isElectron: boolean,
@Inject(IS_INTELLIJ) readonly isIntellij: boolean,
readonly settings: Settings,
private readonly route: ActivatedRoute,
private readonly router: Router,
private readonly settings: Settings,
private readonly mediaObserver: MediaObserver,
private readonly contextualActionBarService: ContextualActionBarService,
private readonly editorSupport: EditorSupport,
Expand Down
13 changes: 13 additions & 0 deletions libs/schema/src/lib/generated/graphql-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export interface Settings {

enableDetailedStatus?: Maybe<boolean>;

showRoutesSideNav?: Maybe<boolean>;

channel?: Maybe<string>;

workspaceSchematicsDirectory?: Maybe<string>;
Expand Down Expand Up @@ -621,6 +623,12 @@ export namespace SettingsResolvers {
Context
>;

showRoutesSideNav?: ShowRoutesSideNavResolver<
Maybe<boolean>,
TypeParent,
Context
>;

channel?: ChannelResolver<Maybe<string>, TypeParent, Context>;

workspaceSchematicsDirectory?: WorkspaceSchematicsDirectoryResolver<
Expand Down Expand Up @@ -674,6 +682,11 @@ export namespace SettingsResolvers {
Parent = any,
Context = any
> = Resolver<R, Parent, Context>;
export type ShowRoutesSideNavResolver<
R = Maybe<boolean>,
Parent = any,
Context = any
> = Resolver<R, Parent, Context>;
export type ChannelResolver<
R = Maybe<string>,
Parent = any,
Expand Down
4 changes: 2 additions & 2 deletions libs/server/src/assets/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type Architect {
project: String!
builder: String!
description: String!
options: Options!,
options: Options!
configurations: [ArchitectConfigurations!]!
schema: [Schema!]!
}
Expand Down Expand Up @@ -70,7 +70,6 @@ type Extension {
installed: Boolean
}


type IsNodeInstalledResult {
result: Boolean!
}
Expand Down Expand Up @@ -221,6 +220,7 @@ type Settings {
showSupportPlugin: Boolean
installNodeManually: Boolean
enableDetailedStatus: Boolean
showRoutesSideNav: Boolean
channel: String
workspaceSchematicsDirectory: String
workspaceSchematicsNpmScript: String
Expand Down
Loading

0 comments on commit 09717c2

Please sign in to comment.