diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/ScriptingBox.tsx | 13 | ||||
-rw-r--r-- | src/server/database.ts | 8 | ||||
-rw-r--r-- | src/server/index.ts | 2 |
3 files changed, 17 insertions, 6 deletions
diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index f810d178c..8e8340042 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -122,14 +122,17 @@ 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("="); - this.compileParams[index] = firstParam[0] + " = " + de.complete.docDragData?.droppedDocuments[0]; + this.compileParams[index] = firstParam[0] + " = " + de.complete.docDragData?.droppedDocuments[0].id; } - onDelete = (parameter: any) => { - this.compileParams.filter(s => s !== parameter); + @action + onDelete = (num: number) => { + this.compileParams.splice(num, 1); } render() { @@ -154,7 +157,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc />; const listParams = this.compileParams.map((parameter, i) => - <div className="scriptingBox-pborder" style={{ background: this._dropped ? "blue" : "" }}> + <div className="scriptingBox-pborder" style={{ background: this._dropped ? "yellow" : "" }}> <EditableView contents={parameter} display={"block"} @@ -169,7 +172,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc parameter = value; return true; } else { - this.onDelete(parameter); + this.onDelete(i); return true; } }} diff --git a/src/server/database.ts b/src/server/database.ts index ad285765b..e9373762c 100644 --- a/src/server/database.ts +++ b/src/server/database.ts @@ -8,6 +8,7 @@ import { IDatabase } from './IDatabase'; import { MemoryDatabase } from './MemoryDatabase'; import * as mongoose from 'mongoose'; import { Upload } from './SharedMediaTypes'; +import { timeout } from 'async'; export namespace Database { @@ -53,6 +54,7 @@ export namespace Database { private db?: mongodb.Db; private onConnect: (() => void)[] = []; + doConnect() { console.error(`\nConnecting to Mongo with URL : ${url}\n`); this.MongoClient.connect(url, { connectTimeoutMS: 30000, socketTimeoutMS: 30000, useUnifiedTopology: true }, (_err, client) => { @@ -67,6 +69,12 @@ export namespace Database { }); } + + + + + + public async update(id: string, value: any, callback: (err: mongodb.MongoError, res: mongodb.UpdateWriteOpResult) => void, upsert = true, collectionName = Database.DocumentsCollection) { if (this.db) { diff --git a/src/server/index.ts b/src/server/index.ts index f26c8a6ab..005ecb1be 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -153,6 +153,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(); } |