added status filter

This commit is contained in:
nikita_bartoshuk
2025-06-17 18:16:09 +03:00
parent 71b43373ab
commit 542d438ea8
2 changed files with 76 additions and 2 deletions

View File

@ -103,7 +103,8 @@ define([
'comment:closeEditing': _.bind(this.closeEditing, this),
'comment:sort': _.bind(this.setComparator, this),
'comment:filtergroups': _.bind(this.setFilterGroups, this)
'comment:filtergroups': _.bind(this.setFilterGroups, this),
'comment:filtercomments': _.bind(this.setFilterComments, this)
},
'Common.Views.ReviewPopover': {
@ -1776,6 +1777,36 @@ define([
this.updateComments(true);
},
setFilterComments: function (type) {
console.log(this.collection)
console.log(type)
var i, end = true;
for (i = this.collection.length - 1; i >= 0; --i) {
var item = this.collection.at(i);
var isResolved = item.get('resolved') === true;
let shouldFilter = false;
if (type === 'open' && isResolved) {
shouldFilter = true;
} else if (type === 'resolved' && !isResolved) {
shouldFilter = true;
}
item.set('filtered', shouldFilter, { silent: true });
if (end && !item.get('filtered') && !item.get('hide')) {
item.set('last', true, { silent: true });
end = false;
} else if (item.get('last')) {
item.set('last', false, { silent: true });
}
}
this.updateComments(true);
},
onAppReady: function (config) {
var me = this;
(new Promise(function (accept, reject) {

View File

@ -399,8 +399,38 @@ define([
},
{
caption: '--',
visible: false
visible: true
},
this.menuFilterComments = new Common.UI.MenuItem({
caption: this.mniFilterComments,
checkable: false,
visible: true,
menu: new Common.UI.Menu({
menuAlign: 'tl-tr',
style: 'min-width: auto;',
items: [
{
caption: 'Open',
checkable: true,
visible: true,
value: 'open'
},
{
caption: 'Resolved',
checkable: true,
visible: true,
value: 'resolved'
},
{
caption: 'All',
checkable: true,
visible: true,
value: 'all',
checked: true
}
]
})
}),
this.menuFilterGroups = new Common.UI.MenuItem({
caption: this.mniFilterGroups,
checkable: false,
@ -442,6 +472,7 @@ define([
this.buttonClose.on('click', _.bind(this.onClickClosePanel, this));
this.buttonSort.menu.on('item:toggle', _.bind(this.onSortClick, this));
this.menuFilterGroups.menu.on('item:toggle', _.bind(this.onFilterGroupsClick, this));
this.menuFilterComments.menu.on('item:toggle', _.bind(this.onFilterCommentsClick, this));
this.mnuAddCommentToDoc.on('click', _.bind(this.onClickShowBoxDocumentComment, this));
this.buttonAddNew.on('click', _.bind(this.onClickAddNewComment, this));
@ -907,6 +938,17 @@ define([
state && this.fireEvent('comment:filtergroups', [item.value]);
},
onFilterCommentsClick: function(menu, item, state) {
if (!state) return;
menu.items.forEach(function (it) {
if (it !== item) {
it.setChecked(false);
}
});
state && this.fireEvent('comment:filtercomments', [item.value]);
},
onClickClosePanel: function() {
Common.NotificationCenter.trigger('leftmenu:change', 'hide');
},
@ -937,6 +979,7 @@ define([
textClosePanel: 'Close comments',
textViewResolved: 'You have not permission for reopen comment',
mniFilterGroups: 'Filter by Group',
mniFilterComments: 'Show comments',
textAll: 'All',
txtEmpty: 'There are no comments in the document.',
textSortFilter: 'Sort and filter comments',