mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
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:
@@ -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": [
|
||||
{
|
||||
|
||||
5
extensions/schema-compare/package.nls.json
Normal file
5
extensions/schema-compare/package.nls.json
Normal 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"
|
||||
}
|
||||
@@ -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 }[]> {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user