Commit bab40211c5476186b37aea65a0d38f5d473f03ee
1 parent
02a4cc4d
Exists in
master
and in
95 other branches
Test time selection validity before run plot request + Fix bug with source selector
Showing
4 changed files
with
57 additions
and
16 deletions
Show diff stats
js/app/views/IntervalUI.js
@@ -159,6 +159,21 @@ Ext.define('amdaUI.IntervalUI', { | @@ -159,6 +159,21 @@ Ext.define('amdaUI.IntervalUI', { | ||
159 | ); | 159 | ); |
160 | }, | 160 | }, |
161 | 161 | ||
162 | + isValid: function() { | ||
163 | + var form = this.findParentByType('form').getForm(); | ||
164 | + var startField = form.findField('startDate'); | ||
165 | + var stopField = form.findField('stopDate'); | ||
166 | + if (!startField.isValid() || !stopField.isValid()) | ||
167 | + return false; | ||
168 | + var start = this.getStartTime(); | ||
169 | + var stop = this.getStopTime(); | ||
170 | + if ( stop <= start ) { | ||
171 | + form.findField('stopDate').markInvalid('Stop Time must be after Start Time'); | ||
172 | + return false; | ||
173 | + } | ||
174 | + return true; | ||
175 | + }, | ||
176 | + | ||
162 | updateStop: function() { | 177 | updateStop: function() { |
163 | var form = this.findParentByType('form').getForm(); | 178 | var form = this.findParentByType('form').getForm(); |
164 | var start = form.findField('startDate').getValue(); | 179 | var start = form.findField('startDate').getValue(); |
js/app/views/PlotComponents/PlotTabContent.js
@@ -146,11 +146,27 @@ Ext.define('amdaPlotComp.PlotTabContent', { | @@ -146,11 +146,27 @@ Ext.define('amdaPlotComp.PlotTabContent', { | ||
146 | } | 146 | } |
147 | }, | 147 | }, |
148 | 148 | ||
149 | + getDataProcess : function() { | ||
150 | + var downObject = amdaModel.DownloadNode.decodeObject(this.plotNode.get('object')); | ||
151 | + amdaModel.DownloadNode.set('object',Ext.create('amdaModel.Download',downObject)); | ||
152 | + amdaModel.DownloadNode.editInModule(); | ||
153 | + }, | ||
154 | + | ||
155 | + isValidRequest : function(acceptEmptyTTList = true) { | ||
156 | + this.updateTimeObject(); | ||
157 | + if (!this.timeSelector.isValid(acceptEmptyTTList)) { | ||
158 | + myDesktopApp.errorMsg('Error in Time definition'); | ||
159 | + return false; | ||
160 | + } | ||
161 | + return true; | ||
162 | + }, | ||
163 | + | ||
149 | updateUI : function() { | 164 | updateUI : function() { |
150 | this.plotOutput.setObject(this.plotNode.get('object')); | 165 | this.plotOutput.setObject(this.plotNode.get('object')); |
151 | this.timeSelector.intervalSel.setInterval(this.plotNode.get('object').get('startDate'), this.plotNode.get('object').get('stopDate')); | 166 | this.timeSelector.intervalSel.setInterval(this.plotNode.get('object').get('startDate'), this.plotNode.get('object').get('stopDate')); |
152 | this.timeSelector.intervalSel.updateStop(); | 167 | this.timeSelector.intervalSel.updateStop(); |
153 | this.timeSelector.setTTTab(this.plotNode.get('object').get('timeTables')); | 168 | this.timeSelector.setTTTab(this.plotNode.get('object').get('timeTables')); |
169 | + this.timeSelector.timeSrc.setActiveTab(this.plotNode.get('object').get('timesrc')); | ||
154 | this.treePlot.buildTree(this.plotNode.get('object')); | 170 | this.treePlot.buildTree(this.plotNode.get('object')); |
155 | }, | 171 | }, |
156 | 172 |
js/app/views/PlotUI.js
@@ -53,9 +53,7 @@ Ext.define('amdaUI.PlotUI', { | @@ -53,9 +53,7 @@ Ext.define('amdaUI.PlotUI', { | ||
53 | var plotTab = this.plotTabs.getCurrentPlotTabContent(); | 53 | var plotTab = this.plotTabs.getCurrentPlotTabContent(); |
54 | if (!plotTab || !plotTab.plotNode) | 54 | if (!plotTab || !plotTab.plotNode) |
55 | return; | 55 | return; |
56 | - var downObject = amdaModel.DownloadNode.decodeObject(plotTab.plotNode.get('object')); | ||
57 | - amdaModel.DownloadNode.set('object',Ext.create('amdaModel.Download',downObject)); | ||
58 | - amdaModel.DownloadNode.editInModule(); | 56 | + plotTab.getDataProcess(); |
59 | } | 57 | } |
60 | }, | 58 | }, |
61 | 59 | ||
@@ -83,7 +81,7 @@ Ext.define('amdaUI.PlotUI', { | @@ -83,7 +81,7 @@ Ext.define('amdaUI.PlotUI', { | ||
83 | * plot method called by 'Do Plot' button to launch the plot process | 81 | * plot method called by 'Do Plot' button to launch the plot process |
84 | */ | 82 | */ |
85 | doPlot : function(){ | 83 | doPlot : function(){ |
86 | - if ( this.updateObject() ) { | 84 | + if ( this.updateObject(false) ) { |
87 | var plotTab = this.plotTabs.getCurrentPlotTabContent(); | 85 | var plotTab = this.plotTabs.getCurrentPlotTabContent(); |
88 | if (plotTab) | 86 | if (plotTab) |
89 | plotTab.doPlot(); | 87 | plotTab.doPlot(); |
@@ -105,15 +103,11 @@ Ext.define('amdaUI.PlotUI', { | @@ -105,15 +103,11 @@ Ext.define('amdaUI.PlotUI', { | ||
105 | /** | 103 | /** |
106 | * update time selector of this.object from form | 104 | * update time selector of this.object from form |
107 | */ | 105 | */ |
108 | - updateObject : function(){ | ||
109 | - this.plotTabs.updateTimeObjects(); | ||
110 | - var basicForm = this.formPanel.getForm(); | ||
111 | - if (basicForm && ! basicForm.hasInvalidField()) { | ||
112 | - return true; | ||
113 | - } | ||
114 | - else { | ||
115 | - return false; | ||
116 | - } | 106 | + updateObject : function(acceptEmptyTTList = true){ |
107 | + var plotTab = this.plotTabs.getCurrentPlotTabContent(); | ||
108 | + if (plotTab) | ||
109 | + return plotTab.isValidRequest(acceptEmptyTTList); | ||
110 | + return false; | ||
117 | }, | 111 | }, |
118 | 112 | ||
119 | updateTabs : function() { | 113 | updateTabs : function() { |
@@ -145,9 +139,11 @@ Ext.define('amdaUI.PlotUI', { | @@ -145,9 +139,11 @@ Ext.define('amdaUI.PlotUI', { | ||
145 | }, | 139 | }, |
146 | 140 | ||
147 | savePlotRequest : function() { | 141 | savePlotRequest : function() { |
148 | - var plotTab = this.plotTabs.getCurrentPlotTabContent(); | ||
149 | - if (plotTab) | ||
150 | - plotTab.savePlot(); | 142 | + if (this.updateObject(true)) { |
143 | + var plotTab = this.plotTabs.getCurrentPlotTabContent(); | ||
144 | + if (plotTab) | ||
145 | + plotTab.savePlot(); | ||
146 | + } | ||
151 | }, | 147 | }, |
152 | 148 | ||
153 | init : function(config) { | 149 | init : function(config) { |
js/app/views/TimeSelectorUI.js
@@ -61,6 +61,20 @@ Ext.define('amdaUI.TimeSelectorUI', { | @@ -61,6 +61,20 @@ Ext.define('amdaUI.TimeSelectorUI', { | ||
61 | getActiveTimeSource: function() { | 61 | getActiveTimeSource: function() { |
62 | return this.timeSrc.getActiveTab().getItemId(); | 62 | return this.timeSrc.getActiveTab().getItemId(); |
63 | }, | 63 | }, |
64 | + | ||
65 | + isValid: function(acceptEmptyTTList = true) { | ||
66 | + if (this.getActiveTimeSource() === amdaModel.AmdaTimeObject.inputTimeSrc[0]) { | ||
67 | + //TimeTables | ||
68 | + if (acceptEmptyTTList) | ||
69 | + return true; | ||
70 | + return (this.TTGrid.getStore().count() > 0); | ||
71 | + } | ||
72 | + else { | ||
73 | + //Interval | ||
74 | + return this.intervalSel.isValid(); | ||
75 | + } | ||
76 | + return true; | ||
77 | + }, | ||
64 | 78 | ||
65 | initComponent: function() { | 79 | initComponent: function() { |
66 | this.activeField = null; | 80 | this.activeField = null; |