diff --git a/js/app/models/PlotObjects/PlotRequestObject.js b/js/app/models/PlotObjects/PlotRequestObject.js index 72f3417..3960fa2 100644 --- a/js/app/models/PlotObjects/PlotRequestObject.js +++ b/js/app/models/PlotObjects/PlotRequestObject.js @@ -29,7 +29,8 @@ Ext.define('amdaPlotObj.PlotRequestObject', { {name: 'file-prefix', type: 'string'}, {name: 'one-file-per-interval', type: 'boolean'}, {name: 'last-plotted-tab', type: 'int', defaultValue: 0}, - {name: 'last-tab-id', type: 'int', defaultValue: 0} + {name: 'last-tab-id', type: 'int', defaultValue: 0}, + {name: 'active-tab-id', type: 'int', defaultValue: 0} ], hasMany: { @@ -122,7 +123,8 @@ Ext.define('amdaPlotObj.PlotRequestObject', { requestValues['one-file-per-interval'] = this.get('one-file-per-interval'); requestValues['last-plotted-tab'] = this.get('last-plotted-tab'); requestValues['name'] = this.get('name'); - + requestValues['active-tab-id'] = this.get('active-tab-id'); + requestValues['timesrc'] = this.get('timesrc'); // if there's at least one timeTable name into 'timeTables' collection if (this.get('timesrc') == amdaModel.AmdaTimeObject.inputTimeSrc[0] && this.get('timeTables') && this.get('timeTables').length){ @@ -156,7 +158,7 @@ Ext.define('amdaPlotObj.PlotRequestObject', { }); requestValues['last-tab-id'] = this.get('last-tab-id'); - - return requestValues; + + return requestValues; } }); \ No newline at end of file diff --git a/js/app/views/PlotComponents/PlotTabPanel.js b/js/app/views/PlotComponents/PlotTabPanel.js index 0391ae4..c0fb645 100644 --- a/js/app/views/PlotComponents/PlotTabPanel.js +++ b/js/app/views/PlotComponents/PlotTabPanel.js @@ -33,10 +33,14 @@ Ext.define('amdaPlotComp.PlotTabPanel', { { this.object = object; this.removeAll(); - var isFirstTab = true; - this.object.tabs().each(function (rec) { - this.addPlotTab(rec, isFirstTab); - isFirstTab = false; + var selectedTab = this.object.get('active-tab-id'); + + this.object.tabs().each(function (rec, index) { + var isSelected = false; + if (index+1 == selectedTab) + isSelected = true; + + this.addPlotTab(rec, isSelected); }, this); }, diff --git a/js/app/views/PlotUI.js b/js/app/views/PlotUI.js index 0d38695..f09faaf 100644 --- a/js/app/views/PlotUI.js +++ b/js/app/views/PlotUI.js @@ -53,7 +53,9 @@ Ext.define('amdaUI.PlotUI', { return; this.updateObject(); - + + this.object.set('active-tab-id', this.plotTabs.getSelectedTabId()); + if ((this.object.get('id') != '') && (plotModule.linkedNode.get('text') == this.object.get('name'))) //update existing request plotModule.linkedNode.update(); @@ -62,14 +64,12 @@ Ext.define('amdaUI.PlotUI', { var me = this; //Request Name validation plotModule.linkedNode.isValidName(this.object.get('name'), function (res) { - if (!res) - { + if (!res) { myDesktopApp.errorMsg('Error during object validation'); return; } - if (!res.valid) - { + if (!res.valid) { if (res.error) myDesktopApp.errorMsg(res.error); else @@ -78,16 +78,12 @@ Ext.define('amdaUI.PlotUI', { } //Save - if (me.object.get('id') != '') - { + if (me.object.get('id') != '') { //Duplicate request plotModule.createLinkedNode(); plotModule.linkedNode.set('object',me.object); } - else - { - //Create new request - } + plotModule.linkedNode.create(); }); } @@ -213,20 +209,6 @@ Ext.define('amdaUI.PlotUI', { ] }); -// this.multiPlotIntervalPanel = new Ext.form.Panel({ -// flex: 2, -// layout: 'fit', -// bodyStyle: { background : '#dfe8f6' }, -// visible : false, -// collapsible : true, -// defaults: { -// border: false -// }, -// items : [ -// this.timeSelector -// ] -// }); - this.formPanel = new Ext.form.Panel({ region: 'center', layout: { -- libgit2 0.21.2