Add connection info to title (#1645)

* add connection info to the file label

* formatting

* first attempt at title shortening

* add user to title shortening

* add settings to control connection info in title

* formatting

* move setting
This commit is contained in:
Anthony Dresser
2018-06-29 17:04:09 -07:00
committed by GitHub
parent 4bd63b615b
commit 2d80d5e611
6 changed files with 99 additions and 50 deletions

View File

@@ -17,10 +17,10 @@ import URI from 'vs/base/common/uri';
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
import { QueryInput } from 'sql/parts/query/common/queryInput';
suite('TaskUtilities', function() {
suite('TaskUtilities', function () {
test('getCurrentGlobalConnection returns the selected OE server if a server or one of its children is selected', () => {
let connectionProfile = { databaseName: 'test_database', id: 'test_id', authenticationType: 'SQL Login', password: 'test_password', serverName: 'test_server', userName: 'test_user' } as IConnectionProfile;
let mockObjectExplorerService = TypeMoq.Mock.ofInstance({isFocused: () => undefined, getSelectedProfileAndDatabase: () => undefined } as IObjectExplorerService);
let mockObjectExplorerService = TypeMoq.Mock.ofInstance({ isFocused: () => undefined, getSelectedProfileAndDatabase: () => undefined } as IObjectExplorerService);
let mockConnectionManagementService = TypeMoq.Mock.ofType(TestConnectionManagementService);
let mockWorkbenchEditorService = TypeMoq.Mock.ofType(WorkbenchEditorTestService);
let expectedProfile = new ConnectionProfile(undefined, connectionProfile);
@@ -38,7 +38,7 @@ suite('TaskUtilities', function() {
test('getCurrentGlobalConnection returns the selected OE database if a database or its children is selected', () => {
let connectionProfile = { databaseName: 'test_database', id: 'test_id', authenticationType: 'SQL Login', password: 'test_password', serverName: 'test_server', userName: 'test_user' } as IConnectionProfile;
let mockObjectExplorerService = TypeMoq.Mock.ofInstance({isFocused: () => undefined, getSelectedProfileAndDatabase: () => undefined } as IObjectExplorerService);
let mockObjectExplorerService = TypeMoq.Mock.ofInstance({ isFocused: () => undefined, getSelectedProfileAndDatabase: () => undefined } as IObjectExplorerService);
let mockConnectionManagementService = TypeMoq.Mock.ofType(TestConnectionManagementService);
let mockWorkbenchEditorService = TypeMoq.Mock.ofType(WorkbenchEditorTestService);
let serverProfile = new ConnectionProfile(undefined, connectionProfile);
@@ -63,7 +63,7 @@ suite('TaskUtilities', function() {
test('getCurrentGlobalConnection returns the connection from the active tab, if there is one and OE is not focused', () => {
let connectionProfile = { databaseName: 'test_database', id: 'test_id', authenticationType: 'SQL Login', password: 'test_password', serverName: 'test_server', userName: 'test_user' } as IConnectionProfile;
let mockObjectExplorerService = TypeMoq.Mock.ofInstance({isFocused: () => undefined, getSelectedProfileAndDatabase: () => undefined } as IObjectExplorerService);
let mockObjectExplorerService = TypeMoq.Mock.ofInstance({ isFocused: () => undefined, getSelectedProfileAndDatabase: () => undefined } as IObjectExplorerService);
let mockConnectionManagementService = TypeMoq.Mock.ofType(TestConnectionManagementService);
let mockWorkbenchEditorService = TypeMoq.Mock.ofType(WorkbenchEditorTestService);
let oeProfile = new ConnectionProfile(undefined, connectionProfile);
@@ -80,7 +80,7 @@ suite('TaskUtilities', function() {
// Mock the workbench service to return the active tab connection
let tabConnectionUri = 'test_uri';
let editorInput = new UntitledEditorInput(URI.parse(tabConnectionUri), false, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
let queryInput = new QueryInput(undefined, undefined, editorInput, undefined, undefined, undefined, undefined, undefined);
let queryInput = new QueryInput(undefined, editorInput, undefined, undefined, undefined, undefined, undefined, undefined);
mockWorkbenchEditorService.setup(x => x.getActiveEditorInput()).returns(() => queryInput);
mockConnectionManagementService.setup(x => x.getConnectionProfile(tabConnectionUri)).returns(() => tabProfile);
@@ -95,7 +95,7 @@ suite('TaskUtilities', function() {
test('getCurrentGlobalConnection returns the connection from OE if there is no active tab, even if OE is not focused', () => {
let connectionProfile = { databaseName: 'test_database', id: 'test_id', authenticationType: 'SQL Login', password: 'test_password', serverName: 'test_server', userName: 'test_user' } as IConnectionProfile;
let mockObjectExplorerService = TypeMoq.Mock.ofInstance({isFocused: () => undefined, getSelectedProfileAndDatabase: () => undefined } as IObjectExplorerService);
let mockObjectExplorerService = TypeMoq.Mock.ofInstance({ isFocused: () => undefined, getSelectedProfileAndDatabase: () => undefined } as IObjectExplorerService);
let mockConnectionManagementService = TypeMoq.Mock.ofType(TestConnectionManagementService);
let mockWorkbenchEditorService = TypeMoq.Mock.ofType(WorkbenchEditorTestService);
let oeProfile = new ConnectionProfile(undefined, connectionProfile);