Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default Value Pop up Warning #889

Open
wants to merge 2 commits into
base: feature/default-value
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ <h3 class="primary-header">Spanner Dialect</h3>
<button mat-raised-button id="test-connect-btn" type="submit" color="accent" [disabled]="!connectForm.valid" (click)="testConn()">
Test Connection
</button>
<button mat-raised-button id="connect-btn" type="submit" color="primary" [disabled]="!connectForm.valid || !isTestConnectionSuccessful" (click)="connectToDb()">
<button mat-raised-button id="connect-btn" type="submit" color="primary" [disabled]="!connectForm.valid || !isTestConnectionSuccessful" (click)="checkSpConfig()">
Connect
</button>
<button mat-raised-button [routerLink]="'/'">Cancel</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -35,6 +37,7 @@ export class DirectConnectionComponent implements OnInit {
]

isTestConnectionSuccessful = false
isOfflineStatus: boolean = false

connectRequest: any = null
getSchemaRequest: any = null
Expand All @@ -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 {
Expand All @@ -72,6 +76,12 @@ export class DirectConnectionComponent implements OnInit {
}
},
})

this.data.isOffline.subscribe({
next: (res) => {
this.isOfflineStatus = res
},
})
}

testConn() {
Expand Down Expand Up @@ -103,6 +113,22 @@ export class DirectConnectionComponent implements OnInit {
})
}

checkSpConfig() {
if (this.isOfflineStatus) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests for this

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 {
this.connectToDb();
}
}

connectToDb() {
this.clickEvent.openDatabaseLoader('direct', this.connectForm.value.dbName!)
window.scroll(0, 0)
Expand Down
Loading