<button *ngFor="let t of textFilterTargets" ngbDropdownItem [class.active]="textFilterTarget == t.id" (click)="changeTextFilterTarget(t.id)">{{t.name}}</button>
</div>
</div>
- <input #textFilterInput class="form-control form-control-sm" type="text" [(ngModel)]="textFilter" (keyup.enter)="textFilterEnter()" [readonly]="textFilterTarget == 'fulltext-morelike'">
+ <div *ngIf="textFilterTarget == 'asn'" class="input-group-text py-0">
+ <div class="form-check form-switch m-0">
+ <input class="form-check-input" type="checkbox" role="switch" [(ngModel)]="textFilterTargetIsNull" (change)="updateRules()">
+ <label class="form-check-label" [class.text-muted]="!textFilterTargetIsNull" i18n>Is empty</label>
+ </div>
+ </div>
+ <input #textFilterInput class="form-control form-control-sm" type="text" [disabled]="textFilterTargetIsNull" [(ngModel)]="textFilter" (keyup.enter)="textFilterEnter()" [readonly]="textFilterTarget == 'fulltext-morelike'">
</div>
</div>
</div>
FILTER_DOES_NOT_HAVE_TAG,
FILTER_TITLE,
FILTER_TITLE_CONTENT,
+ FILTER_ASN_ISNULL,
} from 'src/app/data/filter-rule-type'
import { FilterableDropdownSelectionModel } from '../../common/filterable-dropdown/filterable-dropdown.component'
import { ToggleableItemState } from '../../common/filterable-dropdown/toggleable-dropdown-button/toggleable-dropdown-button.component'
}
textFilterTarget = TEXT_FILTER_TARGET_TITLE_CONTENT
+ textFilterTargetIsNull: boolean = false
get textFilterTargetName() {
return this.textFilterTargets.find((t) => t.id == this.textFilterTarget)
this.dateAddedAfter = null
this.dateCreatedBefore = null
this.dateCreatedAfter = null
+ this.textFilterTargetIsNull = false
value.forEach((rule) => {
switch (rule.rule_type) {
false
)
break
+ case FILTER_ASN_ISNULL:
+ this.textFilterTarget = TEXT_FILTER_TARGET_ASN
+ this.textFilterTargetIsNull = rule.value == 'true'
+ break
}
})
this.checkIfRulesHaveChanged()
if (this._textFilter && this.textFilterTarget == TEXT_FILTER_TARGET_TITLE) {
filterRules.push({ rule_type: FILTER_TITLE, value: this._textFilter })
}
- if (this._textFilter && this.textFilterTarget == TEXT_FILTER_TARGET_ASN) {
- filterRules.push({ rule_type: FILTER_ASN, value: this._textFilter })
+ if (this.textFilterTarget == TEXT_FILTER_TARGET_ASN) {
+ if (this.textFilter?.length && !this.textFilterTargetIsNull) {
+ filterRules.push({ rule_type: FILTER_ASN, value: this._textFilter })
+ } else if (!this.textFilter?.length) {
+ filterRules.push({
+ rule_type: FILTER_ASN_ISNULL,
+ value: this.textFilterTargetIsNull.toString(),
+ })
+ }
}
if (
this._textFilter &&
}
get textFilter() {
- return this._textFilter
+ return this.textFilterTargetIsNull ? '' : this._textFilter
}
set textFilter(value) {