From f913578e2c5ecf0bb161aaa9f57effa457c5e027 Mon Sep 17 00:00:00 2001 From: Tim Kuchenbuch Date: Wed, 7 Nov 2018 17:24:05 +0100 Subject: [PATCH] ConDec-386: Add a Change Type dialog and fix missing function bugs (#54) * ConDec-386: Add a Change Type dialog and fix missing function bugs * ConDec-386: Add context menu point to issue modul * ConDec-386: Fix link Type problem --- src/main/resources/js/management.js | 33 ++++++------ src/main/resources/js/view.context.menu.js | 53 +++++++++++++++++++ .../js/view.decision.knowledge.page.js | 1 + src/main/resources/js/view.issue.module.js | 3 +- 4 files changed, 73 insertions(+), 17 deletions(-) diff --git a/src/main/resources/js/management.js b/src/main/resources/js/management.js index 0243aa1e54..01ee553130 100644 --- a/src/main/resources/js/management.js +++ b/src/main/resources/js/management.js @@ -59,22 +59,23 @@ function switchLinkTypes(type, idOfExistingElement, idOfNewElement, linkTypeFunc function updateDecisionKnowledgeElementAsChild(childId, summary, description, type) { console.log("management.js updateDecisionKnowledgeElementAsChild"); var simpleType = getSimpleType(type); - updateDecisionKnowledgeElement(childId, summary, description, simpleType, function() { - conDecAPI.getDecisionKnowledgeElement(childId, function(decisionKnowledgeElement) { - if (decisionKnowledgeElement.type !== type) { - var parentId = findParentId(childId); - switchLinkTypes(type, parentId, childId, function(linkType, parentId, childId) { - deleteLink(parentId, childId, function() { - conDecAPI.linkElements(parentId, childId, linkType, function() { - notify(); - }); - }); - }); - } else { - notify(); - } - }); - }); + conDecAPI.getDecisionKnowledgeElement(childId, function(decisionKnowledgeElement) { + conDecAPI.updateDecisionKnowledgeElement(childId,summary,description,simpleType,function () { + console.log(decisionKnowledgeElement.type +" IN function "+ type); + if (decisionKnowledgeElement.type !== type) { + var parentId = findParentId(childId); + switchLinkTypes(type, parentId, childId, function(linkType, parentId, childId) { + conDecAPI.deleteLink(parentId, childId, function() { + conDecAPI.linkElements(parentId, childId, linkType, function() { + notify(); + }); + }); + }); + } else { + notify(); + } + }); + }); } function getSimpleType(type) { diff --git a/src/main/resources/js/view.context.menu.js b/src/main/resources/js/view.context.menu.js index c1f449958f..c6a1128920 100644 --- a/src/main/resources/js/view.context.menu.js +++ b/src/main/resources/js/view.context.menu.js @@ -29,6 +29,7 @@ var linkKnowledgeElementText = "Link Existing Element"; var deleteLinkToParentText = "Delete Link to Parent"; var editKnowledgeElementText = "Edit Element"; var deleteKnowledgeElementText = "Delete Element"; +var changeKnowledgeTypeText = "Change Element Type"; var contextMenuCreateAction = { // label for Tree Viewer, name for Treant context menu @@ -144,6 +145,24 @@ function setUpCreateOrEditDialog(summary, description, knowledgeType) { AJS.$("#form-select-type").auiSelect2(); } +function setUpTypeChangeDialog(knowledgeType){ + console.log("view.context.menu.js setUpTypeChangeDialog"); + document.getElementById("dialog-content").insertAdjacentHTML( + "afterBegin", + "
" + + "