only show confirmation message for apply all changes, not for view changes in schema compare (#18520)

This commit is contained in:
Kim Santiago
2022-02-22 13:33:24 -08:00
committed by GitHub
parent 5547c2baba
commit 7b92c9eb65
2 changed files with 71 additions and 71 deletions

View File

@@ -1382,17 +1382,21 @@ export class ProjectsController {
if (model.action === UpdateProjectAction.Compare) { if (model.action === UpdateProjectAction.Compare) {
await vscode.commands.executeCommand(constants.schemaCompareRunComparisonCommand, model.sourceEndpointInfo, model.targetEndpointInfo, true, undefined); await vscode.commands.executeCommand(constants.schemaCompareRunComparisonCommand, model.sourceEndpointInfo, model.targetEndpointInfo, true, undefined);
} else if (model.action === UpdateProjectAction.Update) { } else if (model.action === UpdateProjectAction.Update) {
await vscode.window.withProgress( await vscode.window.showWarningMessage(constants.applyConfirmation, { modal: true }, constants.yesString).then(async (result) => {
{ if (result === constants.yesString) {
location: vscode.ProgressLocation.Notification, await vscode.window.withProgress(
title: constants.updatingProjectFromDatabase(path.basename(model.targetEndpointInfo.projectFilePath), model.sourceEndpointInfo.databaseName), {
cancellable: false location: vscode.ProgressLocation.Notification,
}, async (_progress, _token) => { title: constants.updatingProjectFromDatabase(path.basename(model.targetEndpointInfo.projectFilePath), model.sourceEndpointInfo.databaseName),
return this.schemaCompareAndUpdateProject(model.sourceEndpointInfo, model.targetEndpointInfo); cancellable: false
}); }, async (_progress, _token) => {
return this.schemaCompareAndUpdateProject(model.sourceEndpointInfo, model.targetEndpointInfo);
});
void vscode.commands.executeCommand(constants.refreshDataWorkspaceCommand); void vscode.commands.executeCommand(constants.refreshDataWorkspaceCommand);
utils.getDataWorkspaceExtensionApi().showProjectsView(); utils.getDataWorkspaceExtensionApi().showProjectsView();
}
});
} else { } else {
throw new Error(`Unknown UpdateProjectAction: ${model.action}`); throw new Error(`Unknown UpdateProjectAction: ${model.action}`);
} }

View File

@@ -497,74 +497,70 @@ export class UpdateProjectFromDatabaseDialog {
} }
public async handleUpdateButtonClick(): Promise<void> { public async handleUpdateButtonClick(): Promise<void> {
await vscode.window.showWarningMessage(constants.applyConfirmation, { modal: true }, constants.yesString).then(async (result) => { const serverDropdownValue = this.serverDropdown!.value! as azdata.CategoryValue as ConnectionDropdownValue;
if (result === constants.yesString) { const ownerUri = await getAzdataApi()!.connection.getUriForConnection(serverDropdownValue.connection.connectionId);
const serverDropdownValue = this.serverDropdown!.value! as azdata.CategoryValue as ConnectionDropdownValue;
const ownerUri = await getAzdataApi()!.connection.getUriForConnection(serverDropdownValue.connection.connectionId);
let connection = (await getAzdataApi()!.connection.getConnections(true)).filter(con => con.connectionId === serverDropdownValue.connection.connectionId)[0]; let connection = (await getAzdataApi()!.connection.getConnections(true)).filter(con => con.connectionId === serverDropdownValue.connection.connectionId)[0];
connection.databaseName = this.databaseDropdown!.value! as string; connection.databaseName = this.databaseDropdown!.value! as string;
const credentials = await getAzdataApi()!.connection.getCredentials(connection.connectionId); const credentials = await getAzdataApi()!.connection.getCredentials(connection.connectionId);
if (credentials.hasOwnProperty('password')) { if (credentials.hasOwnProperty('password')) {
connection.password = connection.options.password = credentials.password; connection.password = connection.options.password = credentials.password;
} }
const connectionDetails: azdata.IConnectionProfile = { const connectionDetails: azdata.IConnectionProfile = {
id: connection.connectionId, id: connection.connectionId,
userName: connection.userName, userName: connection.userName,
password: connection.password, password: connection.password,
serverName: connection.serverName, serverName: connection.serverName,
databaseName: connection.databaseName, databaseName: connection.databaseName,
connectionName: connection.connectionName, connectionName: connection.connectionName,
providerName: connection.providerId, providerName: connection.providerId,
groupId: connection.groupId, groupId: connection.groupId,
groupFullName: connection.groupFullName, groupFullName: connection.groupFullName,
authenticationType: connection.authenticationType, authenticationType: connection.authenticationType,
savePassword: connection.savePassword, savePassword: connection.savePassword,
saveProfile: connection.saveProfile, saveProfile: connection.saveProfile,
options: connection.options, options: connection.options,
}; };
const sourceEndpointInfo: mssql.SchemaCompareEndpointInfo = { const sourceEndpointInfo: mssql.SchemaCompareEndpointInfo = {
endpointType: mssql.SchemaCompareEndpointType.Database, endpointType: mssql.SchemaCompareEndpointType.Database,
databaseName: this.databaseDropdown!.value! as string, databaseName: this.databaseDropdown!.value! as string,
serverDisplayName: serverDropdownValue.displayName, serverDisplayName: serverDropdownValue.displayName,
serverName: serverDropdownValue.name!, serverName: serverDropdownValue.name!,
connectionDetails: connectionDetails, connectionDetails: connectionDetails,
ownerUri: ownerUri, ownerUri: ownerUri,
projectFilePath: '', projectFilePath: '',
folderStructure: '', folderStructure: '',
targetScripts: [], targetScripts: [],
dataSchemaProvider: '', dataSchemaProvider: '',
packageFilePath: '', packageFilePath: '',
connectionName: serverDropdownValue.connection.options.connectionName connectionName: serverDropdownValue.connection.options.connectionName
}; };
const targetEndpointInfo: mssql.SchemaCompareEndpointInfo = { const targetEndpointInfo: mssql.SchemaCompareEndpointInfo = {
endpointType: mssql.SchemaCompareEndpointType.Project, endpointType: mssql.SchemaCompareEndpointType.Project,
projectFilePath: this.projectFileTextBox!.value!, projectFilePath: this.projectFileTextBox!.value!,
folderStructure: this.folderStructureDropDown!.value as string, folderStructure: this.folderStructureDropDown!.value as string,
targetScripts: [], targetScripts: [],
dataSchemaProvider: '', dataSchemaProvider: '',
connectionDetails: connectionDetails, connectionDetails: connectionDetails,
databaseName: '', databaseName: '',
serverDisplayName: '', serverDisplayName: '',
serverName: '', serverName: '',
ownerUri: '', ownerUri: '',
packageFilePath: '', packageFilePath: '',
}; };
const model: UpdateProjectDataModel = { const model: UpdateProjectDataModel = {
sourceEndpointInfo: sourceEndpointInfo, sourceEndpointInfo: sourceEndpointInfo,
targetEndpointInfo: targetEndpointInfo, targetEndpointInfo: targetEndpointInfo,
action: this.action! action: this.action!
}; };
void this.updateProjectFromDatabaseCallback!(model);
}
this.dispose(); void this.updateProjectFromDatabaseCallback!(model);
}); this.dispose();
} }
async validate(): Promise<boolean> { async validate(): Promise<boolean> {