Commit 429f876c4df01e586c37d189bee5dbc0a8e8d271
1 parent
3a420953
Exists in
master
and in
102 other branches
Fix plot request deletion
Showing
2 changed files
with
16 additions
and
17 deletions
Show diff stats
js/app/models/InteractiveNode.js
@@ -52,7 +52,7 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -52,7 +52,7 @@ Ext.define('amdaModel.InteractiveNode', { | ||
52 | { | 52 | { |
53 | node.eachChild(function(n) | 53 | node.eachChild(function(n) |
54 | { | 54 | { |
55 | - if (!n.isLoaded() && !n.isLeaf()) | 55 | + if (!n.isLoaded() && !n.isRealLeaf()) |
56 | { | 56 | { |
57 | nodesToLoad.push(n); | 57 | nodesToLoad.push(n); |
58 | me.preloadTreeNode(n,nodesToLoad,onloaded); | 58 | me.preloadTreeNode(n,nodesToLoad,onloaded); |
@@ -70,7 +70,7 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -70,7 +70,7 @@ Ext.define('amdaModel.InteractiveNode', { | ||
70 | { | 70 | { |
71 | records.forEach(function (record) | 71 | records.forEach(function (record) |
72 | { | 72 | { |
73 | - if (!record.isLoaded() && !record.isLeaf()) | 73 | + if (!record.isLoaded() && !record.isRealLeaf()) |
74 | { | 74 | { |
75 | nodesToLoad.push(record); | 75 | nodesToLoad.push(record); |
76 | me.preloadTreeNode(record,nodesToLoad,onloaded); | 76 | me.preloadTreeNode(record,nodesToLoad,onloaded); |
@@ -99,6 +99,11 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -99,6 +99,11 @@ Ext.define('amdaModel.InteractiveNode', { | ||
99 | } | 99 | } |
100 | } | 100 | } |
101 | }, | 101 | }, |
102 | + | ||
103 | + isRealLeaf: function() | ||
104 | + { | ||
105 | + return this.isLeaf(); | ||
106 | + }, | ||
102 | 107 | ||
103 | /** | 108 | /** |
104 | * this method is overriden into ExecutableNode to return true | 109 | * this method is overriden into ExecutableNode to return true |
@@ -146,7 +151,7 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -146,7 +151,7 @@ Ext.define('amdaModel.InteractiveNode', { | ||
146 | */ | 151 | */ |
147 | rename: function(value,callBackFn) | 152 | rename: function(value,callBackFn) |
148 | { | 153 | { |
149 | - var dataToSend = {id : this.get('id'), old_name: this.modified.text, name: value, parent : this.data.parentId, leaf: this.isLeaf(), nodeType: this.get('nodeType')}; | 154 | + var dataToSend = {id : this.get('id'), old_name: this.modified.text, name: value, parent : this.data.parentId, leaf: this.isRealLeaf(), nodeType: this.get('nodeType')}; |
150 | AmdaAction.renameObject(dataToSend, callBackFn); | 155 | AmdaAction.renameObject(dataToSend, callBackFn); |
151 | }, | 156 | }, |
152 | 157 | ||
@@ -155,7 +160,7 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -155,7 +160,7 @@ Ext.define('amdaModel.InteractiveNode', { | ||
155 | */ | 160 | */ |
156 | renameDD: function(parentId, callBackFn) | 161 | renameDD: function(parentId, callBackFn) |
157 | { | 162 | { |
158 | - var dataToSend = {id : this.get('id'), old_name: this.get('name'), name: this.get('name'), parent : parentId, leaf: this.isLeaf(), nodeType: this.get('nodeType')}; | 163 | + var dataToSend = {id : this.get('id'), old_name: this.get('name'), name: this.get('name'), parent : parentId, leaf: this.isRealLeaf(), nodeType: this.get('nodeType')}; |
159 | AmdaAction.renameObject(dataToSend, callBackFn); | 164 | AmdaAction.renameObject(dataToSend, callBackFn); |
160 | }, | 165 | }, |
161 | 166 | ||
@@ -166,7 +171,7 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -166,7 +171,7 @@ Ext.define('amdaModel.InteractiveNode', { | ||
166 | */ | 171 | */ |
167 | isValidName : function(name, callBackFn) | 172 | isValidName : function(name, callBackFn) |
168 | { | 173 | { |
169 | - var dataToSend = {name: name, nodeType: this.get('nodeType'), leaf: this.isLeaf()}; | 174 | + var dataToSend = {name: name, nodeType: this.get('nodeType'), leaf: this.isRealLeaf()}; |
170 | AmdaAction.validNameObject(dataToSend, callBackFn); | 175 | AmdaAction.validNameObject(dataToSend, callBackFn); |
171 | }, | 176 | }, |
172 | 177 | ||
@@ -515,7 +520,7 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -515,7 +520,7 @@ Ext.define('amdaModel.InteractiveNode', { | ||
515 | 520 | ||
516 | deleteNode: function() { | 521 | deleteNode: function() { |
517 | // if the target is a directory | 522 | // if the target is a directory |
518 | - if (!this.isLeaf()) { | 523 | + if (!this.isRealLeaf()) { |
519 | // determine if this directory is empty before launching the delete confirmation method | 524 | // determine if this directory is empty before launching the delete confirmation method |
520 | this.isNotEmptyDir(this.confirmDirectoryDeletion); | 525 | this.isNotEmptyDir(this.confirmDirectoryDeletion); |
521 | // else (the target is a leaf) | 526 | // else (the target is a leaf) |
@@ -568,14 +573,14 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -568,14 +573,14 @@ Ext.define('amdaModel.InteractiveNode', { | ||
568 | */ | 573 | */ |
569 | realDelete : function() | 574 | realDelete : function() |
570 | { | 575 | { |
571 | - AmdaAction.deleteObject({id: this.get('id'), leaf: this.isLeaf(), nodeType: this.get('nodeType')}, function(res,e){ | 576 | + AmdaAction.deleteObject({id: this.get('id'), leaf: this.isRealLeaf(), nodeType: this.get('nodeType')}, function(res,e){ |
572 | //TODO proper errors handling | 577 | //TODO proper errors handling |
573 | // node deletion in tree | 578 | // node deletion in tree |
574 | if (res) { // if success | 579 | if (res) { // if success |
575 | if (res.id) { | 580 | if (res.id) { |
576 | //Ext.Msg.show({title:'Warning', msg: 'Requests with parameter '+node.data.text+' are deleted', icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); | 581 | //Ext.Msg.show({title:'Warning', msg: 'Requests with parameter '+node.data.text+' are deleted', icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); |
577 | if (this.parentNode) { | 582 | if (this.parentNode) { |
578 | - if (this.isLeaf()){ | 583 | + if (this.isRealLeaf()){ |
579 | var moduleId = this.get('moduleId'); | 584 | var moduleId = this.get('moduleId'); |
580 | // if really interactive node | 585 | // if really interactive node |
581 | if (moduleId) { | 586 | if (moduleId) { |
js/app/models/PlotNode.js
@@ -135,16 +135,10 @@ Ext.define('amdaModel.PlotNode', { | @@ -135,16 +135,10 @@ Ext.define('amdaModel.PlotNode', { | ||
135 | } | 135 | } |
136 | }, | 136 | }, |
137 | 137 | ||
138 | - rename: function(value,callBackFn) { | 138 | + isRealLeaf: function() |
139 | + { | ||
139 | var isFolder = (!this.isLeaf()) && (this.get('tabs') === false); | 140 | var isFolder = (!this.isLeaf()) && (this.get('tabs') === false); |
140 | - var dataToSend = {id : this.get('id'), old_name: this.modified.text, name: value, parent : this.data.parentId, leaf: !isFolder, nodeType: this.get('nodeType')}; | ||
141 | - AmdaAction.renameObject(dataToSend, callBackFn); | ||
142 | - }, | ||
143 | - | ||
144 | - renameDD: function(parentId, callBackFn) { | ||
145 | - var isFolder = (!this.isLeaf()) && (this.get('tabs') === false); | ||
146 | - var dataToSend = {id : this.get('id'), old_name: this.get('name'), name: this.get('name'), parent : parentId, leaf: !isFolder, nodeType: this.get('nodeType')}; | ||
147 | - AmdaAction.renameObject(dataToSend, callBackFn); | 141 | + return !isFolder; |
148 | }, | 142 | }, |
149 | 143 | ||
150 | insertPlotTabsRequest: function() { | 144 | insertPlotTabsRequest: function() { |