mirror of https://github.com/keeweb/keeweb.git
fix #1337: displaying groups in trash
This commit is contained in:
parent
beda8972e8
commit
8794b0d37c
|
@ -1,4 +1,4 @@
|
|||
import { EntryCollection } from 'collections/entry-collection';
|
||||
import { SearchResultCollection } from 'collections/search-result-collection';
|
||||
import { Ranking } from 'util/data/ranking';
|
||||
|
||||
const urlPartsRegex = /^(\w+:\/\/)?(?:(?:www|wwws|secure)\.)?([^\/]+)\/?(.*)/;
|
||||
|
@ -25,7 +25,7 @@ AutoTypeFilter.prototype.getEntries = function() {
|
|||
x[1] === y[1] ? x[0].title.localeCompare(y[0].title) : y[1] - x[1]
|
||||
);
|
||||
entries = entries.map(p => p[0]);
|
||||
return new EntryCollection(entries, { comparator: 'none' });
|
||||
return new SearchResultCollection(entries, { comparator: 'none' });
|
||||
};
|
||||
|
||||
AutoTypeFilter.prototype.hasWindowInfo = function() {
|
||||
|
|
|
@ -1,52 +1,8 @@
|
|||
import { Collection } from 'framework/collection';
|
||||
import { EntryModel } from 'models/entry-model';
|
||||
import { Comparators } from 'util/data/comparators';
|
||||
|
||||
class EntryCollection extends Collection {
|
||||
static model = EntryModel;
|
||||
|
||||
comparators = {
|
||||
'none': null,
|
||||
'title': Comparators.stringComparator('title', true),
|
||||
'-title': Comparators.stringComparator('title', false),
|
||||
'website': Comparators.stringComparator('url', true),
|
||||
'-website': Comparators.stringComparator('url', false),
|
||||
'user': Comparators.stringComparator('user', true),
|
||||
'-user': Comparators.stringComparator('user', false),
|
||||
'created': Comparators.dateComparator('created', true),
|
||||
'-created': Comparators.dateComparator('created', false),
|
||||
'updated': Comparators.dateComparator('updated', true),
|
||||
'-updated': Comparators.dateComparator('updated', false),
|
||||
'-attachments': (x, y) => {
|
||||
return this.attachmentSortVal(x).localeCompare(this.attachmentSortVal(y));
|
||||
},
|
||||
'-rank': Comparators.rankComparator().bind(this)
|
||||
};
|
||||
|
||||
defaultComparator = 'title';
|
||||
|
||||
entryFilter = null;
|
||||
|
||||
constructor(models, options) {
|
||||
super(models);
|
||||
const comparatorName = (options && options.comparator) || this.defaultComparator;
|
||||
this.comparator = this.comparators[comparatorName];
|
||||
}
|
||||
|
||||
sortEntries(comparator, filter) {
|
||||
this.entryFilter = filter;
|
||||
this.comparator = this.comparators[comparator] || this.comparators[this.defaultComparator];
|
||||
this.sort();
|
||||
}
|
||||
|
||||
attachmentSortVal(entry) {
|
||||
const att = entry.attachments;
|
||||
let str = att.length ? String.fromCharCode(64 + att.length) : 'Z';
|
||||
if (att[0]) {
|
||||
str += att[0].title;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
export { EntryCollection };
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
import { Collection } from 'framework/collection';
|
||||
import { Model } from 'framework/model';
|
||||
import { Comparators } from 'util/data/comparators';
|
||||
|
||||
class SearchResultCollection extends Collection {
|
||||
static model = Model;
|
||||
|
||||
comparators = {
|
||||
'none': null,
|
||||
'title': Comparators.stringComparator('title', true),
|
||||
'-title': Comparators.stringComparator('title', false),
|
||||
'website': Comparators.stringComparator('url', true),
|
||||
'-website': Comparators.stringComparator('url', false),
|
||||
'user': Comparators.stringComparator('user', true),
|
||||
'-user': Comparators.stringComparator('user', false),
|
||||
'created': Comparators.dateComparator('created', true),
|
||||
'-created': Comparators.dateComparator('created', false),
|
||||
'updated': Comparators.dateComparator('updated', true),
|
||||
'-updated': Comparators.dateComparator('updated', false),
|
||||
'-attachments': (x, y) => {
|
||||
return this.attachmentSortVal(x).localeCompare(this.attachmentSortVal(y));
|
||||
},
|
||||
'-rank': Comparators.rankComparator().bind(this)
|
||||
};
|
||||
|
||||
defaultComparator = 'title';
|
||||
|
||||
entryFilter = null;
|
||||
|
||||
constructor(models, options) {
|
||||
super(models);
|
||||
const comparatorName = (options && options.comparator) || this.defaultComparator;
|
||||
this.comparator = this.comparators[comparatorName];
|
||||
}
|
||||
|
||||
sortEntries(comparator, filter) {
|
||||
this.entryFilter = filter;
|
||||
this.comparator = this.comparators[comparator] || this.comparators[this.defaultComparator];
|
||||
this.sort();
|
||||
}
|
||||
|
||||
attachmentSortVal(entry) {
|
||||
const att = entry.attachments;
|
||||
let str = att.length ? String.fromCharCode(64 + att.length) : 'Z';
|
||||
if (att[0]) {
|
||||
str += att[0].title;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
export { SearchResultCollection };
|
|
@ -1,7 +1,7 @@
|
|||
import { Events } from 'framework/events';
|
||||
import { AutoType } from 'auto-type';
|
||||
import { Storage } from 'storage';
|
||||
import { EntryCollection } from 'collections/entry-collection';
|
||||
import { SearchResultCollection } from 'collections/search-result-collection';
|
||||
import { FileCollection } from 'collections/file-collection';
|
||||
import { FileInfoCollection } from 'collections/file-info-collection';
|
||||
import { RuntimeInfo } from 'comp/app/runtime-info';
|
||||
|
@ -307,7 +307,7 @@ class AppModel {
|
|||
|
||||
getEntriesByFilter(filter) {
|
||||
const preparedFilter = this.prepareFilter(filter);
|
||||
const entries = new EntryCollection();
|
||||
const entries = new SearchResultCollection();
|
||||
this.files.forEach(file => {
|
||||
file.forEachEntry(preparedFilter, entry => entries.push(entry));
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { View } from 'framework/views/view';
|
||||
import { Events } from 'framework/events';
|
||||
import { EntryCollection } from 'collections/entry-collection';
|
||||
import { SearchResultCollection } from 'collections/search-result-collection';
|
||||
import { DragDropInfo } from 'comp/app/drag-drop-info';
|
||||
import { Alerts } from 'comp/ui/alerts';
|
||||
import { AppSettingsModel } from 'models/app-settings-model';
|
||||
|
@ -67,7 +67,7 @@ class ListView extends View {
|
|||
|
||||
this.readTableColumnsEnabled();
|
||||
|
||||
this.items = new EntryCollection();
|
||||
this.items = new SearchResultCollection();
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -4,6 +4,7 @@ Release notes
|
|||
`-` fixed non-working updater
|
||||
`-` fix #1336: saving disabled storage option
|
||||
`-` fix #1333: item selection in the auto-type pop-up
|
||||
`-` fix #1337: displaying groups in trash
|
||||
|
||||
##### v1.12.1 (2019-10-27)
|
||||
`-` fix #1324: duplicated shortcut editor in settings
|
||||
|
|
Loading…
Reference in New Issue