aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package-lock.json321
-rw-r--r--src/.DS_Storebin6148 -> 8196 bytes
-rw-r--r--src/client/documents/Documents.ts5
-rw-r--r--src/client/views/EditableView.tsx9
-rw-r--r--src/client/views/nodes/ScriptingBox.scss52
-rw-r--r--src/client/views/nodes/ScriptingBox.tsx175
-rw-r--r--src/server/database.ts17
-rw-r--r--src/server/index.ts2
8 files changed, 552 insertions, 29 deletions
diff --git a/package-lock.json b/package-lock.json
index e3f7fa018..d4a5e57b1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5529,18 +5529,95 @@
"to-regex": "^3.0.1"
},
"dependencies": {
+<<<<<<< HEAD
+ "abbrev": {
+ "version": "1.1.1",
+ "bundled": true,
+ "optional": true
+ },
+ "ansi-regex": {
+ "version": "2.1.1",
+ "bundled": true,
+ "optional": true
+ },
+ "aproba": {
+ "version": "1.2.0",
+ "bundled": true,
+ "optional": true
+ },
+ "are-we-there-yet": {
+ "version": "1.1.5",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "delegates": "^1.0.0",
+ "readable-stream": "^2.0.6"
+ }
+ },
+ "balanced-match": {
+ "version": "1.0.0",
+ "bundled": true,
+ "optional": true
+ },
+ "bindings": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
+ "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
+ "optional": true,
+ "requires": {
+ "file-uri-to-path": "1.0.0"
+ }
+ },
+ "brace-expansion": {
+ "version": "1.1.11",
+ "bundled": true,
+ "optional": true,
+=======
"define-property": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz",
"integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=",
+>>>>>>> 98c7540fff67c232c1b04f2130ee624f9a70afbd
"requires": {
"is-descriptor": "^1.0.0"
}
},
+<<<<<<< HEAD
+ "chownr": {
+ "version": "1.1.4",
+ "bundled": true,
+ "optional": true
+ },
+ "code-point-at": {
+ "version": "1.1.0",
+ "bundled": true,
+ "optional": true
+ },
+ "concat-map": {
+ "version": "0.0.1",
+ "bundled": true,
+ "optional": true
+ },
+ "console-control-strings": {
+ "version": "1.1.0",
+ "bundled": true,
+ "optional": true
+ },
+ "core-util-is": {
+ "version": "1.0.2",
+ "bundled": true,
+ "optional": true
+ },
+ "debug": {
+ "version": "3.2.6",
+ "bundled": true,
+ "optional": true,
+=======
"extend-shallow": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz",
"integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=",
+>>>>>>> 98c7540fff67c232c1b04f2130ee624f9a70afbd
"requires": {
"is-extendable": "^0.1.0"
}
@@ -5571,6 +5648,22 @@
"kind-of": "^6.0.2"
}
},
+<<<<<<< HEAD
+ "inherits": {
+ "version": "2.0.4",
+ "bundled": true,
+ "optional": true
+ },
+ "ini": {
+ "version": "1.3.5",
+ "bundled": true,
+ "optional": true
+ },
+ "is-fullwidth-code-point": {
+ "version": "1.0.0",
+ "bundled": true,
+ "optional": true,
+=======
"is-extendable": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
@@ -5647,6 +5740,7 @@
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
+>>>>>>> 98c7540fff67c232c1b04f2130ee624f9a70afbd
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
@@ -5677,9 +5771,32 @@
"dependencies": {
"schema-utils": {
"version": "1.0.0",
+<<<<<<< HEAD
+ "bundled": true,
+ "optional": true
+ },
+ "minimatch": {
+ "version": "3.0.4",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "brace-expansion": "^1.1.7"
+ }
+ },
+ "minimist": {
+ "version": "1.2.5",
+ "bundled": true,
+ "optional": true
+ },
+ "minipass": {
+ "version": "2.9.0",
+ "bundled": true,
+ "optional": true,
+=======
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",
"integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==",
"dev": true,
+>>>>>>> 98c7540fff67c232c1b04f2130ee624f9a70afbd
"requires": {
"ajv": "^6.1.0",
"ajv-errors": "^1.0.0",
@@ -5727,6 +5844,12 @@
"is-extendable": "^0.1.0"
}
},
+<<<<<<< HEAD
+ "mkdirp": {
+ "version": "0.5.3",
+ "bundled": true,
+ "optional": true,
+=======
"is-extendable": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
@@ -5752,11 +5875,81 @@
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+>>>>>>> 98c7540fff67c232c1b04f2130ee624f9a70afbd
"requires": {
"ms": "2.0.0"
}
},
"ms": {
+<<<<<<< HEAD
+ "version": "2.1.2",
+ "bundled": true,
+ "optional": true
+ },
+ "needle": {
+ "version": "2.3.3",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "debug": "^3.2.6",
+ "iconv-lite": "^0.4.4",
+ "sax": "^1.2.4"
+ }
+ },
+ "node-pre-gyp": {
+ "version": "0.14.0",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "detect-libc": "^1.0.2",
+ "mkdirp": "^0.5.1",
+ "needle": "^2.2.1",
+ "nopt": "^4.0.1",
+ "npm-packlist": "^1.1.6",
+ "npmlog": "^4.0.2",
+ "rc": "^1.2.7",
+ "rimraf": "^2.6.1",
+ "semver": "^5.3.0",
+ "tar": "^4.4.2"
+ }
+ },
+ "nopt": {
+ "version": "4.0.3",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "abbrev": "1",
+ "osenv": "^0.1.4"
+ }
+ },
+ "npm-bundled": {
+ "version": "1.1.1",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "npm-normalize-package-bin": "^1.0.1"
+ }
+ },
+ "npm-normalize-package-bin": {
+ "version": "1.0.1",
+ "bundled": true,
+ "optional": true
+ },
+ "npm-packlist": {
+ "version": "1.4.8",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "ignore-walk": "^3.0.1",
+ "npm-bundled": "^1.0.1",
+ "npm-normalize-package-bin": "^1.0.1"
+ }
+ },
+ "npmlog": {
+ "version": "4.1.2",
+ "bundled": true,
+ "optional": true,
+=======
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
@@ -5844,6 +6037,7 @@
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"dev": true,
+>>>>>>> 98c7540fff67c232c1b04f2130ee624f9a70afbd
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
@@ -5853,6 +6047,23 @@
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
+<<<<<<< HEAD
+ },
+ "number-is-nan": {
+ "version": "1.0.1",
+ "bundled": true,
+ "optional": true
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "bundled": true,
+ "optional": true
+ },
+ "once": {
+ "version": "1.4.0",
+ "bundled": true,
+ "optional": true,
+=======
}
}
},
@@ -5868,6 +6079,7 @@
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
+>>>>>>> 98c7540fff67c232c1b04f2130ee624f9a70afbd
"requires": {
"ms": "2.0.0"
}
@@ -6052,6 +6264,115 @@
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
+<<<<<<< HEAD
+ },
+ "rimraf": {
+ "version": "2.7.1",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "glob": "^7.1.3"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.1.2",
+ "bundled": true,
+ "optional": true
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "bundled": true,
+ "optional": true
+ },
+ "sax": {
+ "version": "1.2.4",
+ "bundled": true,
+ "optional": true
+ },
+ "semver": {
+ "version": "5.7.1",
+ "bundled": true,
+ "optional": true
+ },
+ "set-blocking": {
+ "version": "2.0.0",
+ "bundled": true,
+ "optional": true
+ },
+ "signal-exit": {
+ "version": "3.0.2",
+ "bundled": true,
+ "optional": true
+ },
+ "string-width": {
+ "version": "1.0.2",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "code-point-at": "^1.0.0",
+ "is-fullwidth-code-point": "^1.0.0",
+ "strip-ansi": "^3.0.0"
+ }
+ },
+ "string_decoder": {
+ "version": "1.1.1",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "safe-buffer": "~5.1.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "3.0.1",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "ansi-regex": "^2.0.0"
+ }
+ },
+ "strip-json-comments": {
+ "version": "2.0.1",
+ "bundled": true,
+ "optional": true
+ },
+ "tar": {
+ "version": "4.4.13",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "chownr": "^1.1.1",
+ "fs-minipass": "^1.2.5",
+ "minipass": "^2.8.6",
+ "minizlib": "^1.2.1",
+ "mkdirp": "^0.5.0",
+ "safe-buffer": "^5.1.2",
+ "yallist": "^3.0.3"
+ }
+ },
+ "util-deprecate": {
+ "version": "1.0.2",
+ "bundled": true,
+ "optional": true
+ },
+ "wide-align": {
+ "version": "1.1.3",
+ "bundled": true,
+ "optional": true,
+ "requires": {
+ "string-width": "^1.0.2 || 2"
+ }
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "bundled": true,
+ "optional": true
+ },
+ "yallist": {
+ "version": "3.1.1",
+ "bundled": true,
+ "optional": true
+=======
+>>>>>>> 98c7540fff67c232c1b04f2130ee624f9a70afbd
}
}
},
diff --git a/src/.DS_Store b/src/.DS_Store
index 5b35884bd..942a5672b 100644
--- a/src/.DS_Store
+++ b/src/.DS_Store
Binary files differ
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 18a0b43ff..471045400 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -699,6 +699,11 @@ export namespace Docs {
}
export function ButtonDocument(options?: DocumentOptions) {
+ // const btn = InstanceFromProto(Prototypes.get(DocumentType.BUTTON), undefined, { ...(options || {}), "onClick-rawScript": "-script-" });
+ // btn.layoutKey = "layout_onClick";
+ // btn.height = 250;
+ // btn.width = 200;
+ // btn.layout_onClick = ScriptingBox.LayoutString("onClick");
return InstanceFromProto(Prototypes.get(DocumentType.BUTTON), undefined, { ...(options || {}), "onClick-rawScript": "-script-" });
}
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx
index e0e205df9..4f3da70d7 100644
--- a/src/client/views/EditableView.tsx
+++ b/src/client/views/EditableView.tsx
@@ -5,6 +5,7 @@ import * as Autosuggest from 'react-autosuggest';
import { ObjectField } from '../../fields/ObjectField';
import { SchemaHeaderField } from '../../fields/SchemaHeaderField';
import "./EditableView.scss";
+import { DragManager } from '../util/DragManager';
export interface EditableProps {
/**
@@ -48,6 +49,7 @@ export interface EditableProps {
HeadingObject?: SchemaHeaderField | undefined;
toggle?: () => void;
color?: string | undefined;
+ onDrop?: any;
}
/**
@@ -77,6 +79,13 @@ export class EditableView extends React.Component<EditableProps> {
}
}
+ @action
+ componentDidMount() {
+ if (this._ref.current && this.props.onDrop) {
+ DragManager.MakeDropTarget(this._ref.current, this.props.onDrop.bind(this));
+ }
+ }
+
_didShow = false;
@action
diff --git a/src/client/views/nodes/ScriptingBox.scss b/src/client/views/nodes/ScriptingBox.scss
index 43695f00d..4746d62d4 100644
--- a/src/client/views/nodes/ScriptingBox.scss
+++ b/src/client/views/nodes/ScriptingBox.scss
@@ -5,31 +5,63 @@
flex-direction: column;
background-color: rgb(241, 239, 235);
padding: 10px;
+
.scriptingBox-inputDiv {
display: flex;
flex-direction: column;
height: calc(100% - 30px);
+ table-layout: fixed;
+
+ overflow-y: hidden;
+ white-space: nowrap;
+
+ .scriptingBox-wrapper {
+ width: 100%;
+ height: 100%;
+ max-height: calc(100%-30px);
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ overflow-y: hidden;
+
+ .scriptingBox-textArea {
+ flex: 70;
+ width: 70%;
+ height: 100%;
+ box-sizing: border-box;
+ resize: none;
+ padding: 7px;
+ overflow-y: hidden;
+ }
+
+ .scriptingBox-plist {
+ flex: 30;
+ width: 30%;
+ height: 100%;
+ box-sizing: border-box;
+ resize: none;
+ padding: 2px;
+ overflow-y: scroll;
+ }
+ }
+
.scriptingBox-errorMessage {
overflow: auto;
}
+
.scripting-params {
background: "beige";
}
- .scriptingBox-textArea {
- width: 100%;
- height: 100%;
- box-sizing: border-box;
- resize: none;
- padding: 7px;
- }
}
.scriptingBox-toolbar {
width: 100%;
height: 30px;
+
.scriptingBox-button {
- width: 50%
+ width: 50%;
+ resize: auto;
+
}
}
-}
-
+} \ No newline at end of file
diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx
index 0944edf60..98d5e6b71 100644
--- a/src/client/views/nodes/ScriptingBox.tsx
+++ b/src/client/views/nodes/ScriptingBox.tsx
@@ -13,24 +13,35 @@ import { FieldView, FieldViewProps } from "../nodes/FieldView";
import "./ScriptingBox.scss";
import { OverlayView } from "../OverlayView";
import { DocumentIconContainer } from "./DocumentIcon";
+<<<<<<< HEAD
+import { List } from "../../../new_fields/List";
+import { DragManager } from "../../util/DragManager";
+=======
import { List } from "../../../fields/List";
+>>>>>>> 98c7540fff67c232c1b04f2130ee624f9a70afbd
const ScriptingSchema = createSchema({});
type ScriptingDocument = makeInterface<[typeof ScriptingSchema, typeof documentSchema]>;
const ScriptingDocument = makeInterface(ScriptingSchema, documentSchema);
+
@observer
export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, ScriptingDocument>(ScriptingDocument) {
+
protected multiTouchDisposer?: InteractionUtils.MultiTouchEventDisposer | undefined;
+ rowProps: any;
public static LayoutString(fieldStr: string) { return FieldView.LayoutString(ScriptingBox, fieldStr); }
_overlayDisposer?: () => void;
@observable private _errorMessage: string = "";
+ @observable private _paramNum: number = 0;
+ @observable private _dropped: boolean = false;
@computed get rawScript() { return StrCast(this.dataDoc[this.props.fieldKey + "-rawScript"], StrCast(this.layoutDoc[this.props.fieldKey + "-rawScript"])); }
@computed get compileParams() { return Cast(this.dataDoc[this.props.fieldKey + "-params"], listSpec("string"), Cast(this.layoutDoc[this.props.fieldKey + "-params"], listSpec("string"), [])); }
set rawScript(value) { this.dataDoc[this.props.fieldKey + "-rawScript"] = value; }
+
set compileParams(value) { this.dataDoc[this.props.fieldKey + "-params"] = value; }
@action
@@ -41,21 +52,73 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc
componentWillUnmount() { this._overlayDisposer?.(); }
@action
+ onFinish = () => {
+ const result = CompileScript(this.rawScript, {});
+ this.rootDoc.layoutKey = "layout";
+ this.rootDoc.height = 50;
+ this.rootDoc.width = 100;
+ this.props.Document.documentText = this.rawScript;
+ }
+
+ @action
+ onError = (error: any) => {
+ for (const entry of error) {
+ this._errorMessage = this._errorMessage + " " + entry.messageText;
+ }
+ }
+
+ @action
onCompile = () => {
+ // const params = this.compileParams.reduce((o: ScriptParam, p: string) => { o[p] = "any"; return o; }, {} as ScriptParam);
+ // const result = CompileScript(this.rawScript, {
+ // editable: true,
+ // transformer: DocumentIconContainer.getTransformer(),
+ // params,
+ // typecheck: false
+ // });
+ // this._errorMessage = isCompileError(result) ? result.errors.map(e => e.messageText).join("\n") : "";
+ // return this.dataDoc[this.props.fieldKey] = result.compiled ? new ScriptField(result) : undefined;
const params = this.compileParams.reduce((o: ScriptParam, p: string) => { o[p] = "any"; return o; }, {} as ScriptParam);
const result = CompileScript(this.rawScript, {
- editable: true,
- transformer: DocumentIconContainer.getTransformer(),
+ editable: false,
+ transformer: undefined,
params,
- typecheck: false
+ typecheck: true
});
- this._errorMessage = isCompileError(result) ? result.errors.map(e => e.messageText).join("\n") : "";
- return this.dataDoc[this.props.fieldKey] = result.compiled ? new ScriptField(result) : undefined;
+ this._errorMessage = "";
+ if (result.compiled) {
+ this._errorMessage = "";
+ this.props.Document.data = new ScriptField(result);
+ }
+ else {
+ this.onError(result.errors);
+ }
+ this.props.Document.documentText = this.rawScript;
}
@action
onRun = () => {
- this.onCompile()?.script.run({}, err => this._errorMessage = err.map((e: any) => e.messageText).join("\n"));
+ const params = this.compileParams.reduce((o: ScriptParam, p: string) => { o[p] = "any"; return o; }, {} as ScriptParam);
+ const result = CompileScript(this.rawScript, {
+ editable: false,
+ transformer: undefined,
+ params,
+ typecheck: true
+ });
+ this._errorMessage = "";
+ if (result.compiled) {
+ // this automatically saves
+ result.run({}, (err: any) => {
+ this._errorMessage = "";
+ this.onError(err);
+ });
+ this.props.Document.data = new ScriptField(result);
+ }
+ else {
+ this.onError(result.errors);
+ }
+ this.props.Document.documentText = this.rawScript;
+ //this.onCompile()?.script.run({}, err => this._errorMessage = err.map((e: any) => e.messageText).join("\n"));
}
onFocus = () => {
@@ -63,36 +126,112 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc
this._overlayDisposer = OverlayView.Instance.addElement(<DocumentIconContainer />, { x: 0, y: 0 });
}
+ @action
+ onDrop = (e: Event, de: DragManager.DropEvent, index: any) => {
+ this._dropped = true;
+ console.log("drop");
+ const firstParam = this.compileParams[index].split("=");
+ const dropped = de.complete.docDragData?.droppedDocuments;
+ if (dropped?.length) {
+ this.compileParams[index] = firstParam[0] + " = " + dropped[0].id;
+ }
+ }
+
+ @action
+ onDelete = (num: number) => {
+ this.compileParams.splice(num, 1);
+ }
+
render() {
+
const params = <EditableView
- contents={this.compileParams.join(" ")}
+ contents={""}
display={"block"}
maxHeight={72}
height={35}
- fontSize={28}
+ fontSize={22}
GetValue={() => ""}
- SetValue={value => { this.compileParams = new List<string>(value.split(" ").filter(s => s !== " ")); return true; }}
+ SetValue={value => {
+ if (value !== "" && value !== " ") {
+ this._paramNum++;
+ const par = this.compileParams;
+ this.compileParams = new List<string>(value.split(";").filter(s => s !== " "));
+ this.compileParams.push.apply(this.compileParams, par);
+ return true;
+ }
+ return false;
+ }}
/>;
+
+ const listParams = this.compileParams.map((parameter, i) =>
+ <div className="scriptingBox-pborder"
+ onFocus={this.onFocus}
+ onBlur={e => this._overlayDisposer?.()}
+ onKeyPress={e => {
+ if (e.key === "Enter") {
+ this._overlayDisposer?.();
+ }
+ }
+ }
+ style={{ background: this._dropped ? "yellow" : "" }}>
+ <EditableView
+ contents={parameter}
+ display={"block"}
+ maxHeight={72}
+ height={35}
+ fontSize={12}
+ GetValue={() => parameter}
+ onDrop={(e: Event, de: DragManager.DropEvent) => this.onDrop(e, de, i)}
+ SetValue={value => {
+ if (value !== "" && value !== " ") {
+ this.compileParams[i] = value;
+ parameter = value;
+ return true;
+ } else {
+ this.onDelete(i);
+ return true;
+ }
+ }}
+ />
+ </div>
+ );
+
return (
<div className="scriptingBox-outerDiv"
+
onWheel={e => this.props.isSelected(true) && e.stopPropagation()}>
+
<div className="scriptingBox-inputDiv"
onPointerDown={e => this.props.isSelected(true) && e.stopPropagation()} >
- <textarea className="scriptingBox-textarea"
- placeholder="write your script here"
- onChange={e => this.rawScript = e.target.value}
- value={this.rawScript}
- onFocus={this.onFocus}
- onBlur={e => this._overlayDisposer?.()} />
- <div className="scriptingBox-errorMessage" style={{ background: this._errorMessage ? "red" : "" }}>{this._errorMessage}</div>
+ <div className="scriptingBox-wrapper">
+
+ <textarea className="scriptingBox-textarea"
+ placeholder="write your script here"
+ onChange={e => this.rawScript = e.target.value}
+ value={this.rawScript}
+ onFocus={this.onFocus}
+ onBlur={e => this._overlayDisposer?.()}
+ style={{ width: this.compileParams.length > 0 ? "70%" : "100%" }} />
+
+ {this.compileParams.length > 0 ? <div className="scriptingBox-plist" style={{ width: "30%" }}>
+ {listParams}
+ </div> : null}
+ </div>
<div className="scriptingBox-params" >{params}</div>
+ <div className="scriptingBox-errorMessage" style={{ background: this._errorMessage ? "red" : "" }}>{this._errorMessage}</div>
</div>
{this.rootDoc.layout === "layout" ? <div></div> : (null)}
<div className="scriptingBox-toolbar">
- <button className="scriptingBox-button" onPointerDown={e => { this.onCompile(); e.stopPropagation(); }}>Compile</button>
- <button className="scriptingBox-button" onPointerDown={e => { this.onRun(); e.stopPropagation(); }}>Run</button>
+ <button className="scriptingBox-button" style={{ width: this.rootDoc.layoutKey === "layout_onClick" ? "33%" : "50%" }}
+ onPointerDown={e => { this.onCompile(); e.stopPropagation(); }}>Compile</button>
+ <button className="scriptingBox-button" style={{ width: this.rootDoc.layoutKey === "layout_onClick" ? "33%" : "50%" }}
+ onPointerDown={e => { this.onRun(); e.stopPropagation(); }}>Run</button>
+ {this.rootDoc.layoutKey === "layout_onClick" ? <button className="scriptingBox-button"
+ style={{ width: this.rootDoc.layoutKey === "layout_onClick" ? "33%" : "50%" }}
+ onPointerDown={e => { this.onFinish(); e.stopPropagation(); }}>Finish</button> : null}
</div>
</div>
);
}
+
}
diff --git a/src/server/database.ts b/src/server/database.ts
index a5f23c4b1..817712fb0 100644
--- a/src/server/database.ts
+++ b/src/server/database.ts
@@ -8,6 +8,7 @@ import { IDatabase, DocumentsCollection } from './IDatabase';
import { MemoryDatabase } from './MemoryDatabase';
import * as mongoose from 'mongoose';
import { Upload } from './SharedMediaTypes';
+import { timeout } from 'async';
export namespace Database {
@@ -52,7 +53,12 @@ export namespace Database {
private db?: mongodb.Db;
private onConnect: (() => void)[] = [];
+<<<<<<< HEAD
+
+ doConnect() {
+=======
async doConnect() {
+>>>>>>> 98c7540fff67c232c1b04f2130ee624f9a70afbd
console.error(`\nConnecting to Mongo with URL : ${url}\n`);
return new Promise<void>(resolve => {
this.MongoClient.connect(url, { connectTimeoutMS: 30000, socketTimeoutMS: 30000, useUnifiedTopology: true }, (_err, client) => {
@@ -69,7 +75,18 @@ export namespace Database {
});
}
+<<<<<<< HEAD
+
+
+
+
+
+
+ public async update(id: string, value: any, callback: (err: mongodb.MongoError, res: mongodb.UpdateWriteOpResult) => void, upsert = true, collectionName = Database.DocumentsCollection) {
+
+=======
public async update(id: string, value: any, callback: (err: mongodb.MongoError, res: mongodb.UpdateWriteOpResult) => void, upsert = true, collectionName = DocumentsCollection) {
+>>>>>>> 98c7540fff67c232c1b04f2130ee624f9a70afbd
if (this.db) {
const collection = this.db.collection(collectionName);
const prom = this.currentWrites[id];
diff --git a/src/server/index.ts b/src/server/index.ts
index af8f95a5e..d1bac6635 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -152,6 +152,6 @@ export async function launchServer() {
if (process.env.RELEASE) {
(sessionAgent = new DashSessionAgent()).launch();
} else {
- (Database.Instance as Database.Database).doConnect();
+ setTimeout(() => (Database.Instance as Database.Database).doConnect(), 30000);
launchServer();
}