onClickAttrFilter: function()

in dashboardv3/public/js/views/search/SearchDefaultLayoutView.js [275:378]


            onClickAttrFilter: function() {
                var that = this,
                    obj = {
                        value: that.options.value,
                        relationship: Utils.getUrlState.isRelationSearch() ? true : false,
                        searchVent: that.options.searchVent,
                        entityDefCollection: that.options.entityDefCollection,
                        enumDefCollection: that.options.enumDefCollection,
                        typeHeaders: that.options.typeHeaders,
                        classificationDefCollection: that.options.classificationDefCollection,
                        businessMetadataDefCollection: that.options.businessMetadataDefCollection,
                        relationshipDefCollection: that.options.relationshipDefCollection,
                        searchTableFilters: that.checkEntityFilter(that.options)
                    };
                this.tagEntityCheck = false;
                this.typeEntityCheck = false;
                if (that.options.value) {
                    this.ui.checkDeletedEntity.prop('checked', this.options.value.includeDE ? this.options.value.includeDE : false);
                    this.ui.checkSubClassification.prop('checked', this.options.value.excludeSC ? this.options.value.excludeSC : false);
                    this.ui.checkSubType.prop('checked', this.options.value.excludeST ? this.options.value.excludeST : false);

                    if (that.options.value.tag && that.options.value.type) {
                        this.$('.attribute-filter-container').removeClass('no-attr');
                        this.ui.classificationRegion.show();
                        this.ui.entityRegion.show();
                    } else {
                        if (!that.options.value.tag && !that.options.value.type) {
                            this.$('.attribute-filter-container').addClass('no-attr');
                        }
                        this.ui.entityRegion.hide();
                        this.ui.classificationRegion.hide();
                    }
                    if (that.options.value.tag) {
                        this.ui.classificationRegion.show();
                        this.ui.includeExclude.show();
                        // this.ui.entityRegion.hide();
                        var attrTagObj = that.options.classificationDefCollection.fullCollection.find({ name: that.options.value.tag });
                        if (attrTagObj) {
                            attrTagObj = Utils.getNestedSuperTypeObj({
                                data: attrTagObj.toJSON(),
                                collection: that.options.classificationDefCollection,
                                attrMerge: true,
                            });
                            this.tagAttributeLength = attrTagObj.length;
                        }
                        if (Globals[that.options.value.tag] || Globals[Enums.addOnClassification[0]]) {
                            obj.systemAttrArr = (Globals[that.options.value.tag] || Globals[Enums.addOnClassification[0]]).attributeDefs;
                            this.tagAttributeLength = obj.systemAttrArr.length;
                        }
                        this.renderQueryBuilder(_.extend({}, obj, {
                            tag: true,
                            type: false,
                            attrObj: attrTagObj
                        }), this.RQueryBuilderClassification);
                        this.ui.classificationName.html(that.options.value.tag);
                    }
                    if (that.options.value.type) {
                        this.ui.entityRegion.show();
                        this.ui.includeExclude.show();
                        var attrTypeObj = that.options.entityDefCollection.fullCollection.find({ name: that.options.value.type });
                        if (attrTypeObj) {
                            attrTypeObj = Utils.getNestedSuperTypeObj({
                                data: attrTypeObj.toJSON(),
                                collection: that.options.entityDefCollection,
                                attrMerge: true
                            });
                            this.entityAttributeLength = attrTypeObj.length;
                        }
                        if (Globals[that.options.value.type] || Globals[Enums.addOnEntities[0]]) {
                            obj.systemAttrArr = (Globals[that.options.value.type] || Globals[Enums.addOnEntities[0]]).attributeDefs;
                            this.entityAttributeLength = obj.systemAttrArr.length;
                        }
                        this.renderQueryBuilder(_.extend({}, obj, {
                            tag: false,
                            type: true,
                            attrObj: attrTypeObj
                        }), this.RQueryBuilderEntity);

                        this.ui.entityName.html(_.escape(that.options.value.type));
                    }
                    if (that.options.value.relationshipName) {
                        this.ui.relationshipRegion.show();
                        this.ui.includeExclude.hide();
                        var attrTypeObj = that.options.relationshipDefCollection.fullCollection.find({ name: that.options.value.relationshipName });
                        if (attrTypeObj) {
                            attrTypeObj = Utils.getNestedSuperTypeObj({
                                data: attrTypeObj.toJSON(),
                                collection: that.options.relationshipDefCollection,
                                attrMerge: true
                            });
                            this.relationshipAttributeLength = attrTypeObj.length;
                        }
                        this.renderQueryBuilder(_.extend({}, obj, {
                            tag: false,
                            type: false,
                            relation: true,
                            attrObj: attrTypeObj
                        }), this.RQueryBuilderRelationship);

                        this.ui.relationshipName.html(_.escape(that.options.value.relationshipName));
                    }
                }

            },