Skip to content

Commit

Permalink
fixed labels for node
Browse files Browse the repository at this point in the history
  • Loading branch information
abist committed Jan 22, 2020
1 parent aa4fbfe commit 2203991
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
9 changes: 7 additions & 2 deletions src/queryHistory/queryHistoryProvider.ts
Expand Up @@ -188,8 +188,13 @@ export class QueryHistoryProvider implements vscode.TreeDataProvider<any> {
* Creates a connection label based on credentials
*/
private getConnectionLabel(ownerUri: string): string {
let connInfo = this._connectionManager.getConnectionInfo(ownerUri);
return `(${connInfo.credentials.server}|${connInfo.credentials.database})`;
const connInfo = this._connectionManager.getConnectionInfo(ownerUri);
const credentials = connInfo.credentials;
let connString = `(${credentials.server}|${credentials.database})`;
if (credentials.authenticationType === Constants.sqlAuthentication) {
connString = `${connString} : ${credentials.user}`;
}
return connString;
}

/**
Expand Down
11 changes: 6 additions & 5 deletions src/views/queryHistoryUI.ts
Expand Up @@ -14,12 +14,13 @@ import * as LocalizedConstants from '../constants/localizedConstants';
export enum QueryHistoryAction {
OpenQueryHistoryAction = 1,
RunQueryHistoryAction = 2
};
}

// tslint:disable-next-line: interface-name
export interface QueryHistoryQuickPickItem extends vscode.QuickPickItem {
node: QueryHistoryNode;
action: any;
};
}

export class QueryHistoryUI {

Expand All @@ -31,7 +32,7 @@ export class QueryHistoryUI {
public convertToQuickPickItem(node: vscode.TreeItem): QueryHistoryQuickPickItem {
let historyNode = node as QueryHistoryNode;
let quickPickItem: QueryHistoryQuickPickItem = {
label: QueryHistoryProvider.limitStringSize(historyNode.queryString, true),
label: QueryHistoryProvider.limitStringSize(historyNode.queryString, true).trim(),
detail: `${historyNode.connectionLabel}, ${historyNode.timeStamp.toLocaleString()}`,
node: historyNode,
action: undefined,
Expand Down Expand Up @@ -76,10 +77,10 @@ export class QueryHistoryUI {
answer.action = QueryHistoryAction.RunQueryHistoryAction;
}
return answer;
})
});
}
return undefined;
});
}

}
}

0 comments on commit 2203991

Please sign in to comment.