Schema compare Icon and other fixes (#6009)

* Changes to 1. Enable Icon for Schema Compare model view editor 2. Set context setting in editable drop down 3. Fix a console error

* new icons

* Changes as per PR comments

* Adding PR comments

* Fixing a spelling mistake
This commit is contained in:
udeeshagautam
2019-06-14 13:28:46 -07:00
committed by GitHub
parent 363af2a85c
commit f494c7af4e
12 changed files with 109 additions and 24 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "schema-compare",
"displayName": "SQL Server Schema Compare",
"description": "SQL Server Schema Compare for Azure Data Studio supports comparing the schemas of databases and dacpacs.",
"displayName": "%displayName%",
"description": "%description%",
"version": "0.3.0",
"publisher": "Microsoft",
"preview": true,
@@ -27,13 +27,27 @@
"commands": [
{
"command": "schemaCompare.start",
"title": "Schema Compare",
"title": "%schemaCompare.start%",
"icon": {
"light": "./images/light_icon.svg",
"dark": "./images/dark_icon.svg"
}
}
],
"languages": [
{
"id": "scmp",
"filenames": [
"Schema Compare"
],
"extensions": [
".scmp"
],
"aliases": [
"scmp"
]
}
],
"menus": {
"objectExplorer/item/context": [
{

View File

@@ -0,0 +1,5 @@
{
"displayName": "SQL Server Schema Compare",
"description": "SQL Server Schema Compare for Azure Data Studio supports comparing the schemas of databases and dacpacs.",
"schemaCompare.start": "Schema Compare"
}

View File

@@ -421,7 +421,8 @@ export class SchemaCompareDialog {
this.sourceServerDropdown.onValueChanged(async (value) => {
if (this.sourceServerDropdown.values.findIndex(x => this.matchesValue(x, value)) === -1) {
this.sourceDatabaseDropdown.updateProperties({
values: []
values: [],
value: ' '
});
}
else {
@@ -445,7 +446,8 @@ export class SchemaCompareDialog {
this.targetServerDropdown.onValueChanged(async (value) => {
if (this.targetServerDropdown.values.findIndex(x => this.matchesValue(x, value)) === -1) {
this.targetDatabaseDropdown.updateProperties({
values: []
values: [],
value: ' '
});
}
else {
@@ -463,9 +465,12 @@ export class SchemaCompareDialog {
let currentDropdown = isTarget ? this.targetServerDropdown : this.sourceServerDropdown;
let values = await this.getServerValues();
currentDropdown.updateProperties({
values: values
});
if (values && values.length > 0) {
currentDropdown.updateProperties({
values: values,
value: values[0]
});
}
}
protected async getServerValues(): Promise<{ connection: azdata.connection.Connection, displayName: string, name: string }[]> {
@@ -562,12 +567,15 @@ export class SchemaCompareDialog {
protected async populateDatabaseDropdown(connectionId: string, isTarget: boolean): Promise<void> {
let currentDropdown = isTarget ? this.targetDatabaseDropdown : this.sourceDatabaseDropdown;
currentDropdown.updateProperties({ values: [] });
currentDropdown.updateProperties({ values: [], value: null });
let values = await this.getDatabaseValues(connectionId);
currentDropdown.updateProperties({
values: values
});
if (values && values.length > 0) {
currentDropdown.updateProperties({
values: values,
value: values[0],
});
}
}
protected async getDatabaseValues(connectionId: string): Promise<{ displayName, name }[]> {

View File

@@ -19,6 +19,10 @@ const generateScriptEnabledMessage = localize('schemaCompare.generateScriptEnabl
const generateScriptNoChangesMessage = localize('schemaCompare.generateScriptNoChanges', 'No changes to script');
const applyEnabledMessage = localize('schemaCompare.applyButtonEnabledTitle', 'Apply changes to target');
const applyNoChangesMessage = localize('schemaCompare.applyNoChanges', 'No changes to apply');
// Do not localize this, this is used to decide the icon for the editor.
// TODO : In future icon should be decided based on language id (scmp) and not resource name
const schemaCompareResourceName = 'Schema Compare';
export class SchemaCompareResult {
private differencesTable: azdata.TableComponent;
@@ -53,7 +57,7 @@ export class SchemaCompareResult {
this.SchemaCompareActionMap[azdata.SchemaUpdateAction.Change] = localize('schemaCompare.changeAction', 'Change');
this.SchemaCompareActionMap[azdata.SchemaUpdateAction.Add] = localize('schemaCompare.addAction', 'Add');
this.editor = azdata.workspace.createModelViewEditor(localize('schemaCompare.Title', 'Schema Compare'), { retainContextWhenHidden: true, supportsSave: true });
this.editor = azdata.workspace.createModelViewEditor(localize('schemaCompare.Title', 'Schema Compare'), { retainContextWhenHidden: true, supportsSave: true, resourceName: schemaCompareResourceName });
this.GetDefaultDeploymentOptions();
this.editor.registerContent(async view => {
@@ -178,10 +182,15 @@ export class SchemaCompareResult {
}
// only for test
public getComparisionResult(): azdata.SchemaCompareResult {
public getComparisonResult(): azdata.SchemaCompareResult {
return this.comparisonResult;
}
// only for test
public getDeploymentOptions(): azdata.DeploymentOptions {
return this.deploymentOptions;
}
public async execute(): Promise<void> {
if (this.schemaCompareOptionDialog && this.schemaCompareOptionDialog.deploymentOptions) {
// take updates if any

View File

@@ -69,10 +69,10 @@ describe('SchemaCompareResult.start', function(): void {
await promise;
await result.start();
should(result.getComparisionResult() === undefined);
should(result.getComparisonResult() === undefined);
await result.execute();
should(result.getComparisionResult() !== undefined);
should(result.getComparisionResult().operationId !== undefined);
should(result.getComparisonResult() !== undefined);
should(result.getComparisonResult().operationId !== undefined);
});
});