Commit f6539f85fbbeced721bbb2d729a943cd6c217f33

Authored by Benjamin Renard
1 parent f569bae5

Download - Fix save process

js/app/controllers/DownloadModule.js
... ... @@ -29,7 +29,7 @@ Ext.define('amdaDesktop.DownloadModule', {
29 29 * @required
30 30 */
31 31 width: 600,
32   - height: 650,
  32 + height: 620,
33 33 uiType : 'panelDownload',
34 34 helpTitle : 'Help on Download Module',
35 35 helpFile : 'downloadHelp',
... ...
js/app/views/DownloadUI.js
... ... @@ -60,6 +60,11 @@ Ext.define('amdaUI.DownloadUI', {
60 60 return;
61 61 }
62 62  
  63 + if ((this.object.get('id') != '') && (downloadModule.linkedNode.get('text') == this.object.get('name'))) {
  64 + this.saveProcess(false);
  65 + return;
  66 + }
  67 +
63 68 downloadModule.linkedNode.isValidName(this.fieldName.getValue(), function (res) {
64 69 if (!res)
65 70 {
... ... @@ -78,7 +83,11 @@ Ext.define('amdaUI.DownloadUI', {
78 83 msg: res.error+'<br/>Do you want to overwrite it?',
79 84 width: 300,
80 85 buttons: Ext.MessageBox.OKCANCEL,
81   - fn : me.overwriteProcess,
  86 + fn : function(btn) {
  87 + if (btn == 'cancel') return;
  88 + this.fieldName.clearInvalid();
  89 + this.saveProcess(true);
  90 + },
82 91 icon: Ext.MessageBox.WARNING,
83 92 scope : me
84 93 });
... ... @@ -704,8 +713,7 @@ Ext.define(&#39;amdaUI.DownloadUI&#39;, {
704 713 data: this.timeformatData
705 714 });
706 715  
707   - this.paramPanel = {
708   - xtype: 'container',
  716 + this.paramPanel = new Ext.container.Container({
709 717 title: 'Parameters',
710 718 layout: {
711 719 type: 'hbox',
... ... @@ -721,12 +729,7 @@ Ext.define(&#39;amdaUI.DownloadUI&#39;, {
721 729 align: 'stretch'
722 730 },
723 731 items: [
724   - {
725   - xtype: 'textfield',
726   - fieldLabel: 'Request Name',
727   - disabled: true,
728   - name: 'name'
729   - },
  732 + this.fieldName,
730 733 {
731 734 xtype: 'splitter',
732 735 flex: 0.05
... ... @@ -817,11 +820,10 @@ Ext.define(&#39;amdaUI.DownloadUI&#39;, {
817 820 store: this.filecompressData,
818 821 value: this.filecompressData[0]
819 822 },
820   - this.fieldName,
821 823 this.timeSelector
822 824 ]
823 825 }
824   - ]};
  826 + ]});
825 827  
826 828 this.ttPanel =
827 829 {
... ... @@ -885,8 +887,16 @@ Ext.define(&#39;amdaUI.DownloadUI&#39;, {
885 887 items: [
886 888 this.paramPanel,
887 889 this.ttPanel
888   - ]
889   - }],
  890 + ],
  891 + listeners: {
  892 + tabchange: function(tabPanel, newCard, oldCard, eOpts) {
  893 + var saveBtn = this.down('#save-download');
  894 + saveBtn.setDisabled(newCard != this.paramPanel);
  895 + },
  896 + scope: this
  897 + }
  898 + },
  899 + ],
890 900 fbar: [
891 901 {
892 902 text: 'Download',
... ... @@ -918,6 +928,7 @@ Ext.define(&#39;amdaUI.DownloadUI&#39;, {
918 928 },
919 929 {
920 930 text: 'Save',
  931 + id: 'save-download',
921 932 scope: this,
922 933 handler: function () {
923 934 this.saveRequest();
... ...