mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Set default radio button selection, evaluate default component popula… (#17764)
* Set default radio button selection, evaluate default component population off of selection instead of unprocessed input * rename var * if -> switches * Remove project radio buttons because they require commands that aren't yet checked in (and fail as a result)
This commit is contained in:
@@ -320,49 +320,36 @@ export class SchemaCompareDialog {
|
|||||||
let targetComponents = [];
|
let targetComponents = [];
|
||||||
|
|
||||||
// start source and target with either dacpac, database, or project selection based on what the previous value was
|
// start source and target with either dacpac, database, or project selection based on what the previous value was
|
||||||
if (this.schemaCompareMainWindow.sourceEndpointInfo && this.schemaCompareMainWindow.sourceEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Database) {
|
sourceComponents = [sourceRadioButtons];
|
||||||
sourceComponents = [
|
|
||||||
sourceRadioButtons,
|
switch (this.sourceEndpointType) {
|
||||||
this.sourceServerComponent,
|
case mssql.SchemaCompareEndpointType.Database:
|
||||||
this.sourceDatabaseComponent
|
sourceComponents.push(
|
||||||
];
|
this.sourceServerComponent,
|
||||||
} else if (this.schemaCompareMainWindow.sourceEndpointInfo && this.schemaCompareMainWindow.sourceEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Dacpac) {
|
this.sourceDatabaseComponent);
|
||||||
sourceComponents = [
|
break;
|
||||||
sourceRadioButtons,
|
case mssql.SchemaCompareEndpointType.Dacpac:
|
||||||
this.sourceDacpacComponent,
|
sourceComponents.push(this.sourceDacpacComponent);
|
||||||
];
|
break;
|
||||||
} else if (this.schemaCompareMainWindow.sourceEndpointInfo && this.schemaCompareMainWindow.sourceEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Project) {
|
case mssql.SchemaCompareEndpointType.Project:
|
||||||
sourceComponents = [
|
sourceComponents.push(this.sourceProjectFilePathComponent);
|
||||||
sourceRadioButtons,
|
break;
|
||||||
this.sourceProjectFilePathComponent,
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
sourceComponents = [
|
|
||||||
sourceRadioButtons,
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.schemaCompareMainWindow.targetEndpointInfo && this.schemaCompareMainWindow.targetEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Database) {
|
targetComponents = [targetRadioButtons];
|
||||||
targetComponents = [
|
|
||||||
targetRadioButtons,
|
switch (this.targetEndpointType) {
|
||||||
this.targetServerComponent,
|
case mssql.SchemaCompareEndpointType.Database:
|
||||||
this.targetDatabaseComponent
|
targetComponents.push(
|
||||||
];
|
this.targetServerComponent,
|
||||||
} else if (this.schemaCompareMainWindow.targetEndpointInfo && this.schemaCompareMainWindow.targetEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Dacpac) {
|
this.targetDatabaseComponent);
|
||||||
targetComponents = [
|
break;
|
||||||
targetRadioButtons,
|
case mssql.SchemaCompareEndpointType.Dacpac:
|
||||||
this.targetDacpacComponent,
|
targetComponents.push(this.targetDacpacComponent);
|
||||||
];
|
break;
|
||||||
} else if (this.schemaCompareMainWindow.targetEndpointInfo && this.schemaCompareMainWindow.targetEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Project) {
|
case mssql.SchemaCompareEndpointType.Project:
|
||||||
targetComponents = [
|
targetComponents.push(this.targetProjectFilePathComponent);
|
||||||
targetRadioButtons,
|
break;
|
||||||
this.targetProjectFilePathComponent,
|
|
||||||
this.targetProjectStructureComponent
|
|
||||||
];
|
|
||||||
} else {
|
|
||||||
targetComponents = [
|
|
||||||
targetRadioButtons,
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.formBuilder = <azdata.FormBuilder>this.view.modelBuilder.formContainer()
|
this.formBuilder = <azdata.FormBuilder>this.view.modelBuilder.formContainer()
|
||||||
@@ -525,23 +512,26 @@ export class SchemaCompareDialog {
|
|||||||
this.dialog.okButton.enabled = await this.shouldEnableOkayButton();
|
this.dialog.okButton.enabled = await this.shouldEnableOkayButton();
|
||||||
});
|
});
|
||||||
|
|
||||||
// if source is currently a db, show it in the server and db dropdowns
|
this.sourceEndpointType = this.schemaCompareMainWindow.sourceEndpointInfo?.endpointType ?? mssql.SchemaCompareEndpointType.Database; // default to database if no specific source is passed
|
||||||
if (this.schemaCompareMainWindow.sourceEndpointInfo && this.schemaCompareMainWindow.sourceEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Database) {
|
|
||||||
this.sourceDatabaseRadioButton.checked = true;
|
switch (this.sourceEndpointType) {
|
||||||
this.sourceEndpointType = mssql.SchemaCompareEndpointType.Database;
|
case mssql.SchemaCompareEndpointType.Dacpac:
|
||||||
} else if (this.schemaCompareMainWindow.sourceEndpointInfo && this.schemaCompareMainWindow.sourceEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Dacpac) {
|
this.sourceDacpacRadioButton.checked = true;
|
||||||
this.sourceDacpacRadioButton.checked = true;
|
break;
|
||||||
this.sourceEndpointType = mssql.SchemaCompareEndpointType.Dacpac;
|
case mssql.SchemaCompareEndpointType.Project:
|
||||||
} else if (this.schemaCompareMainWindow.sourceEndpointInfo) {
|
this.sourceProjectRadioButton.checked = true;
|
||||||
this.sourceProjectRadioButton.checked = true;
|
break;
|
||||||
this.sourceEndpointType = mssql.SchemaCompareEndpointType.Project;
|
case mssql.SchemaCompareEndpointType.Database:
|
||||||
|
this.sourceDatabaseRadioButton.checked = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
let radioButtons = [this.sourceDatabaseRadioButton, this.sourceDacpacRadioButton];
|
let radioButtons = [this.sourceDatabaseRadioButton, this.sourceDacpacRadioButton];
|
||||||
|
|
||||||
if (vscode.extensions.getExtension(loc.sqlDatabaseProjectExtensionId)) {
|
// TODO: re-add once database projects changes are checked in; chicken-and-egg problem (https://github.com/microsoft/azuredatastudio/pull/17738)
|
||||||
radioButtons.push(this.sourceProjectRadioButton);
|
// if (vscode.extensions.getExtension(loc.sqlDatabaseProjectExtensionId)) {
|
||||||
}
|
// radioButtons.push(this.sourceProjectRadioButton);
|
||||||
|
// }
|
||||||
|
|
||||||
let flexRadioButtonsModel = this.view.modelBuilder.flexContainer()
|
let flexRadioButtonsModel = this.view.modelBuilder.flexContainer()
|
||||||
.withLayout({ flexFlow: 'column' })
|
.withLayout({ flexFlow: 'column' })
|
||||||
@@ -556,26 +546,26 @@ export class SchemaCompareDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private createTargetRadioButtons(): azdata.FormComponent {
|
private createTargetRadioButtons(): azdata.FormComponent {
|
||||||
let dacpacRadioButton = this.view.modelBuilder.radioButton()
|
let targetDacpacRadioButton = this.view.modelBuilder.radioButton()
|
||||||
.withProps({
|
.withProps({
|
||||||
name: 'target',
|
name: 'target',
|
||||||
label: loc.DacpacRadioButtonLabel
|
label: loc.DacpacRadioButtonLabel
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
let databaseRadioButton = this.view.modelBuilder.radioButton()
|
let targetDatabaseRadioButton = this.view.modelBuilder.radioButton()
|
||||||
.withProps({
|
.withProps({
|
||||||
name: 'target',
|
name: 'target',
|
||||||
label: loc.DatabaseRadioButtonLabel
|
label: loc.DatabaseRadioButtonLabel
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
let projectRadioButton = this.view.modelBuilder.radioButton()
|
let targetProjectRadioButton = this.view.modelBuilder.radioButton()
|
||||||
.withProps({
|
.withProps({
|
||||||
name: 'target',
|
name: 'target',
|
||||||
label: loc.ProjectRadioButtonLabel
|
label: loc.ProjectRadioButtonLabel
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
// show dacpac file browser
|
// show dacpac file browser
|
||||||
dacpacRadioButton.onDidClick(async () => {
|
targetDacpacRadioButton.onDidClick(async () => {
|
||||||
this.targetEndpointType = mssql.SchemaCompareEndpointType.Dacpac;
|
this.targetEndpointType = mssql.SchemaCompareEndpointType.Dacpac;
|
||||||
this.targetTextBox.value = this.targetDacpacPath;
|
this.targetTextBox.value = this.targetDacpacPath;
|
||||||
this.formBuilder.removeFormItem(this.targetServerComponent);
|
this.formBuilder.removeFormItem(this.targetServerComponent);
|
||||||
@@ -587,7 +577,7 @@ export class SchemaCompareDialog {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// show server and db dropdowns
|
// show server and db dropdowns
|
||||||
databaseRadioButton.onDidClick(async () => {
|
targetDatabaseRadioButton.onDidClick(async () => {
|
||||||
this.targetEndpointType = mssql.SchemaCompareEndpointType.Database;
|
this.targetEndpointType = mssql.SchemaCompareEndpointType.Database;
|
||||||
this.formBuilder.removeFormItem(this.targetDacpacComponent);
|
this.formBuilder.removeFormItem(this.targetDacpacComponent);
|
||||||
this.formBuilder.removeFormItem(this.targetProjectFilePathComponent);
|
this.formBuilder.removeFormItem(this.targetProjectFilePathComponent);
|
||||||
@@ -599,7 +589,7 @@ export class SchemaCompareDialog {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// show project directory browser
|
// show project directory browser
|
||||||
projectRadioButton.onDidClick(async () => {
|
targetProjectRadioButton.onDidClick(async () => {
|
||||||
this.targetEndpointType = mssql.SchemaCompareEndpointType.Project;
|
this.targetEndpointType = mssql.SchemaCompareEndpointType.Project;
|
||||||
this.targetTextBox.value = this.targetProjectFilePath;
|
this.targetTextBox.value = this.targetProjectFilePath;
|
||||||
this.formBuilder.removeFormItem(this.targetServerComponent);
|
this.formBuilder.removeFormItem(this.targetServerComponent);
|
||||||
@@ -610,23 +600,27 @@ export class SchemaCompareDialog {
|
|||||||
this.dialog.okButton.enabled = await this.shouldEnableOkayButton();
|
this.dialog.okButton.enabled = await this.shouldEnableOkayButton();
|
||||||
});
|
});
|
||||||
|
|
||||||
// if target is currently a db, show it in the server and db dropdowns
|
|
||||||
if (this.schemaCompareMainWindow.targetEndpointInfo && this.schemaCompareMainWindow.targetEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Database) {
|
this.targetEndpointType = this.schemaCompareMainWindow.targetEndpointInfo?.endpointType ?? mssql.SchemaCompareEndpointType.Database; // default to database if no specific target is passed
|
||||||
databaseRadioButton.checked = true;
|
|
||||||
this.targetEndpointType = mssql.SchemaCompareEndpointType.Database;
|
switch (this.targetEndpointType) {
|
||||||
} else if (this.schemaCompareMainWindow.targetEndpointInfo && this.schemaCompareMainWindow.targetEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Dacpac) {
|
case mssql.SchemaCompareEndpointType.Dacpac:
|
||||||
dacpacRadioButton.checked = true;
|
targetDacpacRadioButton.checked = true;
|
||||||
this.targetEndpointType = mssql.SchemaCompareEndpointType.Dacpac;
|
break;
|
||||||
} else if (this.schemaCompareMainWindow.targetEndpointInfo) {
|
case mssql.SchemaCompareEndpointType.Project:
|
||||||
projectRadioButton.checked = true;
|
targetProjectRadioButton.checked = true;
|
||||||
this.targetEndpointType = mssql.SchemaCompareEndpointType.Project;
|
break;
|
||||||
|
case mssql.SchemaCompareEndpointType.Database:
|
||||||
|
targetDatabaseRadioButton.checked = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
let radioButtons = [databaseRadioButton, dacpacRadioButton];
|
let radioButtons = [targetDatabaseRadioButton, targetDacpacRadioButton];
|
||||||
|
|
||||||
if (vscode.extensions.getExtension(loc.sqlDatabaseProjectExtensionId)) {
|
// TODO: re-add once database projects changes are checked in; chicken-and-egg problem (https://github.com/microsoft/azuredatastudio/pull/17738)
|
||||||
radioButtons.push(projectRadioButton);
|
// if (vscode.extensions.getExtension(loc.sqlDatabaseProjectExtensionId)) {
|
||||||
}
|
// radioButtons.push(targetProjectRadioButton);
|
||||||
|
// }
|
||||||
|
|
||||||
let flexRadioButtonsModel = this.view.modelBuilder.flexContainer()
|
let flexRadioButtonsModel = this.view.modelBuilder.flexContainer()
|
||||||
.withLayout({ flexFlow: 'column' })
|
.withLayout({ flexFlow: 'column' })
|
||||||
|
|||||||
Reference in New Issue
Block a user