Skip to content

Commit

Permalink
Merge branch 'master' into queryFocus
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya Bist committed Dec 12, 2019
2 parents f74c0ef + 44f17e8 commit 3e14e25
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 33 deletions.
6 changes: 0 additions & 6 deletions localization/xliff/enu/constants/localizedConstants.enu.xlf
Expand Up @@ -236,9 +236,6 @@
<trans-unit id="msgPromptRetryFirewallRuleNotSignedIn">
<source xml:lang="en">Your client IP address does not have access to the server. Sign in to an Azure account and create a new firewall rule to enable access.</source>
</trans-unit>
<trans-unit id="msgPromptRetryFirewallRuleNotActivated">
<source xml:lang="en">Your client IP address does not have access to the server. Activate the Azure Account extension and sign in to an Azure account and create a new firewall rule to enable access.</source>
</trans-unit>
<trans-unit id="msgPromptRetryFirewallRuleSignedIn">
<source xml:lang="en">Account signed In. Create new firewall rule? </source>
</trans-unit>
Expand Down Expand Up @@ -266,9 +263,6 @@
<trans-unit id="downloadAndInstallLabel">
<source xml:lang="en">Download and Install</source>
</trans-unit>
<trans-unit id="activateLabel">
<source xml:lang="en">Activate</source>
</trans-unit>
<trans-unit id="createFirewallRuleLabel">
<source xml:lang="en">Create Firewall Rule</source>
</trans-unit>
Expand Down
14 changes: 7 additions & 7 deletions package.json
Expand Up @@ -203,17 +203,17 @@
{
"command": "mssql.removeObjectExplorerNode",
"when": "view == objectExplorer && viewItem =~ /^(disconnectedServer|Server)$/",
"group": "MS_SQL@3"
"group": "MS_SQL@4"
},
{
"command": "mssql.refreshObjectExplorerNode",
"when": "view == objectExplorer && viewItem != disconnectedServer",
"group": "MS_SQL@2"
"group": "MS_SQL@10"
},
{
"command": "mssql.disconnectObjectExplorerNode",
"when": "view == objectExplorer && viewItem == Server",
"group": "MS_SQL@4"
"group": "MS_SQL@3"
},
{
"command": "mssql.scriptSelect",
Expand All @@ -223,22 +223,22 @@
{
"command": "mssql.scriptCreate",
"when": "view == objectExplorer && viewItem =~ /^(Table|View|AggregateFunction|PartitionFunction|ScalarValuedFunction|Schema|StoredProcedure|TableValuedFunction|User|UserDefinedTableType)$/",
"group": "MS_SQL@1"
"group": "MS_SQL@2"
},
{
"command": "mssql.scriptDelete",
"when": "view == objectExplorer && viewItem =~ /^(Table|View|AggregateFunction|PartitionFunction|ScalarValuedFunction|Schema|StoredProcedure|TableValuedFunction|User|UserDefinedTableType)$/",
"group": "MS_SQL@1"
"group": "MS_SQL@3"
},
{
"command": "mssql.scriptExecute",
"when": "view == objectExplorer && viewItem =~ /^(StoredProcedure)$/",
"group": "MS_SQL@1"
"group": "MS_SQL@5"
},
{
"command": "mssql.scriptAlter",
"when": "view == objectExplorer && viewItem =~ /^(AggregateFunction|PartitionFunction|ScalarValuedFunction|StoredProcedure|TableValuedFunction|View)$/",
"group": "MS_SQL@1"
"group": "MS_SQL@4"
}
],
"commandPalette": [
Expand Down
11 changes: 10 additions & 1 deletion src/controllers/queryRunner.ts
Expand Up @@ -415,9 +415,18 @@ export default class QueryRunner {
for (let rowId of allRowIds) {
let row = rowIdToRowMap.get(rowId);
const rowSelections = rowIdToSelectionMap.get(rowId);

// sort selections by column to go from left to right
rowSelections.sort((a, b) => {
return ((a.fromCell < b.fromCell) ? -1 : (a.fromCell > b.fromCell) ? 1 : 0);
});

// start copy paste from left-most column
const firstColumn = rowSelections[0].fromCell;

for (let i = 0; i < rowSelections.length; i++) {
let rowSelection = rowSelections[i];
for (let j = 0; j < rowSelection.fromCell; j++) {
for (let j = firstColumn; j < rowSelection.fromCell; j++) {
copyString += ' \t';
}
let cellObjects = row.slice(rowSelection.fromCell, (rowSelection.toCell + 1));
Expand Down
20 changes: 5 additions & 15 deletions src/views/connectionUI.ts
Expand Up @@ -507,17 +507,8 @@ export class ConnectionUI {
} else {
// If the extension exists but not active
if (this._vscodeWrapper.azureAccountExtension) {
// Prompt user to activate the extension
let selection = await this._vscodeWrapper.showInformationMessage(LocalizedConstants.msgPromptRetryFirewallRuleNotActivated,
LocalizedConstants.activateLabel);
if (selection === LocalizedConstants.activateLabel) {
let activated = await this._vscodeWrapper.azureAccountExtension.activate();
if (activated) {
this.showAzureExtensionActivated();
return this.handleFirewallError(uri, profile, ipAddress);
}
}
return false;
await this._vscodeWrapper.azureAccountExtension.activate();
return this.handleExtensionActivation();
} else {
// Show recommendation to download the azure account extension
const selection = await this._vscodeWrapper.showInformationMessage(LocalizedConstants.msgPromptRetryFirewallRuleExtNotInstalled,
Expand All @@ -528,7 +519,7 @@ export class ConnectionUI {
// Activate the Azure Account extension and call the function again
if (this._vscodeWrapper.azureAccountExtension) {
await this._vscodeWrapper.azureAccountExtension.activate();
await this.showAzureExtensionActivated();
await this.handleExtensionActivation();
}
});
}
Expand All @@ -538,7 +529,7 @@ export class ConnectionUI {
}

/**
* Save a connection profile using the connection store.
* Save a connection profile using the connection store
*/
private saveProfile(profile: IConnectionProfile): Promise<IConnectionProfile> {
return this._connectionStore.saveProfile(profile);
Expand Down Expand Up @@ -582,7 +573,7 @@ export class ConnectionUI {
});
}

private async showAzureExtensionActivated(): Promise<boolean> {
private async handleExtensionActivation(): Promise<boolean> {
if (!this._vscodeWrapper.isAccountSignedIn) {
const result = await this._vscodeWrapper.showInformationMessage(LocalizedConstants.msgPromptAzureExtensionActivatedNotSignedIn,
LocalizedConstants.signInLabel);
Expand All @@ -591,7 +582,6 @@ export class ConnectionUI {
}
return false;
} else {
await this._vscodeWrapper.showInformationMessage(LocalizedConstants.msgPromptAzureExtensionActivatedSignedIn);
return true;
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/views/htmlcontent/src/css/color-theme.css
Expand Up @@ -4,10 +4,16 @@
*--------------------------------------------------------------------------------------------*/

/** Disable selection in html **/
.results.vertBox.scrollable {
.fullsize.vertBox {
user-select: none;
}

/** Add the ability to select messages using the cursor **/
.scrollable.messages {
cursor: text;
user-select: text;
}

/** Light Theme **/

.vscode-light * {
Expand Down
5 changes: 5 additions & 0 deletions src/views/htmlcontent/src/css/styles.css
Expand Up @@ -61,6 +61,11 @@
}

/* messages */

table#messageTable td.errorMessage {
color: var(--color-error);
}

table {
font-weight: inherit;
font-size: inherit;
Expand Down
22 changes: 20 additions & 2 deletions src/views/htmlcontent/src/js/components/app.component.ts
Expand Up @@ -107,7 +107,7 @@ const template = `
</tbody>
</table>
</div>
<div id="resizeHandle" [class.hidden]="!resizing" [style.top]="resizeHandleTop"></div>
<div id="resizeHandle" [class.hidden]="!resizing" [style.top.px]="resizeHandleTop"></div>
</div>
`;
// tslint:enable:max-line-length
Expand All @@ -117,7 +117,7 @@ const template = `
*/
@Component({
selector: 'my-app',
host: { '(window:keydown)': 'keyEvent($event)', '(window:gridnav)': 'keyEvent($event)' },
host: { '(window:keydown)': 'keyEvent($event)', '(window:gridnav)': 'keyEvent($event)', '(window:keyup)' : 'keyUpEvent($event)' },
template: template,
providers: [DataService, ShortcutService],
styles: [`
Expand Down Expand Up @@ -792,6 +792,24 @@ export class AppComponent implements OnInit, AfterViewChecked {
});
}

/**
* Helper to deselect messages when Ctrl + A is pressed
* inside the grid
*/
keyUpEvent(e: KeyboardEvent): void {
let eString = this.shortcuts.buildEventString(e);
this.shortcuts.getEvent(eString).then((result) => {
if (result) {
let eventName = <string> result;
if (eventName === 'event.selectAll') {
window.getSelection().empty();
rangy.getSelection().removeAllRanges();
}
e.stopImmediatePropagation();
}
});
}

/**
* Handles rendering and unrendering necessary resources in order to properly
* navigate from one grid another. Should be called any time grid navigation is performed
Expand Down
Expand Up @@ -13,7 +13,7 @@ import { IRange } from '../../../../../models/interfaces';
*/

const template = `
<ul class="contextMenu" style="position:absolute" [class.hidden]="!visible" [style.top]="position.y" [style.left]="position.x">
<ul class="contextMenu" style="position:absolute" [class.hidden]="!visible" [style.top.px]="position.y" [style.left.px]="position.x">
<li id="copy" (click)="handleContextActionClick('copySelection')" [class.disabled]="isDisabled"> {{Constants.copyLabel}}
<span style="float: right; color: lightgrey; padding-left: 10px">{{keys['event.copySelection']}}</span>
</li>
Expand Down

0 comments on commit 3e14e25

Please sign in to comment.