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

11 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()
6 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()
6 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()
6 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
3 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
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
9 years ago
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()
6 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()
6 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()
6 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()
6 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()
6 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()
6 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()
6 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()
6 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()
6 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()
6 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()
6 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()
6 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()
6 years ago
9 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
11 years ago
11 years ago
11 years ago
11 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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869
  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. issue_service "code.gitea.io/gitea/services/issue"
  25. pull_service "code.gitea.io/gitea/services/pull"
  26. "github.com/keybase/go-crypto/openpgp"
  27. "github.com/keybase/go-crypto/openpgp/armor"
  28. "xorm.io/builder"
  29. )
  30. const (
  31. tplDashboard base.TplName = "user/dashboard/dashboard"
  32. tplIssues base.TplName = "user/dashboard/issues"
  33. tplMilestones base.TplName = "user/dashboard/milestones"
  34. tplProfile base.TplName = "user/profile"
  35. tplCloudbrains base.TplName = "user/dashboard/cloudbrains"
  36. )
  37. // getDashboardContextUser finds out dashboard is viewing as which context user.
  38. func getDashboardContextUser(ctx *context.Context) *models.User {
  39. ctxUser := ctx.User
  40. orgName := ctx.Params(":org")
  41. if len(orgName) > 0 {
  42. // Organization.
  43. org, err := models.GetUserByName(orgName)
  44. if err != nil {
  45. if models.IsErrUserNotExist(err) {
  46. ctx.NotFound("GetUserByName", err)
  47. } else {
  48. ctx.ServerError("GetUserByName", err)
  49. }
  50. return nil
  51. }
  52. ctxUser = org
  53. }
  54. ctx.Data["ContextUser"] = ctxUser
  55. if err := ctx.User.GetOrganizations(&models.SearchOrganizationsOptions{All: true}); err != nil {
  56. ctx.ServerError("GetOrganizations", err)
  57. return nil
  58. }
  59. ctx.Data["Orgs"] = ctx.User.Orgs
  60. return ctxUser
  61. }
  62. // retrieveFeeds loads feeds for the specified user
  63. func retrieveFeeds(ctx *context.Context, options models.GetFeedsOptions) {
  64. actions, err := models.GetFeeds(options)
  65. if err != nil {
  66. ctx.ServerError("GetFeeds", err)
  67. return
  68. }
  69. userCache := map[int64]*models.User{options.RequestedUser.ID: options.RequestedUser}
  70. if ctx.User != nil {
  71. userCache[ctx.User.ID] = ctx.User
  72. }
  73. for _, act := range actions {
  74. if act.ActUser != nil {
  75. userCache[act.ActUserID] = act.ActUser
  76. }
  77. }
  78. for _, act := range actions {
  79. repoOwner, ok := userCache[act.Repo.OwnerID]
  80. if !ok {
  81. repoOwner, err = models.GetUserByID(act.Repo.OwnerID)
  82. if err != nil {
  83. if models.IsErrUserNotExist(err) {
  84. continue
  85. }
  86. ctx.ServerError("GetUserByID", err)
  87. return
  88. }
  89. userCache[repoOwner.ID] = repoOwner
  90. }
  91. act.Repo.Owner = repoOwner
  92. }
  93. ctx.Data["Feeds"] = actions
  94. }
  95. // Dashboard render the dashborad page
  96. func Dashboard(ctx *context.Context) {
  97. ctxUser := getDashboardContextUser(ctx)
  98. if ctx.Written() {
  99. return
  100. }
  101. ctx.Data["Title"] = ctxUser.DisplayName() + " - " + ctx.Tr("dashboard")
  102. ctx.Data["PageIsDashboard"] = true
  103. ctx.Data["PageIsNews"] = true
  104. ctx.Data["SearchLimit"] = setting.UI.User.RepoPagingNum
  105. ctx.Data["EnableHeatmap"] = setting.Service.EnableUserHeatmap
  106. ctx.Data["HeatmapUser"] = ctxUser.Name
  107. var err error
  108. var mirrors []*models.Repository
  109. if ctxUser.IsOrganization() {
  110. env, err := ctxUser.AccessibleReposEnv(ctx.User.ID)
  111. if err != nil {
  112. ctx.ServerError("AccessibleReposEnv", err)
  113. return
  114. }
  115. mirrors, err = env.MirrorRepos()
  116. if err != nil {
  117. ctx.ServerError("env.MirrorRepos", err)
  118. return
  119. }
  120. } else {
  121. mirrors, err = ctxUser.GetMirrorRepositories()
  122. if err != nil {
  123. ctx.ServerError("GetMirrorRepositories", err)
  124. return
  125. }
  126. }
  127. ctx.Data["MaxShowRepoNum"] = setting.UI.User.RepoPagingNum
  128. if err := models.MirrorRepositoryList(mirrors).LoadAttributes(); err != nil {
  129. ctx.ServerError("MirrorRepositoryList.LoadAttributes", err)
  130. return
  131. }
  132. ctx.Data["MirrorCount"] = len(mirrors)
  133. ctx.Data["Mirrors"] = mirrors
  134. retrieveFeeds(ctx, models.GetFeedsOptions{
  135. RequestedUser: ctxUser,
  136. Actor: ctx.User,
  137. IncludePrivate: true,
  138. OnlyPerformedBy: false,
  139. IncludeDeleted: false,
  140. })
  141. if ctx.Written() {
  142. return
  143. }
  144. ctx.HTML(200, tplDashboard)
  145. }
  146. // Milestones render the user milestones page
  147. func Milestones(ctx *context.Context) {
  148. if models.UnitTypeIssues.UnitGlobalDisabled() && models.UnitTypePullRequests.UnitGlobalDisabled() {
  149. log.Debug("Milestones overview page not available as both issues and pull requests are globally disabled")
  150. ctx.Status(404)
  151. return
  152. }
  153. ctx.Data["Title"] = ctx.Tr("milestones")
  154. ctx.Data["PageIsMilestonesDashboard"] = true
  155. ctxUser := getDashboardContextUser(ctx)
  156. if ctx.Written() {
  157. return
  158. }
  159. var (
  160. repoOpts = models.SearchRepoOptions{
  161. Actor: ctxUser,
  162. OwnerID: ctxUser.ID,
  163. Private: true,
  164. AllPublic: false, // Include also all public repositories of users and public organisations
  165. AllLimited: false, // Include also all public repositories of limited organisations
  166. HasMilestones: util.OptionalBoolTrue, // Just needs display repos has milestones
  167. }
  168. userRepoCond = models.SearchRepositoryCondition(&repoOpts) // all repo condition user could visit
  169. repoCond = userRepoCond
  170. repoIDs []int64
  171. reposQuery = ctx.Query("repos")
  172. isShowClosed = ctx.Query("state") == "closed"
  173. sortType = ctx.Query("sort")
  174. page = ctx.QueryInt("page")
  175. )
  176. if page <= 1 {
  177. page = 1
  178. }
  179. if len(reposQuery) != 0 {
  180. if issueReposQueryPattern.MatchString(reposQuery) {
  181. // remove "[" and "]" from string
  182. reposQuery = reposQuery[1 : len(reposQuery)-1]
  183. //for each ID (delimiter ",") add to int to repoIDs
  184. for _, rID := range strings.Split(reposQuery, ",") {
  185. // Ensure nonempty string entries
  186. if rID != "" && rID != "0" {
  187. rIDint64, err := strconv.ParseInt(rID, 10, 64)
  188. // If the repo id specified by query is not parseable or not accessible by user, just ignore it.
  189. if err == nil {
  190. repoIDs = append(repoIDs, rIDint64)
  191. }
  192. }
  193. }
  194. if len(repoIDs) > 0 {
  195. // Don't just let repoCond = builder.In("id", repoIDs) because user may has no permission on repoIDs
  196. // But the original repoCond has a limitation
  197. repoCond = repoCond.And(builder.In("id", repoIDs))
  198. }
  199. } else {
  200. log.Warn("issueReposQueryPattern not match with query")
  201. }
  202. }
  203. counts, err := models.CountMilestonesByRepoCond(userRepoCond, isShowClosed)
  204. if err != nil {
  205. ctx.ServerError("CountMilestonesByRepoIDs", err)
  206. return
  207. }
  208. milestones, err := models.SearchMilestones(repoCond, page, isShowClosed, sortType)
  209. if err != nil {
  210. ctx.ServerError("GetMilestonesByRepoIDs", err)
  211. return
  212. }
  213. showRepos, _, err := models.SearchRepositoryByCondition(&repoOpts, userRepoCond, false)
  214. if err != nil {
  215. ctx.ServerError("SearchRepositoryByCondition", err)
  216. return
  217. }
  218. sort.Sort(showRepos)
  219. for i := 0; i < len(milestones); {
  220. for _, repo := range showRepos {
  221. if milestones[i].RepoID == repo.ID {
  222. milestones[i].Repo = repo
  223. break
  224. }
  225. }
  226. if milestones[i].Repo == nil {
  227. log.Warn("Cannot find milestone %d 's repository %d", milestones[i].ID, milestones[i].RepoID)
  228. milestones = append(milestones[:i], milestones[i+1:]...)
  229. continue
  230. }
  231. milestones[i].RenderedContent = string(markdown.Render([]byte(milestones[i].Content), milestones[i].Repo.Link(), milestones[i].Repo.ComposeMetas()))
  232. if milestones[i].Repo.IsTimetrackerEnabled() {
  233. err := milestones[i].LoadTotalTrackedTime()
  234. if err != nil {
  235. ctx.ServerError("LoadTotalTrackedTime", err)
  236. return
  237. }
  238. }
  239. i++
  240. }
  241. milestoneStats, err := models.GetMilestonesStatsByRepoCond(repoCond)
  242. if err != nil {
  243. ctx.ServerError("GetMilestoneStats", err)
  244. return
  245. }
  246. var totalMilestoneStats *models.MilestonesStats
  247. if len(repoIDs) == 0 {
  248. totalMilestoneStats = milestoneStats
  249. } else {
  250. totalMilestoneStats, err = models.GetMilestonesStatsByRepoCond(userRepoCond)
  251. if err != nil {
  252. ctx.ServerError("GetMilestoneStats", err)
  253. return
  254. }
  255. }
  256. var pagerCount int
  257. if isShowClosed {
  258. ctx.Data["State"] = "closed"
  259. ctx.Data["Total"] = totalMilestoneStats.ClosedCount
  260. pagerCount = int(milestoneStats.ClosedCount)
  261. } else {
  262. ctx.Data["State"] = "open"
  263. ctx.Data["Total"] = totalMilestoneStats.OpenCount
  264. pagerCount = int(milestoneStats.OpenCount)
  265. }
  266. ctx.Data["Milestones"] = milestones
  267. ctx.Data["Repos"] = showRepos
  268. ctx.Data["Counts"] = counts
  269. ctx.Data["MilestoneStats"] = milestoneStats
  270. ctx.Data["SortType"] = sortType
  271. if milestoneStats.Total() != totalMilestoneStats.Total() {
  272. ctx.Data["RepoIDs"] = repoIDs
  273. }
  274. ctx.Data["IsShowClosed"] = isShowClosed
  275. pager := context.NewPagination(pagerCount, setting.UI.IssuePagingNum, page, 5)
  276. pager.AddParam(ctx, "repos", "RepoIDs")
  277. pager.AddParam(ctx, "sort", "SortType")
  278. pager.AddParam(ctx, "state", "State")
  279. ctx.Data["Page"] = pager
  280. ctx.HTML(200, tplMilestones)
  281. }
  282. // Regexp for repos query
  283. var issueReposQueryPattern = regexp.MustCompile(`^\[\d+(,\d+)*,?\]$`)
  284. // Issues render the user issues page
  285. func Issues(ctx *context.Context) {
  286. isPullList := ctx.Params(":type") == "pulls"
  287. unitType := models.UnitTypeIssues
  288. if isPullList {
  289. if models.UnitTypePullRequests.UnitGlobalDisabled() {
  290. log.Debug("Pull request overview page not available as it is globally disabled.")
  291. ctx.Status(404)
  292. return
  293. }
  294. ctx.Data["Title"] = ctx.Tr("pull_requests")
  295. ctx.Data["PageIsPulls"] = true
  296. unitType = models.UnitTypePullRequests
  297. } else {
  298. if models.UnitTypeIssues.UnitGlobalDisabled() {
  299. log.Debug("Issues overview page not available as it is globally disabled.")
  300. ctx.Status(404)
  301. return
  302. }
  303. ctx.Data["Title"] = ctx.Tr("issues")
  304. ctx.Data["PageIsIssues"] = true
  305. }
  306. ctxUser := getDashboardContextUser(ctx)
  307. if ctx.Written() {
  308. return
  309. }
  310. // Organization does not have view type and filter mode.
  311. var (
  312. viewType string
  313. sortType = ctx.Query("sort")
  314. filterMode = models.FilterModeAll
  315. )
  316. if ctxUser.IsOrganization() {
  317. viewType = "your_repositories"
  318. } else {
  319. viewType = ctx.Query("type")
  320. switch viewType {
  321. case "assigned":
  322. filterMode = models.FilterModeAssign
  323. case "created_by":
  324. filterMode = models.FilterModeCreate
  325. case "mentioned":
  326. filterMode = models.FilterModeMention
  327. case "your_repositories": // filterMode already set to All
  328. default:
  329. viewType = "your_repositories"
  330. }
  331. }
  332. page := ctx.QueryInt("page")
  333. if page <= 1 {
  334. page = 1
  335. }
  336. reposQuery := ctx.Query("repos")
  337. var repoIDs []int64
  338. if len(reposQuery) != 0 {
  339. if issueReposQueryPattern.MatchString(reposQuery) {
  340. // remove "[" and "]" from string
  341. reposQuery = reposQuery[1 : len(reposQuery)-1]
  342. //for each ID (delimiter ",") add to int to repoIDs
  343. for _, rID := range strings.Split(reposQuery, ",") {
  344. // Ensure nonempty string entries
  345. if rID != "" && rID != "0" {
  346. rIDint64, err := strconv.ParseInt(rID, 10, 64)
  347. if err == nil {
  348. repoIDs = append(repoIDs, rIDint64)
  349. }
  350. }
  351. }
  352. } else {
  353. log.Warn("issueReposQueryPattern not match with query")
  354. }
  355. }
  356. isShowClosed := ctx.Query("state") == "closed"
  357. // Get repositories.
  358. var err error
  359. var userRepoIDs []int64
  360. if ctxUser.IsOrganization() {
  361. env, err := ctxUser.AccessibleReposEnv(ctx.User.ID)
  362. if err != nil {
  363. ctx.ServerError("AccessibleReposEnv", err)
  364. return
  365. }
  366. userRepoIDs, err = env.RepoIDs(1, ctxUser.NumRepos)
  367. if err != nil {
  368. ctx.ServerError("env.RepoIDs", err)
  369. return
  370. }
  371. userRepoIDs, err = models.FilterOutRepoIdsWithoutUnitAccess(ctx.User, userRepoIDs, unitType)
  372. if err != nil {
  373. ctx.ServerError("FilterOutRepoIdsWithoutUnitAccess", err)
  374. return
  375. }
  376. } else {
  377. userRepoIDs, err = ctxUser.GetAccessRepoIDs(unitType)
  378. if err != nil {
  379. ctx.ServerError("ctxUser.GetAccessRepoIDs", err)
  380. return
  381. }
  382. }
  383. if len(userRepoIDs) == 0 {
  384. userRepoIDs = []int64{-1}
  385. }
  386. opts := &models.IssuesOptions{
  387. IsPull: util.OptionalBoolOf(isPullList),
  388. SortType: sortType,
  389. }
  390. switch filterMode {
  391. case models.FilterModeAll:
  392. opts.RepoIDs = userRepoIDs
  393. case models.FilterModeAssign:
  394. opts.AssigneeID = ctxUser.ID
  395. case models.FilterModeCreate:
  396. opts.PosterID = ctxUser.ID
  397. case models.FilterModeMention:
  398. opts.MentionedID = ctxUser.ID
  399. }
  400. var forceEmpty bool
  401. var issueIDsFromSearch []int64
  402. var keyword = strings.Trim(ctx.Query("q"), " ")
  403. if len(keyword) > 0 {
  404. searchRepoIDs, err := models.GetRepoIDsForIssuesOptions(opts, ctxUser)
  405. if err != nil {
  406. ctx.ServerError("GetRepoIDsForIssuesOptions", err)
  407. return
  408. }
  409. issueIDsFromSearch, err = issue_indexer.SearchIssuesByKeyword(searchRepoIDs, keyword)
  410. if err != nil {
  411. ctx.ServerError("SearchIssuesByKeyword", err)
  412. return
  413. }
  414. if len(issueIDsFromSearch) > 0 {
  415. opts.IssueIDs = issueIDsFromSearch
  416. } else {
  417. forceEmpty = true
  418. }
  419. }
  420. ctx.Data["Keyword"] = keyword
  421. opts.IsClosed = util.OptionalBoolOf(isShowClosed)
  422. var counts map[int64]int64
  423. if !forceEmpty {
  424. counts, err = models.CountIssuesByRepo(opts)
  425. if err != nil {
  426. ctx.ServerError("CountIssuesByRepo", err)
  427. return
  428. }
  429. }
  430. opts.Page = page
  431. opts.PageSize = setting.UI.IssuePagingNum
  432. var labelIDs []int64
  433. selectLabels := ctx.Query("labels")
  434. if len(selectLabels) > 0 && selectLabels != "0" {
  435. labelIDs, err = base.StringsToInt64s(strings.Split(selectLabels, ","))
  436. if err != nil {
  437. ctx.ServerError("StringsToInt64s", err)
  438. return
  439. }
  440. }
  441. opts.LabelIDs = labelIDs
  442. if len(repoIDs) > 0 {
  443. opts.RepoIDs = repoIDs
  444. }
  445. var issues []*models.Issue
  446. if !forceEmpty {
  447. issues, err = models.Issues(opts)
  448. if err != nil {
  449. ctx.ServerError("Issues", err)
  450. return
  451. }
  452. } else {
  453. issues = []*models.Issue{}
  454. }
  455. approvalCounts, err := models.IssueList(issues).GetApprovalCounts()
  456. if err != nil {
  457. ctx.ServerError("ApprovalCounts", err)
  458. return
  459. }
  460. showReposMap := make(map[int64]*models.Repository, len(counts))
  461. for repoID := range counts {
  462. if repoID > 0 {
  463. if _, ok := showReposMap[repoID]; !ok {
  464. repo, err := models.GetRepositoryByID(repoID)
  465. if models.IsErrRepoNotExist(err) {
  466. ctx.NotFound("GetRepositoryByID", err)
  467. return
  468. } else if err != nil {
  469. ctx.ServerError("GetRepositoryByID", fmt.Errorf("[%d]%v", repoID, err))
  470. return
  471. }
  472. showReposMap[repoID] = repo
  473. }
  474. repo := showReposMap[repoID]
  475. // Check if user has access to given repository.
  476. perm, err := models.GetUserRepoPermission(repo, ctxUser)
  477. if err != nil {
  478. ctx.ServerError("GetUserRepoPermission", fmt.Errorf("[%d]%v", repoID, err))
  479. return
  480. }
  481. if !perm.CanRead(models.UnitTypeIssues) {
  482. log.Error("User created Issues in Repository which they no longer have access to: [%d]", repoID)
  483. }
  484. }
  485. }
  486. showRepos := models.RepositoryListOfMap(showReposMap)
  487. sort.Sort(showRepos)
  488. if err = showRepos.LoadAttributes(); err != nil {
  489. ctx.ServerError("LoadAttributes", err)
  490. return
  491. }
  492. var commitStatus = make(map[int64]*models.CommitStatus, len(issues))
  493. for _, issue := range issues {
  494. issue.Repo = showReposMap[issue.RepoID]
  495. if isPullList {
  496. commitStatus[issue.PullRequest.ID], _ = pull_service.GetLastCommitStatus(issue.PullRequest)
  497. }
  498. }
  499. userIssueStatsOpts := models.UserIssueStatsOptions{
  500. UserID: ctxUser.ID,
  501. UserRepoIDs: userRepoIDs,
  502. FilterMode: filterMode,
  503. IsPull: isPullList,
  504. IsClosed: isShowClosed,
  505. }
  506. if len(repoIDs) > 0 {
  507. userIssueStatsOpts.UserRepoIDs = repoIDs
  508. }
  509. userIssueStats, err := models.GetUserIssueStats(userIssueStatsOpts)
  510. if err != nil {
  511. ctx.ServerError("GetUserIssueStats User", err)
  512. return
  513. }
  514. var shownIssueStats *models.IssueStats
  515. if !forceEmpty {
  516. statsOpts := models.UserIssueStatsOptions{
  517. UserID: ctxUser.ID,
  518. UserRepoIDs: userRepoIDs,
  519. FilterMode: filterMode,
  520. IsPull: isPullList,
  521. IsClosed: isShowClosed,
  522. IssueIDs: issueIDsFromSearch,
  523. }
  524. if len(repoIDs) > 0 {
  525. statsOpts.RepoIDs = repoIDs
  526. }
  527. shownIssueStats, err = models.GetUserIssueStats(statsOpts)
  528. if err != nil {
  529. ctx.ServerError("GetUserIssueStats Shown", err)
  530. return
  531. }
  532. } else {
  533. shownIssueStats = &models.IssueStats{}
  534. }
  535. var allIssueStats *models.IssueStats
  536. if !forceEmpty {
  537. allIssueStats, err = models.GetUserIssueStats(models.UserIssueStatsOptions{
  538. UserID: ctxUser.ID,
  539. UserRepoIDs: userRepoIDs,
  540. FilterMode: filterMode,
  541. IsPull: isPullList,
  542. IsClosed: isShowClosed,
  543. IssueIDs: issueIDsFromSearch,
  544. })
  545. if err != nil {
  546. ctx.ServerError("GetUserIssueStats All", err)
  547. return
  548. }
  549. } else {
  550. allIssueStats = &models.IssueStats{}
  551. }
  552. var shownIssues int
  553. var totalIssues int
  554. if !isShowClosed {
  555. shownIssues = int(shownIssueStats.OpenCount)
  556. totalIssues = int(allIssueStats.OpenCount)
  557. } else {
  558. shownIssues = int(shownIssueStats.ClosedCount)
  559. totalIssues = int(allIssueStats.ClosedCount)
  560. }
  561. ctx.Data["IssueRefEndNames"], ctx.Data["IssueRefURLs"] =
  562. issue_service.GetRefEndNamesAndURLs(issues, ctx.Query("RepoLink"))
  563. ctx.Data["Issues"] = issues
  564. ctx.Data["ApprovalCounts"] = func(issueID int64, typ string) int64 {
  565. counts, ok := approvalCounts[issueID]
  566. if !ok || len(counts) == 0 {
  567. return 0
  568. }
  569. reviewTyp := models.ReviewTypeApprove
  570. if typ == "reject" {
  571. reviewTyp = models.ReviewTypeReject
  572. } else if typ == "waiting" {
  573. reviewTyp = models.ReviewTypeRequest
  574. }
  575. for _, count := range counts {
  576. if count.Type == reviewTyp {
  577. return count.Count
  578. }
  579. }
  580. return 0
  581. }
  582. ctx.Data["CommitStatus"] = commitStatus
  583. ctx.Data["Repos"] = showRepos
  584. ctx.Data["Counts"] = counts
  585. ctx.Data["IssueStats"] = userIssueStats
  586. ctx.Data["ShownIssueStats"] = shownIssueStats
  587. ctx.Data["ViewType"] = viewType
  588. ctx.Data["SortType"] = sortType
  589. ctx.Data["RepoIDs"] = repoIDs
  590. ctx.Data["IsShowClosed"] = isShowClosed
  591. ctx.Data["TotalIssueCount"] = totalIssues
  592. if isShowClosed {
  593. ctx.Data["State"] = "closed"
  594. } else {
  595. ctx.Data["State"] = "open"
  596. }
  597. // Convert []int64 to string
  598. reposParam, _ := json.Marshal(repoIDs)
  599. ctx.Data["ReposParam"] = string(reposParam)
  600. pager := context.NewPagination(shownIssues, setting.UI.IssuePagingNum, page, 5)
  601. pager.AddParam(ctx, "q", "Keyword")
  602. pager.AddParam(ctx, "type", "ViewType")
  603. pager.AddParam(ctx, "repos", "ReposParam")
  604. pager.AddParam(ctx, "sort", "SortType")
  605. pager.AddParam(ctx, "state", "State")
  606. pager.AddParam(ctx, "labels", "SelectLabels")
  607. pager.AddParam(ctx, "milestone", "MilestoneID")
  608. pager.AddParam(ctx, "assignee", "AssigneeID")
  609. ctx.Data["Page"] = pager
  610. ctx.HTML(200, tplIssues)
  611. }
  612. // ShowSSHKeys output all the ssh keys of user by uid
  613. func ShowSSHKeys(ctx *context.Context, uid int64) {
  614. keys, err := models.ListPublicKeys(uid, models.ListOptions{})
  615. if err != nil {
  616. ctx.ServerError("ListPublicKeys", err)
  617. return
  618. }
  619. var buf bytes.Buffer
  620. for i := range keys {
  621. buf.WriteString(keys[i].OmitEmail())
  622. buf.WriteString("\n")
  623. }
  624. ctx.PlainText(200, buf.Bytes())
  625. }
  626. // ShowGPGKeys output all the public GPG keys of user by uid
  627. func ShowGPGKeys(ctx *context.Context, uid int64) {
  628. keys, err := models.ListGPGKeys(uid, models.ListOptions{})
  629. if err != nil {
  630. ctx.ServerError("ListGPGKeys", err)
  631. return
  632. }
  633. entities := make([]*openpgp.Entity, 0)
  634. failedEntitiesID := make([]string, 0)
  635. for _, k := range keys {
  636. e, err := models.GPGKeyToEntity(k)
  637. if err != nil {
  638. if models.IsErrGPGKeyImportNotExist(err) {
  639. failedEntitiesID = append(failedEntitiesID, k.KeyID)
  640. continue //Skip previous import without backup of imported armored key
  641. }
  642. ctx.ServerError("ShowGPGKeys", err)
  643. return
  644. }
  645. entities = append(entities, e)
  646. }
  647. var buf bytes.Buffer
  648. headers := make(map[string]string)
  649. if len(failedEntitiesID) > 0 { //If some key need re-import to be exported
  650. headers["Note"] = fmt.Sprintf("The keys with the following IDs couldn't be exported and need to be reuploaded %s", strings.Join(failedEntitiesID, ", "))
  651. }
  652. writer, _ := armor.Encode(&buf, "PGP PUBLIC KEY BLOCK", headers)
  653. for _, e := range entities {
  654. err = e.Serialize(writer) //TODO find why key are exported with a different cipherTypeByte as original (should not be blocking but strange)
  655. if err != nil {
  656. ctx.ServerError("ShowGPGKeys", err)
  657. return
  658. }
  659. }
  660. writer.Close()
  661. ctx.PlainText(200, buf.Bytes())
  662. }
  663. // Email2User show user page via email
  664. func Email2User(ctx *context.Context) {
  665. u, err := models.GetUserByEmail(ctx.Query("email"))
  666. if err != nil {
  667. if models.IsErrUserNotExist(err) {
  668. ctx.NotFound("GetUserByEmail", err)
  669. } else {
  670. ctx.ServerError("GetUserByEmail", err)
  671. }
  672. return
  673. }
  674. ctx.Redirect(setting.AppSubURL + "/user/" + u.Name)
  675. }
  676. func Cloudbrains(ctx *context.Context) {
  677. ctx.Data["Title"] = ctx.Tr("user.cloudbrains")
  678. listType := ctx.Query("listType")
  679. jobType := ctx.Query("jobType")
  680. jobStatus := ctx.Query("jobStatus")
  681. aiCenter := ctx.Query("aiCenter")
  682. cluster := ctx.Query("cluster")
  683. ctx.Data["ListType"] = listType
  684. ctx.Data["JobType"] = jobType
  685. ctx.Data["JobStatus"] = jobStatus
  686. ctx.Data["aiCenter"] = aiCenter
  687. ctx.Data["cluster"] = cluster
  688. page := ctx.QueryInt("page")
  689. if page <= 0 {
  690. page = 1
  691. }
  692. var jobTypes []string
  693. jobTypeNot := false
  694. if jobType == string(models.JobTypeBenchmark) {
  695. jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet))
  696. } else if jobType != "all" && jobType != "" {
  697. jobTypes = append(jobTypes, jobType)
  698. }
  699. var jobStatuses []string
  700. jobStatusNot := false
  701. if jobStatus == "other" {
  702. jobStatusNot = true
  703. jobStatuses = append(jobStatuses, string(models.ModelArtsTrainJobWaiting), string(models.ModelArtsTrainJobFailed), string(models.ModelArtsRunning), string(models.ModelArtsTrainJobCompleted),
  704. string(models.ModelArtsStarting), string(models.ModelArtsRestarting), string(models.ModelArtsStartFailed),
  705. string(models.ModelArtsStopping), string(models.ModelArtsStopped), string(models.JobSucceeded))
  706. } else if jobStatus != "all" && jobStatus != "" {
  707. jobStatuses = append(jobStatuses, jobStatus)
  708. }
  709. keyword := strings.Trim(ctx.Query("q"), " ")
  710. ctxUser := getDashboardContextUser(ctx)
  711. if ctx.Written() {
  712. return
  713. }
  714. repos, _, err := models.SearchRepository(&models.SearchRepoOptions{
  715. Actor: ctx.User,
  716. OwnerID: ctxUser.ID,
  717. Private: true,
  718. })
  719. if err != nil {
  720. ctx.ServerError("SearchRepository", err)
  721. return
  722. }
  723. var repoIDList []int64
  724. for i, _ := range repos {
  725. repoIDList = append(repoIDList, repos[i].ID)
  726. }
  727. ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{
  728. ListOptions: models.ListOptions{
  729. Page: page,
  730. PageSize: setting.UI.IssuePagingNum,
  731. },
  732. Keyword: keyword,
  733. UserID: ctxUser.ID,
  734. JobTypeNot: jobTypeNot,
  735. JobStatusNot: jobStatusNot,
  736. JobStatus: jobStatuses,
  737. JobTypes: jobTypes,
  738. NeedRepoInfo: true,
  739. IsLatestVersion: modelarts.IsLatestVersion,
  740. RepoIDList: repoIDList,
  741. ComputeResource: listType,
  742. Type: models.TypeCloudBrainAll,
  743. AiCenter: aiCenter,
  744. Cluster: cluster,
  745. })
  746. if err != nil {
  747. ctx.ServerError("Get job failed:", err)
  748. return
  749. }
  750. models.LoadSpecs4CloudbrainInfo(ciTasks)
  751. for i, task := range ciTasks {
  752. ciTasks[i].CanDebug = true
  753. ciTasks[i].CanDel = true
  754. ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource
  755. ciTasks[i].Cloudbrain.AiCenter = repo.GetCloudbrainAiCenter(task.Cloudbrain, ctx)
  756. ciTasks[i].Cloudbrain.Cluster = repo.GetCloudbrainCluster(task.Cloudbrain, ctx)
  757. }
  758. pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum))
  759. pager.SetDefaultParams(ctx)
  760. pager.AddParam(ctx, "listType", "ListType")
  761. ctx.Data["Page"] = pager
  762. ctx.Data["PageIsUserCloudBrain"] = true
  763. ctx.Data["Tasks"] = ciTasks
  764. ctx.Data["CanCreate"] = true
  765. ctx.Data["Keyword"] = keyword
  766. ctx.HTML(200, tplCloudbrains)
  767. }
  768. func getTotalPage(total int64, pageSize int) int {
  769. another := 0
  770. if int(total)%pageSize != 0 {
  771. another = 1
  772. }
  773. return int(total)/pageSize + another
  774. }