From a7cf2520c53964a648b248edb87b618203e83cc2 Mon Sep 17 00:00:00 2001 From: Javier <10879637+javiertuya@users.noreply.github.com> Date: Fri, 11 Oct 2024 09:35:24 +0200 Subject: [PATCH] Add changes requested to assigned view 106 --- README.md | 2 +- dashgit-web/app/GitHubApi.js | 7 +++++-- dashgit-web/app/GitLabApi.js | 6 +++--- dashgit-web/app/WiViewRender.js | 4 +++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 69d8ce0..edffc2e 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This dashboard provides: - A consolidated view of multiple GitHub and GitLab repositories. - Different views of your work items - (open issues, pull requests, review requests), + (open issues and pull requests, unread mentions, review requests, requests for changes), triage (unassigned), branches and dependabot updates. - Build statuses of all branches and notifications diff --git a/dashgit-web/app/GitHubApi.js b/dashgit-web/app/GitHubApi.js index 257dc54..bf3a630 100644 --- a/dashgit-web/app/GitHubApi.js +++ b/dashgit-web/app/GitHubApi.js @@ -25,6 +25,7 @@ const gitHubApi = { const assigned = `is:open assignee:${provider.user} archived:false`; const unassigned = `is:open no:assignee owner:${provider.user} ${this.additionalOwners(provider, provider.unassignedAdditionalOwner)} archived:false`; const reviewer = `is:open user-review-requested:${provider.user} archived:false` + const revise= `is:open type:pr review:changes_requested author:${provider.user} archived:false` const created = `is:open author:${provider.user} archived:false` const involved = `is:open involves:${provider.user} archived:false` const dependabot = `is:open is:pr author:app/dependabot owner:${provider.user} ${this.additionalOwners(provider, provider.dependabotAdditionalOwner)} archived:false`; @@ -35,6 +36,7 @@ const gitHubApi = { octokit.rest.search.issuesAndPullRequests({ q: assigned, }), //To allow the ui to mark this as a review request, the api call is wrapped to add a special attribute (called custom_actions) to the response this.wrapIssuesAndPullRequestsCall(octokit, { q: reviewer, }, "review_request"), + this.wrapIssuesAndPullRequestsCall(octokit, { q: revise, }, "changes_requested"), //Also show work items that need follow-up gitStoreApi.followUpAll(provider, true), ]; @@ -158,8 +160,9 @@ const gitHubApi = { //When the model is completed, calls controller to update the status value of the current target updateStatusesAsync: function (provider, updateSince) { this.log(provider.uid, "Get Statuses from the GraphQL api"); + const t0 = Date.now(); this.getStatusesRequest(provider, updateSince).then(function (model) { - gitHubApi.log(provider.uid, "ASYNC Statuses model:", model); + gitHubApi.log(provider.uid, `ASYNC Statuses model [${Date.now() - t0}ms]:`, model); wiController.updateStatuses(provider.uid, model, updateSince); //direct call instead of using a callback }).catch(function (error) { console.error("GitHub GraphQL transformation failed"); @@ -186,7 +189,7 @@ const gitHubApi = { return `{ viewer { login, resourcePath, url, repositories(first: ${maxProjects}, ownerAffiliations: [${affiliations}], - ${forks} orderBy: {field: PUSHED_AT, direction: DESC}) { + ${forks} isArchived:false, orderBy: {field: PUSHED_AT, direction: DESC}) { nodes { name, nameWithOwner, url, pushedAt ${includeAll ? this.getProjectsRefsSubquery(provider) : ""} diff --git a/dashgit-web/app/GitLabApi.js b/dashgit-web/app/GitLabApi.js index eaf4ec6..3b19cda 100644 --- a/dashgit-web/app/GitLabApi.js +++ b/dashgit-web/app/GitLabApi.js @@ -133,8 +133,7 @@ const gitLabApi = { let query0 = this.getProjectsQuery(provider, provider.graphql.maxProjects, true); const t0 = Date.now(); let gqlresponse0 = await this.callGraphqlApi(provider, query0, true); - console.log(`time to get projects: ${Date.now() - t0}`) - this.log(provider.uid, "Statuses graphql response (projects):", gqlresponse0); + this.log(provider.uid, `Statuses graphql response (projects) [${Date.now() - t0}ms]:`, gqlresponse0); if (updateSince != "") { //filter out oldest projects to do a partial update this.filterOldProjects(gqlresponse0, updateSince); @@ -204,8 +203,9 @@ const gitLabApi = { //When the model is completed, calls controller to update the status valueof the current target updateStatusesAsync: function (provider, updateSince) { this.log(provider.uid, "Get Statuses from the GraphQL api"); + const t0 = Date.now(); this.getStatusesRequest(provider, updateSince).then(function (model) { - gitLabApi.log(provider.uid, "ASYNC Statuses model:", model); + gitLabApi.log(provider.uid, `ASYNC Statuses model [${Date.now() - t0}ms]:`, model); wiController.updateStatuses(provider.uid, model, updateSince); //direct call instead of using a callback }).catch(function (error) { console.error("GitLab GraphQL transformation failed"); diff --git a/dashgit-web/app/WiViewRender.js b/dashgit-web/app/WiViewRender.js index d2eba88..582945c 100644 --- a/dashgit-web/app/WiViewRender.js +++ b/dashgit-web/app/WiViewRender.js @@ -87,7 +87,9 @@ const wiRender = { return ""; let html = ""; if (actions["review_request"]) - html += ` review `; + html += ` review request `; + if (actions["changes_requested"]) + html += ` changes requested `; if (actions["follow_up"]) html += ` follow up `; return html;