diff --git a/pdb-js/src/app/dashboard-page/dashboard/add-plot-dialog/add-plot-dialog.component.ts b/pdb-js/src/app/dashboard-page/dashboard/add-plot-dialog/add-plot-dialog.component.ts index 2d287ee..cda3170 100644 --- a/pdb-js/src/app/dashboard-page/dashboard/add-plot-dialog/add-plot-dialog.component.ts +++ b/pdb-js/src/app/dashboard-page/dashboard/add-plot-dialog/add-plot-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, ElementRef, ViewChild } from '@angular/core'; import { MatDialogRef } from '@angular/material/dialog'; @Component({ @@ -8,7 +8,6 @@ import { MatDialogRef } from '@angular/material/dialog'; }) export class AddPlotDialogComponent { - constructor(public dialogRef: MatDialogRef){ } diff --git a/pdb-js/src/app/dashboard-page/dashboard/add-text-dialog/add-text-dialog.component.html b/pdb-js/src/app/dashboard-page/dashboard/add-text-dialog/add-text-dialog.component.html index 268936d..0970427 100644 --- a/pdb-js/src/app/dashboard-page/dashboard/add-text-dialog/add-text-dialog.component.html +++ b/pdb-js/src/app/dashboard-page/dashboard/add-text-dialog/add-text-dialog.component.html @@ -2,7 +2,7 @@
Text - +
diff --git a/pdb-js/src/app/dashboard-page/dashboard/add-text-dialog/add-text-dialog.component.ts b/pdb-js/src/app/dashboard-page/dashboard/add-text-dialog/add-text-dialog.component.ts index 71c57c1..b4167bb 100644 --- a/pdb-js/src/app/dashboard-page/dashboard/add-text-dialog/add-text-dialog.component.ts +++ b/pdb-js/src/app/dashboard-page/dashboard/add-text-dialog/add-text-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; import { MatDialogRef } from '@angular/material/dialog'; @Component({ @@ -6,12 +6,18 @@ import { MatDialogRef } from '@angular/material/dialog'; templateUrl: './add-text-dialog.component.html', styleUrls: ['./add-text-dialog.component.scss'] }) -export class AddTextDialogComponent { +export class AddTextDialogComponent implements OnInit { text = ""; + @ViewChild('textElement') textElement!: ElementRef; + constructor(public dialogRef: MatDialogRef){ } + ngOnInit(): void { + window.setTimeout(() => this.textElement.nativeElement.focus(), 0); + } + onSaveClick(): void { this.dialogRef.close(this.text); } diff --git a/pdb-js/src/app/dashboard-page/dashboard/text-widget/text-widget.component.scss b/pdb-js/src/app/dashboard-page/dashboard/text-widget/text-widget.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/pdb-js/src/app/dashboard-page/new-dashboard/new-dashboard.component.html b/pdb-js/src/app/dashboard-page/new-dashboard/new-dashboard.component.html index e1c78c9..97cb1c4 100644 --- a/pdb-js/src/app/dashboard-page/new-dashboard/new-dashboard.component.html +++ b/pdb-js/src/app/dashboard-page/new-dashboard/new-dashboard.component.html @@ -2,7 +2,7 @@
Name - + Description diff --git a/pdb-js/src/app/dashboard-page/new-dashboard/new-dashboard.component.ts b/pdb-js/src/app/dashboard-page/new-dashboard/new-dashboard.component.ts index 5fef083..e660232 100644 --- a/pdb-js/src/app/dashboard-page/new-dashboard/new-dashboard.component.ts +++ b/pdb-js/src/app/dashboard-page/new-dashboard/new-dashboard.component.ts @@ -1,4 +1,4 @@ -import { Component, Inject } from '@angular/core'; +import { Component, ElementRef, Inject, OnInit, ViewChild } from '@angular/core'; import {MatDialog, MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; import { DashboardCreationData } from 'src/app/dashboard.service'; @@ -7,11 +7,18 @@ import { DashboardCreationData } from 'src/app/dashboard.service'; templateUrl: './new-dashboard.component.html', styleUrls: ['./new-dashboard.component.scss'] }) -export class NewDashboardComponent { +export class NewDashboardComponent implements OnInit { + + @ViewChild('name') nameInput!: ElementRef; + constructor(public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: DashboardCreationData,){ } + ngOnInit(): void { + window.setTimeout(() => this.nameInput.nativeElement.focus(), 0); + } + onSaveClick(): void { this.dialogRef.close(this.data); }