mirror of
https://github.com/bitwarden/browser
synced 2026-02-10 05:30:01 +00:00
Update to new field syntax
This commit is contained in:
@@ -10,12 +10,12 @@ describe("BasicVaultFilterHandler", () => {
|
||||
basicFilter: {
|
||||
vaults: [null, "org_vault"],
|
||||
collections: ["collection_one", "collection_two"],
|
||||
fields: [],
|
||||
fields: ["field_one", "field_two"],
|
||||
types: ["Login", "Card"],
|
||||
folders: ["folder_one", "folder_two"],
|
||||
},
|
||||
rawFilter:
|
||||
'(in:my_vault OR in:org:"org_vault") AND (in:folder:"folder_one" OR in:folder:"folder_two") AND (in:collection:"collection_one" AND in:collection:"collection_two") AND (type:"Login" OR type:"Card")',
|
||||
'(in:my_vault OR in:org:"org_vault") AND (in:folder:"folder_one" OR in:folder:"folder_two") AND (in:collection:"collection_one" AND in:collection:"collection_two") AND (type:"Login" OR type:"Card") AND (has:field:"field_one" AND has:field:"field_two")',
|
||||
},
|
||||
{
|
||||
basicFilter: {
|
||||
@@ -68,6 +68,16 @@ describe("BasicVaultFilterHandler", () => {
|
||||
rawFilter:
|
||||
'(in:folder:"folder_one" OR in:folder:"Folder two") AND (type:"Card" OR type:"Login")',
|
||||
},
|
||||
{
|
||||
basicFilter: {
|
||||
vaults: [],
|
||||
collections: [],
|
||||
fields: ["field_one", "Field two"],
|
||||
types: [],
|
||||
folders: [],
|
||||
},
|
||||
rawFilter: '(has:field:"field_one" AND has:field:"Field two")',
|
||||
},
|
||||
{
|
||||
// Example of a filter that we could pretty
|
||||
basicFilter: {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
AstNode,
|
||||
isAnd,
|
||||
isBinary,
|
||||
isFieldTerm,
|
||||
isHasField,
|
||||
isInCollection,
|
||||
isInFolder,
|
||||
isInMyVault,
|
||||
@@ -101,7 +101,7 @@ export class BasicVaultFilterHandler {
|
||||
} else if (isTypeFilter(node)) {
|
||||
expressionType = "types";
|
||||
value = node.cipherType;
|
||||
} else if (isFieldTerm(node)) {
|
||||
} else if (isHasField(node)) {
|
||||
expressionType = "fields";
|
||||
value = node.field;
|
||||
} else {
|
||||
@@ -243,7 +243,7 @@ export class BasicVaultFilterHandler {
|
||||
addGroup(basicFilter.folders, "in:folder", "OR");
|
||||
addGroup(basicFilter.collections, "in:collection", "AND");
|
||||
addGroup(basicFilter.types, "type", "OR");
|
||||
addGroup(basicFilter.fields, "field", "AND");
|
||||
addGroup(basicFilter.fields, "has:field", "AND");
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user