aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/KeyRestrictionRow.tsx
diff options
context:
space:
mode:
authoryipstanley <stanley_yip@brown.edu>2019-07-30 16:33:27 -0400
committeryipstanley <stanley_yip@brown.edu>2019-07-30 16:33:27 -0400
commit7c3b56a2e4552308014aa011493b33e3b054be94 (patch)
tree2a4ff8619ffbfd0a2270b5ba02ee9328f0097206 /src/client/views/collections/KeyRestrictionRow.tsx
parent8f1159a8216a56caeabe9bed686852f18758eddb (diff)
fixed some scripting stuff on view specs
Diffstat (limited to 'src/client/views/collections/KeyRestrictionRow.tsx')
-rw-r--r--src/client/views/collections/KeyRestrictionRow.tsx6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/views/collections/KeyRestrictionRow.tsx b/src/client/views/collections/KeyRestrictionRow.tsx
index 9baa250a6..1b59547d8 100644
--- a/src/client/views/collections/KeyRestrictionRow.tsx
+++ b/src/client/views/collections/KeyRestrictionRow.tsx
@@ -2,6 +2,7 @@ import * as React from "react";
import { observable, runInAction } from "mobx";
import { observer } from "mobx-react";
import { PastelSchemaPalette } from "../../../new_fields/SchemaHeaderField";
+import { Doc } from "../../../new_fields/Doc";
interface IKeyRestrictionProps {
contains: boolean;
@@ -23,7 +24,10 @@ export default class KeyRestrictionRow extends React.Component<IKeyRestrictionPr
parsedValue = parsed;
type = "number";
}
- let scriptText = `${this._contains ? "" : "!"}((doc.${this._key} as ${type})${type === "string" ? ".includes" : "<="}(${parsedValue}))`;
+ let scriptText = `${this._contains ? "" : "!"}(((doc.${this._key} && (doc.${this._key} as ${type})${type === "string" ? ".includes" : "<="}(${parsedValue}))) ||
+ ((doc.data_ext && doc.data_ext.${this._key}) && (doc.data_ext.${this._key} as ${type})${type === "string" ? ".includes" : "<="}(${parsedValue}))))`;
+ // let doc = new Doc();
+ // ((doc.data_ext && doc.data_ext!.text) && (doc.data_ext!.text as string).includes("hello"));
this.props.script(scriptText);
}
else {