From 1e3fd9b69fcff1ba72fcaf0225494d39be9676e0 Mon Sep 17 00:00:00 2001 From: puni9869 Date: Mon, 18 Sep 2023 17:05:18 +0530 Subject: [PATCH 01/19] Empty-Commit From e5d7c2b4a6f91b813d8b6879a69e812e4bf2db15 Mon Sep 17 00:00:00 2001 From: puni9869 Date: Sat, 23 Sep 2023 17:19:02 +0530 Subject: [PATCH 02/19] Adding the archived label checkbox in ui issue filter Signed-off-by: puni9869 --- options/locale/locale_en-US.ini | 1 + templates/repo/issue/filters.tmpl | 9 +++++++++ web_src/css/repo.css | 6 ++++-- web_src/css/repo/issue-list.css | 11 +++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 74b8931de88ae..506a71db0a75f 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1512,6 +1512,7 @@ issues.label_description = Description issues.label_color = Color issues.label_exclusive = Exclusive issues.label_archive = Archive Label +issues.label_archived_filter= Archived Labels issues.label_archive_tooltip= Archived labels are excluded from the label search when applying labels to an issue. Existing labels on issues remain unaffected, allowing you to retire obsolete labels without losing information. issues.label_exclusive_desc = Name the label scope/item to make it mutually exclusive with other scope/ labels. issues.label_exclusive_warning = Any conflicting scoped labels will be removed when editing the labels of an issue or pull request. diff --git a/templates/repo/issue/filters.tmpl b/templates/repo/issue/filters.tmpl index 1805a23e372a1..79fd2a98e233f 100644 --- a/templates/repo/issue/filters.tmpl +++ b/templates/repo/issue/filters.tmpl @@ -18,6 +18,15 @@ {{svg "octicon-search" 16}} +
+ + +
{{.locale.Tr "repo.issues.filter_label_exclude" | Safe}}
{{.locale.Tr "repo.issues.filter_label_no_select"}} diff --git a/web_src/css/repo.css b/web_src/css/repo.css index b7b14f740791c..15d300b27aee8 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -129,11 +129,13 @@ .repository .filter.menu.labels .label-filter .menu .info { display: inline-block; - padding: 0.5rem 0.25rem; + padding: 0.5rem 0; font-size: 12px; width: 100%; white-space: nowrap; - text-align: center; + margin-left: 10px; + margin-right: 8px; + text-align: left; } .repository .filter.menu.labels .label-filter .menu .info code { diff --git a/web_src/css/repo/issue-list.css b/web_src/css/repo/issue-list.css index 17ae6ea38fc67..ba151d1a977ac 100644 --- a/web_src/css/repo/issue-list.css +++ b/web_src/css/repo/issue-list.css @@ -21,13 +21,16 @@ left: auto !important; right: auto !important; } + .issue-list-navbar { order: 0; } + .issue-list-new { order: 1; margin-left: auto !important; } + .issue-list-search { order: 2 !important; } @@ -80,3 +83,11 @@ #issue-list .flex-item-body .checklist progress::-moz-progress-bar { background-color: var(--color-secondary-dark-4); } + +.archived-label-filter { + margin-left: 10px; + font-size: 12px; + display: flex !important; + margin-bottom: 8px; + min-width: fit-content; +} From d82a13005f15bcb93e7cbbb984c51079360d0f31 Mon Sep 17 00:00:00 2001 From: puni9869 Date: Sat, 23 Sep 2023 17:22:27 +0530 Subject: [PATCH 03/19] Fix Spacing in file Signed-off-by: puni9869 --- options/locale/locale_en-US.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 506a71db0a75f..80f993ed91e7d 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1512,8 +1512,8 @@ issues.label_description = Description issues.label_color = Color issues.label_exclusive = Exclusive issues.label_archive = Archive Label -issues.label_archived_filter= Archived Labels -issues.label_archive_tooltip= Archived labels are excluded from the label search when applying labels to an issue. Existing labels on issues remain unaffected, allowing you to retire obsolete labels without losing information. +issues.label_archived_filter = Archived Labels +issues.label_archive_tooltip = Archived labels are excluded from the label search when applying labels to an issue. Existing labels on issues remain unaffected, allowing you to retire obsolete labels without losing information. issues.label_exclusive_desc = Name the label scope/item to make it mutually exclusive with other scope/ labels. issues.label_exclusive_warning = Any conflicting scoped labels will be removed when editing the labels of an issue or pull request. issues.label_count = %d labels From 9dce826bb2a651f493a6835290d2183b6787b1a8 Mon Sep 17 00:00:00 2001 From: puni9869 Date: Sun, 24 Sep 2023 06:08:58 +0530 Subject: [PATCH 04/19] Adding filter functionality for archived label When archived label checkbox is checked then we show archived label; when checked is uncheked we will hide the archived labels Signed-off-by: puni9869 --- routers/web/repo/issue.go | 11 +++++++++++ templates/repo/issue/filters.tmpl | 11 +++++++---- web_src/js/features/repo-issue-list.js | 18 ++++++++++++------ 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index f4aa357fac77b..b1315463c3d43 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -356,6 +356,17 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti labels = append(labels, orgLabels...) } + if !ctx.FormBool("archived") { + var tempLabels []*issues_model.Label + for _, l := range labels { + if !l.IsArchived() { + tempLabels = append(tempLabels, l) + } + } + labels = tempLabels + } else { + ctx.Data["ShowArchivedLabels"] = true + } // Get the exclusive scope for every label ID labelExclusiveScopes := make([]string, 0, len(labelIDs)) for _, labelID := range labelIDs { diff --git a/templates/repo/issue/filters.tmpl b/templates/repo/issue/filters.tmpl index 79fd2a98e233f..2ba8a321dd2db 100644 --- a/templates/repo/issue/filters.tmpl +++ b/templates/repo/issue/filters.tmpl @@ -19,7 +19,10 @@
- +
{{.locale.Tr "repo.issues.filter_label_exclude" | Safe}}
- {{.locale.Tr "repo.issues.filter_label_no_select"}} - {{.locale.Tr "repo.issues.filter_label_select_no_label"}} + {{.locale.Tr "repo.issues.filter_label_no_select"}} + {{.locale.Tr "repo.issues.filter_label_select_no_label"}} {{$previousExclusiveScope := "_no_scope"}} {{range .Labels}} {{$exclusiveScope := .ExclusiveScope}} @@ -38,7 +41,7 @@
{{end}} {{$previousExclusiveScope = $exclusiveScope}} - {{if .IsExcluded}}{{svg "octicon-circle-slash"}}{{else if .IsSelected}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} + {{if .IsExcluded}}{{svg "octicon-circle-slash"}}{{else if .IsSelected}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} {{RenderLabel $.Context .}}

