aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionSchemaView.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-06-26 00:58:42 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-06-26 00:58:42 -0400
commit40884e159b436307aa30c02b5754c6f52fc1266f (patch)
tree4cc4ff000437e1d5fbceb7aef4185bd0fc06e896 /src/client/views/collections/CollectionSchemaView.tsx
parent5f3ba2363b74dc493b96ef2253560a48d3a7c711 (diff)
fixed schema and treeview for templates i think.
Diffstat (limited to 'src/client/views/collections/CollectionSchemaView.tsx')
-rw-r--r--src/client/views/collections/CollectionSchemaView.tsx7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx
index 17d87be7e..796882724 100644
--- a/src/client/views/collections/CollectionSchemaView.tsx
+++ b/src/client/views/collections/CollectionSchemaView.tsx
@@ -10,7 +10,7 @@ import { Doc, DocListCast, DocListCastAsync, Field } from "../../../new_fields/D
import { Id } from "../../../new_fields/FieldSymbols";
import { List } from "../../../new_fields/List";
import { listSpec } from "../../../new_fields/Schema";
-import { Cast, FieldValue, NumCast, StrCast } from "../../../new_fields/Types";
+import { Cast, FieldValue, NumCast, StrCast, BoolCast } from "../../../new_fields/Types";
import { emptyFunction, returnFalse, returnZero } from "../../../Utils";
import { Docs } from "../../documents/Documents";
import { Gateway } from "../../northstar/manager/Gateway";
@@ -283,8 +283,7 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) {
@computed
get previewDocument(): Doc | undefined {
- const children = DocListCast(this.props.Document[this.props.fieldKey]);
- const selected = children.length > this._selectedIndex ? FieldValue(children[this._selectedIndex]) : undefined;
+ const selected = this.childDocs.length > this._selectedIndex ? this.childDocs[this._selectedIndex] : undefined;
return selected ? (this.previewScript && this.previewScript !== "this" ? FieldValue(Cast(selected[this.previewScript], Doc)) : selected) : undefined;
}
@@ -351,7 +350,7 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) {
get previewPanel() {
return <div ref={this.createTarget}><CollectionSchemaPreview
Document={this.previewDocument}
- DataDocument={this.previewDocument}
+ DataDocument={BoolCast(this.props.Document.isTemplate) ? this.previewDocument : this.props.DataDoc}
childDocs={this.childDocs}
width={this.previewWidth}
height={this.previewHeight}