Skip to content

Commit

Permalink
feat: use cmd/ctrl+enter to execute generator while in the UI form
Browse files Browse the repository at this point in the history
  • Loading branch information
Cammisuli committed Jan 21, 2022
1 parent d6d7605 commit 005a68a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libs/vscode-ui/components/src/lib/field/field.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class FieldComponent implements ControlValueAccessor, OnDestroy {
return Object.keys(this.control.errors ?? {})
.map((key) => {
if (this.control.errors) {
if (key === 'isRequired') {
if (key === 'required') {
return `${fieldName
.slice(0, 1)
.toLocaleUpperCase()}${fieldName.slice(1)} is required`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
taskExecForm.architect.configurations &&
taskExecForm.architect.configurations.length > 0
"
(document:keydown.meta.enter)="isMacOs && runCommand(taskExecForm)"
(document:keydown.control.enter)="!isMacOs && runCommand(taskExecForm)"
>
<div class="form-header-container" #formHeaderContainer>
<div class="form-header">
Expand Down Expand Up @@ -57,7 +59,10 @@
<form class="fields" [formGroup]="taskExecForm.form">
<div class="title-container">
<span class="title">
{{ taskExecForm.architect | formatTask: taskExecForm.form.get('configuration')?.value }}
{{
taskExecForm.architect
| formatTask: taskExecForm.form.get('configuration')?.value
}}
</span>
<button
(click)="
Expand Down Expand Up @@ -88,7 +93,7 @@
<nx-console-argument-list
[args]="runCommandArguments$ | async"
></nx-console-argument-list>
<div class ="fields-container">
<div class="fields-container">
<ng-container *ngIf="defaultValues$ | async as defaultValues">
<nx-console-field
[id]="field.name + '-nx-console-field'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ export class TaskExecutionFormComponent implements OnInit, AfterViewChecked {
@ViewChild('formHeaderContainer')
formHeaderContainer: ElementRef<HTMLElement>;

get isMacOs() {
return navigator.userAgent.indexOf('Mac') > -1;
}

private readonly activeFieldIdSubject = new BehaviorSubject<string>('');
readonly activeFieldName$ = this.activeFieldIdSubject.pipe(
distinctUntilChanged(),
Expand Down

0 comments on commit 005a68a

Please sign in to comment.