Skip to content
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

Make database configuration relative to the workspace root #255

Merged
merged 4 commits into from May 30, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -1,7 +1,7 @@
import { EXT_NAME } from '@sqltools/core/constants';
import { getConnectionId } from '@sqltools/core/utils';
import WebviewProvider from '@sqltools/plugins/connection-manager/screens/provider';
import { commands, ExtensionContext, Uri } from 'vscode';
import { commands, ExtensionContext, Uri, workspace } from 'vscode';
import path from 'path';

export default class SettingsWebview extends WebviewProvider {
@@ -28,6 +28,11 @@ export default class SettingsWebview extends WebviewProvider {

private updateConnection = async ({ connInfo, isGlobal, editId }) => {
console.log({ connInfo, isGlobal, editId });

if (connInfo.database) {
This conversation was marked as resolved by mitchellsimoens

This comment has been minimized.

Copy link
@mtxr

mtxr May 28, 2019

Owner

We need to check if connInfo.dialect is SQLite.

Adding this change, we are good to go! Thanks @mitchellsimoens !

connInfo.database = path.relative(workspace.rootPath, connInfo.database);
}

commands.executeCommand(`${EXT_NAME}.updateConnection`, editId, connInfo, isGlobal ? 'Global' : undefined)
.then(() => {
this.postMessage({ action: 'updateConnectionSuccess', payload: { isGlobal, connInfo: { ...connInfo, id: getConnectionId(connInfo) } } });
@@ -40,6 +45,10 @@ export default class SettingsWebview extends WebviewProvider {
}

private createConnection = async ({ connInfo, isGlobal }) => {
if (connInfo.database) {
connInfo.database = path.relative(workspace.rootPath, connInfo.database);
}

commands.executeCommand(`${EXT_NAME}.addConnection`, connInfo, isGlobal ? 'Global' : undefined)
.then(() => {
this.postMessage({ action: 'createConnectionSuccess', payload: { isGlobal, connInfo: { ...connInfo, id: getConnectionId(connInfo) } } });
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.