Skip to content

Commit

Permalink
Merge pull request #15 from pullflow/release/1.1.1
Browse files Browse the repository at this point in the history
🚇 Release 1.2.0
  • Loading branch information
srzainab authored Nov 30, 2023
2 parents 657a160 + e525375 commit 69fa1f7
Show file tree
Hide file tree
Showing 11 changed files with 383 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.2.0",
"configurations": [
{
"name": "Run Extension",
Expand Down
Binary file modified assets/Pullflow.woff
Binary file not shown.
27 changes: 17 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"publisher": "Pullflow",
"displayName": "Pullflow",
"description": "Code review collaboration across GitHub, Slack, and VS Code.",
"version": "1.1.0",
"version": "1.2.0",
"preview": true,
"license": "MIT",
"engines": {
"vscode": "^1.70.0"
},
"author": {
"name": "IDE integration team at Pullflow"
"name": "Pullflow"
},
"icon": "assets/pullflow.png",
"categories": [
Expand Down Expand Up @@ -112,60 +112,67 @@
}
},
"checks-running-icon": {
"description": "checks running icon",
"description": "Checks running icon",
"default": {
"fontPath": "./assets/Pullflow.woff",
"fontCharacter": "\\e903"
}
},
"checks-failed-icon": {
"description": "checks failed icon",
"description": "Checks failed icon",
"default": {
"fontPath": "./assets/Pullflow.woff",
"fontCharacter": "\\e904"
}
},
"checks-skipped-icon": {
"description": "checks skipped icon",
"description": "Checks skipped icon",
"default": {
"fontPath": "./assets/Pullflow.woff",
"fontCharacter": "\\e901"
}
},
"checks-passed-icon": {
"description": "checks passed icon",
"description": "Checks passed icon",
"default": {
"fontPath": "./assets/Pullflow.woff",
"fontCharacter": "\\e902"
}
},
"review-comment-icon": {
"description": "review comment icon",
"description": "Review comment icon",
"default": {
"fontPath": "./assets/Pullflow.woff",
"fontCharacter": "\\e907"
}
},
"pr-open-icon": {
"description": "pr open icon",
"description": "PR open icon",
"default": {
"fontPath": "./assets/Pullflow.woff",
"fontCharacter": "\\e909"
}
},
"request-changes-icon": {
"description": "request changes icon",
"description": "Request changes icon",
"default": {
"fontPath": "./assets/Pullflow.woff",
"fontCharacter": "\\e906"
}
},
"draft-pr-icon": {
"description": "draft pr icon",
"description": "Draft PR icon",
"default": {
"fontPath": "./assets/Pullflow.woff",
"fontCharacter": "\\e908"
}
},
"flow-state-icon": {
"description": "Flow-state icon",
"default": {
"fontPath": "./assets/Pullflow.woff",
"fontCharacter": "\\e90c"
}
}
}
},
Expand Down
32 changes: 32 additions & 0 deletions src/api/pullRequestQuickActionsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -159,6 +168,29 @@ export const PullRequestQuickActionsApi = {
}
},

refresh: 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,
Expand Down
359 changes: 272 additions & 87 deletions src/assets/Pullflow.sfd

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions src/pullRequestQuickActions/pullRequestQuickActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Store } from '../utils/store'
import { StatusBar } from '../views/statusBar/statusBar'
import { TimeSelectionItem, timePicker } from '../views/quickpicks/timePicker'
import moment = require('moment')
import { PullRequestState } from '../utils/pullRequestsState'

export const PullRequestQuickActions = {
applyLabel: async ({
Expand Down Expand Up @@ -211,6 +212,47 @@ 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 PullRequestState.update({
context,
statusBar,
isLogin: true,
errorCount: { count: 0 },
}) // refetch pull requests

await Presence.set({
status: PresenceStatus.Active,
context,
statusBar,
})
return true
},
setReminder: ({
codeReview,
context,
Expand Down
10 changes: 3 additions & 7 deletions src/utils/pullflowApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -118,6 +119,7 @@ export type ApiVariables =
| RequestReviewVariables
| CodeReviewApproveVariables
| CodeReviewRemindersVariables
| RefreshCodeReviewVariables
export type ThreadMessageVariables = {
body: string
parentMessageXid: string
Expand Down Expand Up @@ -163,3 +165,6 @@ export type RepoInfo = {
repoName?: string
branch?: string
}
export type RefreshCodeReviewVariables = {
codeReviewId: string
}
3 changes: 3 additions & 0 deletions src/views/quickpicks/pullRequestActionPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ const getActionItems = (type: CodeReviewType) => [
label: ActivePullRequestActions.RequestReview,
},
{ label: ActivePullRequestActions.SetReminder },
{
label: ActivePullRequestActions.Refresh,
},
]

export const pullRequestActionPicker = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
2 changes: 1 addition & 1 deletion src/views/statusBar/statusBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function getStatusBarText({
} = Store.get(context)

const presenceIcon =
previousPresenceStatus === PresenceStatus.Flow ? '$(symbol-event)' : ''
previousPresenceStatus === PresenceStatus.Flow ? '$(flow-state-icon)' : ''
const errorIcon = showErrorIcon ? ' $(warning) ' : ''

if (!pendingUserCodeReviews && !userAuthoredCodeReviews)
Expand Down

0 comments on commit 69fa1f7

Please sign in to comment.