[ARVADOS-WORKBENCH2] updated: 1.2.1-1022-g7e323d0
Git user
git at public.curoverse.com
Thu Nov 29 19:02:09 EST 2018
Summary of changes:
src/services/api/filter-builder.ts | 8 +++++++-
src/store/search-bar/search-bar-actions.ts | 10 +++++++---
2 files changed, 14 insertions(+), 4 deletions(-)
via 7e323d0c3e6734e6ca698c6bffcb9c24ef5acd13 (commit)
from 1e18043c06c85a015a90d32b3da167eebb760b18 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 7e323d0c3e6734e6ca698c6bffcb9c24ef5acd13
Author: Daniel Kos <daniel.kos at contractors.roche.com>
Date: Fri Nov 30 01:02:01 2018 +0100
Add exist filter
Feature #14280
Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos at contractors.roche.com>
diff --git a/src/services/api/filter-builder.ts b/src/services/api/filter-builder.ts
index 1ebf488..08746c8 100644
--- a/src/services/api/filter-builder.ts
+++ b/src/services/api/filter-builder.ts
@@ -51,6 +51,10 @@ export class FilterBuilder {
return this.addCondition(field, "<=", value, "", "", resourcePrefix);
}
+ public addExists(value?: string, resourcePrefix?: string) {
+ return this.addCondition("properties", "exists", value, "", "", resourcePrefix);
+ }
+
public getFilters() {
return this.filters;
}
@@ -69,7 +73,9 @@ export class FilterBuilder {
? resourcePrefix + "."
: "";
- this.filters += `${this.filters ? "," : ""}["${resPrefix}${_.snakeCase(field)}","${cond}",${value}]`;
+ const fld = field.indexOf('properties.') < 0 ? _.snakeCase(field) : field;
+
+ this.filters += `${this.filters ? "," : ""}["${resPrefix}${fld}","${cond}",${value}]`;
}
return this;
}
diff --git a/src/store/search-bar/search-bar-actions.ts b/src/store/search-bar/search-bar-actions.ts
index f5d8357..3d1b4ee 100644
--- a/src/store/search-bar/search-bar-actions.ts
+++ b/src/store/search-bar/search-bar-actions.ts
@@ -353,7 +353,7 @@ export const parseSearchQuery: (query: string) => ParseSearchQuery = (searchValu
const getFirstProp = (sq: ParseSearchQuery, name: string) => sq.properties[name] && sq.properties[name][0];
const getPropValue = (sq: ParseSearchQuery, name: string, value: string) => sq.properties[name] && sq.properties[name].find((v: string) => v === value);
-const getProperties = (sq: ParseSearchQuery) => {
+const getProperties = (sq: ParseSearchQuery): PropertyValues[] => {
if (sq.properties.has) {
return sq.properties.has.map((value: string) => {
const v = value.split(':');
@@ -439,9 +439,13 @@ export const getFilters = (filterName: string, searchValue: string): string => {
if (dateTo) {
filter.addLte('modified_at', buildDateFilter(dateTo));
}
- }
- // TODO: has props
+ const props = getProperties(sq);
+ props.forEach(p => {
+ // filter.addILike(`properties.${p.key}`, p.value);
+ filter.addExists(p.key);
+ });
+ }
return filter
.addEqual('groupClass', GroupClass.PROJECT, GroupContentsResourcePrefix.PROJECT)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list