aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2020-01-09 18:31:03 -0500
committerSam Wilkins <samwilkins333@gmail.com>2020-01-09 18:31:03 -0500
commit6a45fd58601a2b03ed234f05b9b0a1b91d25a54d (patch)
tree23bc7c4fa3ce4202a0f37fb1a561770dd155b6d6
parent13ad9e65697101574893a1fcdf49e018391d0d33 (diff)
azure ink fixes, session
-rw-r--r--src/client/DocServer.ts6
-rw-r--r--src/client/cognitive_services/CognitiveServices.ts9
-rw-r--r--src/new_fields/InkField.ts1
-rw-r--r--src/server/Session/session.ts2
4 files changed, 8 insertions, 10 deletions
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts
index 1723312cf..12fed3e46 100644
--- a/src/client/DocServer.ts
+++ b/src/client/DocServer.ts
@@ -64,13 +64,14 @@ export namespace DocServer {
}
}
+ const instructions = "This page will automatically refresh after this alert is closed. Expect to reconnect after about 30 seconds.";
function alertUser(connectionTerminationReason: string) {
switch (connectionTerminationReason) {
case "crash":
- alert("Dash has temporarily crashed. Administrators have been notified and the server is restarting itself. Please refresh your page in a few seconds, and expect to reconnect after about 30 seconds.");
+ alert(`Dash has temporarily crashed. Administrators have been notified and the server is restarting itself. ${instructions}`);
break;
case "temporary":
- alert("An administrator has chosen to restart the server. Please refresh your page in a few seconds, and expect to reconnect after about 30 seconds.");
+ alert(`An administrator has chosen to restart the server. ${instructions}`);
break;
case "exit":
alert("An administrator has chosen to kill the server. Do not expect to reconnect until administrators start the server.");
@@ -78,6 +79,7 @@ export namespace DocServer {
default:
console.log(`Received an unknown ConnectionTerminated message: ${connectionTerminationReason}`);
}
+ window.location.reload();
}
export function init(protocol: string, hostname: string, port: number, identifier: string) {
diff --git a/src/client/cognitive_services/CognitiveServices.ts b/src/client/cognitive_services/CognitiveServices.ts
index 02eff3b25..57296c961 100644
--- a/src/client/cognitive_services/CognitiveServices.ts
+++ b/src/client/cognitive_services/CognitiveServices.ts
@@ -137,7 +137,7 @@ export namespace CognitiveServices {
let id = 0;
const strokes: AzureStrokeData[] = inkData.map(points => ({
id: id++,
- points: points.map(({ x, y }) => `${x},${y}`).join(","),
+ points: points.map(({ X: x, Y: y }) => `${x},${y}`).join(","),
language: "en-US"
}));
return JSON.stringify({
@@ -153,7 +153,7 @@ export namespace CognitiveServices {
const serverAddress = "https://api.cognitive.microsoft.com";
const endpoint = serverAddress + "/inkrecognizer/v1.0-preview/recognize";
- const promisified = (resolve: any, reject: any) => {
+ return new Promise<string>((resolve, reject) => {
xhttp.onreadystatechange = function () {
if (this.readyState === 4) {
const result = xhttp.responseText;
@@ -171,11 +171,8 @@ export namespace CognitiveServices {
xhttp.setRequestHeader('Ocp-Apim-Subscription-Key', apiKey);
xhttp.setRequestHeader('Content-Type', 'application/json');
xhttp.send(body);
- };
-
- return new Promise<any>(promisified);
+ });
},
-
};
export namespace Appliers {
diff --git a/src/new_fields/InkField.ts b/src/new_fields/InkField.ts
index 83d631958..e2aa7ee16 100644
--- a/src/new_fields/InkField.ts
+++ b/src/new_fields/InkField.ts
@@ -2,7 +2,6 @@ import { Deserializable } from "../client/util/SerializationHelper";
import { serializable, custom, createSimpleSchema, list, object, map } from "serializr";
import { ObjectField } from "./ObjectField";
import { Copy, ToScriptString } from "./FieldSymbols";
-import { DeepCopy } from "../Utils";
export enum InkTool {
None,
diff --git a/src/server/Session/session.ts b/src/server/Session/session.ts
index a0a52f128..d46e6b6e7 100644
--- a/src/server/Session/session.ts
+++ b/src/server/Session/session.ts
@@ -193,7 +193,7 @@ export namespace Session {
*/
public killSession = async (reason: string, graceful = true, errorCode = 0) => {
this.mainLog(cyan(`exiting session ${graceful ? "clean" : "immediate"}ly`));
- this.mainLog(`reason: ${(red(reason))}`);
+ this.mainLog(`session exit reason: ${(red(reason))}`);
await this.executeExitHandlers(true);
this.killActiveWorker(graceful, true);
process.exit(errorCode);