You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

home.go 24 kB

10 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
issue search on my related repositories (#9758) * adding search capability to user's issues dashboard * global issue search * placement of search bar on issues dashboard * fixed some bugs in the issue dashboard search * added unit test because IssueIDs option was added to UserIssueStatsOptions * some renaming of fields in the issue dashboard code to be more clear; also trying to fix issue of searching the right repos based on the filter * added unit test fro GetRepoIDsForIssuesOptions; fixed search lost on pagination; using shown issue status for open/close count; removed some debugging * fix issue with all count showing incorrectly * removed todo comment left in by mistake * typo pulling wrong count * fxied all count being off when selecting repositories * setting the opts.IsClosed after pulling repos to search, this is done so that the list of repo ids to serach for the keyword is not limited, we need to get all the issue ids for the shown issue stats * added "accessibleRepositoryCondition" check on the query to pull the repo ids to search for issues, this is an added protection to ensure we don't search repos the user does not have access to * added code so that in the issues search, we won't use an in clause of issues ids that goes over 1000 * fixed unit test * using 950 as the limit for issue search, removed unneeded group by in GetRepoIDsForIssuesOptions, showing search on pulls dashboard page too (not just issues) Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
5 years ago
3 years ago
2 years ago
2 years ago
3 years ago
API add/generalize pagination (#9452) * paginate results * fixed deadlock * prevented breaking change * updated swagger * go fmt * fixed find topic * go mod tidy * go mod vendor with go1.13.5 * fixed repo find topics * fixed unit test * added Limit method to Engine struct; use engine variable when provided; fixed gitignore * use ItemsPerPage for default pagesize; fix GetWatchers, getOrgUsersByOrgID and GetStargazers; fix GetAllCommits headers; reverted some changed behaviors * set Page value on Home route * improved memory allocations * fixed response headers * removed logfiles * fixed import order * import order * improved swagger * added function to get models.ListOptions from context * removed pagesize diff on unit test * fixed imports * removed unnecessary struct field * fixed go fmt * scoped PR * code improvements * code improvements * go mod tidy * fixed import order * fixed commit statuses session * fixed files headers * fixed headers; added pagination for notifications * go mod tidy * go fmt * removed Private from user search options; added setting.UI.IssuePagingNum as default valeu on repo's issues list * Apply suggestions from code review Co-Authored-By: 6543 <6543@obermui.de> Co-Authored-By: zeripath <art27@cantab.net> * fixed build error * CI.restart() * fixed merge conflicts resolve * fixed conflicts resolve * improved FindTrackedTimesOptions.ToOptions() method * added backwards compatibility on ListReleases request; fixed issue tracked time ToSession * fixed build error; fixed swagger template * fixed swagger template * fixed ListReleases backwards compatibility * added page to user search route Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
5 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
issue search on my related repositories (#9758) * adding search capability to user's issues dashboard * global issue search * placement of search bar on issues dashboard * fixed some bugs in the issue dashboard search * added unit test because IssueIDs option was added to UserIssueStatsOptions * some renaming of fields in the issue dashboard code to be more clear; also trying to fix issue of searching the right repos based on the filter * added unit test fro GetRepoIDsForIssuesOptions; fixed search lost on pagination; using shown issue status for open/close count; removed some debugging * fix issue with all count showing incorrectly * removed todo comment left in by mistake * typo pulling wrong count * fxied all count being off when selecting repositories * setting the opts.IsClosed after pulling repos to search, this is done so that the list of repo ids to serach for the keyword is not limited, we need to get all the issue ids for the shown issue stats * added "accessibleRepositoryCondition" check on the query to pull the repo ids to search for issues, this is an added protection to ensure we don't search repos the user does not have access to * added code so that in the issues search, we won't use an in clause of issues ids that goes over 1000 * fixed unit test * using 950 as the limit for issue search, removed unneeded group by in GetRepoIDsForIssuesOptions, showing search on pulls dashboard page too (not just issues) Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
5 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
issue search on my related repositories (#9758) * adding search capability to user's issues dashboard * global issue search * placement of search bar on issues dashboard * fixed some bugs in the issue dashboard search * added unit test because IssueIDs option was added to UserIssueStatsOptions * some renaming of fields in the issue dashboard code to be more clear; also trying to fix issue of searching the right repos based on the filter * added unit test fro GetRepoIDsForIssuesOptions; fixed search lost on pagination; using shown issue status for open/close count; removed some debugging * fix issue with all count showing incorrectly * removed todo comment left in by mistake * typo pulling wrong count * fxied all count being off when selecting repositories * setting the opts.IsClosed after pulling repos to search, this is done so that the list of repo ids to serach for the keyword is not limited, we need to get all the issue ids for the shown issue stats * added "accessibleRepositoryCondition" check on the query to pull the repo ids to search for issues, this is an added protection to ensure we don't search repos the user does not have access to * added code so that in the issues search, we won't use an in clause of issues ids that goes over 1000 * fixed unit test * using 950 as the limit for issue search, removed unneeded group by in GetRepoIDsForIssuesOptions, showing search on pulls dashboard page too (not just issues) Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
5 years ago
issue search on my related repositories (#9758) * adding search capability to user's issues dashboard * global issue search * placement of search bar on issues dashboard * fixed some bugs in the issue dashboard search * added unit test because IssueIDs option was added to UserIssueStatsOptions * some renaming of fields in the issue dashboard code to be more clear; also trying to fix issue of searching the right repos based on the filter * added unit test fro GetRepoIDsForIssuesOptions; fixed search lost on pagination; using shown issue status for open/close count; removed some debugging * fix issue with all count showing incorrectly * removed todo comment left in by mistake * typo pulling wrong count * fxied all count being off when selecting repositories * setting the opts.IsClosed after pulling repos to search, this is done so that the list of repo ids to serach for the keyword is not limited, we need to get all the issue ids for the shown issue stats * added "accessibleRepositoryCondition" check on the query to pull the repo ids to search for issues, this is an added protection to ensure we don't search repos the user does not have access to * added code so that in the issues search, we won't use an in clause of issues ids that goes over 1000 * fixed unit test * using 950 as the limit for issue search, removed unneeded group by in GetRepoIDsForIssuesOptions, showing search on pulls dashboard page too (not just issues) Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
5 years ago
issue search on my related repositories (#9758) * adding search capability to user's issues dashboard * global issue search * placement of search bar on issues dashboard * fixed some bugs in the issue dashboard search * added unit test because IssueIDs option was added to UserIssueStatsOptions * some renaming of fields in the issue dashboard code to be more clear; also trying to fix issue of searching the right repos based on the filter * added unit test fro GetRepoIDsForIssuesOptions; fixed search lost on pagination; using shown issue status for open/close count; removed some debugging * fix issue with all count showing incorrectly * removed todo comment left in by mistake * typo pulling wrong count * fxied all count being off when selecting repositories * setting the opts.IsClosed after pulling repos to search, this is done so that the list of repo ids to serach for the keyword is not limited, we need to get all the issue ids for the shown issue stats * added "accessibleRepositoryCondition" check on the query to pull the repo ids to search for issues, this is an added protection to ensure we don't search repos the user does not have access to * added code so that in the issues search, we won't use an in clause of issues ids that goes over 1000 * fixed unit test * using 950 as the limit for issue search, removed unneeded group by in GetRepoIDsForIssuesOptions, showing search on pulls dashboard page too (not just issues) Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
5 years ago
issue search on my related repositories (#9758) * adding search capability to user's issues dashboard * global issue search * placement of search bar on issues dashboard * fixed some bugs in the issue dashboard search * added unit test because IssueIDs option was added to UserIssueStatsOptions * some renaming of fields in the issue dashboard code to be more clear; also trying to fix issue of searching the right repos based on the filter * added unit test fro GetRepoIDsForIssuesOptions; fixed search lost on pagination; using shown issue status for open/close count; removed some debugging * fix issue with all count showing incorrectly * removed todo comment left in by mistake * typo pulling wrong count * fxied all count being off when selecting repositories * setting the opts.IsClosed after pulling repos to search, this is done so that the list of repo ids to serach for the keyword is not limited, we need to get all the issue ids for the shown issue stats * added "accessibleRepositoryCondition" check on the query to pull the repo ids to search for issues, this is an added protection to ensure we don't search repos the user does not have access to * added code so that in the issues search, we won't use an in clause of issues ids that goes over 1000 * fixed unit test * using 950 as the limit for issue search, removed unneeded group by in GetRepoIDsForIssuesOptions, showing search on pulls dashboard page too (not just issues) Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
5 years ago
issue search on my related repositories (#9758) * adding search capability to user's issues dashboard * global issue search * placement of search bar on issues dashboard * fixed some bugs in the issue dashboard search * added unit test because IssueIDs option was added to UserIssueStatsOptions * some renaming of fields in the issue dashboard code to be more clear; also trying to fix issue of searching the right repos based on the filter * added unit test fro GetRepoIDsForIssuesOptions; fixed search lost on pagination; using shown issue status for open/close count; removed some debugging * fix issue with all count showing incorrectly * removed todo comment left in by mistake * typo pulling wrong count * fxied all count being off when selecting repositories * setting the opts.IsClosed after pulling repos to search, this is done so that the list of repo ids to serach for the keyword is not limited, we need to get all the issue ids for the shown issue stats * added "accessibleRepositoryCondition" check on the query to pull the repo ids to search for issues, this is an added protection to ensure we don't search repos the user does not have access to * added code so that in the issues search, we won't use an in clause of issues ids that goes over 1000 * fixed unit test * using 950 as the limit for issue search, removed unneeded group by in GetRepoIDsForIssuesOptions, showing search on pulls dashboard page too (not just issues) Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
5 years ago
issue search on my related repositories (#9758) * adding search capability to user's issues dashboard * global issue search * placement of search bar on issues dashboard * fixed some bugs in the issue dashboard search * added unit test because IssueIDs option was added to UserIssueStatsOptions * some renaming of fields in the issue dashboard code to be more clear; also trying to fix issue of searching the right repos based on the filter * added unit test fro GetRepoIDsForIssuesOptions; fixed search lost on pagination; using shown issue status for open/close count; removed some debugging * fix issue with all count showing incorrectly * removed todo comment left in by mistake * typo pulling wrong count * fxied all count being off when selecting repositories * setting the opts.IsClosed after pulling repos to search, this is done so that the list of repo ids to serach for the keyword is not limited, we need to get all the issue ids for the shown issue stats * added "accessibleRepositoryCondition" check on the query to pull the repo ids to search for issues, this is an added protection to ensure we don't search repos the user does not have access to * added code so that in the issues search, we won't use an in clause of issues ids that goes over 1000 * fixed unit test * using 950 as the limit for issue search, removed unneeded group by in GetRepoIDsForIssuesOptions, showing search on pulls dashboard page too (not just issues) Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
5 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
issue search on my related repositories (#9758) * adding search capability to user's issues dashboard * global issue search * placement of search bar on issues dashboard * fixed some bugs in the issue dashboard search * added unit test because IssueIDs option was added to UserIssueStatsOptions * some renaming of fields in the issue dashboard code to be more clear; also trying to fix issue of searching the right repos based on the filter * added unit test fro GetRepoIDsForIssuesOptions; fixed search lost on pagination; using shown issue status for open/close count; removed some debugging * fix issue with all count showing incorrectly * removed todo comment left in by mistake * typo pulling wrong count * fxied all count being off when selecting repositories * setting the opts.IsClosed after pulling repos to search, this is done so that the list of repo ids to serach for the keyword is not limited, we need to get all the issue ids for the shown issue stats * added "accessibleRepositoryCondition" check on the query to pull the repo ids to search for issues, this is an added protection to ensure we don't search repos the user does not have access to * added code so that in the issues search, we won't use an in clause of issues ids that goes over 1000 * fixed unit test * using 950 as the limit for issue search, removed unneeded group by in GetRepoIDsForIssuesOptions, showing search on pulls dashboard page too (not just issues) Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
5 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
issue search on my related repositories (#9758) * adding search capability to user's issues dashboard * global issue search * placement of search bar on issues dashboard * fixed some bugs in the issue dashboard search * added unit test because IssueIDs option was added to UserIssueStatsOptions * some renaming of fields in the issue dashboard code to be more clear; also trying to fix issue of searching the right repos based on the filter * added unit test fro GetRepoIDsForIssuesOptions; fixed search lost on pagination; using shown issue status for open/close count; removed some debugging * fix issue with all count showing incorrectly * removed todo comment left in by mistake * typo pulling wrong count * fxied all count being off when selecting repositories * setting the opts.IsClosed after pulling repos to search, this is done so that the list of repo ids to serach for the keyword is not limited, we need to get all the issue ids for the shown issue stats * added "accessibleRepositoryCondition" check on the query to pull the repo ids to search for issues, this is an added protection to ensure we don't search repos the user does not have access to * added code so that in the issues search, we won't use an in clause of issues ids that goes over 1000 * fixed unit test * using 950 as the limit for issue search, removed unneeded group by in GetRepoIDsForIssuesOptions, showing search on pulls dashboard page too (not just issues) Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
5 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
issue search on my related repositories (#9758) * adding search capability to user's issues dashboard * global issue search * placement of search bar on issues dashboard * fixed some bugs in the issue dashboard search * added unit test because IssueIDs option was added to UserIssueStatsOptions * some renaming of fields in the issue dashboard code to be more clear; also trying to fix issue of searching the right repos based on the filter * added unit test fro GetRepoIDsForIssuesOptions; fixed search lost on pagination; using shown issue status for open/close count; removed some debugging * fix issue with all count showing incorrectly * removed todo comment left in by mistake * typo pulling wrong count * fxied all count being off when selecting repositories * setting the opts.IsClosed after pulling repos to search, this is done so that the list of repo ids to serach for the keyword is not limited, we need to get all the issue ids for the shown issue stats * added "accessibleRepositoryCondition" check on the query to pull the repo ids to search for issues, this is an added protection to ensure we don't search repos the user does not have access to * added code so that in the issues search, we won't use an in clause of issues ids that goes over 1000 * fixed unit test * using 950 as the limit for issue search, removed unneeded group by in GetRepoIDsForIssuesOptions, showing search on pulls dashboard page too (not just issues) Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
5 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
issue search on my related repositories (#9758) * adding search capability to user's issues dashboard * global issue search * placement of search bar on issues dashboard * fixed some bugs in the issue dashboard search * added unit test because IssueIDs option was added to UserIssueStatsOptions * some renaming of fields in the issue dashboard code to be more clear; also trying to fix issue of searching the right repos based on the filter * added unit test fro GetRepoIDsForIssuesOptions; fixed search lost on pagination; using shown issue status for open/close count; removed some debugging * fix issue with all count showing incorrectly * removed todo comment left in by mistake * typo pulling wrong count * fxied all count being off when selecting repositories * setting the opts.IsClosed after pulling repos to search, this is done so that the list of repo ids to serach for the keyword is not limited, we need to get all the issue ids for the shown issue stats * added "accessibleRepositoryCondition" check on the query to pull the repo ids to search for issues, this is an added protection to ensure we don't search repos the user does not have access to * added code so that in the issues search, we won't use an in clause of issues ids that goes over 1000 * fixed unit test * using 950 as the limit for issue search, removed unneeded group by in GetRepoIDsForIssuesOptions, showing search on pulls dashboard page too (not just issues) Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
5 years ago
[UI] IssuePage multi repo select (#8741) * Make repository list @ issues/PR page persist Will partially fix #6355 * Enable multiple selections in repo list @ issues/PR page Part of issue #6355 * Add RepoIDs to UserIssueStatsOptions to make "type" count correct when selecting one/multiple repos. * Replace variable "repo" with list "repos[]" and enable multiple selections of repositories from list by including/excluding RepoIDs in list. * * Remove redundant code * Add 'All' button Improves functionality of the page, so that backtracking is not necessary to reset the page * Remove redundant variable Completely replace 'RepoID' with 'RepoIDs' and remove redundant code * Add RepoIDs to label link * Revert part of code to previous version to troubleshoot build failure * Implement old and new pieces of code whilst adhering to multi select * Attempt to join the two versions Last commit passed tests but doesn't work in practice, this works in practice and hopefully passes the tests. * Update tests to desired state * Fix pagination implementation and tests * Pass repoIDs as `repos=[1,2,3...]` instead of several `repos[]=..` * Update tests file to reflect new functionality * Update template with new `repos` format * Implement new solution to show constant "total issues" count for "All" button * Correct behavior when passing zero to array * Comment out test url returning 404 This keeps returning 404 in the test despite working in practice, for the sake of running more tests I am commenting it out * Comment out another test url returning 404 Last attempt, if more tests crash I will uncomment the urls and request assistance. * Reenable tests and test fix * Re-enable tests * Make selecting "In your repositories" reset selection as passing IDs of repos belonging to other profiles causes breakage * Remove unnecessary (with multi-selection enable) code * Drop repo from repo map and total count if permission denied * Remove extra parenthesis * make template work again * find bug! * forgot the '#' at bugfixing * delete unused RepoID * compile regex only one time * make fmt * local variable = capital letter lower * check if repos query pattern is correct * pagination remove last , - make regex work again * use Replace instead of ReplaceAll; del delete * fix test * how did this test binary got in?!? dont forgot the "-p" at git add * ! * dont replace -> cut fisrt & last string Co-Authored-By: zeripath <art27@cantab.net> * jet another regex dont mind as long as it has the same result and is performatn ... Co-Authored-By: zeripath <art27@cantab.net> * dont use nonexisting repo for test * exclude /issues?type=created_by from test * add table to querys use same syntax in each query (table.colum) * add new issue for test * dont make a workaround or something else this need a refactor itself and is out of scope for this PR * fix misspell * CI.redo() * englisch txt update Co-Authored-By: zeripath <art27@cantab.net> * add sugestions * Tweak & Fix * CI.restart()
5 years ago
8 years ago
API add/generalize pagination (#9452) * paginate results * fixed deadlock * prevented breaking change * updated swagger * go fmt * fixed find topic * go mod tidy * go mod vendor with go1.13.5 * fixed repo find topics * fixed unit test * added Limit method to Engine struct; use engine variable when provided; fixed gitignore * use ItemsPerPage for default pagesize; fix GetWatchers, getOrgUsersByOrgID and GetStargazers; fix GetAllCommits headers; reverted some changed behaviors * set Page value on Home route * improved memory allocations * fixed response headers * removed logfiles * fixed import order * import order * improved swagger * added function to get models.ListOptions from context * removed pagesize diff on unit test * fixed imports * removed unnecessary struct field * fixed go fmt * scoped PR * code improvements * code improvements * go mod tidy * fixed import order * fixed commit statuses session * fixed files headers * fixed headers; added pagination for notifications * go mod tidy * go fmt * removed Private from user search options; added setting.UI.IssuePagingNum as default valeu on repo's issues list * Apply suggestions from code review Co-Authored-By: 6543 <6543@obermui.de> Co-Authored-By: zeripath <art27@cantab.net> * fixed build error * CI.restart() * fixed merge conflicts resolve * fixed conflicts resolve * improved FindTrackedTimesOptions.ToOptions() method * added backwards compatibility on ListReleases request; fixed issue tracked time ToSession * fixed build error; fixed swagger template * fixed swagger template * fixed ListReleases backwards compatibility * added page to user search route Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
5 years ago
10 years ago
10 years ago
10 years ago
10 years ago
API add/generalize pagination (#9452) * paginate results * fixed deadlock * prevented breaking change * updated swagger * go fmt * fixed find topic * go mod tidy * go mod vendor with go1.13.5 * fixed repo find topics * fixed unit test * added Limit method to Engine struct; use engine variable when provided; fixed gitignore * use ItemsPerPage for default pagesize; fix GetWatchers, getOrgUsersByOrgID and GetStargazers; fix GetAllCommits headers; reverted some changed behaviors * set Page value on Home route * improved memory allocations * fixed response headers * removed logfiles * fixed import order * import order * improved swagger * added function to get models.ListOptions from context * removed pagesize diff on unit test * fixed imports * removed unnecessary struct field * fixed go fmt * scoped PR * code improvements * code improvements * go mod tidy * fixed import order * fixed commit statuses session * fixed files headers * fixed headers; added pagination for notifications * go mod tidy * go fmt * removed Private from user search options; added setting.UI.IssuePagingNum as default valeu on repo's issues list * Apply suggestions from code review Co-Authored-By: 6543 <6543@obermui.de> Co-Authored-By: zeripath <art27@cantab.net> * fixed build error * CI.restart() * fixed merge conflicts resolve * fixed conflicts resolve * improved FindTrackedTimesOptions.ToOptions() method * added backwards compatibility on ListReleases request; fixed issue tracked time ToSession * fixed build error; fixed swagger template * fixed swagger template * fixed ListReleases backwards compatibility * added page to user search route Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
5 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Copyright 2019 The Gitea Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package user
  6. import (
  7. "bytes"
  8. "encoding/json"
  9. "fmt"
  10. "regexp"
  11. "sort"
  12. "strconv"
  13. "strings"
  14. "code.gitea.io/gitea/models"
  15. "code.gitea.io/gitea/modules/base"
  16. "code.gitea.io/gitea/modules/context"
  17. issue_indexer "code.gitea.io/gitea/modules/indexer/issues"
  18. "code.gitea.io/gitea/modules/log"
  19. "code.gitea.io/gitea/modules/markup/markdown"
  20. "code.gitea.io/gitea/modules/modelarts"
  21. "code.gitea.io/gitea/modules/setting"
  22. "code.gitea.io/gitea/modules/util"
  23. "code.gitea.io/gitea/routers/repo"
  24. cloudbrainService "code.gitea.io/gitea/services/cloudbrain"
  25. issue_service "code.gitea.io/gitea/services/issue"
  26. pull_service "code.gitea.io/gitea/services/pull"
  27. "github.com/keybase/go-crypto/openpgp"
  28. "github.com/keybase/go-crypto/openpgp/armor"
  29. "xorm.io/builder"
  30. )
  31. const (
  32. tplDashboard base.TplName = "user/dashboard/dashboard"
  33. tplIssues base.TplName = "user/dashboard/issues"
  34. tplMilestones base.TplName = "user/dashboard/milestones"
  35. tplProfile base.TplName = "user/profile"
  36. tplCloudbrains base.TplName = "user/dashboard/cloudbrains"
  37. )
  38. // getDashboardContextUser finds out dashboard is viewing as which context user.
  39. func getDashboardContextUser(ctx *context.Context) *models.User {
  40. ctxUser := ctx.User
  41. orgName := ctx.Params(":org")
  42. if len(orgName) > 0 {
  43. // Organization.
  44. org, err := models.GetUserByName(orgName)
  45. if err != nil {
  46. if models.IsErrUserNotExist(err) {
  47. ctx.NotFound("GetUserByName", err)
  48. } else {
  49. ctx.ServerError("GetUserByName", err)
  50. }
  51. return nil
  52. }
  53. ctxUser = org
  54. }
  55. ctx.Data["ContextUser"] = ctxUser
  56. if err := ctx.User.GetOrganizations(&models.SearchOrganizationsOptions{All: true}); err != nil {
  57. ctx.ServerError("GetOrganizations", err)
  58. return nil
  59. }
  60. ctx.Data["Orgs"] = ctx.User.Orgs
  61. return ctxUser
  62. }
  63. // retrieveFeeds loads feeds for the specified user
  64. func retrieveFeeds(ctx *context.Context, options models.GetFeedsOptions) {
  65. actions, err := models.GetFeeds(options)
  66. if err != nil {
  67. ctx.ServerError("GetFeeds", err)
  68. return
  69. }
  70. userCache := map[int64]*models.User{options.RequestedUser.ID: options.RequestedUser}
  71. if ctx.User != nil {
  72. userCache[ctx.User.ID] = ctx.User
  73. }
  74. for _, act := range actions {
  75. if act.ActUser != nil {
  76. userCache[act.ActUserID] = act.ActUser
  77. }
  78. }
  79. for _, act := range actions {
  80. repoOwner, ok := userCache[act.Repo.OwnerID]
  81. if !ok {
  82. repoOwner, err = models.GetUserByID(act.Repo.OwnerID)
  83. if err != nil {
  84. if models.IsErrUserNotExist(err) {
  85. continue
  86. }
  87. ctx.ServerError("GetUserByID", err)
  88. return
  89. }
  90. userCache[repoOwner.ID] = repoOwner
  91. }
  92. act.Repo.Owner = repoOwner
  93. }
  94. ctx.Data["Feeds"] = actions
  95. }
  96. // Dashboard render the dashborad page
  97. func Dashboard(ctx *context.Context) {
  98. ctxUser := getDashboardContextUser(ctx)
  99. if ctx.Written() {
  100. return
  101. }
  102. ctx.Data["Title"] = ctxUser.DisplayName() + " - " + ctx.Tr("dashboard")
  103. ctx.Data["PageIsDashboard"] = true
  104. ctx.Data["PageIsNews"] = true
  105. ctx.Data["SearchLimit"] = setting.UI.User.RepoPagingNum
  106. ctx.Data["EnableHeatmap"] = setting.Service.EnableUserHeatmap
  107. ctx.Data["HeatmapUser"] = ctxUser.Name
  108. var err error
  109. var mirrors []*models.Repository
  110. if ctxUser.IsOrganization() {
  111. env, err := ctxUser.AccessibleReposEnv(ctx.User.ID)
  112. if err != nil {
  113. ctx.ServerError("AccessibleReposEnv", err)
  114. return
  115. }
  116. mirrors, err = env.MirrorRepos()
  117. if err != nil {
  118. ctx.ServerError("env.MirrorRepos", err)
  119. return
  120. }
  121. } else {
  122. mirrors, err = ctxUser.GetMirrorRepositories()
  123. if err != nil {
  124. ctx.ServerError("GetMirrorRepositories", err)
  125. return
  126. }
  127. }
  128. ctx.Data["MaxShowRepoNum"] = setting.UI.User.RepoPagingNum
  129. if err := models.MirrorRepositoryList(mirrors).LoadAttributes(); err != nil {
  130. ctx.ServerError("MirrorRepositoryList.LoadAttributes", err)
  131. return
  132. }
  133. ctx.Data["MirrorCount"] = len(mirrors)
  134. ctx.Data["Mirrors"] = mirrors
  135. retrieveFeeds(ctx, models.GetFeedsOptions{
  136. RequestedUser: ctxUser,
  137. Actor: ctx.User,
  138. IncludePrivate: true,
  139. OnlyPerformedBy: false,
  140. IncludeDeleted: false,
  141. })
  142. if ctx.Written() {
  143. return
  144. }
  145. ctx.HTML(200, tplDashboard)
  146. }
  147. // Milestones render the user milestones page
  148. func Milestones(ctx *context.Context) {
  149. if models.UnitTypeIssues.UnitGlobalDisabled() && models.UnitTypePullRequests.UnitGlobalDisabled() {
  150. log.Debug("Milestones overview page not available as both issues and pull requests are globally disabled")
  151. ctx.Status(404)
  152. return
  153. }
  154. ctx.Data["Title"] = ctx.Tr("milestones")
  155. ctx.Data["PageIsMilestonesDashboard"] = true
  156. ctxUser := getDashboardContextUser(ctx)
  157. if ctx.Written() {
  158. return
  159. }
  160. var (
  161. repoOpts = models.SearchRepoOptions{
  162. Actor: ctxUser,
  163. OwnerID: ctxUser.ID,
  164. Private: true,
  165. AllPublic: false, // Include also all public repositories of users and public organisations
  166. AllLimited: false, // Include also all public repositories of limited organisations
  167. HasMilestones: util.OptionalBoolTrue, // Just needs display repos has milestones
  168. }
  169. userRepoCond = models.SearchRepositoryCondition(&repoOpts) // all repo condition user could visit
  170. repoCond = userRepoCond
  171. repoIDs []int64
  172. reposQuery = ctx.Query("repos")
  173. isShowClosed = ctx.Query("state") == "closed"
  174. sortType = ctx.Query("sort")
  175. page = ctx.QueryInt("page")
  176. )
  177. if page <= 1 {
  178. page = 1
  179. }
  180. if len(reposQuery) != 0 {
  181. if issueReposQueryPattern.MatchString(reposQuery) {
  182. // remove "[" and "]" from string
  183. reposQuery = reposQuery[1 : len(reposQuery)-1]
  184. //for each ID (delimiter ",") add to int to repoIDs
  185. for _, rID := range strings.Split(reposQuery, ",") {
  186. // Ensure nonempty string entries
  187. if rID != "" && rID != "0" {
  188. rIDint64, err := strconv.ParseInt(rID, 10, 64)
  189. // If the repo id specified by query is not parseable or not accessible by user, just ignore it.
  190. if err == nil {
  191. repoIDs = append(repoIDs, rIDint64)
  192. }
  193. }
  194. }
  195. if len(repoIDs) > 0 {
  196. // Don't just let repoCond = builder.In("id", repoIDs) because user may has no permission on repoIDs
  197. // But the original repoCond has a limitation
  198. repoCond = repoCond.And(builder.In("id", repoIDs))
  199. }
  200. } else {
  201. log.Warn("issueReposQueryPattern not match with query")
  202. }
  203. }
  204. counts, err := models.CountMilestonesByRepoCond(userRepoCond, isShowClosed)
  205. if err != nil {
  206. ctx.ServerError("CountMilestonesByRepoIDs", err)
  207. return
  208. }
  209. milestones, err := models.SearchMilestones(repoCond, page, isShowClosed, sortType)
  210. if err != nil {
  211. ctx.ServerError("GetMilestonesByRepoIDs", err)
  212. return
  213. }
  214. showRepos, _, err := models.SearchRepositoryByCondition(&repoOpts, userRepoCond, false)
  215. if err != nil {
  216. ctx.ServerError("SearchRepositoryByCondition", err)
  217. return
  218. }
  219. sort.Sort(showRepos)
  220. for i := 0; i < len(milestones); {
  221. for _, repo := range showRepos {
  222. if milestones[i].RepoID == repo.ID {
  223. milestones[i].Repo = repo
  224. break
  225. }
  226. }
  227. if milestones[i].Repo == nil {
  228. log.Warn("Cannot find milestone %d 's repository %d", milestones[i].ID, milestones[i].RepoID)
  229. milestones = append(milestones[:i], milestones[i+1:]...)
  230. continue
  231. }
  232. milestones[i].RenderedContent = string(markdown.Render([]byte(milestones[i].Content), milestones[i].Repo.Link(), milestones[i].Repo.ComposeMetas()))
  233. if milestones[i].Repo.IsTimetrackerEnabled() {
  234. err := milestones[i].LoadTotalTrackedTime()
  235. if err != nil {
  236. ctx.ServerError("LoadTotalTrackedTime", err)
  237. return
  238. }
  239. }
  240. i++
  241. }
  242. milestoneStats, err := models.GetMilestonesStatsByRepoCond(repoCond)
  243. if err != nil {
  244. ctx.ServerError("GetMilestoneStats", err)
  245. return
  246. }
  247. var totalMilestoneStats *models.MilestonesStats
  248. if len(repoIDs) == 0 {
  249. totalMilestoneStats = milestoneStats
  250. } else {
  251. totalMilestoneStats, err = models.GetMilestonesStatsByRepoCond(userRepoCond)
  252. if err != nil {
  253. ctx.ServerError("GetMilestoneStats", err)
  254. return
  255. }
  256. }
  257. var pagerCount int
  258. if isShowClosed {
  259. ctx.Data["State"] = "closed"
  260. ctx.Data["Total"] = totalMilestoneStats.ClosedCount
  261. pagerCount = int(milestoneStats.ClosedCount)
  262. } else {
  263. ctx.Data["State"] = "open"
  264. ctx.Data["Total"] = totalMilestoneStats.OpenCount
  265. pagerCount = int(milestoneStats.OpenCount)
  266. }
  267. ctx.Data["Milestones"] = milestones
  268. ctx.Data["Repos"] = showRepos
  269. ctx.Data["Counts"] = counts
  270. ctx.Data["MilestoneStats"] = milestoneStats
  271. ctx.Data["SortType"] = sortType
  272. if milestoneStats.Total() != totalMilestoneStats.Total() {
  273. ctx.Data["RepoIDs"] = repoIDs
  274. }
  275. ctx.Data["IsShowClosed"] = isShowClosed
  276. pager := context.NewPagination(pagerCount, setting.UI.IssuePagingNum, page, 5)
  277. pager.AddParam(ctx, "repos", "RepoIDs")
  278. pager.AddParam(ctx, "sort", "SortType")
  279. pager.AddParam(ctx, "state", "State")
  280. ctx.Data["Page"] = pager
  281. ctx.HTML(200, tplMilestones)
  282. }
  283. // Regexp for repos query
  284. var issueReposQueryPattern = regexp.MustCompile(`^\[\d+(,\d+)*,?\]$`)
  285. // Issues render the user issues page
  286. func Issues(ctx *context.Context) {
  287. isPullList := ctx.Params(":type") == "pulls"
  288. unitType := models.UnitTypeIssues
  289. if isPullList {
  290. if models.UnitTypePullRequests.UnitGlobalDisabled() {
  291. log.Debug("Pull request overview page not available as it is globally disabled.")
  292. ctx.Status(404)
  293. return
  294. }
  295. ctx.Data["Title"] = ctx.Tr("pull_requests")
  296. ctx.Data["PageIsPulls"] = true
  297. unitType = models.UnitTypePullRequests
  298. } else {
  299. if models.UnitTypeIssues.UnitGlobalDisabled() {
  300. log.Debug("Issues overview page not available as it is globally disabled.")
  301. ctx.Status(404)
  302. return
  303. }
  304. ctx.Data["Title"] = ctx.Tr("issues")
  305. ctx.Data["PageIsIssues"] = true
  306. }
  307. ctxUser := getDashboardContextUser(ctx)
  308. if ctx.Written() {
  309. return
  310. }
  311. // Organization does not have view type and filter mode.
  312. var (
  313. viewType string
  314. sortType = ctx.Query("sort")
  315. filterMode = models.FilterModeAll
  316. )
  317. if ctxUser.IsOrganization() {
  318. viewType = "your_repositories"
  319. } else {
  320. viewType = ctx.Query("type")
  321. switch viewType {
  322. case "assigned":
  323. filterMode = models.FilterModeAssign
  324. case "created_by":
  325. filterMode = models.FilterModeCreate
  326. case "mentioned":
  327. filterMode = models.FilterModeMention
  328. case "your_repositories": // filterMode already set to All
  329. default:
  330. viewType = "your_repositories"
  331. }
  332. }
  333. page := ctx.QueryInt("page")
  334. if page <= 1 {
  335. page = 1
  336. }
  337. reposQuery := ctx.Query("repos")
  338. var repoIDs []int64
  339. if len(reposQuery) != 0 {
  340. if issueReposQueryPattern.MatchString(reposQuery) {
  341. // remove "[" and "]" from string
  342. reposQuery = reposQuery[1 : len(reposQuery)-1]
  343. //for each ID (delimiter ",") add to int to repoIDs
  344. for _, rID := range strings.Split(reposQuery, ",") {
  345. // Ensure nonempty string entries
  346. if rID != "" && rID != "0" {
  347. rIDint64, err := strconv.ParseInt(rID, 10, 64)
  348. if err == nil {
  349. repoIDs = append(repoIDs, rIDint64)
  350. }
  351. }
  352. }
  353. } else {
  354. log.Warn("issueReposQueryPattern not match with query")
  355. }
  356. }
  357. isShowClosed := ctx.Query("state") == "closed"
  358. // Get repositories.
  359. var err error
  360. var userRepoIDs []int64
  361. if ctxUser.IsOrganization() {
  362. env, err := ctxUser.AccessibleReposEnv(ctx.User.ID)
  363. if err != nil {
  364. ctx.ServerError("AccessibleReposEnv", err)
  365. return
  366. }
  367. userRepoIDs, err = env.RepoIDs(1, ctxUser.NumRepos)
  368. if err != nil {
  369. ctx.ServerError("env.RepoIDs", err)
  370. return
  371. }
  372. userRepoIDs, err = models.FilterOutRepoIdsWithoutUnitAccess(ctx.User, userRepoIDs, unitType)
  373. if err != nil {
  374. ctx.ServerError("FilterOutRepoIdsWithoutUnitAccess", err)
  375. return
  376. }
  377. } else {
  378. userRepoIDs, err = ctxUser.GetAccessRepoIDs(unitType)
  379. if err != nil {
  380. ctx.ServerError("ctxUser.GetAccessRepoIDs", err)
  381. return
  382. }
  383. }
  384. if len(userRepoIDs) == 0 {
  385. userRepoIDs = []int64{-1}
  386. }
  387. opts := &models.IssuesOptions{
  388. IsPull: util.OptionalBoolOf(isPullList),
  389. SortType: sortType,
  390. }
  391. switch filterMode {
  392. case models.FilterModeAll:
  393. opts.RepoIDs = userRepoIDs
  394. case models.FilterModeAssign:
  395. opts.AssigneeID = ctxUser.ID
  396. case models.FilterModeCreate:
  397. opts.PosterID = ctxUser.ID
  398. case models.FilterModeMention:
  399. opts.MentionedID = ctxUser.ID
  400. }
  401. var forceEmpty bool
  402. var issueIDsFromSearch []int64
  403. var keyword = strings.Trim(ctx.Query("q"), " ")
  404. if len(keyword) > 0 {
  405. searchRepoIDs, err := models.GetRepoIDsForIssuesOptions(opts, ctxUser)
  406. if err != nil {
  407. ctx.ServerError("GetRepoIDsForIssuesOptions", err)
  408. return
  409. }
  410. issueIDsFromSearch, err = issue_indexer.SearchIssuesByKeyword(searchRepoIDs, keyword)
  411. if err != nil {
  412. ctx.ServerError("SearchIssuesByKeyword", err)
  413. return
  414. }
  415. if len(issueIDsFromSearch) > 0 {
  416. opts.IssueIDs = issueIDsFromSearch
  417. } else {
  418. forceEmpty = true
  419. }
  420. }
  421. ctx.Data["Keyword"] = keyword
  422. opts.IsClosed = util.OptionalBoolOf(isShowClosed)
  423. var counts map[int64]int64
  424. if !forceEmpty {
  425. counts, err = models.CountIssuesByRepo(opts)
  426. if err != nil {
  427. ctx.ServerError("CountIssuesByRepo", err)
  428. return
  429. }
  430. }
  431. opts.Page = page
  432. opts.PageSize = setting.UI.IssuePagingNum
  433. var labelIDs []int64
  434. selectLabels := ctx.Query("labels")
  435. if len(selectLabels) > 0 && selectLabels != "0" {
  436. labelIDs, err = base.StringsToInt64s(strings.Split(selectLabels, ","))
  437. if err != nil {
  438. ctx.ServerError("StringsToInt64s", err)
  439. return
  440. }
  441. }
  442. opts.LabelIDs = labelIDs
  443. if len(repoIDs) > 0 {
  444. opts.RepoIDs = repoIDs
  445. }
  446. var issues []*models.Issue
  447. if !forceEmpty {
  448. issues, err = models.Issues(opts)
  449. if err != nil {
  450. ctx.ServerError("Issues", err)
  451. return
  452. }
  453. } else {
  454. issues = []*models.Issue{}
  455. }
  456. approvalCounts, err := models.IssueList(issues).GetApprovalCounts()
  457. if err != nil {
  458. ctx.ServerError("ApprovalCounts", err)
  459. return
  460. }
  461. showReposMap := make(map[int64]*models.Repository, len(counts))
  462. for repoID := range counts {
  463. if repoID > 0 {
  464. if _, ok := showReposMap[repoID]; !ok {
  465. repo, err := models.GetRepositoryByID(repoID)
  466. if models.IsErrRepoNotExist(err) {
  467. ctx.NotFound("GetRepositoryByID", err)
  468. return
  469. } else if err != nil {
  470. ctx.ServerError("GetRepositoryByID", fmt.Errorf("[%d]%v", repoID, err))
  471. return
  472. }
  473. showReposMap[repoID] = repo
  474. }
  475. repo := showReposMap[repoID]
  476. // Check if user has access to given repository.
  477. perm, err := models.GetUserRepoPermission(repo, ctxUser)
  478. if err != nil {
  479. ctx.ServerError("GetUserRepoPermission", fmt.Errorf("[%d]%v", repoID, err))
  480. return
  481. }
  482. if !perm.CanRead(models.UnitTypeIssues) {
  483. log.Error("User created Issues in Repository which they no longer have access to: [%d]", repoID)
  484. }
  485. }
  486. }
  487. showRepos := models.RepositoryListOfMap(showReposMap)
  488. sort.Sort(showRepos)
  489. if err = showRepos.LoadAttributes(); err != nil {
  490. ctx.ServerError("LoadAttributes", err)
  491. return
  492. }
  493. var commitStatus = make(map[int64]*models.CommitStatus, len(issues))
  494. for _, issue := range issues {
  495. issue.Repo = showReposMap[issue.RepoID]
  496. if isPullList {
  497. commitStatus[issue.PullRequest.ID], _ = pull_service.GetLastCommitStatus(issue.PullRequest)
  498. }
  499. }
  500. userIssueStatsOpts := models.UserIssueStatsOptions{
  501. UserID: ctxUser.ID,
  502. UserRepoIDs: userRepoIDs,
  503. FilterMode: filterMode,
  504. IsPull: isPullList,
  505. IsClosed: isShowClosed,
  506. }
  507. if len(repoIDs) > 0 {
  508. userIssueStatsOpts.UserRepoIDs = repoIDs
  509. }
  510. userIssueStats, err := models.GetUserIssueStats(userIssueStatsOpts)
  511. if err != nil {
  512. ctx.ServerError("GetUserIssueStats User", err)
  513. return
  514. }
  515. var shownIssueStats *models.IssueStats
  516. if !forceEmpty {
  517. statsOpts := models.UserIssueStatsOptions{
  518. UserID: ctxUser.ID,
  519. UserRepoIDs: userRepoIDs,
  520. FilterMode: filterMode,
  521. IsPull: isPullList,
  522. IsClosed: isShowClosed,
  523. IssueIDs: issueIDsFromSearch,
  524. }
  525. if len(repoIDs) > 0 {
  526. statsOpts.RepoIDs = repoIDs
  527. }
  528. shownIssueStats, err = models.GetUserIssueStats(statsOpts)
  529. if err != nil {
  530. ctx.ServerError("GetUserIssueStats Shown", err)
  531. return
  532. }
  533. } else {
  534. shownIssueStats = &models.IssueStats{}
  535. }
  536. var allIssueStats *models.IssueStats
  537. if !forceEmpty {
  538. allIssueStats, err = models.GetUserIssueStats(models.UserIssueStatsOptions{
  539. UserID: ctxUser.ID,
  540. UserRepoIDs: userRepoIDs,
  541. FilterMode: filterMode,
  542. IsPull: isPullList,
  543. IsClosed: isShowClosed,
  544. IssueIDs: issueIDsFromSearch,
  545. })
  546. if err != nil {
  547. ctx.ServerError("GetUserIssueStats All", err)
  548. return
  549. }
  550. } else {
  551. allIssueStats = &models.IssueStats{}
  552. }
  553. var shownIssues int
  554. var totalIssues int
  555. if !isShowClosed {
  556. shownIssues = int(shownIssueStats.OpenCount)
  557. totalIssues = int(allIssueStats.OpenCount)
  558. } else {
  559. shownIssues = int(shownIssueStats.ClosedCount)
  560. totalIssues = int(allIssueStats.ClosedCount)
  561. }
  562. ctx.Data["IssueRefEndNames"], ctx.Data["IssueRefURLs"] =
  563. issue_service.GetRefEndNamesAndURLs(issues, ctx.Query("RepoLink"))
  564. ctx.Data["Issues"] = issues
  565. ctx.Data["ApprovalCounts"] = func(issueID int64, typ string) int64 {
  566. counts, ok := approvalCounts[issueID]
  567. if !ok || len(counts) == 0 {
  568. return 0
  569. }
  570. reviewTyp := models.ReviewTypeApprove
  571. if typ == "reject" {
  572. reviewTyp = models.ReviewTypeReject
  573. } else if typ == "waiting" {
  574. reviewTyp = models.ReviewTypeRequest
  575. }
  576. for _, count := range counts {
  577. if count.Type == reviewTyp {
  578. return count.Count
  579. }
  580. }
  581. return 0
  582. }
  583. ctx.Data["CommitStatus"] = commitStatus
  584. ctx.Data["Repos"] = showRepos
  585. ctx.Data["Counts"] = counts
  586. ctx.Data["IssueStats"] = userIssueStats
  587. ctx.Data["ShownIssueStats"] = shownIssueStats
  588. ctx.Data["ViewType"] = viewType
  589. ctx.Data["SortType"] = sortType
  590. ctx.Data["RepoIDs"] = repoIDs
  591. ctx.Data["IsShowClosed"] = isShowClosed
  592. ctx.Data["TotalIssueCount"] = totalIssues
  593. if isShowClosed {
  594. ctx.Data["State"] = "closed"
  595. } else {
  596. ctx.Data["State"] = "open"
  597. }
  598. // Convert []int64 to string
  599. reposParam, _ := json.Marshal(repoIDs)
  600. ctx.Data["ReposParam"] = string(reposParam)
  601. pager := context.NewPagination(shownIssues, setting.UI.IssuePagingNum, page, 5)
  602. pager.AddParam(ctx, "q", "Keyword")
  603. pager.AddParam(ctx, "type", "ViewType")
  604. pager.AddParam(ctx, "repos", "ReposParam")
  605. pager.AddParam(ctx, "sort", "SortType")
  606. pager.AddParam(ctx, "state", "State")
  607. pager.AddParam(ctx, "labels", "SelectLabels")
  608. pager.AddParam(ctx, "milestone", "MilestoneID")
  609. pager.AddParam(ctx, "assignee", "AssigneeID")
  610. ctx.Data["Page"] = pager
  611. ctx.HTML(200, tplIssues)
  612. }
  613. // ShowSSHKeys output all the ssh keys of user by uid
  614. func ShowSSHKeys(ctx *context.Context, uid int64) {
  615. keys, err := models.ListPublicKeys(uid, models.ListOptions{})
  616. if err != nil {
  617. ctx.ServerError("ListPublicKeys", err)
  618. return
  619. }
  620. var buf bytes.Buffer
  621. for i := range keys {
  622. buf.WriteString(keys[i].OmitEmail())
  623. buf.WriteString("\n")
  624. }
  625. ctx.PlainText(200, buf.Bytes())
  626. }
  627. // ShowGPGKeys output all the public GPG keys of user by uid
  628. func ShowGPGKeys(ctx *context.Context, uid int64) {
  629. keys, err := models.ListGPGKeys(uid, models.ListOptions{})
  630. if err != nil {
  631. ctx.ServerError("ListGPGKeys", err)
  632. return
  633. }
  634. entities := make([]*openpgp.Entity, 0)
  635. failedEntitiesID := make([]string, 0)
  636. for _, k := range keys {
  637. e, err := models.GPGKeyToEntity(k)
  638. if err != nil {
  639. if models.IsErrGPGKeyImportNotExist(err) {
  640. failedEntitiesID = append(failedEntitiesID, k.KeyID)
  641. continue //Skip previous import without backup of imported armored key
  642. }
  643. ctx.ServerError("ShowGPGKeys", err)
  644. return
  645. }
  646. entities = append(entities, e)
  647. }
  648. var buf bytes.Buffer
  649. headers := make(map[string]string)
  650. if len(failedEntitiesID) > 0 { //If some key need re-import to be exported
  651. headers["Note"] = fmt.Sprintf("The keys with the following IDs couldn't be exported and need to be reuploaded %s", strings.Join(failedEntitiesID, ", "))
  652. }
  653. writer, _ := armor.Encode(&buf, "PGP PUBLIC KEY BLOCK", headers)
  654. for _, e := range entities {
  655. err = e.Serialize(writer) //TODO find why key are exported with a different cipherTypeByte as original (should not be blocking but strange)
  656. if err != nil {
  657. ctx.ServerError("ShowGPGKeys", err)
  658. return
  659. }
  660. }
  661. writer.Close()
  662. ctx.PlainText(200, buf.Bytes())
  663. }
  664. // Email2User show user page via email
  665. func Email2User(ctx *context.Context) {
  666. u, err := models.GetUserByEmail(ctx.Query("email"))
  667. if err != nil {
  668. if models.IsErrUserNotExist(err) {
  669. ctx.NotFound("GetUserByEmail", err)
  670. } else {
  671. ctx.ServerError("GetUserByEmail", err)
  672. }
  673. return
  674. }
  675. ctx.Redirect(setting.AppSubURL + "/user/" + u.Name)
  676. }
  677. func Cloudbrains(ctx *context.Context) {
  678. ctx.Data["Title"] = ctx.Tr("user.cloudbrains")
  679. listType := ctx.Query("listType")
  680. jobType := ctx.Query("jobType")
  681. jobStatus := ctx.Query("jobStatus")
  682. aiCenter := ctx.Query("aiCenter")
  683. cluster := ctx.Query("cluster")
  684. ctx.Data["ListType"] = listType
  685. ctx.Data["JobType"] = jobType
  686. ctx.Data["JobStatus"] = jobStatus
  687. ctx.Data["aiCenter"] = aiCenter
  688. ctx.Data["cluster"] = cluster
  689. page := ctx.QueryInt("page")
  690. if page <= 0 {
  691. page = 1
  692. }
  693. var jobTypes []string
  694. jobTypeNot := false
  695. if jobType == string(models.JobTypeBenchmark) {
  696. jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeModelSafety), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet), string(models.JobTypeSnn4Ecoset))
  697. } else if jobType != "all" && jobType != "" {
  698. jobTypes = append(jobTypes, jobType)
  699. }
  700. var jobStatuses []string
  701. jobStatusNot := false
  702. if jobStatus == "other" {
  703. jobStatusNot = true
  704. jobStatuses = append(jobStatuses, string(models.ModelArtsTrainJobWaiting), string(models.ModelArtsTrainJobFailed), string(models.ModelArtsRunning), string(models.ModelArtsTrainJobCompleted),
  705. string(models.ModelArtsStarting), string(models.ModelArtsRestarting), string(models.ModelArtsStartFailed),
  706. string(models.ModelArtsStopping), string(models.ModelArtsStopped), string(models.JobSucceeded))
  707. } else if jobStatus != "all" && jobStatus != "" {
  708. jobStatuses = append(jobStatuses, jobStatus)
  709. }
  710. keyword := strings.Trim(ctx.Query("q"), " ")
  711. ctxUser := getDashboardContextUser(ctx)
  712. if ctx.Written() {
  713. return
  714. }
  715. repos, _, err := models.SearchRepository(&models.SearchRepoOptions{
  716. Actor: ctx.User,
  717. OwnerID: ctxUser.ID,
  718. Private: true,
  719. })
  720. if err != nil {
  721. ctx.ServerError("SearchRepository", err)
  722. return
  723. }
  724. var repoIDList []int64
  725. for i, _ := range repos {
  726. repoIDList = append(repoIDList, repos[i].ID)
  727. }
  728. ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{
  729. ListOptions: models.ListOptions{
  730. Page: page,
  731. PageSize: setting.UI.IssuePagingNum,
  732. },
  733. Keyword: keyword,
  734. UserID: ctxUser.ID,
  735. JobTypeNot: jobTypeNot,
  736. JobStatusNot: jobStatusNot,
  737. JobStatus: jobStatuses,
  738. JobTypes: jobTypes,
  739. NeedRepoInfo: true,
  740. IsLatestVersion: modelarts.IsLatestVersion,
  741. RepoIDList: repoIDList,
  742. ComputeResource: listType,
  743. Type: models.TypeCloudBrainAll,
  744. AiCenter: aiCenter,
  745. Cluster: cluster,
  746. })
  747. if err != nil {
  748. ctx.ServerError("Get job failed:", err)
  749. return
  750. }
  751. models.LoadSpecs4CloudbrainInfo(ciTasks)
  752. for i, _ := range ciTasks {
  753. ciTasks[i] = cloudbrainService.UpdateCloudbrainAiCenter(ciTasks[i])
  754. ciTasks[i].Cloudbrain.AiCenter = repo.GetAiCenterNameByCode(ciTasks[i].Cloudbrain.AiCenter, ctx.Language())
  755. ciTasks[i].CanDebug = true
  756. ciTasks[i].CanDel = true
  757. ciTasks[i].Cloudbrain.ComputeResource = ciTasks[i].ComputeResource
  758. if ciTasks[i].Cloudbrain.Spec != nil {
  759. if ciTasks[i].Cloudbrain.Type == models.TypeC2Net {
  760. ciTasks[i].Cloudbrain.Spec.Cluster = models.C2NetCluster
  761. } else {
  762. ciTasks[i].Cloudbrain.Spec.Cluster = models.OpenICluster
  763. }
  764. }
  765. }
  766. pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum))
  767. pager.SetDefaultParams(ctx)
  768. pager.AddParam(ctx, "listType", "ListType")
  769. ctx.Data["Page"] = pager
  770. ctx.Data["PageIsUserCloudBrain"] = true
  771. ctx.Data["Tasks"] = ciTasks
  772. ctx.Data["CanCreate"] = true
  773. ctx.Data["Keyword"] = keyword
  774. ctx.HTML(200, tplCloudbrains)
  775. }
  776. func getTotalPage(total int64, pageSize int) int {
  777. another := 0
  778. if int(total)%pageSize != 0 {
  779. another = 1
  780. }
  781. return int(total)/pageSize + another
  782. }