Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Conversation

@RafaelGB
Copy link
Owner

PR of filtergroups

@RafaelGB RafaelGB self-assigned this Sep 27, 2022
@RafaelGB RafaelGB linked an issue Sep 27, 2022 that may be closed by this pull request
@RafaelGB
Copy link
Owner Author

unmarshall is working well

public handle(handlerResponse: DiskHandlerResponse): DiskHandlerResponse { const { filters } = handlerResponse.yaml; let indentLevel = 1; // Lvl1: filters this.localDisk.push(`${this.handlerName}:`); this.localDisk.push(`${YAML_INDENT.repeat(indentLevel)}enabled: ${filters.enabled}`); this.localDisk.push(`${YAML_INDENT.repeat(indentLevel)}conditions:`); indentLevel++; if (filters.conditions) { for (const condition of filters.conditions) { // Lvl2: Array of filters this.localDisk.push(`${YAML_INDENT.repeat(indentLevel)}- field: ${DataviewService.getDataviewAPI().  value  .isTruthy(condition.field) ? condition.field : "\"\""  }`); this.striginifyFilter(condition, indentLevel + 1); } } return this.goNext(handlerResponse); } striginifyFilter(filter: FilterGroup, indentLevel: number, isList = false): void { if ((filter as FilterGroupCondition).condition) { // Is a filter group this.localDisk.push(`${YAML_INDENT.repeat(indentLevel)}condition: ${(filter as FilterGroupCondition).condition}`); this.localDisk.push(`${YAML_INDENT.repeat(indentLevel)}filters:`); indentLevel++; for (const group of (filter as FilterGroupCondition).filters) { this.striginifyFilter(group, indentLevel, true); } } else { const list_indent_operator = isList ? "- " : ""; const list_indent_value = isList ? " " : ""; // Is a simple filter this.localDisk.push(`${YAML_INDENT.repeat(indentLevel)}${list_indent_operator}operator: ${(filter as AtomicFilter).operator}`); this.localDisk.push(`${YAML_INDENT.repeat(indentLevel)}${list_indent_value}value: ${(filter as AtomicFilter).value}`); } }
@RafaelGB RafaelGB added the epic enhancement new feature or request that suppose a breaking change label Sep 28, 2022
@RafaelGB
Copy link
Owner Author

@RafaelGB
Copy link
Owner Author

Screen_Recording_2022-09-29_at_17.40.56.mov
@RafaelGB RafaelGB merged commit 94580cf into master Sep 29, 2022
@RafaelGB RafaelGB deleted the 268-and-or-filter-selector branch September 29, 2022 16:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

epic enhancement new feature or request that suppose a breaking change

1 participant