Commit e9e906ad3b5522f51f905dafff6ee02f18fdba94
1 parent
218521cf
Exists in
master
and in
109 other branches
update mulritab plot requests save
Showing
3 changed files
with
21 additions
and
33 deletions
Show diff stats
js/app/models/PlotObjects/PlotRequestObject.js
... | ... | @@ -29,7 +29,8 @@ Ext.define('amdaPlotObj.PlotRequestObject', { |
29 | 29 | {name: 'file-prefix', type: 'string'}, |
30 | 30 | {name: 'one-file-per-interval', type: 'boolean'}, |
31 | 31 | {name: 'last-plotted-tab', type: 'int', defaultValue: 0}, |
32 | - {name: 'last-tab-id', type: 'int', defaultValue: 0} | |
32 | + {name: 'last-tab-id', type: 'int', defaultValue: 0}, | |
33 | + {name: 'active-tab-id', type: 'int', defaultValue: 0} | |
33 | 34 | ], |
34 | 35 | |
35 | 36 | hasMany: { |
... | ... | @@ -122,7 +123,8 @@ Ext.define('amdaPlotObj.PlotRequestObject', { |
122 | 123 | requestValues['one-file-per-interval'] = this.get('one-file-per-interval'); |
123 | 124 | requestValues['last-plotted-tab'] = this.get('last-plotted-tab'); |
124 | 125 | requestValues['name'] = this.get('name'); |
125 | - | |
126 | + requestValues['active-tab-id'] = this.get('active-tab-id'); | |
127 | + | |
126 | 128 | requestValues['timesrc'] = this.get('timesrc'); |
127 | 129 | // if there's at least one timeTable name into 'timeTables' collection |
128 | 130 | if (this.get('timesrc') == amdaModel.AmdaTimeObject.inputTimeSrc[0] && this.get('timeTables') && this.get('timeTables').length){ |
... | ... | @@ -156,7 +158,7 @@ Ext.define('amdaPlotObj.PlotRequestObject', { |
156 | 158 | }); |
157 | 159 | |
158 | 160 | requestValues['last-tab-id'] = this.get('last-tab-id'); |
159 | - | |
160 | - return requestValues; | |
161 | + | |
162 | + return requestValues; | |
161 | 163 | } |
162 | 164 | }); |
163 | 165 | \ No newline at end of file |
... | ... |
js/app/views/PlotComponents/PlotTabPanel.js
... | ... | @@ -33,10 +33,14 @@ Ext.define('amdaPlotComp.PlotTabPanel', { |
33 | 33 | { |
34 | 34 | this.object = object; |
35 | 35 | this.removeAll(); |
36 | - var isFirstTab = true; | |
37 | - this.object.tabs().each(function (rec) { | |
38 | - this.addPlotTab(rec, isFirstTab); | |
39 | - isFirstTab = false; | |
36 | + var selectedTab = this.object.get('active-tab-id'); | |
37 | + | |
38 | + this.object.tabs().each(function (rec, index) { | |
39 | + var isSelected = false; | |
40 | + if (index+1 == selectedTab) | |
41 | + isSelected = true; | |
42 | + | |
43 | + this.addPlotTab(rec, isSelected); | |
40 | 44 | }, this); |
41 | 45 | }, |
42 | 46 | |
... | ... |
js/app/views/PlotUI.js
... | ... | @@ -53,7 +53,9 @@ Ext.define('amdaUI.PlotUI', { |
53 | 53 | return; |
54 | 54 | |
55 | 55 | this.updateObject(); |
56 | - | |
56 | + | |
57 | + this.object.set('active-tab-id', this.plotTabs.getSelectedTabId()); | |
58 | + | |
57 | 59 | if ((this.object.get('id') != '') && (plotModule.linkedNode.get('text') == this.object.get('name'))) |
58 | 60 | //update existing request |
59 | 61 | plotModule.linkedNode.update(); |
... | ... | @@ -62,14 +64,12 @@ Ext.define('amdaUI.PlotUI', { |
62 | 64 | var me = this; |
63 | 65 | //Request Name validation |
64 | 66 | plotModule.linkedNode.isValidName(this.object.get('name'), function (res) { |
65 | - if (!res) | |
66 | - { | |
67 | + if (!res) { | |
67 | 68 | myDesktopApp.errorMsg('Error during object validation'); |
68 | 69 | return; |
69 | 70 | } |
70 | 71 | |
71 | - if (!res.valid) | |
72 | - { | |
72 | + if (!res.valid) { | |
73 | 73 | if (res.error) |
74 | 74 | myDesktopApp.errorMsg(res.error); |
75 | 75 | else |
... | ... | @@ -78,16 +78,12 @@ Ext.define('amdaUI.PlotUI', { |
78 | 78 | } |
79 | 79 | |
80 | 80 | //Save |
81 | - if (me.object.get('id') != '') | |
82 | - { | |
81 | + if (me.object.get('id') != '') { | |
83 | 82 | //Duplicate request |
84 | 83 | plotModule.createLinkedNode(); |
85 | 84 | plotModule.linkedNode.set('object',me.object); |
86 | 85 | } |
87 | - else | |
88 | - { | |
89 | - //Create new request | |
90 | - } | |
86 | + | |
91 | 87 | plotModule.linkedNode.create(); |
92 | 88 | }); |
93 | 89 | } |
... | ... | @@ -213,20 +209,6 @@ Ext.define('amdaUI.PlotUI', { |
213 | 209 | ] |
214 | 210 | }); |
215 | 211 | |
216 | -// this.multiPlotIntervalPanel = new Ext.form.Panel({ | |
217 | -// flex: 2, | |
218 | -// layout: 'fit', | |
219 | -// bodyStyle: { background : '#dfe8f6' }, | |
220 | -// visible : false, | |
221 | -// collapsible : true, | |
222 | -// defaults: { | |
223 | -// border: false | |
224 | -// }, | |
225 | -// items : [ | |
226 | -// this.timeSelector | |
227 | -// ] | |
228 | -// }); | |
229 | - | |
230 | 212 | this.formPanel = new Ext.form.Panel({ |
231 | 213 | region: 'center', |
232 | 214 | layout: { |
... | ... |