diff --git a/src/app/datasets/datasets-filter/datasets-filter.component.html b/src/app/datasets/datasets-filter/datasets-filter.component.html
index 8800e1b96..c138a9033 100644
--- a/src/app/datasets/datasets-filter/datasets-filter.component.html
+++ b/src/app/datasets/datasets-filter/datasets-filter.component.html
@@ -193,6 +193,9 @@
=
+
+ contains
+
<
@@ -201,7 +204,7 @@
{{
- condition.relation === "EQUAL_TO_STRING"
+ ["EQUAL_TO_STRING", "CONTAINS_STRING"].includes(condition.relation)
? '"' + condition.rhs + '"'
: condition.rhs
}}
diff --git a/src/app/samples/sample-dashboard/sample-dashboard.component.html b/src/app/samples/sample-dashboard/sample-dashboard.component.html
index 65f55a51d..ff3d75997 100644
--- a/src/app/samples/sample-dashboard/sample-dashboard.component.html
+++ b/src/app/samples/sample-dashboard/sample-dashboard.component.html
@@ -48,6 +48,9 @@
=
+
+ =
+
<
@@ -56,7 +59,7 @@
{{
- characteristic.relation === "EQUAL_TO_STRING"
+ [ "EQUAL_TO_STRING", "CONTAINS_STRING" ].includes(characteristic.relation)
? '"' + characteristic.rhs + '"'
: characteristic.rhs
}}
diff --git a/src/app/shared/modules/search-parameters-dialog/search-parameters-dialog.component.html b/src/app/shared/modules/search-parameters-dialog/search-parameters-dialog.component.html
index aa35c9c74..fb79c7f1e 100644
--- a/src/app/shared/modules/search-parameters-dialog/search-parameters-dialog.component.html
+++ b/src/app/shared/modules/search-parameters-dialog/search-parameters-dialog.component.html
@@ -38,6 +38,7 @@
Add Characteristic
is less than
is equal to (numeric)
is equal to (string)
+ contains string
@@ -90,4 +91,4 @@ Add Characteristic
Add
-
+
\ No newline at end of file
diff --git a/src/app/shared/modules/search-parameters-dialog/search-parameters-dialog.component.spec.ts b/src/app/shared/modules/search-parameters-dialog/search-parameters-dialog.component.spec.ts
index 5865322f8..2072f7a67 100644
--- a/src/app/shared/modules/search-parameters-dialog/search-parameters-dialog.component.spec.ts
+++ b/src/app/shared/modules/search-parameters-dialog/search-parameters-dialog.component.spec.ts
@@ -107,7 +107,7 @@ describe("SearchParametersDialogComponent", () => {
});
describe("#toggleUnitField()", () => {
- it("should enable unitField if lhs is valid and relation is not EQUAL_TO_STRING", () => {
+ it("should enable unitField if lhs is valid and relation is not CONTAINS_STRING or EQUAL_TO_STRING" , () => {
const formValues = {
lhs: "mass",
relation: "LESS_THAN",
diff --git a/src/app/shared/modules/search-parameters-dialog/search-parameters-dialog.component.ts b/src/app/shared/modules/search-parameters-dialog/search-parameters-dialog.component.ts
index e5af6d850..2c54e3233 100644
--- a/src/app/shared/modules/search-parameters-dialog/search-parameters-dialog.component.ts
+++ b/src/app/shared/modules/search-parameters-dialog/search-parameters-dialog.component.ts
@@ -57,8 +57,9 @@ export class SearchParametersDialogComponent {
add = (): void => {
const { lhs, relation, unit } = this.parametersForm.value;
const rawRhs = this.parametersForm.get("rhs")?.value;
- const rhs =
- relation === "EQUAL_TO_STRING" ? String(rawRhs) : Number(rawRhs);
+ const rhs = ["CONTAINS_STRING", "EQUAL_TO_STRING"].includes(relation)
+ ? String(rawRhs)
+ : Number(rawRhs);
this.parametersForm.patchValue({ rhs });
this.dialogRef.close({ data: { lhs, relation, rhs, unit } });
};
@@ -73,7 +74,11 @@ export class SearchParametersDialogComponent {
toggleUnitField = (): void => {
const lhsInvalid = this.parametersForm.get("lhs")?.invalid;
const { relation } = this.parametersForm.value;
- const isStringRelation = relation === "EQUAL_TO_STRING" ? true : false;
+ const isStringRelation = ["CONTAINS_STRING", "EQUAL_TO_STRING"].includes(
+ relation,
+ )
+ ? true
+ : false;
const unitField = this.parametersForm.get("unit");
unitField?.enable();
if (lhsInvalid || isStringRelation) {
@@ -88,7 +93,10 @@ export class SearchParametersDialogComponent {
if (invalid) {
return invalid;
}
- if (relation !== "EQUAL_TO_STRING" && isNaN(Number(rhs))) {
+ if (
+ !["CONTAINS_STRING", "EQUAL_TO_STRING"].includes(relation) &&
+ isNaN(Number(rhs))
+ ) {
return true;
}
return lhs.length * (rhs as string).length === 0;
diff --git a/src/app/state-management/models/index.ts b/src/app/state-management/models/index.ts
index 12f769a01..fde0343a3 100644
--- a/src/app/state-management/models/index.ts
+++ b/src/app/state-management/models/index.ts
@@ -81,6 +81,7 @@ export enum JobViewMode {
type ScientificConditionRelation =
| "EQUAL_TO_NUMERIC"
| "EQUAL_TO_STRING"
+ | "CONTAINS_STRING"
| "GREATER_THAN"
| "LESS_THAN";