Pinned Query Status Bar Item #17

Merged
merged 7 commits into from Apr 25, 2016

Projects

None yet

3 participants

@mmanela
Member
mmanela commented Apr 23, 2016

In the status bar we already have items for build and pull request. This pull request adds work item query there as well. I introduced the concept of a pinned query. This is a user configurable query that they will want real time feedback on.

By pinning the query you will get automatic updating of the number of items returned by it:
image

By clicking on the query you get those results. This is very useful since you can configure to quickly catch new items assigned to you or other items you want to track.

By default I use the same "my work items" query already in the code base but I let the user customize it in the user settings file with the following block:

    "team.pinnedQueries": [
        {
            "account": "your-account-name",
            "queryText": "SELECT * FROM WorkItems WHERE [System.AssignedTo] = @me AND [System.ChangedDate] > @Today - 14"
        }
    ]
@msftclas

Hi @mmanela, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!


It looks like you're a Microsoft contributor (Matthew Manela). If you're full-time, we DON'T require a Contribution License Agreement. If you are a vendor, please DO sign the electronic Contribution License Agreement. It will take 2 minutes and there's no faxing! https://cla.microsoft.com.

TTYL, MSBOT;

@jeffyoung jeffyoung commented on an outdated diff Apr 25, 2016
src/team-extension.ts
@@ -5,7 +5,7 @@
"use strict";
import { FileSystemWatcher, StatusBarAlignment, StatusBarItem, window, workspace } from "vscode";
-import { AccountSettings, Settings } from "./helpers/settings";
+import { PinnedQuerySettings, AccountSettings, Settings } from "./helpers/settings";
@jeffyoung
jeffyoung Apr 25, 2016 Member

Preference is to alphabetize the imports

@jeffyoung jeffyoung commented on an outdated diff Apr 25, 2016
src/clients/witclient.ts
@@ -99,13 +103,22 @@ export class WitClient extends BaseClient {
);
}
+ public ShowPinnedQueryWorkItems(): void {
+ this.ReportEvent(TelemetryEvents.ViewPinnedQueryWorkItems);
+ this.showWorkItems(this._pinnedQueryText);
+
@jeffyoung
jeffyoung Apr 25, 2016 Member

Could you remove the extra whitespace (line)?

@jeffyoung jeffyoung commented on an outdated diff Apr 25, 2016
src/clients/witclient.ts
@@ -126,6 +139,16 @@ export class WitClient extends BaseClient {
);
}
+ public GetPinnedQueryResultCount() : Q.Promise<number> {
+
@jeffyoung
jeffyoung Apr 25, 2016 Member

Could you remove the extra whitespace (line)?

@jeffyoung jeffyoung commented on an outdated diff Apr 25, 2016
src/clients/witclient.ts
@@ -126,6 +139,16 @@ export class WitClient extends BaseClient {
);
}
+ public GetPinnedQueryResultCount() : Q.Promise<number> {
+
+ let svc: WorkItemTrackingService = new WorkItemTrackingService(this._serverContext);
+
+ Logger.LogInfo("Running pinned work item query to get count...");
+ Logger.LogInfo("TP: " + this._serverContext.RepoInfo.TeamProject);
+ return svc.GetQueryResultCount(this._serverContext.RepoInfo.TeamProject, this._pinnedQueryText);
+
@jeffyoung
jeffyoung Apr 25, 2016 Member

Could you remove the extra whitespace (line)?

@jeffyoung jeffyoung commented on an outdated diff Apr 25, 2016
src/helpers/strings.ts
@@ -6,6 +6,9 @@
/* tslint:disable:variable-name */
export class Strings {
+
@jeffyoung
jeffyoung Apr 25, 2016 Member

Could you remove the extra whitespace (line)?

@jeffyoung jeffyoung commented on the diff Apr 25, 2016
src/helpers/settings.ts
@@ -21,6 +21,47 @@ abstract class BaseSettings {
}
}
+export interface IPinnedQuery {
@jeffyoung
jeffyoung Apr 25, 2016 Member

I don't think you need to export this interface (only references is in this particular file).

@jeffyoung
Member

Hi Matt. Thanks for the contribution (very cool)! I wonder though if you gave any thought to having the "pinned query" be a name of a particular query instead of the WIQL? We'd have to look it up but it'd give the user more control over editing (using web access) and wouldn't require the user to craft WIQL? What do you think?

@mmanela
Member
mmanela commented Apr 25, 2016

I agree that would be nice. I plan to eventually give that option but wanted to do this first and in the future provide both options. The complication with the query path is just that we would need to always query for that first before running the query. Not a big deal just 2 calls instead of one. I plan to do this eventually:

"team.pinnedQueries": [
{
"account": "your-account-name",
"queryPath": "My Queryes/foo/bar
}
]

@mmanela
Member
mmanela commented Apr 25, 2016

Update the PR to respond to your other feedback

@mmanela
Member
mmanela commented Apr 25, 2016

@jeffyoung On second thought, I will add the queryPath support now ;)

@mmanela
Member
mmanela commented Apr 25, 2016

Query Path support added

@jeffyoung jeffyoung commented on an outdated diff Apr 25, 2016
+ }
+ ]
+ ```
+
+**Using Query Path**
+ ```javascript
+ "team.pinnedQueries": [
+ {
+ "account": "your-account-name",
+ "queryPath": "Shared Queries/My Folder/My Query"
+ }
+ ]
+ ```
+
+
+ You can also create a *global* pinned query which will be the default if you have not configured one for your account:
@jeffyoung
jeffyoung Apr 25, 2016 Member

Since global also works for a query path, you may just update this text to explain that you can replace your-account-name with "global" and they'll both work. That means you can remove the sample below. Since "global" was introduced earlier with regards to PAT, they should already know what to change.

@jeffyoung jeffyoung commented on an outdated diff Apr 25, 2016
src/helpers/strings.ts
@@ -6,6 +6,8 @@
/* tslint:disable:variable-name */
export class Strings {
+ static ViewYourPinnedQuery: string = "View your pinned work item query.";
@jeffyoung
jeffyoung Apr 25, 2016 Member

It'd be great if you could change "...work item query" to "...work item query results."

@jeffyoung
Member

Thanks for adding the query path support so quickly!

@mmanela
Member
mmanela commented Apr 25, 2016

Update per your comments

@jeffyoung
Member

Merging. Thanks Matt!

@jeffyoung jeffyoung merged commit fd68131 into Microsoft:master Apr 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment