mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
add confirmation message to update project from db dialog (#18199)
This commit is contained in:
@@ -270,6 +270,7 @@ export const updateAction = localize('updateAction', "Update action");
|
|||||||
export const compareActionRadioButtonLabel = localize('compareActionRadiButtonLabel', "View changes in Schema Compare");
|
export const compareActionRadioButtonLabel = localize('compareActionRadiButtonLabel', "View changes in Schema Compare");
|
||||||
export const updateActionRadioButtonLabel = localize('updateActionRadiButtonLabel', "Apply all changes");
|
export const updateActionRadioButtonLabel = localize('updateActionRadiButtonLabel', "Apply all changes");
|
||||||
export const actionLabel = localize('actionLabel', "Action");
|
export const actionLabel = localize('actionLabel', "Action");
|
||||||
|
export const applyConfirmation: string = localize('applyConfirmation', "Are you sure you want to update the target project?");
|
||||||
|
|
||||||
// Update project from database
|
// Update project from database
|
||||||
|
|
||||||
|
|||||||
@@ -497,72 +497,74 @@ export class UpdateProjectFromDatabaseDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async handleUpdateButtonClick(): Promise<void> {
|
public async handleUpdateButtonClick(): Promise<void> {
|
||||||
const serverDropdownValue = this.serverDropdown!.value! as azdata.CategoryValue as ConnectionDropdownValue;
|
await vscode.window.showWarningMessage(constants.applyConfirmation, { modal: true }, constants.yesString).then(async (result) => {
|
||||||
const ownerUri = await getAzdataApi()!.connection.getUriForConnection(serverDropdownValue.connection.connectionId);
|
if (result === constants.yesString) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
getAzdataApi()!.window.closeDialog(this.dialog);
|
this.dispose();
|
||||||
await this.updateProjectFromDatabaseCallback!(model);
|
});
|
||||||
|
|
||||||
this.dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async validate(): Promise<boolean> {
|
async validate(): Promise<boolean> {
|
||||||
|
|||||||
Reference in New Issue
Block a user