1
0
mirror of https://github.com/keeweb/keeweb.git synced 2024-06-21 07:06:39 +02:00
keeweb/app/scripts/models/external/external-entry-model.js

63 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-04-15 16:50:01 +02:00
import { Model } from 'framework/model';
2020-05-05 15:08:19 +02:00
import { EntrySearch } from 'util/entry-search';
2020-04-15 16:50:01 +02:00
class ExternalEntryModel extends Model {
tags = [];
fields = {};
2020-05-05 15:08:19 +02:00
constructor(props) {
super(props);
this._buildSearchText();
this._buildFields();
this._search = new EntrySearch(this);
}
matches(filter) {
return this._search.matches(filter);
}
_buildSearchText() {
let text = '';
if (this.title) {
text += this.title.toLowerCase();
}
if (this.user) {
text += '\n' + this.user.toLowerCase();
}
this.searchText = text;
}
_buildFields() {
this.fields.Title = this.title;
}
getAllFields() {
return this.fields;
}
2020-05-09 08:57:57 +02:00
getFieldValue(field) {
return this.fields[field];
}
getEffectiveAutoTypeSeq() {
return '{TOTP}{ENTER}';
2020-05-09 08:57:57 +02:00
}
2020-04-15 16:50:01 +02:00
}
ExternalEntryModel.defineModelProperties({
id: '',
2020-05-05 17:05:20 +02:00
external: true,
readOnly: true,
2020-04-15 16:50:01 +02:00
device: undefined,
2020-05-06 19:30:30 +02:00
deviceSubId: null,
2020-04-15 16:50:01 +02:00
title: undefined,
description: undefined,
fields: undefined,
icon: undefined,
2020-05-05 15:08:19 +02:00
tags: undefined,
searchText: undefined,
_search: undefined
2020-04-15 16:50:01 +02:00
});
export { ExternalEntryModel };