X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=dgbuilder%2Fpublic%2Fred%2Fmain.js;fp=dgbuilder%2Fpublic%2Fred%2Fmain.js;h=27032a2654bfe2a9f6ff3d89f7198109b0ebedad;hb=d1569975bb18f4359fac18aa98f55b69c248a3ad;hp=0000000000000000000000000000000000000000;hpb=a016ea661ff5767a3539734c4c07ef974a6e4614;p=ccsdk%2Fdistribution.git
diff --git a/dgbuilder/public/red/main.js b/dgbuilder/public/red/main.js
new file mode 100644
index 00000000..27032a26
--- /dev/null
+++ b/dgbuilder/public/red/main.js
@@ -0,0 +1,1620 @@
+/**
+ * Copyright 2013 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ **/
+var RED = (function() {
+
+ function hideDropTarget() {
+ $("#dropTarget").hide();
+ RED.keyboard.remove(/* ESCAPE */ 27);
+ }
+
+ $('#chart').on("dragenter",function(event) {
+ if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1) {
+ $("#dropTarget").css({display:'table'});
+ RED.keyboard.add(/* ESCAPE */ 27,hideDropTarget);
+ }
+ });
+
+ $('#dropTarget').on("dragover",function(event) {
+ if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1) {
+ event.preventDefault();
+ }
+ })
+ .on("dragleave",function(event) {
+ hideDropTarget();
+ })
+ .on("drop",function(event) {
+ var data = event.originalEvent.dataTransfer.getData("text/plain");
+ hideDropTarget();
+ RED.view.importNodes(data);
+ event.preventDefault();
+ });
+
+
+ function save(force) {
+ if (RED.view.dirty()) {
+ //$("#debug-tab-clear").click(); // uncomment this to auto clear debug on deploy
+
+ if (!force) {
+ var invalid = false;
+ var unknownNodes = [];
+ RED.nodes.eachNode(function(node) {
+ invalid = invalid || !node.valid;
+ if (node.type === "unknown") {
+ if (unknownNodes.indexOf(node.name) == -1) {
+ unknownNodes.push(node.name);
+ }
+ invalid = true;
+ }
+ });
+ if (invalid) {
+ if (unknownNodes.length > 0) {
+ $( "#node-dialog-confirm-deploy-config" ).hide();
+ $( "#node-dialog-confirm-deploy-unknown" ).show();
+ var list = "