{{template "repo/issue/labels/label_archived" .}}

diff --git a/web_src/js/features/repo-issue-list.js b/web_src/js/features/repo-issue-list.js index af4586121edc4..1a8bed9040d34 100644 --- a/web_src/js/features/repo-issue-list.js +++ b/web_src/js/features/repo-issue-list.js @@ -69,12 +69,7 @@ function initRepoIssueListCheckboxes() { } } - updateIssuesMeta( - url, - action, - issueIDs, - elementId - ).then(() => { + updateIssuesMeta(url, action, issueIDs, elementId).then(() => { window.location.reload(); }).catch((reason) => { showErrorToast(reason.responseJSON.error); @@ -185,9 +180,20 @@ async function initIssuePinSort() { }); } +function initArchivedLabelFilter() { + const archivedLabelEl = document.querySelector('#archived-filter-checkbox'); + if (archivedLabelEl) { + archivedLabelEl.addEventListener('change', () => { + const url = archivedLabelEl.getAttribute('data-url'); + window.location = (archivedLabelEl.checked) ? url : url.replace(/&archived=true/, ''); + }); + } +} + export function initRepoIssueList() { if (!document.querySelectorAll('.page-content.repository.issue-list, .page-content.repository.milestone-issue-list').length) return; initRepoIssueListCheckboxes(); initRepoIssueListAuthorDropdown(); initIssuePinSort(); + initArchivedLabelFilter(); } From eba3ccedadca3d7c64840e6300360b957e45bf78 Mon Sep 17 00:00:00 2001 From: puni9869 Date: Sun, 24 Sep 2023 11:49:42 +0530 Subject: [PATCH 05/19] * Splitting issue filter actions into different template * Adding archived param into querystring of pagination. * Adding locals for issue filter actions labels for archived labels hinting. Signed-off-by: puni9869 --- options/locale/locale_en-US.ini | 1 + routers/web/repo/issue.go | 4 + templates/repo/issue/filter_actions.tmpl | 130 +++++++++++++++++++++++ templates/repo/issue/list.tmpl | 127 +--------------------- 4 files changed, 136 insertions(+), 126 deletions(-) create mode 100644 templates/repo/issue/filter_actions.tmpl diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 80f993ed91e7d..a064d583f2cb6 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1512,6 +1512,7 @@ issues.label_description = Description issues.label_color = Color issues.label_exclusive = Exclusive issues.label_archive = Archive Label +issues.label_archived = Archived issues.label_archived_filter = Archived Labels issues.label_archive_tooltip = Archived labels are excluded from the label search when applying labels to an issue. Existing labels on issues remain unaffected, allowing you to retire obsolete labels without losing information. issues.label_exclusive_desc = Name the label scope/item to make it mutually exclusive with other scope/ labels. diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index b1315463c3d43..6f9b190980c98 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -453,6 +453,10 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti pager.AddParam(ctx, "project", "ProjectID") pager.AddParam(ctx, "assignee", "AssigneeID") pager.AddParam(ctx, "poster", "PosterID") + + if ctx.FormBool("archived") { + pager.AddParam(ctx, "archived", "ShowArchivedLabels") + } ctx.Data["Page"] = pager } diff --git a/templates/repo/issue/filter_actions.tmpl b/templates/repo/issue/filter_actions.tmpl new file mode 100644 index 0000000000000..7f7d97fe3329b --- /dev/null +++ b/templates/repo/issue/filter_actions.tmpl @@ -0,0 +1,130 @@ + + diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index cc8c647c1ef07..4d0eb51b18633 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -36,132 +36,7 @@ {{template "repo/issue/openclose" .}}
- + {{template "repo/issue/filter_actions" .}}
{{template "shared/issuelist" dict "." . "listType" "repo"}} From f6a1c09405f53d95b321ac5b225fa35d0a1894aa Mon Sep 17 00:00:00 2001 From: puni9869 Date: Sun, 24 Sep 2023 12:11:22 +0530 Subject: [PATCH 06/19] Reverting the unnecessary code change Signed-off-by: puni9869 --- web_src/css/repo/issue-list.css | 3 --- web_src/js/features/repo-issue-list.js | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/web_src/css/repo/issue-list.css b/web_src/css/repo/issue-list.css index ba151d1a977ac..d2f8e429f5880 100644 --- a/web_src/css/repo/issue-list.css +++ b/web_src/css/repo/issue-list.css @@ -21,16 +21,13 @@ left: auto !important; right: auto !important; } - .issue-list-navbar { order: 0; } - .issue-list-new { order: 1; margin-left: auto !important; } - .issue-list-search { order: 2 !important; } diff --git a/web_src/js/features/repo-issue-list.js b/web_src/js/features/repo-issue-list.js index 1a8bed9040d34..1b6cdf8a5ac75 100644 --- a/web_src/js/features/repo-issue-list.js +++ b/web_src/js/features/repo-issue-list.js @@ -69,7 +69,12 @@ function initRepoIssueListCheckboxes() { } } - updateIssuesMeta(url, action, issueIDs, elementId).then(() => { + updateIssuesMeta( + url, + action, + issueIDs, + elementId + ).then(() => { window.location.reload(); }).catch((reason) => { showErrorToast(reason.responseJSON.error); From a2754ab85688d27b3743213ab6f6373bbbc262ff Mon Sep 17 00:00:00 2001 From: puni9869 Date: Sun, 24 Sep 2023 13:31:40 +0530 Subject: [PATCH 07/19] * Adding the archived flag in issue url labels Signed-off-by: puni9869 --- templates/shared/issuelist.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index 80d4e3dd85e1c..49ca43ad1a159 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -21,7 +21,7 @@ {{end}} {{range .Labels}} - {{RenderLabel $.Context .}} + {{RenderLabel $.Context .}} {{end}} From 6e568f70e572dfde58219832407f1a514c700887 Mon Sep 17 00:00:00 2001 From: puni9869 Date: Sun, 24 Sep 2023 13:52:38 +0530 Subject: [PATCH 08/19] * Adding archivedLabel true in all the filters Signed-off-by: puni9869 --- templates/repo/issue/filters.tmpl | 52 +++++++++++++++---------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/templates/repo/issue/filters.tmpl b/templates/repo/issue/filters.tmpl index 2ba8a321dd2db..98bb3ff8bb925 100644 --- a/templates/repo/issue/filters.tmpl +++ b/templates/repo/issue/filters.tmpl @@ -62,13 +62,13 @@
- {{.locale.Tr "repo.issues.filter_milestone_all"}} - {{.locale.Tr "repo.issues.filter_milestone_none"}} + {{.locale.Tr "repo.issues.filter_milestone_all"}} + {{.locale.Tr "repo.issues.filter_milestone_none"}} {{if .OpenMilestones}}
{{.locale.Tr "repo.issues.filter_milestone_open"}}
{{range .OpenMilestones}} - + {{svg "octicon-milestone" 16 "mr-2"}} {{.Name}} @@ -78,7 +78,7 @@
{{.locale.Tr "repo.issues.filter_milestone_closed"}}
{{range .ClosedMilestones}} - + {{svg "octicon-milestone" 16 "mr-2"}} {{.Name}} @@ -99,15 +99,15 @@ {{svg "octicon-search" 16}} - {{.locale.Tr "repo.issues.filter_project_all"}} - {{.locale.Tr "repo.issues.filter_project_none"}} + {{.locale.Tr "repo.issues.filter_project_all"}} + {{.locale.Tr "repo.issues.filter_project_none"}} {{if .OpenProjects}}
{{.locale.Tr "repo.issues.new.open_projects"}}
{{range .OpenProjects}} - + {{svg .IconName 18 "gt-mr-3 gt-shrink-0"}}{{.Title}} {{end}} @@ -118,7 +118,7 @@ {{.locale.Tr "repo.issues.new.closed_projects"}} {{range .ClosedProjects}} - + {{svg .IconName 18 "gt-mr-3"}}{{.Title}} {{end}} @@ -130,7 +130,7 @@ - {{.locale.Tr "repo.issues.filter_assginee_no_select"}} - {{.locale.Tr "repo.issues.filter_assginee_no_assignee"}} + {{.locale.Tr "repo.issues.filter_assginee_no_select"}} + {{.locale.Tr "repo.issues.filter_assginee_no_assignee"}}
{{range .Assignees}} - + {{ctx.AvatarUtils.Avatar . 20}}{{template "repo/search_name" .}} {{end}} @@ -175,14 +175,14 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}} {{end}} @@ -194,14 +194,14 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}} From 2606f445a460ccbe5f703aed1b3837411765d296 Mon Sep 17 00:00:00 2001 From: puni9869 Date: Sun, 24 Sep 2023 14:12:43 +0530 Subject: [PATCH 09/19] * Adding `archive=true` in open/close tabs Signed-off-by: puni9869 --- templates/repo/issue/openclose.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/issue/openclose.tmpl b/templates/repo/issue/openclose.tmpl index a5916ed7934e6..1dbe443d7f0ae 100644 --- a/templates/repo/issue/openclose.tmpl +++ b/templates/repo/issue/openclose.tmpl @@ -1,5 +1,5 @@