-
Notifications
You must be signed in to change notification settings - Fork 567
Add Schema Compare Controller Logic #18619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
cb30533
Set up schema compare page
lewis-sanchez 8d061b9
Localized strings
lewis-sanchez ac6c44b
Add schema compare contracts and endpoints
lewis-sanchez f64c1f9
Add schema compare icons
lewis-sanchez 6cd7f33
Use schema compare icon in webview.
lewis-sanchez 2fb9256
Add init logic for SC webview controller
lewis-sanchez 8d68dfb
Defines and registers reducers
lewis-sanchez c8ad560
Merge branch 'main' into lewissanchez/feat/schemaCompare
lewis-sanchez c526d32
Remove unwanted change
lewis-sanchez 2d4e878
Define and implement schame compare state provider
lewis-sanchez e9b1fb3
Fix controller init logic
lewis-sanchez 71dc730
Add SQL Projects schema compare entry point
lewis-sanchez 88f6be6
Get full SQL projects path
lewis-sanchez cdbc5dc
Setup controller for tests
lewis-sanchez e039089
Add basic test
lewis-sanchez 722f683
Add schema compare controller unit tests
lewis-sanchez 7666686
Add more tests for SchemaCompare controller tests
lewis-sanchez d396aa4
Add additional tests to verify results
lewis-sanchez eaff4b8
Code review changes
lewis-sanchez 4d68783
Add deployment options reducer
lewis-sanchez aa55223
Rename reducers to be less redundant
lewis-sanchez 187bc54
Add doc strings
lewis-sanchez ebc6f2d
Code review changes
lewis-sanchez 846e30a
Fix schema compare docstring
lewis-sanchez 5eff020
Minor clean up
lewis-sanchez 7876c42
Merge branch 'main' into lewissanchez/feat/schemaCompare
lewis-sanchez 005b9c6
Clean up pipelines
lewis-sanchez 094ad5b
Skip all tests for now
lewis-sanchez 7992641
Add vscodeWrapper to controller
lewis-sanchez a287782
Bring back tests
lewis-sanchez d6620c4
Bring back all other tests
lewis-sanchez ff80374
Set operationId in controller
lewis-sanchez d226cab
Code review changes
lewis-sanchez 060382e
Consolidate unit tests
lewis-sanchez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| export const SchemaComparePage = () => { | ||
| return ( | ||
| <div> | ||
| {/* WIP/Initial Checkin: Page is a work in progress */} | ||
| <h1>Schema Compare Page</h1> | ||
lewis-sanchez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </div> | ||
| ); | ||
| }; | ||
131 changes: 131 additions & 0 deletions
131
src/reactviews/pages/SchemaCompare/SchemaCompareStateProvider.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| import * as sc from "../../../sharedInterfaces/schemaCompare"; | ||
| import * as mssql from "vscode-mssql"; | ||
|
|
||
| import { createContext } from "react"; | ||
| import { useVscodeWebview } from "../../common/vscodeWebviewProvider"; | ||
|
|
||
| const schemaCompareContext = createContext<sc.SchemaCompareContextProps>( | ||
| {} as sc.SchemaCompareContextProps, | ||
| ); | ||
|
|
||
| interface SchemaCompareStateProviderProps { | ||
| children: React.ReactNode; | ||
| } | ||
|
|
||
| const SchemaCompareStateProvider: React.FC<SchemaCompareStateProviderProps> = ({ | ||
| children, | ||
| }) => { | ||
| const webViewState = useVscodeWebview< | ||
| sc.SchemaCompareWebViewState, | ||
| sc.SchemaCompareReducers | ||
| >(); | ||
| const schemaCompareState = webViewState?.state; | ||
|
|
||
| return ( | ||
| <schemaCompareContext.Provider | ||
| value={{ | ||
| state: schemaCompareState, | ||
| themeKind: webViewState?.themeKind, | ||
| compare: function ( | ||
| sourceEndpointInfo: mssql.SchemaCompareEndpointInfo, | ||
| targetEndpointInfo: mssql.SchemaCompareEndpointInfo, | ||
| taskExecutionMode: mssql.TaskExecutionMode, | ||
| deploymentOptions: mssql.DeploymentOptions, | ||
| ): void { | ||
| webViewState?.extensionRpc.action("compare", { | ||
| sourceEndpointInfo: sourceEndpointInfo, | ||
| targetEndpointInfo: targetEndpointInfo, | ||
| taskExecutionMode: taskExecutionMode, | ||
| deploymentOptions: deploymentOptions, | ||
| }); | ||
| }, | ||
| generateScript: function ( | ||
| targetServerName: string, | ||
| targetDatabaseName: string, | ||
| taskExecutionMode: mssql.TaskExecutionMode, | ||
| ): void { | ||
| webViewState?.extensionRpc.action("generateScript", { | ||
| targetServerName: targetServerName, | ||
| targetDatabaseName: targetDatabaseName, | ||
| taskExecutionMode: taskExecutionMode, | ||
| }); | ||
| }, | ||
| publishDatabaseChanges: function ( | ||
| targetServerName: string, | ||
| targetDatabaseName: string, | ||
| taskExecutionMode: mssql.TaskExecutionMode, | ||
| ): void { | ||
| webViewState?.extensionRpc.action( | ||
| "publishDatabaseChanges", | ||
| { | ||
| targetServerName: targetServerName, | ||
| targetDatabaseName: targetDatabaseName, | ||
| taskExecutionMode: taskExecutionMode, | ||
| }, | ||
| ); | ||
| }, | ||
| publishProjectChanges: function ( | ||
| targetProjectPath: string, | ||
| targetFolderStructure: mssql.ExtractTarget, | ||
| taskExecutionMode: mssql.TaskExecutionMode, | ||
| ): void { | ||
| webViewState?.extensionRpc.action("publishProjectChanges", { | ||
| targetProjectPath: targetProjectPath, | ||
| targetFolderStructure: targetFolderStructure, | ||
| taskExecutionMode: taskExecutionMode, | ||
| }); | ||
| }, | ||
| getDefaultOptions: function (): void { | ||
| webViewState?.extensionRpc.action("getDefaultOptions", {}); | ||
| }, | ||
| includeExcludeNode: function ( | ||
| diffEntry: mssql.DiffEntry, | ||
| includeRequest: boolean, | ||
| taskExecutionMode: mssql.TaskExecutionMode, | ||
| ): void { | ||
| webViewState?.extensionRpc.action("includeExcludeNode", { | ||
| diffEntry: diffEntry, | ||
| includeRequest: includeRequest, | ||
| taskExecutionMode: taskExecutionMode, | ||
| }); | ||
| }, | ||
| openScmp: function (filePath: string): void { | ||
| webViewState?.extensionRpc.action("openScmp", { | ||
| filePath: filePath, | ||
| }); | ||
| }, | ||
| saveScmp: function ( | ||
| sourceEndpointInfo: mssql.SchemaCompareEndpointInfo, | ||
| targetEndpointInfo: mssql.SchemaCompareEndpointInfo, | ||
| taskExecutionMode: mssql.TaskExecutionMode, | ||
| deploymentOptions: mssql.DeploymentOptions, | ||
| scmpFilePath: string, | ||
| excludedSourceObjects: mssql.SchemaCompareObjectId[], | ||
| excludedTargetObjects: mssql.SchemaCompareObjectId[], | ||
| ): void { | ||
| webViewState?.extensionRpc.action("saveScmp", { | ||
| sourceEndpointInfo: sourceEndpointInfo, | ||
| targetEndpointInfo: targetEndpointInfo, | ||
| taskExecutionMode: taskExecutionMode, | ||
| deploymentOptions: deploymentOptions, | ||
| scmpFilePath: scmpFilePath, | ||
| excludedSourceObjects: excludedSourceObjects, | ||
| excludedTargetObjects: excludedTargetObjects, | ||
| }); | ||
| }, | ||
| cancel: function (): void { | ||
| webViewState?.extensionRpc.action("cancel", {}); | ||
| }, | ||
| }} | ||
| > | ||
| {children} | ||
| </schemaCompareContext.Provider> | ||
| ); | ||
| }; | ||
|
|
||
| export { SchemaCompareStateProvider }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| import ReactDOM from "react-dom/client"; | ||
| import "../../index.css"; | ||
| import { VscodeWebviewProvider } from "../../common/vscodeWebviewProvider"; | ||
| import { SchemaComparePage } from "./SchemaCompare"; | ||
| import { SchemaCompareStateProvider } from "./SchemaCompareStateProvider"; | ||
|
|
||
| ReactDOM.createRoot(document.getElementById("root")!).render( | ||
| <VscodeWebviewProvider> | ||
| <SchemaCompareStateProvider> | ||
| <SchemaComparePage /> | ||
| </SchemaCompareStateProvider> | ||
| </VscodeWebviewProvider>, | ||
| ); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.