mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Benjin/project update bug (#18532)
* correct result.success * shifting success message to actually check success * keying on errorMessage rather than success
This commit is contained in:
@@ -898,8 +898,7 @@ export class SchemaCompareMainWindow {
|
|||||||
throw new Error(`Unsupported SchemaCompareEndpointType: ${getSchemaCompareEndpointString(this.targetEndpointInfo.endpointType)}`);
|
throw new Error(`Unsupported SchemaCompareEndpointType: ${getSchemaCompareEndpointString(this.targetEndpointInfo.endpointType)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result || !result.success) {
|
if (!result || !result.success || result.errorMessage !== '') {
|
||||||
|
|
||||||
TelemetryReporter.createErrorEvent(TelemetryViews.SchemaCompareMainWindow, 'SchemaCompareApplyFailed', undefined, getTelemetryErrorType(result?.errorMessage))
|
TelemetryReporter.createErrorEvent(TelemetryViews.SchemaCompareMainWindow, 'SchemaCompareApplyFailed', undefined, getTelemetryErrorType(result?.errorMessage))
|
||||||
.withAdditionalProperties({
|
.withAdditionalProperties({
|
||||||
'operationId': this.comparisonResult.operationId,
|
'operationId': this.comparisonResult.operationId,
|
||||||
@@ -912,6 +911,11 @@ export class SchemaCompareMainWindow {
|
|||||||
this.generateScriptButton.title = loc.generateScriptEnabledMessage;
|
this.generateScriptButton.title = loc.generateScriptEnabledMessage;
|
||||||
this.applyButton.enabled = true;
|
this.applyButton.enabled = true;
|
||||||
this.applyButton.title = loc.applyEnabledMessage;
|
this.applyButton.title = loc.applyEnabledMessage;
|
||||||
|
} else if (this.targetEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Project) {
|
||||||
|
const workspaceApi = getDataWorkspaceExtensionApi();
|
||||||
|
workspaceApi.showProjectsView();
|
||||||
|
|
||||||
|
void vscode.window.showInformationMessage(loc.applySuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
TelemetryReporter.createActionEvent(TelemetryViews.SchemaCompareMainWindow, 'SchemaCompareApplyEnded')
|
TelemetryReporter.createActionEvent(TelemetryViews.SchemaCompareMainWindow, 'SchemaCompareApplyEnded')
|
||||||
@@ -920,13 +924,6 @@ export class SchemaCompareMainWindow {
|
|||||||
'operationId': this.comparisonResult.operationId,
|
'operationId': this.comparisonResult.operationId,
|
||||||
'targetType': getSchemaCompareEndpointString(this.targetEndpointInfo.endpointType)
|
'targetType': getSchemaCompareEndpointString(this.targetEndpointInfo.endpointType)
|
||||||
}).send();
|
}).send();
|
||||||
|
|
||||||
if (this.targetEndpointInfo.endpointType === mssql.SchemaCompareEndpointType.Project) {
|
|
||||||
const workspaceApi = getDataWorkspaceExtensionApi();
|
|
||||||
workspaceApi.showProjectsView();
|
|
||||||
|
|
||||||
void vscode.window.showInformationMessage(loc.applySuccess);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -534,21 +534,23 @@ export class ProjectsController {
|
|||||||
|
|
||||||
const result: mssql.SchemaComparePublishProjectResult = await service.schemaComparePublishProjectChanges(operationId, projectPath, fs, utils.getAzdataApi()!.TaskExecutionMode.execute);
|
const result: mssql.SchemaComparePublishProjectResult = await service.schemaComparePublishProjectChanges(operationId, projectPath, fs, utils.getAzdataApi()!.TaskExecutionMode.execute);
|
||||||
|
|
||||||
const project = await Project.openProject(projectFilePath);
|
if (result.errorMessage === '') {
|
||||||
|
const project = await Project.openProject(projectFilePath);
|
||||||
|
|
||||||
let toAdd: vscode.Uri[] = [];
|
let toAdd: vscode.Uri[] = [];
|
||||||
result.addedFiles.forEach((f: any) => toAdd.push(vscode.Uri.file(f)));
|
result.addedFiles.forEach((f: any) => toAdd.push(vscode.Uri.file(f)));
|
||||||
await project.addToProject(toAdd);
|
await project.addToProject(toAdd);
|
||||||
|
|
||||||
let toRemove: vscode.Uri[] = [];
|
let toRemove: vscode.Uri[] = [];
|
||||||
result.deletedFiles.forEach((f: any) => toRemove.push(vscode.Uri.file(f)));
|
result.deletedFiles.forEach((f: any) => toRemove.push(vscode.Uri.file(f)));
|
||||||
|
|
||||||
let toRemoveEntries: FileProjectEntry[] = [];
|
let toRemoveEntries: FileProjectEntry[] = [];
|
||||||
toRemove.forEach(f => toRemoveEntries.push(new FileProjectEntry(f, f.path.replace(projectPath + '\\', ''), EntryType.File)));
|
toRemove.forEach(f => toRemoveEntries.push(new FileProjectEntry(f, f.path.replace(projectPath + '\\', ''), EntryType.File)));
|
||||||
|
|
||||||
toRemoveEntries.forEach(async f => await project.exclude(f));
|
toRemoveEntries.forEach(async f => await project.exclude(f));
|
||||||
|
|
||||||
await this.buildProject(project);
|
await this.buildProject(project);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user