Skip to content

Commit

Permalink
feat: Show all actions from project view
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaac Mann authored and Isaac Mann committed Jan 30, 2019
1 parent a1df664 commit 33f05e5
Show file tree
Hide file tree
Showing 12 changed files with 362 additions and 61 deletions.
45 changes: 40 additions & 5 deletions apps/angular-console-e2e/src/integration/projects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,56 @@ describe('Projects', () => {
});

it('checks that hot actions work', () => {
cy.contains('button', 'Generate Component').click();
cy.contains('angular-console-projects button', 'Component').should(
'not.exist'
);

cy.contains('mat-icon', 'more_horiz')
.first()
.click();
cy.contains('.cdk-overlay-pane button', 'Component').click();
cy.contains('div.context-title', '@schematics/angular - component');
cy.get('input[name="project"]').should(($p: any) => {
expect($p[0].value).to.equal('proj');
});
});

it('provides navigation to and from command runners', () => {
cy.contains('Generate Component').click();
cy.get('.exit-action').click();

projectNames($p => {
expect($p.length).to.equal(2);
expect(texts($p)[0]).to.contain('proj');
expect(texts($p)[1]).to.contain('proj-e2e');
});
cy.contains('angular-console-projects button', 'Component');

cy.contains('angular-console-projects button', 'Build')
.first()
.click();
cy.contains('div.context-title', 'ng build proj');
cy.get('.exit-action').click();
cy.contains('angular-console-projects button', 'Serve')
.first()
.click();
cy.contains('div.context-title', 'ng serve proj');
cy.get('.exit-action').click();
cy.contains('angular-console-projects button', 'Extract-i18n')
.first()
.click();
cy.contains('div.context-title', 'ng extract-i18n proj');
cy.get('.exit-action').click();
cy.contains('angular-console-projects button', 'Test')
.first()
.click();
cy.contains('div.context-title', 'ng test proj');
cy.get('.exit-action').click();
cy.contains('mat-icon', 'more_horiz')
.first()
.click();
cy.contains('.cdk-overlay-pane button', 'Lint').click();
cy.contains('div.context-title', 'ng lint proj');
cy.get('.exit-action').click();

cy.contains('angular-console-projects button', 'Component').should(
'not.exist'
);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
mutation SaveRecentAction(
$workspacePath: String!
$projectName: String!
$actionName: String!
$schematicName: String
) {
saveRecentAction(
workspacePath: $workspacePath
projectName: $projectName
actionName: $actionName
schematicName: $schematicName
) {
actionName
schematicName
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
query WorkspaceSchematics($path: String!) {
workspace(path: $path) {
schematicCollections {
name
schematics {
name
description
collection
}
}
}
}
4 changes: 4 additions & 0 deletions libs/feature-workspaces/src/lib/graphql/workspace.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ query Workspace($path: String!) {
architect {
name
}
recentActions {
actionName
schematicName
}
}
}
}
31 changes: 27 additions & 4 deletions libs/feature-workspaces/src/lib/projects/projects.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div *ngIf="(filteredProjects$ | async) as projects">
<div *ngIf="(workspacePath$ | async) as workspacePath">
<div
class="project-filter-container"
fxLayout="row"
Expand All @@ -18,7 +18,7 @@
{{ projectFilterFormControl.value ? 'clear' : 'filter_list' }}
</mat-icon>
</div>
<mat-list *ngIf="projects.length > 0">
<mat-list *ngIf="(filteredProjects$ | async) as projects">
<cdk-virtual-scroll-viewport
[style.height]="viewportHeight$ | async"
itemSize="88px"
Expand All @@ -42,12 +42,35 @@
fxLayoutAlign="end center"
>
<button
*ngFor="let a of p.actions"
*ngFor="let a of ((recentActions$ | async) || {})[p.name]"
mat-stroked-button
(click)="onActionTriggered(workspacePath, p, a)"
[routerLink]="a.link"
>
{{ a.actionDescription }}
{{ a.actionDescription | titlecase }}
</button>
<button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_horiz</mat-icon>
</button>
<mat-menu #actionsMenu>
<ng-container *ngFor="let a of p.actions">
<ng-container *ngIf="!a.link">
<mat-divider></mat-divider>
<span mat-menu-item [disabled]="true">
{{ a.actionDescription }}
</span>
<mat-divider></mat-divider>
</ng-container>
<button
mat-menu-item
[routerLink]="a.link"
*ngIf="a.link"
(click)="onActionTriggered(workspacePath, p, a)"
>
{{ a.actionDescription | titlecase }}
</button>
</ng-container>
</mat-menu>
</div>
</mat-list-item>
<mat-divider></mat-divider>
Expand Down
Loading

0 comments on commit 33f05e5

Please sign in to comment.