From d5edcd5f6f91f95809c00af1e9202623b0ffadd2 Mon Sep 17 00:00:00 2001 From: NirnayaSindhuSuthari Date: Thu, 25 Jul 2024 02:48:47 +0000 Subject: [PATCH 1/2] Pop up Warning after clicking connect when Spanner Configuration Details are not given --- .../direct-connection.component.html | 2 +- .../direct-connection.component.ts | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/ui/src/app/components/direct-connection/direct-connection.component.html b/ui/src/app/components/direct-connection/direct-connection.component.html index df390dba1..160bd81e8 100644 --- a/ui/src/app/components/direct-connection/direct-connection.component.html +++ b/ui/src/app/components/direct-connection/direct-connection.component.html @@ -79,7 +79,7 @@

Spanner Dialect

- diff --git a/ui/src/app/components/direct-connection/direct-connection.component.ts b/ui/src/app/components/direct-connection/direct-connection.component.ts index ab91863d8..a8e76ad75 100644 --- a/ui/src/app/components/direct-connection/direct-connection.component.ts +++ b/ui/src/app/components/direct-connection/direct-connection.component.ts @@ -9,6 +9,8 @@ import { DialectList, InputType, PersistedFormValues, StorageKeys } from 'src/ap import { SnackbarService } from 'src/app/services/snackbar/snackbar.service' import { extractSourceDbName } from 'src/app/utils/utils' import { ClickEventService } from 'src/app/services/click-event/click-event.service' +import { MatDialog } from '@angular/material/dialog' +import { InfodialogComponent } from '../infodialog/infodialog.component' @Component({ selector: 'app-direct-connection', @@ -35,6 +37,7 @@ export class DirectConnectionComponent implements OnInit { ] isTestConnectionSuccessful = false + isOfflineStatus: boolean = false connectRequest: any = null getSchemaRequest: any = null @@ -51,7 +54,8 @@ export class DirectConnectionComponent implements OnInit { private data: DataService, private loader: LoaderService, private snackbarService: SnackbarService, - private clickEvent: ClickEventService + private clickEvent: ClickEventService, + private dialog: MatDialog, ) {} ngOnInit(): void { @@ -72,6 +76,12 @@ export class DirectConnectionComponent implements OnInit { } }, }) + + this.data.isOffline.subscribe({ + next: (res) => { + this.isOfflineStatus = res + }, + }) } testConn() { @@ -103,6 +113,24 @@ export class DirectConnectionComponent implements OnInit { }) } + checkSpConfig() { + if (this.isOfflineStatus) { + const dialogRef = this.dialog.open(InfodialogComponent, { + data: { message: "Please configure spanner project id and instance id to proceed otherwise default values will not be migrated", type: 'warning', title: 'Configure Spanner' }, + maxWidth: '500px', + }) + dialogRef.afterClosed().subscribe((dialogResult) => { + if (dialogResult) { + this.connectToDb(); + } else { + // user cancelled, stays on same page. + } + }) + } else { + this.connectToDb(); + } + } + connectToDb() { this.clickEvent.openDatabaseLoader('direct', this.connectForm.value.dbName!) window.scroll(0, 0) From 45f740b238f6e8ae6acae87b29ff5d475ec22115 Mon Sep 17 00:00:00 2001 From: NirnayaSindhuSuthari Date: Fri, 9 Aug 2024 10:43:36 +0000 Subject: [PATCH 2/2] updated --- .../components/direct-connection/direct-connection.component.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/ui/src/app/components/direct-connection/direct-connection.component.ts b/ui/src/app/components/direct-connection/direct-connection.component.ts index a8e76ad75..8f3880701 100644 --- a/ui/src/app/components/direct-connection/direct-connection.component.ts +++ b/ui/src/app/components/direct-connection/direct-connection.component.ts @@ -122,8 +122,6 @@ export class DirectConnectionComponent implements OnInit { dialogRef.afterClosed().subscribe((dialogResult) => { if (dialogResult) { this.connectToDb(); - } else { - // user cancelled, stays on same page. } }) } else {