Skip to content

Commit

Permalink
feat: Show all actions from project view (#490)
Browse files Browse the repository at this point in the history
* feat: Show all actions from project view

* fix lint errors

* chore: Fix lint error

* fix: e2e test
  • Loading branch information
isaacplmann authored and mrmeku committed Mar 5, 2019
1 parent 202261b commit 5e09c0e
Show file tree
Hide file tree
Showing 14 changed files with 427 additions and 65 deletions.
47 changes: 41 additions & 6 deletions apps/angular-console-e2e/src/integration/projects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,57 @@ describe('Projects', () => {
});

it('checks that hot actions work', () => {
elementContainsText('button', 'Generate Component').click();
elementContainsText('div.context-title', '@schematics/angular - component');
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 run proj:extract-i18n');
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'
);
});
it('should pin and unpin projects', () => {
cy.get('.favorite-icon.favorited').should('not.exist');
Expand Down
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
}
}
}
}
29 changes: 26 additions & 3 deletions libs/feature-workspaces/src/lib/projects/projects.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{{ projectFilterFormControl.value ? 'clear' : 'filter_list' }}
</mat-icon>
</div>
<mat-list>
<mat-list *ngIf="(filteredProjects$ | async) as projects">
<cdk-virtual-scroll-viewport
[style.height]="viewportHeight$ | async"
itemSize="88px"
Expand Down Expand Up @@ -84,12 +84,35 @@ <h3 mat-subheader>Projects</h3>
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 5e09c0e

Please sign in to comment.