EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Relation panel recordSpecificSearchStorage
Yuriie4333c6639fd
diff --git a/client/src/helpers/misc/stored-text-search.js b/client/src/helpers/misc/stored-text-search.jsindex 011149c68d..4287e86d42 100644--- a/client/src/helpers/misc/stored-text-search.js+++ b/client/src/helpers/misc/stored-text-search.js@@ -26,20 +26,45 @@* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.************************************************************************/-/** @module helpers/misc/stored-text-search */+import {inject} from 'di';+import Storage from 'storage';++export default class StoredTextSearchHelper {++ /**+ * @private+ * @type {Storage}+ */+ @inject(Storage)+ storage-export default class {/**- * @param {module:storage} storage- * @param {string} scope+ * @param {string} key* @param {Number} [maxCount]*/- constructor(scope, storage, maxCount) {- this.scope = scope;- this.storage = storage;- this.key = 'textSearches';+ constructor(key, maxCount) {+ /**+ * @private+ * @type {string}+ */+ this.key = key;++ /**+ * @private+ * @type {string}+ */+ this.categoryKey = 'textSearches';++ /**+ * @private+ * @type {Number|number}+ */this.maxCount = maxCount || 100;- /** @type {string[]|null} */++ /**+ * @type {string[]|null}+ * @private+ */this.list = null;}@@ -89,7 +114,7 @@ export default class {*/getFromStorage() {/** @var {string[]} */- return this.storage.get(this.key, this.scope) || [];+ return this.storage.get(this.categoryKey, this.key) || [];}/**@@ -115,7 +140,7 @@ export default class {}this.list = list;- this.storage.set(this.key, this.scope, list);+ this.storage.set(this.categoryKey, this.key, list);}/**@@ -137,6 +162,6 @@ export default class {list.splice(index, 1);this.list = list;- this.storage.set(this.key, this.scope, list);+ this.storage.set(this.categoryKey, this.key, list);}}diff --git a/client/src/views/list-related.ts b/client/src/views/list-related.tsindex 8575bdaea1..ef820b6fef 100644--- a/client/src/views/list-related.ts+++ b/client/src/views/list-related.ts@@ -390,6 +390,9 @@ class ListRelatedView<S extends ListRelatedViewSchema = ListRelatedViewSchema> efilterList = [];}+ const storageKey = this.panelDefs.recordSpecificSearchStorage ?+ this.model.entityType + '-' + this.model.id + '-' + this.link : null;+const view = await this.createView<SearchView>('search', this.searchView, {collection: this.collection,fullSelector: '#main > .search-container',@@ -399,6 +402,7 @@ class ListRelatedView<S extends ListRelatedViewSchema = ListRelatedViewSchema> eviewModeList: this.viewModeList,isWide: true,filterList: filterList,+ storageKey: storageKey,});if (this.viewModeList.length > 1) {diff --git a/client/src/views/modals/related-list.js b/client/src/views/modals/related-list.jsindex e676cb6f4d..e0ef0fee2b 100644--- a/client/src/views/modals/related-list.js+++ b/client/src/views/modals/related-list.js@@ -53,6 +53,12 @@ class RelatedListModalView extends ModalView {mandatorySelectAttributeList = nulllayoutName = 'listSmall'+ /**+ * @private+ * @type {Record}+ */+ defs+/** @inheritDoc */shortcutKeys = {/** @this RelatedListModalView */@@ -407,6 +413,9 @@ class RelatedListModalView extends ModalView {}if (this.searchPanel) {+ const storageKey = this.defs.recordSpecificSearchStorage ?+ this.model.entityType + '-' + this.model.id + '-' + this.link : null;+this.createView('search', 'views/record/search', {collection: this.collection,fullSelector: this.containerSelector + ' .search-container',@@ -414,6 +423,7 @@ class RelatedListModalView extends ModalView {disableSavePreset: true,filterList: filterList,filtersLayoutName: this.options.filtersLayoutName,+ storageKey: storageKey,}, view => {this.listenTo(view, 'reset', () => {});});diff --git a/schema/metadata/clientDefs.json b/schema/metadata/clientDefs.jsonindex 28131ab0e2..fa166621ed 100644--- a/schema/metadata/clientDefs.json+++ b/schema/metadata/clientDefs.json@@ -534,6 +534,10 @@},"description": "Attributes to carry over to a related record when creating. Mapping Parent => Related."},+ "recordSpecificSearchStorage": {+ "type": "boolean",+ "description": "Record specific search storage. As of v10.1."+ },"buttonList": {"type": "array","items": {