diff --git a/client/src/views/record/panels/relationship.js b/client/src/views/record/panels/relationship.js index ca6bc12bed..f6748a56e0 100644 --- a/client/src/views/record/panels/relationship.js +++ b/client/src/views/record/panels/relationship.js @@ -95,15 +95,15 @@ class RelationshipPanelView extends BottomPanelView { this.link = this.link || this.defs.link || this.panelName; if (!this.scope && !(this.link in this.model.defs.links)) { - throw new Error('Link \'' + this.link + '\' is not defined in model \'' + this.model.entityType + '\''); + throw new Error(`Link '${this.link}' is not defined in model '${this.model.entityType}'`); } this.scope = this.scope || this.model.defs.links[this.link].entity; - let linkReadOnly = this.getMetadata() + const linkReadOnly = this.getMetadata() .get(['entityDefs', this.model.entityType, 'links', this.link, 'readOnly']) || false; - let url = this.url = this.url || this.model.entityType + '/' + this.model.id + '/' + this.link; + const url = this.url = this.url || this.model.entityType + '/' + this.model.id + '/' + this.link; if (!('create' in this.defs)) { this.defs.create = true; @@ -169,7 +169,7 @@ class RelationshipPanelView extends BottomPanelView { } if (this.defs.select) { - let data = {link: this.link}; + const data = {link: this.link}; if (this.defs.selectPrimaryFilterName) { data.primaryFilterName = this.defs.selectPrimaryFilterName; @@ -209,7 +209,7 @@ class RelationshipPanelView extends BottomPanelView { let listLayout = null; - let layout = this.defs.layout || null; + const layout = this.defs.layout || null; if (layout) { if (typeof layout === 'string') { @@ -231,7 +231,8 @@ class RelationshipPanelView extends BottomPanelView { collection.maxSize = this.recordsPerPage || this.getConfig().get('recordsPerPageSmall') || 5; if (this.defs.filters) { - let searchManager = new SearchManager(collection, 'listRelationship', false, this.getDateTime()); + const searchManager = new SearchManager(collection, 'listRelationship', null, this.getDateTime()); + searchManager.setAdvanced(this.defs.filters); collection.where = searchManager.getWhere(); } @@ -254,7 +255,7 @@ class RelationshipPanelView extends BottomPanelView { this.listenTo(this.model, 'update-all', () => collection.fetch()); - let viewName = + const viewName = this.defs.recordListView || this.getMetadata().get(['clientDefs', this.scope, 'recordViews', 'listRelated']) || this.getMetadata().get(['clientDefs', this.scope, 'recordViews', 'list']) || @@ -381,41 +382,40 @@ class RelationshipPanelView extends BottomPanelView { * @protected */ setupFilterActions() { - if (this.filterList && this.filterList.length) { - this.actionList.push(false); - - this.filterList.slice(0).forEach((item) => { - let selected; - - if (item === 'all') { - selected = !this.filter; - } - else { - selected = item === this.filter; - } - - let label = this.translateFilter(item); - - let $item = - $('