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

Commit 7445a1a

Browse files
committed
Merge branch 'metadata_filters'
2 parents e63dc69 + 21d7db0 commit 7445a1a

File tree

6 files changed

+26
-16
lines changed

6 files changed

+26
-16
lines changed

src/components/modals/filters/handlers/ExistedColumnSelectorComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const ExistedColumnSelectorComponent = (selectorProps: {
5353
</optgroup>
5454
<optgroup label="Metadata Fields">
5555
<option
56-
value={"__filename__"}
56+
value={"file.name"}
5757
key={`MenuItem-Metadata-filename--${level}-${recursiveIndex[level]}`}
5858
>
5959
Filename

src/helpers/Constants.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,12 @@ export const EphimeralConfiguration: EphimeralSettings = Object.freeze({
323323
* FILTERS
324324
******************************************************************************/
325325
export const OperatorFilter = Object.freeze({
326-
EQUAL: ['EQUAL', '='],
327-
NOT_EQUAL: ['NOT_EQUAL', '!='],
328-
GREATER_THAN: ['GREATER_THAN', '>'],
329-
LESS_THAN: ['LESS_THAN', '<'],
330-
GREATER_THAN_OR_EQUAL: ['GREATER_THAN_OR_EQUAL', '>='],
331-
LESS_THAN_OR_EQUAL: ['LESS_THAN_OR_EQUAL', '<='],
326+
EQUAL: ['EQUAL', 'operator_equal'],
327+
NOT_EQUAL: ['NOT_EQUAL', 'operator_not_equal'],
328+
GREATER_THAN: ['GREATER_THAN', 'operator_greater_than'],
329+
LESS_THAN: ['LESS_THAN', 'operator_less_than'],
330+
GREATER_THAN_OR_EQUAL: ['GREATER_THAN_OR_EQUAL', 'operator_greater_than_or_equal'],
331+
LESS_THAN_OR_EQUAL: ['LESS_THAN_OR_EQUAL', 'operator_less_than_or_equal'],
332332
CONTAINS: ['CONTAINS', 'operator_contains'],
333333
NOT_CONTAINS: ['NOT_CONTAINS', 'operator_does_not_contain'],
334334
STARTS_WITH: ['STARTS_WITH', 'operator_starts_with'],
@@ -408,7 +408,7 @@ export const DEFAULT_SETTINGS: DatabaseSettings = {
408408
show_metadata_inlinks: false,
409409
show_metadata_outlinks: false,
410410
source_data: SourceDataTypes.CURRENT_FOLDER,
411-
source_form_result: 'root',
411+
source_form_result: '',
412412
source_destination_path: '/',
413413
row_templates_folder: '/',
414414
current_row_template: '',

src/helpers/TableFiltersHelper.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ function validateFilter(p: Record<string, Literal>, filter: FilterGroup, ddbbCon
4141
}
4242
return groupResult;
4343
}
44-
const filterableValue = ParseService.parseLiteral(p[(filter as AtomicFilter).field], InputType.MARKDOWN, ddbbConfig);
44+
const field = (filter as AtomicFilter).field;
45+
let literalToCheck: Literal = field.split('.').reduce((acc, cur) => {
46+
return acc[cur];
47+
}, p);
48+
49+
const filterableValue = ParseService.parseLiteral(literalToCheck, InputType.MARKDOWN, ddbbConfig);
4550
// Atomic filter
4651
const operator = (filter as AtomicFilter).operator;
4752
const value = (filter as AtomicFilter).value;

src/helpers/VaultManagement.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ export async function sourceDataviewPages(ddbbConfig: LocalSettings, folderPath:
127127
pagesResult = await obtainQueryResult(
128128
generateDataviewTableQuery(
129129
columns,
130-
ddbbConfig.source_form_result),
131-
folderPath
130+
ddbbConfig.source_form_result)
132131
);
133132
break;
134133
case SourceDataTypes.CURRENT_FOLDER_WITHOUT_SUBFOLDERS:
@@ -146,13 +145,13 @@ export async function sourceDataviewPages(ddbbConfig: LocalSettings, folderPath:
146145
} catch (error) {
147146
const msg = `Error obtaining pages result. Current folder loaded instead`;
148147
LOGGER.error(msg, error);
149-
new Notice(msg, 10000);
148+
new Notice(msg, 4000);
150149
pagesResult = DataviewService.getDataviewAPI().pages(`"${folderPath}"`);
151150
}
152151
return pagesResult;
153152
}
154153

155-
async function obtainQueryResult(query: string, folderPath: string): Promise<DataArray<Record<string, Literal>>> {
154+
async function obtainQueryResult(query: string): Promise<DataArray<Record<string, Literal>>> {
156155
const result = await DataviewService.getDataviewAPI().query(query);
157156
if (!result.successful || result.value.type !== 'table') {
158157
throw new Error(`Query ${query} failed`);

src/lang/locale/en.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ export default {
77
'menu_pane_open_as_db_action': 'Open as database folder',
88
'menu_pane_open_as_md_action': 'Open as Markdown',
99
/** OPERATOR FILTERS */
10+
'operator_equal': '=',
11+
'operator_not_equal': '!=',
12+
'operator_greater_than': '>',
13+
'operator_less_than': '<',
14+
'operator_greater_than_or_equal': '>=',
15+
'operator_less_than_or_equal': '<=',
1016
'operator_contains': 'Contains',
1117
'operator_does_not_contain': 'Does not contain',
1218
'operator_starts_with': 'Starts with',

src/settings/handlers/source/flavours/TagsSourceBuilder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,17 @@ export class TagSourceBuilder {
4646
});
4747

4848
cb.inputEl.style.width = "auto";
49-
}).addExtraButton((button) => {
50-
button.setIcon("cross")
49+
}).addButton((button) => {
50+
button.setButtonText("Reset")
5151
.setTooltip(t("settings_source_form_tag_clear_button_tooltip"))
5252
.onClick(async () => {
5353
// Clear all tags
5454
this.selectedTags = [];
55-
this.initSuggestions();
5655
suggester.setSuggestions(this.tagRecords);
5756
await this.view.diskConfig.updateConfig({
5857
source_form_result: ""
5958
});
59+
this.initSuggestions();
6060
this.tagsLabel.innerHTML = "None";
6161
this.tagsContainer.style.display = "none";
6262
});

0 commit comments

Comments
 (0)