added tsconfig.json
This commit is contained in:
parent
1e5a81d9ec
commit
c6d17398c7
12 changed files with 36 additions and 51 deletions
|
|
@ -661,7 +661,7 @@ Or if you have [Air](https://github.com/cosmtrek/air) set up, just:
|
||||||
|
|
||||||
## type script compilation
|
## type script compilation
|
||||||
|
|
||||||
`tsc static/*.ts --lib es2020,dom --target ES5 --watch --downlevelIteration`
|
`tsc --watch`
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
||||||
|
|
|
||||||
15
tsconfig.json
Normal file
15
tsconfig.json
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "CommonJS",
|
||||||
|
"target": "ES5",
|
||||||
|
"lib": ["ES2020", "dom"],
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"removeComments": true,
|
||||||
|
"preserveConstEnums": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"downlevelIteration": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"web/static/*.ts"
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
// @ts-ignore
|
|
||||||
var urlPrefix = getURLPrefix();
|
var urlPrefix = getURLPrefix();
|
||||||
function testSubmit() {
|
function testSubmit() {
|
||||||
var form = document.getElementById("uploadForm");
|
var form = document.getElementById("uploadForm");
|
||||||
|
|
@ -17,3 +16,4 @@ function initUploadSubmit() {
|
||||||
restoreSubmitInput.onclick = restoreSubmit;
|
restoreSubmitInput.onclick = restoreSubmit;
|
||||||
}
|
}
|
||||||
document.addEventListener('DOMContentLoaded', initUploadSubmit, false);
|
document.addEventListener('DOMContentLoaded', initUploadSubmit, false);
|
||||||
|
//# sourceMappingURL=backup.js.map
|
||||||
1
web/static/backup.js.map
Normal file
1
web/static/backup.js.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"backup.js","sourceRoot":"","sources":["backup.ts"],"names":[],"mappings":"AACA,IAAI,SAAS,GAAG,YAAY,EAAE,CAAC;AAC/B,SAAS,UAAU;IACf,IAAI,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAoB,CAAC;IACpE,IAAI,CAAC,MAAM,GAAG,SAAS,GAAG,aAAa,CAAC;IACxC,IAAI,CAAC,MAAM,EAAE,CAAC;AAClB,CAAC;AAED,SAAS,aAAa;IAClB,IAAI,IAAI,GAAG,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAoB,CAAC;IACpE,IAAI,CAAC,MAAM,GAAG,SAAS,GAAG,gBAAgB,CAAC;IAC3C,IAAI,CAAC,MAAM,EAAE,CAAC;AAClB,CAAC;AAED,SAAS,gBAAgB;IACrB,IAAI,eAAe,GAAG,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAqB,CAAC;IAChF,eAAe,CAAC,OAAO,GAAG,UAAU,CAAC;IAErC,IAAI,kBAAkB,GAAG,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAqB,CAAC;IACtF,kBAAkB,CAAC,OAAO,GAAG,aAAa,CAAC;AAC/C,CAAC;AAED,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC"}
|
||||||
|
|
@ -19,3 +19,4 @@ function initOnChange() {
|
||||||
fileInput.onchange = fileOnChange;
|
fileInput.onchange = fileOnChange;
|
||||||
}
|
}
|
||||||
document.addEventListener('DOMContentLoaded', initOnChange, false);
|
document.addEventListener('DOMContentLoaded', initOnChange, false);
|
||||||
|
//# sourceMappingURL=create.js.map
|
||||||
1
web/static/create.js.map
Normal file
1
web/static/create.js.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"create.js","sourceRoot":"","sources":["create.ts"],"names":[],"mappings":"AAAA,SAAS,WAAW;IAChB,IAAI,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAqB,CAAC;IAClE,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAC;QAC1B,IAAI,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAqB,CAAC;QAC5E,aAAa,CAAC,OAAO,GAAG,IAAI,CAAC;KAChC;AACL,CAAC;AAED,SAAS,YAAY;IACjB,IAAI,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAqB,CAAC;IACpE,IAAI,SAAS,CAAC,KAAK,KAAK,IAAI,EAAC;QACzB,IAAI,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAqB,CAAC;QAC9E,cAAc,CAAC,OAAO,GAAG,IAAI,CAAC;KACjC;AACL,CAAC;AAED,SAAS,YAAY;IACjB,IAAI,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAqB,CAAC;IAClE,QAAQ,CAAC,QAAQ,GAAG,WAAW,CAAC;IAEhC,IAAI,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAqB,CAAC;IACpE,SAAS,CAAC,QAAQ,GAAG,YAAY,CAAC;AACtC,CAAC;AAED,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC"}
|
||||||
|
|
@ -22,7 +22,7 @@ var __values = (this && this.__values) || function(o) {
|
||||||
};
|
};
|
||||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||||
};
|
};
|
||||||
var CanvasObject = /** @class */ (function () {
|
var CanvasObject = (function () {
|
||||||
function CanvasObject(x, y, width, height) {
|
function CanvasObject(x, y, width, height) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
|
|
@ -47,7 +47,7 @@ var CanvasObject = /** @class */ (function () {
|
||||||
};
|
};
|
||||||
return CanvasObject;
|
return CanvasObject;
|
||||||
}());
|
}());
|
||||||
var Button = /** @class */ (function (_super) {
|
var Button = (function (_super) {
|
||||||
__extends(Button, _super);
|
__extends(Button, _super);
|
||||||
function Button(x, y, label, ctx, callback, node) {
|
function Button(x, y, label, ctx, callback, node) {
|
||||||
var _this = _super.call(this, x, y, 0, 0) || this;
|
var _this = _super.call(this, x, y, 0, 0) || this;
|
||||||
|
|
@ -84,7 +84,7 @@ var circleTopRadians = Math.PI / 2;
|
||||||
var circleRightRadians = (Math.PI * 3) / 2;
|
var circleRightRadians = (Math.PI * 3) / 2;
|
||||||
var circleBottomRadians = Math.PI + (Math.PI * 3);
|
var circleBottomRadians = Math.PI + (Math.PI * 3);
|
||||||
var circleLeftRadians = Math.PI;
|
var circleLeftRadians = Math.PI;
|
||||||
var NodeIO = /** @class */ (function (_super) {
|
var NodeIO = (function (_super) {
|
||||||
__extends(NodeIO, _super);
|
__extends(NodeIO, _super);
|
||||||
function NodeIO(node, input) {
|
function NodeIO(node, input) {
|
||||||
var _this = _super.call(this, 0, 0, 0, 0) || this;
|
var _this = _super.call(this, 0, 0, 0, 0) || this;
|
||||||
|
|
@ -129,7 +129,7 @@ var NodeIO = /** @class */ (function (_super) {
|
||||||
};
|
};
|
||||||
return NodeIO;
|
return NodeIO;
|
||||||
}(CanvasObject));
|
}(CanvasObject));
|
||||||
var NodeConnection = /** @class */ (function (_super) {
|
var NodeConnection = (function (_super) {
|
||||||
__extends(NodeConnection, _super);
|
__extends(NodeConnection, _super);
|
||||||
function NodeConnection(output, input) {
|
function NodeConnection(output, input) {
|
||||||
var _this = _super.call(this, 0, 0, 0, 0) || this;
|
var _this = _super.call(this, 0, 0, 0, 0) || this;
|
||||||
|
|
@ -187,7 +187,7 @@ var NodeConnection = /** @class */ (function (_super) {
|
||||||
};
|
};
|
||||||
return NodeConnection;
|
return NodeConnection;
|
||||||
}(CanvasObject));
|
}(CanvasObject));
|
||||||
var NewConnection = /** @class */ (function (_super) {
|
var NewConnection = (function (_super) {
|
||||||
__extends(NewConnection, _super);
|
__extends(NewConnection, _super);
|
||||||
function NewConnection(output) {
|
function NewConnection(output) {
|
||||||
var _this = _super.call(this, 0, 0, 0, 0) || this;
|
var _this = _super.call(this, 0, 0, 0, 0) || this;
|
||||||
|
|
@ -255,7 +255,7 @@ var NewConnection = /** @class */ (function (_super) {
|
||||||
};
|
};
|
||||||
return NewConnection;
|
return NewConnection;
|
||||||
}(CanvasObject));
|
}(CanvasObject));
|
||||||
var DiagramNode = /** @class */ (function (_super) {
|
var DiagramNode = (function (_super) {
|
||||||
__extends(DiagramNode, _super);
|
__extends(DiagramNode, _super);
|
||||||
function DiagramNode(id, x, y, label, meta, ctx, results, logs) {
|
function DiagramNode(id, x, y, label, meta, ctx, results, logs) {
|
||||||
if (meta === void 0) { meta = {}; }
|
if (meta === void 0) { meta = {}; }
|
||||||
|
|
@ -354,10 +354,8 @@ var DiagramNode = /** @class */ (function (_super) {
|
||||||
ctx.strokeRect(ms.offset.x + this.x, ms.offset.y + this.y, this.width, this.height);
|
ctx.strokeRect(ms.offset.x + this.x, ms.offset.y + this.y, this.width, this.height);
|
||||||
};
|
};
|
||||||
DiagramNode.prototype.fixType = function () {
|
DiagramNode.prototype.fixType = function () {
|
||||||
// @ts-ignore
|
|
||||||
this.type = this.meta.type;
|
this.type = this.meta.type;
|
||||||
if (["math", "condition"].indexOf(this.type) >= 0) {
|
if (["math", "condition"].indexOf(this.type) >= 0) {
|
||||||
// @ts-ignore
|
|
||||||
this.type = this.meta.var1;
|
this.type = this.meta.var1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -377,7 +375,6 @@ var DiagramNode = /** @class */ (function (_super) {
|
||||||
return this.pointNearNode(p) && (_super.prototype.pointInObject.call(this, p) || this.input.pointInObject(p) || this.output.pointInObject(p));
|
return this.pointNearNode(p) && (_super.prototype.pointInObject.call(this, p) || this.input.pointInObject(p) || this.output.pointInObject(p));
|
||||||
};
|
};
|
||||||
DiagramNode.prototype.pointNearNode = function (p) {
|
DiagramNode.prototype.pointNearNode = function (p) {
|
||||||
// including the input/output circles
|
|
||||||
if (p.x < this.x - this.input.radius) {
|
if (p.x < this.x - this.input.radius) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -419,7 +416,7 @@ function diagramOnWheel(ev) {
|
||||||
function diagramOnContext(ev) {
|
function diagramOnContext(ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
}
|
}
|
||||||
var Point = /** @class */ (function () {
|
var Point = (function () {
|
||||||
function Point(x, y) {
|
function Point(x, y) {
|
||||||
if (x === void 0) { x = 0; }
|
if (x === void 0) { x = 0; }
|
||||||
if (y === void 0) { y = 0; }
|
if (y === void 0) { y = 0; }
|
||||||
|
|
@ -430,7 +427,7 @@ var Point = /** @class */ (function () {
|
||||||
}
|
}
|
||||||
return Point;
|
return Point;
|
||||||
}());
|
}());
|
||||||
var MouseState = /** @class */ (function () {
|
var MouseState = (function () {
|
||||||
function MouseState() {
|
function MouseState() {
|
||||||
this.canvas = new Point();
|
this.canvas = new Point();
|
||||||
this.absCanvas = new Point();
|
this.absCanvas = new Point();
|
||||||
|
|
@ -446,7 +443,7 @@ var MouseState = /** @class */ (function () {
|
||||||
}
|
}
|
||||||
return MouseState;
|
return MouseState;
|
||||||
}());
|
}());
|
||||||
var Diagrams = /** @class */ (function () {
|
var Diagrams = (function () {
|
||||||
function Diagrams(canvasId, editNodeCallback, deleteNodeCallback) {
|
function Diagrams(canvasId, editNodeCallback, deleteNodeCallback) {
|
||||||
if (editNodeCallback === void 0) { editNodeCallback = function () { }; }
|
if (editNodeCallback === void 0) { editNodeCallback = function () { }; }
|
||||||
if (deleteNodeCallback === void 0) { deleteNodeCallback = function () { }; }
|
if (deleteNodeCallback === void 0) { deleteNodeCallback = function () { }; }
|
||||||
|
|
@ -724,13 +721,12 @@ var Diagrams = /** @class */ (function () {
|
||||||
Diagrams.prototype.fillParent = function () {
|
Diagrams.prototype.fillParent = function () {
|
||||||
this.canvas.width = this.canvas.clientWidth;
|
this.canvas.width = this.canvas.clientWidth;
|
||||||
this.canvas.height = this.canvas.clientHeight;
|
this.canvas.height = this.canvas.clientHeight;
|
||||||
//this.draw();
|
|
||||||
};
|
};
|
||||||
return Diagrams;
|
return Diagrams;
|
||||||
}());
|
}());
|
||||||
// http://www.independent-software.com/determining-coordinates-on-a-html-canvas-bezier-curve.html
|
|
||||||
function getBezierXY(t, sx, sy, cp1x, cp1y, cp2x, cp2y, ex, ey) {
|
function getBezierXY(t, sx, sy, cp1x, cp1y, cp2x, cp2y, ex, ey) {
|
||||||
return new Point(Math.pow(1 - t, 3) * sx + 3 * t * Math.pow(1 - t, 2) * cp1x
|
return new Point(Math.pow(1 - t, 3) * sx + 3 * t * Math.pow(1 - t, 2) * cp1x
|
||||||
+ 3 * t * t * (1 - t) * cp2x + t * t * t * ex, Math.pow(1 - t, 3) * sy + 3 * t * Math.pow(1 - t, 2) * cp1y
|
+ 3 * t * t * (1 - t) * cp2x + t * t * t * ex, Math.pow(1 - t, 3) * sy + 3 * t * Math.pow(1 - t, 2) * cp1y
|
||||||
+ 3 * t * t * (1 - t) * cp2y + t * t * t * ey);
|
+ 3 * t * t * (1 - t) * cp2y + t * t * t * ey);
|
||||||
}
|
}
|
||||||
|
//# sourceMappingURL=diagram.js.map
|
||||||
1
web/static/diagram.js.map
Normal file
1
web/static/diagram.js.map
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -29,14 +29,10 @@ var __spread = (this && this.__spread) || function () {
|
||||||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
|
||||||
return ar;
|
return ar;
|
||||||
};
|
};
|
||||||
// @ts-ignore
|
|
||||||
var urlPrefix = getURLPrefix();
|
var urlPrefix = getURLPrefix();
|
||||||
function onTypeChange(node) {
|
function onTypeChange(node) {
|
||||||
var e_1, _a, e_2, _b;
|
var e_1, _a, e_2, _b;
|
||||||
if (node === void 0) { node = null; }
|
if (node === void 0) { node = null; }
|
||||||
// onTypeChange handles changing of the type of a DiagramNode while editing or creating a new Node
|
|
||||||
// It removes all input elements and each case is responsible for adding the input it needs
|
|
||||||
// @ts-ignore
|
|
||||||
var urlPrefix = getURLPrefix();
|
var urlPrefix = getURLPrefix();
|
||||||
var select = document.getElementById("typeInput");
|
var select = document.getElementById("typeInput");
|
||||||
var type = select.value;
|
var type = select.value;
|
||||||
|
|
@ -52,9 +48,7 @@ function onTypeChange(node) {
|
||||||
var var1Value = "";
|
var var1Value = "";
|
||||||
var var2Value = "";
|
var var2Value = "";
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
// @ts-ignore
|
|
||||||
var1Value = node.meta.var1;
|
var1Value = node.meta.var1;
|
||||||
// @ts-ignore
|
|
||||||
var2Value = node.meta.var2;
|
var2Value = node.meta.var2;
|
||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
@ -493,7 +487,6 @@ function onTypeChange(node) {
|
||||||
var2Input.id = "var2Input";
|
var2Input.id = "var2Input";
|
||||||
var2Input.classList.add("form-control");
|
var2Input.classList.add("form-control");
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
|
||||||
for (var notifiers_1 = __values(notifiers), notifiers_1_1 = notifiers_1.next(); !notifiers_1_1.done; notifiers_1_1 = notifiers_1.next()) {
|
for (var notifiers_1 = __values(notifiers), notifiers_1_1 = notifiers_1.next(); !notifiers_1_1.done; notifiers_1_1 = notifiers_1.next()) {
|
||||||
var notifier = notifiers_1_1.value;
|
var notifier = notifiers_1_1.value;
|
||||||
if (notifier == "") {
|
if (notifier == "") {
|
||||||
|
|
@ -599,7 +592,6 @@ function onTypeChange(node) {
|
||||||
}
|
}
|
||||||
var1Input_1.rows = 10;
|
var1Input_1.rows = 10;
|
||||||
var1Div.appendChild(var1Input_1);
|
var1Div.appendChild(var1Input_1);
|
||||||
// dev copy link
|
|
||||||
var devCopyA_1 = document.createElement('a');
|
var devCopyA_1 = document.createElement('a');
|
||||||
var results = node == null ? [] : node.results;
|
var results = node == null ? [] : node.results;
|
||||||
var luaScript_1 = "inputs = {\"" + results.join('","') + "\"}\noutputs = {}\n\n " + var1Input_1.value;
|
var luaScript_1 = "inputs = {\"" + results.join('","') + "\"}\noutputs = {}\n\n " + var1Input_1.value;
|
||||||
|
|
@ -642,7 +634,6 @@ function onTypeChange(node) {
|
||||||
snippetDiv.appendChild(gap);
|
snippetDiv.appendChild(gap);
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
// add snippets
|
|
||||||
for (var luaSnippets_1 = __values(luaSnippets), luaSnippets_1_1 = luaSnippets_1.next(); !luaSnippets_1_1.done; luaSnippets_1_1 = luaSnippets_1.next()) {
|
for (var luaSnippets_1 = __values(luaSnippets), luaSnippets_1_1 = luaSnippets_1.next(); !luaSnippets_1_1.done; luaSnippets_1_1 = luaSnippets_1.next()) {
|
||||||
var _c = __read(luaSnippets_1_1.value, 2), name_1 = _c[0], snippet = _c[1];
|
var _c = __read(luaSnippets_1_1.value, 2), name_1 = _c[0], snippet = _c[1];
|
||||||
_loop_1(name_1, snippet);
|
_loop_1(name_1, snippet);
|
||||||
|
|
@ -671,7 +662,6 @@ function onTypeChange(node) {
|
||||||
}
|
}
|
||||||
function onMathChange(node) {
|
function onMathChange(node) {
|
||||||
if (node === void 0) { node = null; }
|
if (node === void 0) { node = null; }
|
||||||
// onMatchChange handles the changing of the inputs when type == math
|
|
||||||
var var1Input = document.getElementById("var1Input");
|
var var1Input = document.getElementById("var1Input");
|
||||||
var var1Label = document.getElementById("var1Label");
|
var var1Label = document.getElementById("var1Label");
|
||||||
var var2Input = document.getElementById("var2Input");
|
var var2Input = document.getElementById("var2Input");
|
||||||
|
|
@ -679,7 +669,6 @@ function onMathChange(node) {
|
||||||
var var3Label = document.getElementById("var3Label");
|
var var3Label = document.getElementById("var3Label");
|
||||||
var var2Value = "";
|
var var2Value = "";
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
// @ts-ignore
|
|
||||||
var2Value = node.meta.var2;
|
var2Value = node.meta.var2;
|
||||||
}
|
}
|
||||||
if (var1Input.value == "round") {
|
if (var1Input.value == "round") {
|
||||||
|
|
@ -698,7 +687,6 @@ function onMathChange(node) {
|
||||||
function onConditionChange(node) {
|
function onConditionChange(node) {
|
||||||
var e_3, _a;
|
var e_3, _a;
|
||||||
if (node === void 0) { node = null; }
|
if (node === void 0) { node = null; }
|
||||||
// onConditionChange handles the changing of the inputs when type == condition
|
|
||||||
var var1Input = document.getElementById("var1Input");
|
var var1Input = document.getElementById("var1Input");
|
||||||
var var1Label = document.getElementById("var1Label");
|
var var1Label = document.getElementById("var1Label");
|
||||||
var var1Div = document.getElementById("var1Div");
|
var var1Div = document.getElementById("var1Div");
|
||||||
|
|
@ -711,10 +699,8 @@ function onConditionChange(node) {
|
||||||
var var1Value = "";
|
var var1Value = "";
|
||||||
var var2Value = "";
|
var var2Value = "";
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
// @ts-ignore
|
|
||||||
var1Value = node.meta.var1;
|
var1Value = node.meta.var1;
|
||||||
var1Input.value = var1Value;
|
var1Input.value = var1Value;
|
||||||
// @ts-ignore
|
|
||||||
var2Value = node.meta.var2;
|
var2Value = node.meta.var2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -779,7 +765,6 @@ function onConditionChange(node) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onBrowserlessChange(node) {
|
function onBrowserlessChange(node) {
|
||||||
// onBrowserlessChange handles the changing of the inputs when type == browserless
|
|
||||||
if (node === void 0) { node = null; }
|
if (node === void 0) { node = null; }
|
||||||
var var1Input = document.getElementById("var1Input");
|
var var1Input = document.getElementById("var1Input");
|
||||||
var var1Label = document.getElementById("var1Label");
|
var var1Label = document.getElementById("var1Label");
|
||||||
|
|
@ -794,10 +779,8 @@ function onBrowserlessChange(node) {
|
||||||
var var1Value = "";
|
var var1Value = "";
|
||||||
var var2Value = "";
|
var var2Value = "";
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
// @ts-ignore
|
|
||||||
var1Value = node.meta.var1;
|
var1Value = node.meta.var1;
|
||||||
var1Input.value = var1Value;
|
var1Input.value = var1Value;
|
||||||
// @ts-ignore
|
|
||||||
var2Value = node.meta.var2;
|
var2Value = node.meta.var2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -883,7 +866,6 @@ function onBrowserlessChange(node) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onSubmitNewFilter() {
|
function onSubmitNewFilter() {
|
||||||
// onSubmitNewFilter collects all the values from the input elements, and calls _diagram.addNode() with it
|
|
||||||
var nameInput = document.getElementById("nameInput");
|
var nameInput = document.getElementById("nameInput");
|
||||||
var name = nameInput.value;
|
var name = nameInput.value;
|
||||||
var selectType = document.getElementById("typeInput");
|
var selectType = document.getElementById("typeInput");
|
||||||
|
|
@ -898,15 +880,11 @@ function onSubmitNewFilter() {
|
||||||
}
|
}
|
||||||
function editNode(node) {
|
function editNode(node) {
|
||||||
var e_4, _a, e_5, _b;
|
var e_4, _a, e_5, _b;
|
||||||
// editNode resets the edit/new Node modal to reflect the values of 'node'
|
|
||||||
var addFilterButton = document.getElementById("filterButton");
|
var addFilterButton = document.getElementById("filterButton");
|
||||||
addFilterButton.click();
|
addFilterButton.click();
|
||||||
var name = node.label;
|
var name = node.label;
|
||||||
// @ts-ignore
|
|
||||||
var type = node.meta.type;
|
var type = node.meta.type;
|
||||||
// @ts-ignore
|
|
||||||
var var1 = node.meta.var1;
|
var var1 = node.meta.var1;
|
||||||
// @ts-ignore
|
|
||||||
var var2 = node.meta.var2;
|
var var2 = node.meta.var2;
|
||||||
if (var2 === undefined) {
|
if (var2 === undefined) {
|
||||||
var2 = "";
|
var2 = "";
|
||||||
|
|
@ -988,7 +966,6 @@ function editNode(node) {
|
||||||
submitButton.onclick = function () { submitEditNode(node); };
|
submitButton.onclick = function () { submitEditNode(node); };
|
||||||
}
|
}
|
||||||
function deleteNode(node) {
|
function deleteNode(node) {
|
||||||
// deleteNode deletes a node from _diagram and removes all connections to/from it
|
|
||||||
_diagram.nodes.delete(node.id);
|
_diagram.nodes.delete(node.id);
|
||||||
for (var i = 0; i < _diagram.connections.length; i++) {
|
for (var i = 0; i < _diagram.connections.length; i++) {
|
||||||
var connection = _diagram.connections[i];
|
var connection = _diagram.connections[i];
|
||||||
|
|
@ -1001,17 +978,13 @@ function deleteNode(node) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function submitEditNode(node) {
|
function submitEditNode(node) {
|
||||||
// submitEditNode saves the changes to the input elements to the underlying node
|
|
||||||
var nameInput = document.getElementById("nameInput");
|
var nameInput = document.getElementById("nameInput");
|
||||||
node.label = nameInput.value;
|
node.label = nameInput.value;
|
||||||
var selectType = document.getElementById("typeInput");
|
var selectType = document.getElementById("typeInput");
|
||||||
// @ts-ignore
|
|
||||||
node.meta.type = selectType.value;
|
node.meta.type = selectType.value;
|
||||||
var var1Input = document.getElementById("var1Input");
|
var var1Input = document.getElementById("var1Input");
|
||||||
// @ts-ignore
|
|
||||||
node.meta.var1 = var1Input.value;
|
node.meta.var1 = var1Input.value;
|
||||||
var var2Input = document.getElementById("var2Input");
|
var var2Input = document.getElementById("var2Input");
|
||||||
// @ts-ignore
|
|
||||||
node.meta.var2 = var2Input.value;
|
node.meta.var2 = var2Input.value;
|
||||||
node.fixType();
|
node.fixType();
|
||||||
node.resize(_diagram.ctx);
|
node.resize(_diagram.ctx);
|
||||||
|
|
@ -1021,7 +994,6 @@ function submitEditNode(node) {
|
||||||
}
|
}
|
||||||
function saveWatch() {
|
function saveWatch() {
|
||||||
var e_6, _a, e_7, _b;
|
var e_6, _a, e_7, _b;
|
||||||
// saveWatch collects all the state (nodes/connections), turns it into JSON and submits it through a hidden form
|
|
||||||
var watchIdInput = document.getElementById("watch_id");
|
var watchIdInput = document.getElementById("watch_id");
|
||||||
var watchId = Number(watchIdInput.value);
|
var watchId = Number(watchIdInput.value);
|
||||||
var filters = new Array();
|
var filters = new Array();
|
||||||
|
|
@ -1034,11 +1006,8 @@ function saveWatch() {
|
||||||
filter_name: filter.label,
|
filter_name: filter.label,
|
||||||
x: Math.round(filter.x),
|
x: Math.round(filter.x),
|
||||||
y: Math.round(filter.y),
|
y: Math.round(filter.y),
|
||||||
// @ts-ignore
|
|
||||||
filter_type: filter.meta.type,
|
filter_type: filter.meta.type,
|
||||||
// @ts-ignore
|
|
||||||
var1: filter.meta.var1,
|
var1: filter.meta.var1,
|
||||||
// @ts-ignore
|
|
||||||
var2: filter.meta.var2,
|
var2: filter.meta.var2,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -1078,7 +1047,6 @@ function saveWatch() {
|
||||||
saveWatchForm.submit();
|
saveWatchForm.submit();
|
||||||
}
|
}
|
||||||
function addFilterButtonClicked() {
|
function addFilterButtonClicked() {
|
||||||
// addFilterButtonClicked opens up the new/edit filter modal and empties it
|
|
||||||
var submitButton = document.getElementById("submitFilterButton");
|
var submitButton = document.getElementById("submitFilterButton");
|
||||||
submitButton.onclick = onSubmitNewFilter;
|
submitButton.onclick = onSubmitNewFilter;
|
||||||
submitButton.innerHTML = "Add Filter";
|
submitButton.innerHTML = "Add Filter";
|
||||||
|
|
@ -1089,7 +1057,6 @@ function addFilterButtonClicked() {
|
||||||
onTypeChange();
|
onTypeChange();
|
||||||
}
|
}
|
||||||
function pageInit() {
|
function pageInit() {
|
||||||
// pageInit sets all the onclick/onchange trigger events
|
|
||||||
var select = document.getElementById("typeInput");
|
var select = document.getElementById("typeInput");
|
||||||
select.onchange = function () { onTypeChange(); };
|
select.onchange = function () { onTypeChange(); };
|
||||||
var addFilterButton = document.getElementById("filterButton");
|
var addFilterButton = document.getElementById("filterButton");
|
||||||
|
|
@ -1101,10 +1068,9 @@ function pageInit() {
|
||||||
}
|
}
|
||||||
document.addEventListener('DOMContentLoaded', pageInit, false);
|
document.addEventListener('DOMContentLoaded', pageInit, false);
|
||||||
function clearCache() {
|
function clearCache() {
|
||||||
// POSTs to cache/clear and reloads if clearing the cache was succesful
|
|
||||||
var confirmed = confirm("Do you want to clear the URL cache?");
|
var confirmed = confirm("Do you want to clear the URL cache?");
|
||||||
if (!confirmed) {
|
if (!confirmed) {
|
||||||
return; // do nothing
|
return;
|
||||||
}
|
}
|
||||||
var data = new URLSearchParams();
|
var data = new URLSearchParams();
|
||||||
fetch(urlPrefix + "cache/clear", {
|
fetch(urlPrefix + "cache/clear", {
|
||||||
|
|
@ -1123,3 +1089,4 @@ function clearCacheButtonInit() {
|
||||||
clearCacheButton.onclick = clearCache;
|
clearCacheButton.onclick = clearCache;
|
||||||
}
|
}
|
||||||
document.addEventListener('DOMContentLoaded', clearCacheButtonInit, false);
|
document.addEventListener('DOMContentLoaded', clearCacheButtonInit, false);
|
||||||
|
//# sourceMappingURL=edit.js.map
|
||||||
1
web/static/edit.js.map
Normal file
1
web/static/edit.js.map
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1 @@
|
||||||
|
//# sourceMappingURL=script.js.map
|
||||||
1
web/static/script.js.map
Normal file
1
web/static/script.js.map
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"script.js","sourceRoot":"","sources":["script.ts"],"names":[],"mappings":""}
|
||||||
Loading…
Add table
Reference in a new issue