From c276aae7a7b91eacd2fd3e85143976eb47ed7573 Mon Sep 17 00:00:00 2001 From: hassan-pullflow Date: Mon, 13 Nov 2023 21:41:54 +0500 Subject: [PATCH 1/9] added api for refreshCodeReview --- src/api/pullRequestQuickActionsApi.ts | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/api/pullRequestQuickActionsApi.ts b/src/api/pullRequestQuickActionsApi.ts index 20467d0..262491a 100644 --- a/src/api/pullRequestQuickActionsApi.ts +++ b/src/api/pullRequestQuickActionsApi.ts @@ -41,6 +41,15 @@ const REQUEST_REVIEW = ` } ` +const REFRESH_CODE_REVIEW = ` +mutation refreshCodeReview($codeReviewId: String!) { + refreshCodeReview(codeReviewId: $codeReviewId) { + success + message + } +} +` + const SET_REMINDER = ` mutation setCodeReviewReminder($codeReviewId: String!, $duration: Int!) { setCodeReviewReminder(codeReviewId: $codeReviewId, duration: $duration) { @@ -159,6 +168,29 @@ export const PullRequestQuickActionsApi = { } }, + refreshCodeReview: async ({ + codeReviewId, + authToken, + context, + }: { + codeReviewId: string + authToken: string + context: ExtensionContext + }) => { + log.info(`requesting review: ${{ codeReviewId }}}`, module) + + const pullflowApi = new PullflowApi(context, authToken) + try { + const data = await pullflowApi.fetch(REFRESH_CODE_REVIEW, { + codeReviewId, + }) + return data.refreshCodeReview + } catch (error) { + log.error(`error in requesting review, ${error}`, module) + return { error } + } + }, + setReminder: async ({ duration, codeReviewId, From 5299e6fa862994776f50323a68236aa8519dd5f8 Mon Sep 17 00:00:00 2001 From: hassan-pullflow Date: Mon, 13 Nov 2023 22:19:22 +0500 Subject: [PATCH 2/9] refresh quick action in models --- .../pullRequestQuickActions.ts | 37 +++++++++++++++++++ .../pullRequestActionHandler.ts | 7 ++++ 2 files changed, 44 insertions(+) diff --git a/src/pullRequestQuickActions/pullRequestQuickActions.ts b/src/pullRequestQuickActions/pullRequestQuickActions.ts index b9c23ba..8621518 100644 --- a/src/pullRequestQuickActions/pullRequestQuickActions.ts +++ b/src/pullRequestQuickActions/pullRequestQuickActions.ts @@ -11,6 +11,7 @@ import { spaceUserPicker } from '../views/quickpicks/spaceUserPicker' import { Presence } from '../models/presence' import { Store } from '../utils/store' import { StatusBar } from '../views/statusBar/statusBar' +import { initialize } from '../utils/initialize' import { TimeSelectionItem, timePicker } from '../views/quickpicks/timePicker' import moment = require('moment') @@ -211,6 +212,42 @@ export const PullRequestQuickActions = { statusBar, }) }, + + refresh: async ({ + codeReviewId, + context, + statusBar, + }: { + codeReviewId: string + context: ExtensionContext + statusBar: StatusBarItem + }) => { + const session = await Authorization.currentSession(context) + const response = await PullRequestQuickActionsApi.refresh({ + codeReviewId, + authToken: session?.accessToken ?? '', + context, + }) + if (response.error || response.message) { + window.showInformationMessage( + `${ + response.message + ? response.message + : 'Something went wrong, failed to refresh pull request' + }` + ) + return false + } + + await initialize({ context, statusBar }) // refetch pull requests + + await Presence.set({ + status: PresenceStatus.Active, + context, + statusBar, + }) + return true + }, setReminder: ({ codeReview, context, diff --git a/src/views/quickpicks/selectHandlers/pullRequestActionHandler.ts b/src/views/quickpicks/selectHandlers/pullRequestActionHandler.ts index d1288ff..b131a63 100644 --- a/src/views/quickpicks/selectHandlers/pullRequestActionHandler.ts +++ b/src/views/quickpicks/selectHandlers/pullRequestActionHandler.ts @@ -93,6 +93,13 @@ export const pullRequestActionHandler = async ({ context, }) } + if (selectedItem?.label === ActivePullRequestActions.Refresh) { + await PullRequestQuickActions.refresh({ + codeReviewId: codeReviewItem.id, + context, + statusBar, + }) + } } const openLink = (link: string) => env.openExternal(Uri.parse(link)) From d0a6b890d8d2d4ea5a18c747d3a26ed46ffa9578 Mon Sep 17 00:00:00 2001 From: hassan-pullflow Date: Mon, 13 Nov 2023 22:19:43 +0500 Subject: [PATCH 3/9] updated namings --- src/api/pullRequestQuickActionsApi.ts | 2 +- src/utils/types.ts | 5 +++++ src/views/quickpicks/pullRequestActionPicker.ts | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/api/pullRequestQuickActionsApi.ts b/src/api/pullRequestQuickActionsApi.ts index 262491a..3a2cdf1 100644 --- a/src/api/pullRequestQuickActionsApi.ts +++ b/src/api/pullRequestQuickActionsApi.ts @@ -168,7 +168,7 @@ export const PullRequestQuickActionsApi = { } }, - refreshCodeReview: async ({ + refresh: async ({ codeReviewId, authToken, context, diff --git a/src/utils/types.ts b/src/utils/types.ts index b133ba9..e8a591e 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -93,6 +93,7 @@ export enum ActivePullRequestActions { ApplyLabel = 'Add label', AddAssignee = 'Add assignee', RequestReview = 'Add reviewer', + Refresh = 'Refresh', SetReminder = 'Set a reminder', } export type SpaceUser = { @@ -118,6 +119,7 @@ export type ApiVariables = | RequestReviewVariables | CodeReviewApproveVariables | CodeReviewRemindersVariables + | RefreshCodeReviewVariables export type ThreadMessageVariables = { body: string parentMessageXid: string @@ -163,3 +165,6 @@ export type RepoInfo = { repoName?: string branch?: string } +export type RefreshCodeReviewVariables = { + codeReviewId: string +} diff --git a/src/views/quickpicks/pullRequestActionPicker.ts b/src/views/quickpicks/pullRequestActionPicker.ts index 5c5aee1..33fe78d 100644 --- a/src/views/quickpicks/pullRequestActionPicker.ts +++ b/src/views/quickpicks/pullRequestActionPicker.ts @@ -33,6 +33,9 @@ const getActionItems = (type: CodeReviewType) => [ label: ActivePullRequestActions.RequestReview, }, { label: ActivePullRequestActions.SetReminder }, + { + label: ActivePullRequestActions.Refresh, + }, ] export const pullRequestActionPicker = ({ From 0abc506d112e41f34bdc2e683fef3d5e8f7d32b2 Mon Sep 17 00:00:00 2001 From: hassan-pullflow Date: Wed, 15 Nov 2023 23:07:23 +0500 Subject: [PATCH 4/9] removed initialize func --- src/pullRequestQuickActions/pullRequestQuickActions.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pullRequestQuickActions/pullRequestQuickActions.ts b/src/pullRequestQuickActions/pullRequestQuickActions.ts index 8621518..1c3bb7a 100644 --- a/src/pullRequestQuickActions/pullRequestQuickActions.ts +++ b/src/pullRequestQuickActions/pullRequestQuickActions.ts @@ -11,9 +11,9 @@ import { spaceUserPicker } from '../views/quickpicks/spaceUserPicker' import { Presence } from '../models/presence' import { Store } from '../utils/store' import { StatusBar } from '../views/statusBar/statusBar' -import { initialize } from '../utils/initialize' import { TimeSelectionItem, timePicker } from '../views/quickpicks/timePicker' import moment = require('moment') +import { PullRequestState } from '../utils/pullRequestsState' export const PullRequestQuickActions = { applyLabel: async ({ @@ -239,7 +239,12 @@ export const PullRequestQuickActions = { return false } - await initialize({ context, statusBar }) // refetch pull requests + await PullRequestState.update({ + context, + statusBar, + isLogin: true, + errorCount: { count: 0 }, + }) // refetch pull requests await Presence.set({ status: PresenceStatus.Active, From c21cd8490ade161a6cae07ed9ff6ac3d3e93585f Mon Sep 17 00:00:00 2001 From: Zak Mandhro Date: Wed, 15 Nov 2023 16:53:22 -0800 Subject: [PATCH 5/9] add flow state 'wave' icon --- assets/Pullflow.woff | Bin 3012 -> 3184 bytes package.json | 25 ++- src/assets/Pullflow.sfd | 359 +++++++++++++++++++++++-------- src/views/statusBar/statusBar.ts | 2 +- 4 files changed, 289 insertions(+), 97 deletions(-) diff --git a/assets/Pullflow.woff b/assets/Pullflow.woff index d3d4d4a981b5eaef920386ff62a0bf86bda5db2c..1953a453ef3bdd52e9febc8890948a258b1128a9 100644 GIT binary patch delta 2728 zcmZvYc{r3`AI6^Z z#u_Sxln`hudkP}2o0Kg&B;HF)5cNa%zsNvvnH3$uvUInB(WJ2CGNQ*;AaTT%m zyOVtaAg>$JS`emJ0y+M8dXbhDM8Q9iIr>ng zZz-ow@91`I-4E1#@S&v{fo2EH-tZbQ%wb1mV1D-zQ2_A2b_WMO*BdR(9|5>2uR8!> zI)V2GzU!V*zw&FMak=OO+YU^C?quappSVBFoNNNAcqo1VL(Rm^x`2I*N#Osu5&-pYR%&i4ZC7uQOuI=+Y6g|@Sui044Ir3 znT;cyjJ1l%*1&%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~a@4K~ei&5O3zo`8(v*){K2(Un=Va`lj^=a*7g>dv`mLQki%5NZ`9F;y~>@pgA zCvn!eY_);#Gj_)yAhZt2;lh7eyf+|waZyye*wE=}jX0lZGcLu&FhEUgkb3P zOSt)Kx6@IrKuH}^u_@r?PUK|q%X!kC=Mvfb6LXk!#D;owXDax6u6f6Vf*9Z8K*{iF z&7LA+745~Q3mwc8(axuKmTw0_{qD3AGZ;t`_`arR%VW(9XQy%lR+ Date: Thu, 16 Nov 2023 23:45:27 +0500 Subject: [PATCH 6/9] version bump --- .vscode/launch.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 64db220..50580bf 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -3,7 +3,7 @@ // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 { - "version": "1.1.0", + "version": "1.1.1", "configurations": [ { "name": "Run Extension", diff --git a/package.json b/package.json index 84ac953..822ea14 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "publisher": "Pullflow", "displayName": "Pullflow", "description": "Code review collaboration across GitHub, Slack, and VS Code.", - "version": "1.1.0", + "version": "1.1.1", "preview": true, "license": "MIT", "engines": { From e1f5611e04b220a6cd19bafa4b2f1b085950c036 Mon Sep 17 00:00:00 2001 From: Syeda Zainab <83520846+srzainab@users.noreply.github.com> Date: Thu, 23 Nov 2023 11:39:55 +0400 Subject: [PATCH 7/9] added missing headers for 1.15 core compatibility --- src/utils/pullflowApi.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/utils/pullflowApi.ts b/src/utils/pullflowApi.ts index 4abf718..0e05f6a 100644 --- a/src/utils/pullflowApi.ts +++ b/src/utils/pullflowApi.ts @@ -5,13 +5,7 @@ import { AppConfig } from './appConfig' export class PullflowApi { apiUrl: string - options: { - method: string - headers: { - authorization: string - version: string - } - } + options: {} constructor( context: ExtensionContext, @@ -23,6 +17,8 @@ export class PullflowApi { headers: { authorization: accessToken ?? '', version: context.extension.packageJSON.version, + Accept: 'application/json, text/plain', + 'Content-Type': 'application/json;charset=UTF-8', }, } this.apiUrl = AppConfig.pullflow.graphqlUrl From ca10fb92a4dc00e2da83f5e14b8c4bbdbcbed382 Mon Sep 17 00:00:00 2001 From: Syeda Zainab <83520846+srzainab@users.noreply.github.com> Date: Tue, 28 Nov 2023 14:43:16 +0400 Subject: [PATCH 8/9] bumped vscode version to 1.2.0 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b769aaa..28eee69 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "publisher": "Pullflow", "displayName": "Pullflow", "description": "Code review collaboration across GitHub, Slack, and VS Code.", - "version": "1.1.1", + "version": "1.2.0", "preview": true, "license": "MIT", "engines": { @@ -167,7 +167,7 @@ "fontCharacter": "\\e908" } }, - "flow-state-icon":{ + "flow-state-icon": { "description": "Flow-state icon", "default": { "fontPath": "./assets/Pullflow.woff", From a7c525836c72e93db0b5b26a18bcb6b8ff3a62a2 Mon Sep 17 00:00:00 2001 From: hassan-pullflow Date: Tue, 28 Nov 2023 15:57:31 +0500 Subject: [PATCH 9/9] version bump in launch.json --- .vscode/launch.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 50580bf..3a3910d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -3,7 +3,7 @@ // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 { - "version": "1.1.1", + "version": "1.2.0", "configurations": [ { "name": "Run Extension",