Commit f6539f85fbbeced721bbb2d729a943cd6c217f33
1 parent
f569bae5
Exists in
master
and in
82 other branches
Download - Fix save process
Showing
2 changed files
with
25 additions
and
14 deletions
Show diff stats
js/app/controllers/DownloadModule.js
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('amdaUI.DownloadUI', { |
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('amdaUI.DownloadUI', { |
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('amdaUI.DownloadUI', { |
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('amdaUI.DownloadUI', { |
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('amdaUI.DownloadUI', { |
918 | 928 | }, |
919 | 929 | { |
920 | 930 | text: 'Save', |
931 | + id: 'save-download', | |
921 | 932 | scope: this, |
922 | 933 | handler: function () { |
923 | 934 | this.saveRequest(); |
... | ... |