Commit c8c2b61076f7f78cff34ec99a767212e4dcf995c

Authored by Laurent BEIGBEDER
1 parent 20ea6937
Exists in master

6608 : input files volume management

ihm/app/Constants.js
... ... @@ -18,6 +18,9 @@ Ext.define("treps.Constants",
18 18 DROP_MAX_FILESIZE : 100000000,
19 19 UPLD_MAX_FILESIZE : "100MB",
20 20  
  21 + // 6608 - add max number of records by file
  22 + UPLD_MAX_RECORDS_FILE : "1 000 000",
  23 +
21 24 GRID_BUFF_PAGESIZE : 400,
22 25 GRID_BUFF_LEADINGZONE : 800,
23 26  
... ...
ihm/app/controller/Steps/StepsManager.js
1   -Ext.define('treps.controller.Steps.StepsManager', {
2   - extend: 'Ext.app.Controller',
3   -
4   - requires: [
5   - 'treps.view.Steps.SourceSelection.SourceSelectionPanel',
6   - 'treps.view.Steps.TransformationDefinition.TransformationDefinitionPanel',
7   - 'treps.view.Steps.ExportDefinition.ExportDefinitionPanel',
8   - 'treps.view.Steps.ExportResult.ExportResultPanel'
9   - ],
10   -
11   - views: [
12   - 'Application.Central.CentralContainer',
13   - 'Application.Footer.FooterToolbar'
14   - ],
15   -
16   - stores: ['Steps'],
17   -
18   - isReceivedSrc : false,
19   -
20   - refs: [
21   - {
22   - ref: 'app_central',
23   - selector: 'app_central'
24   - },
25   - {
26   - ref: 'nextStepButton',
27   - selector: 'footer_toolbar > #nextStepButton'
28   - },
29   - {
30   - ref: 'prevStepButton',
31   - selector: 'footer_toolbar > #prevStepButton'
32   - },
33   - {
34   - ref: 'resetOpButton',
35   - selector: 'footer_toolbar > #resetOpButton'
36   - }
37   - ],
38   -
39   - init: function() {
40   - var me = this;
41   -
42   - this.control({
43   - 'footer_toolbar > #nextStepButton': {
44   - click: me.onNextStep,
45   - scope: me
46   - },
47   - 'footer_toolbar > #prevStepButton': {
48   - click: me.onPrevStep,
49   - scope: me
50   - },
51   - 'footer_toolbar > #resetOpButton': {
52   - click: me.onReset,
53   - scope: me
54   - }
55   - });
56   -
57   - this.application.on(
58   - {
59   - initapp: me.onReset,
60   - scope: me
61   - }
62   - );
63   -
64   - this.application.on(
65   - {
66   - receivesource: me.onReceiveSource,
67   - scope: me
68   - }
69   - );
70   - },
71   -
72   - onReset: function() {
73   - this.doResetRequest();
74   - },
75   -
76   - onReceiveSource: function(type, data) {
77   - var me = this;
78   -
79   - var steps = Ext.getStore('Steps');
80   - var crtStepIndex = steps.indexOf(this.getCrtStep());
81   -
82   - //block other source reception
83   - if (this.isReceivedSrc)
84   - return;
85   -
86   - this.isReceivedSrc = true;
87   -
88   - if (crtStepIndex != 0)
89   - {
90   - treps.Messages.showQuestion(
91   - "A notification has been received to start new operation. Do you accept?",
92   - function()
93   - {
94   - me.doResetRequest(function()
95   - {
96   - me.doRequest(function (success)
97   - {
98   -
99   - if ((success == null) || success)
100   - {
101   - var nextStep = me.getNextStep();
102   - if (nextStep != null)
103   - me.setStep(nextStep);
104   - }
105   - me.isReceivedSrc = false;
106   - },
107   - type,
108   - data
109   - );
110   - }
111   - );
112   - },
113   - function()
114   - {
115   - me.isReceivedSrc = false;
116   - }
117   - );
118   - return;
119   - }
120   -
121   - this.doRequest(function (success)
122   - {
123   - if ((success == null) || success)
124   - {
125   - var nextStep = me.getNextStep();
126   - if (nextStep != null)
127   - me.setStep(nextStep);
128   - }
129   - me.isReceivedSrc = false;
130   - },
131   - type,
132   - data
133   - );
134   - },
135   -
136   - onNextStep: function() {
137   - var me = this;
138   - this.doRequest(function (success)
139   - {
140   - if ((success == null) || success)
141   - {
142   - var nextStep = me.getNextStep();
143   - if (nextStep != null)
144   - me.setStep(nextStep);
145   - }
146   - }
147   - );
148   - },
149   -
150   - onPrevStep: function() {
151   - var steps = Ext.getStore('Steps');
152   - var firstStep = steps.getAt(0);
153   -
154   - var prevStep = this.getPreviousStep();
155   - if (prevStep != null)
156   - {
157   - if (firstStep.getId() == prevStep.getId())
158   - this.application.fireEvent('initapp');
159   - else
160   - this.setStep(prevStep);
161   - }
162   - },
163   -
164   - getCrtStep: function() {
165   - var steps = Ext.getStore('Steps');
166   - var session = treps.model.Session;
167   - return steps.getById(session.get('stepId'));
168   - },
169   -
170   - getNextStep: function() {
171   - var steps = Ext.getStore('Steps');
172   - var crtStepIndex = steps.indexOf(this.getCrtStep());
173   - if (crtStepIndex < steps.count()-1)
174   - return steps.getAt(crtStepIndex+1);
175   - return null;
176   - },
177   -
178   - getPreviousStep: function() {
179   - var steps = Ext.getStore('Steps');
180   - var crtStepIndex = steps.indexOf(this.getCrtStep());
181   - if (crtStepIndex > 0)
182   - return steps.getAt(crtStepIndex-1);
183   - return null;
184   - },
185   -
186   - getCrtStepPanel: function() {
187   - var crtStep = this.getCrtStep();
188   - if (crtStep == null)
189   - return null;
190   - var view = this.getApp_central();
191   - return view.child(crtStep.get('panel'));
192   - },
193   -
194   - getCrtStepController: function() {
195   - var crtStep = this.getCrtStep();
196   - if (crtStep == null)
197   - return null;
198   - return treps.app.getController(crtStep.get('controller'));
199   - },
200   -
201   - doResetRequest: function(onReady)
202   - {
203   - var steps = Ext.getStore('Steps');
204   - var firstStep = steps.getAt(0);
205   - var me = this;
206   - var session = treps.model.Session;
207   -
208   - //reset all ihm selection recorded values
209   - session.set('step2_vecs',null);
210   - session.set('step2_srcFrame',null);
211   - session.set('step2_dstFrame',null);
212   - session.set('in_filenameBase',null);
213   -
214   - if ((firstStep.getId() != session.get('stepId')) && (session.get('id') != ''))
215   - {
216   - treps.LoadMask.show('Reset operation. Please wait ... ');
217   - TREPSAction.resetOperation({'id' : session.get('id')}, function(result, event)
218   - {
219   - treps.LoadMask.hide();
220   -
221   - if (!result)
222   - {
223   - treps.Messages.showError("Internal error during resetOperation request");
224   - return;
225   - }
226   - else if (!result.success)
227   - {
228   - treps.Messages.showError(result.error);
229   - return;
230   - }
231   -
232   - me.setStep(firstStep);
233   -
234   - if (onReady != null)
235   - onReady.call();
236   - });
237   - }
238   - else
239   - {
240   - this.setStep(firstStep);
241   - if (onReady != null)
242   - onReady.call();
243   - }
244   - },
245   -
246   - doRequest: function(afterrequest,type,data) {
247   - var me = this;
248   -
249   - var crtController = this.getCrtStepController();
250   -
251   - if ((crtController == null) || (crtController.isValidStep == null))
252   - return;
253   -
254   - if ((data == null) && (!crtController.isValidStep()) || (crtController.doRequest == null))
255   - return;
256   -
257   - crtController.doRequest(function (success)
258   - {
259   - if (afterrequest != null)
260   - afterrequest.call(me,success);
261   - },
262   - type,
263   - data
264   - );
265   - },
266   -
267   - doInitStep: function() {
268   - var crtController = this.getCrtStepController();
269   -
270   - if (crtController == null)
271   - return;
272   -
273   - if (crtController.doInitStep == null)
274   - return;
275   -
276   - crtController.doInitStep();
277   - },
278   -
279   - setStep: function( step ) {
280   - var me = this,
281   - config;
282   -
283   - var steps = Ext.getStore('Steps');
284   -
285   - var firstStep = steps.getAt(0);
286   - if (firstStep.getId() == step.getId())
287   - treps.model.Session.set('id','');
288   -
289   - treps.model.Session.set('stepId',step.getId());
290   -
291   - var stepNb = steps.indexOf(step)+1;
292   - var stepsCount = steps.count();
293   -
294   - if(stepNb==1) {
295   - config = {
296   - xtype: step.get('panel'),
297   - title: 'Step '+stepNb+' / '+stepsCount+' - '+step.get('description')+' (max '+treps.Constants.UPLD_MAX_FILESIZE+')'
298   - };
299   - } else {
300   - config = {
301   - xtype: step.get('panel'),
302   - title: 'Step '+stepNb+' / '+stepsCount+' - '+step.get('description')
303   - };
304   - }
305   -
306   -
307   -
308   -
309   - var view = this.getApp_central();
310   -
311   - view.removeAll(true);
312   -
313   - var newPanel = view.add(config);
314   -
315   - view.doLayout();
316   -
317   - var nextStep = this.getNextStep();
318   - var prevStep = this.getPreviousStep();
319   -
320   - var nextBtn = this.getNextStepButton();
321   - var prevBtn = this.getPrevStepButton();
322   -
323   - if (nextStep != null)
324   - {
325   - nextBtn.enable();
326   - nextBtn.setTooltip(nextStep.get('description'));
327   - }
328   - else
329   - {
330   - nextBtn.disable();
331   - nextBtn.setTooltip('Not available');
332   - }
333   -
334   - if (prevStep != null)
335   - {
336   - prevBtn.enable();
337   - prevBtn.setTooltip(prevStep.get('description'));
338   - }
339   - else
340   - {
341   - prevBtn.disable();
342   - prevBtn.setTooltip('Not available');
343   - }
344   -
345   - this.doInitStep();
346   - }
347   -});
  1 +Ext.define('treps.controller.Steps.StepsManager', {
  2 + extend: 'Ext.app.Controller',
  3 +
  4 + requires: [
  5 + 'treps.view.Steps.SourceSelection.SourceSelectionPanel',
  6 + 'treps.view.Steps.TransformationDefinition.TransformationDefinitionPanel',
  7 + 'treps.view.Steps.ExportDefinition.ExportDefinitionPanel',
  8 + 'treps.view.Steps.ExportResult.ExportResultPanel'
  9 + ],
  10 +
  11 + views: [
  12 + 'Application.Central.CentralContainer',
  13 + 'Application.Footer.FooterToolbar'
  14 + ],
  15 +
  16 + stores: ['Steps'],
  17 +
  18 + isReceivedSrc : false,
  19 +
  20 + refs: [
  21 + {
  22 + ref: 'app_central',
  23 + selector: 'app_central'
  24 + },
  25 + {
  26 + ref: 'nextStepButton',
  27 + selector: 'footer_toolbar > #nextStepButton'
  28 + },
  29 + {
  30 + ref: 'prevStepButton',
  31 + selector: 'footer_toolbar > #prevStepButton'
  32 + },
  33 + {
  34 + ref: 'resetOpButton',
  35 + selector: 'footer_toolbar > #resetOpButton'
  36 + }
  37 + ],
  38 +
  39 + init: function() {
  40 + var me = this;
  41 +
  42 + this.control({
  43 + 'footer_toolbar > #nextStepButton': {
  44 + click: me.onNextStep,
  45 + scope: me
  46 + },
  47 + 'footer_toolbar > #prevStepButton': {
  48 + click: me.onPrevStep,
  49 + scope: me
  50 + },
  51 + 'footer_toolbar > #resetOpButton': {
  52 + click: me.onReset,
  53 + scope: me
  54 + }
  55 + });
  56 +
  57 + this.application.on(
  58 + {
  59 + initapp: me.onReset,
  60 + scope: me
  61 + }
  62 + );
  63 +
  64 + this.application.on(
  65 + {
  66 + receivesource: me.onReceiveSource,
  67 + scope: me
  68 + }
  69 + );
  70 + },
  71 +
  72 + onReset: function() {
  73 + this.doResetRequest();
  74 + },
  75 +
  76 + onReceiveSource: function(type, data) {
  77 + var me = this;
  78 +
  79 + var steps = Ext.getStore('Steps');
  80 + var crtStepIndex = steps.indexOf(this.getCrtStep());
  81 +
  82 + //block other source reception
  83 + if (this.isReceivedSrc)
  84 + return;
  85 +
  86 + this.isReceivedSrc = true;
  87 +
  88 + if (crtStepIndex != 0)
  89 + {
  90 + treps.Messages.showQuestion(
  91 + "A notification has been received to start new operation. Do you accept?",
  92 + function()
  93 + {
  94 + me.doResetRequest(function()
  95 + {
  96 + me.doRequest(function (success)
  97 + {
  98 +
  99 + if ((success == null) || success)
  100 + {
  101 + var nextStep = me.getNextStep();
  102 + if (nextStep != null)
  103 + me.setStep(nextStep);
  104 + }
  105 + me.isReceivedSrc = false;
  106 + },
  107 + type,
  108 + data
  109 + );
  110 + }
  111 + );
  112 + },
  113 + function()
  114 + {
  115 + me.isReceivedSrc = false;
  116 + }
  117 + );
  118 + return;
  119 + }
  120 +
  121 + this.doRequest(function (success)
  122 + {
  123 + if ((success == null) || success)
  124 + {
  125 + var nextStep = me.getNextStep();
  126 + if (nextStep != null)
  127 + me.setStep(nextStep);
  128 + }
  129 + me.isReceivedSrc = false;
  130 + },
  131 + type,
  132 + data
  133 + );
  134 + },
  135 +
  136 + onNextStep: function() {
  137 + var me = this;
  138 + this.doRequest(function (success)
  139 + {
  140 + if ((success == null) || success)
  141 + {
  142 + var nextStep = me.getNextStep();
  143 + if (nextStep != null)
  144 + me.setStep(nextStep);
  145 + }
  146 + }
  147 + );
  148 + },
  149 +
  150 + onPrevStep: function() {
  151 + var steps = Ext.getStore('Steps');
  152 + var firstStep = steps.getAt(0);
  153 +
  154 + var prevStep = this.getPreviousStep();
  155 + if (prevStep != null)
  156 + {
  157 + if (firstStep.getId() == prevStep.getId())
  158 + this.application.fireEvent('initapp');
  159 + else
  160 + this.setStep(prevStep);
  161 + }
  162 + },
  163 +
  164 + getCrtStep: function() {
  165 + var steps = Ext.getStore('Steps');
  166 + var session = treps.model.Session;
  167 + return steps.getById(session.get('stepId'));
  168 + },
  169 +
  170 + getNextStep: function() {
  171 + var steps = Ext.getStore('Steps');
  172 + var crtStepIndex = steps.indexOf(this.getCrtStep());
  173 + if (crtStepIndex < steps.count()-1)
  174 + return steps.getAt(crtStepIndex+1);
  175 + return null;
  176 + },
  177 +
  178 + getPreviousStep: function() {
  179 + var steps = Ext.getStore('Steps');
  180 + var crtStepIndex = steps.indexOf(this.getCrtStep());
  181 + if (crtStepIndex > 0)
  182 + return steps.getAt(crtStepIndex-1);
  183 + return null;
  184 + },
  185 +
  186 + getCrtStepPanel: function() {
  187 + var crtStep = this.getCrtStep();
  188 + if (crtStep == null)
  189 + return null;
  190 + var view = this.getApp_central();
  191 + return view.child(crtStep.get('panel'));
  192 + },
  193 +
  194 + getCrtStepController: function() {
  195 + var crtStep = this.getCrtStep();
  196 + if (crtStep == null)
  197 + return null;
  198 + return treps.app.getController(crtStep.get('controller'));
  199 + },
  200 +
  201 + doResetRequest: function(onReady)
  202 + {
  203 + var steps = Ext.getStore('Steps');
  204 + var firstStep = steps.getAt(0);
  205 + var me = this;
  206 + var session = treps.model.Session;
  207 +
  208 + //reset all ihm selection recorded values
  209 + session.set('step2_vecs',null);
  210 + session.set('step2_srcFrame',null);
  211 + session.set('step2_dstFrame',null);
  212 + session.set('in_filenameBase',null);
  213 +
  214 + if ((firstStep.getId() != session.get('stepId')) && (session.get('id') != ''))
  215 + {
  216 + treps.LoadMask.show('Reset operation. Please wait ... ');
  217 + TREPSAction.resetOperation({'id' : session.get('id')}, function(result, event)
  218 + {
  219 + treps.LoadMask.hide();
  220 +
  221 + if (!result)
  222 + {
  223 + treps.Messages.showError("Internal error during resetOperation request");
  224 + return;
  225 + }
  226 + else if (!result.success)
  227 + {
  228 + treps.Messages.showError(result.error);
  229 + return;
  230 + }
  231 +
  232 + me.setStep(firstStep);
  233 +
  234 + if (onReady != null)
  235 + onReady.call();
  236 + });
  237 + }
  238 + else
  239 + {
  240 + this.setStep(firstStep);
  241 + if (onReady != null)
  242 + onReady.call();
  243 + }
  244 + },
  245 +
  246 + doRequest: function(afterrequest,type,data) {
  247 + var me = this;
  248 +
  249 + var crtController = this.getCrtStepController();
  250 +
  251 + if ((crtController == null) || (crtController.isValidStep == null))
  252 + return;
  253 +
  254 + if ((data == null) && (!crtController.isValidStep()) || (crtController.doRequest == null))
  255 + return;
  256 +
  257 + crtController.doRequest(function (success)
  258 + {
  259 + if (afterrequest != null)
  260 + afterrequest.call(me,success);
  261 + },
  262 + type,
  263 + data
  264 + );
  265 + },
  266 +
  267 + doInitStep: function() {
  268 + var crtController = this.getCrtStepController();
  269 +
  270 + if (crtController == null)
  271 + return;
  272 +
  273 + if (crtController.doInitStep == null)
  274 + return;
  275 +
  276 + crtController.doInitStep();
  277 + },
  278 +
  279 + setStep: function( step ) {
  280 + var me = this,
  281 + config;
  282 +
  283 + var steps = Ext.getStore('Steps');
  284 +
  285 + var firstStep = steps.getAt(0);
  286 + if (firstStep.getId() == step.getId())
  287 + treps.model.Session.set('id','');
  288 +
  289 + treps.model.Session.set('stepId',step.getId());
  290 +
  291 + var stepNb = steps.indexOf(step)+1;
  292 + var stepsCount = steps.count();
  293 +
  294 + if(stepNb==1) {
  295 + config = {
  296 + xtype: step.get('panel'),
  297 + // 6608 - add max number of records by file
  298 + //title: 'Step '+stepNb+' / '+stepsCount+' - '+step.get('description')+' (max '+treps.Constants.UPLD_MAX_FILESIZE+')'
  299 + title: 'Step '+stepNb+' / '+stepsCount+' - '+step.get('description')+' (Max file size: '+treps.Constants.UPLD_MAX_FILESIZE+
  300 + ', Records limit: '+ treps.Constants.UPLD_MAX_RECORDS_FILE
  301 + +')'
  302 + };
  303 + } else {
  304 + config = {
  305 + xtype: step.get('panel'),
  306 + title: 'Step '+stepNb+' / '+stepsCount+' - '+step.get('description')
  307 + };
  308 + }
  309 +
  310 +
  311 +
  312 +
  313 + var view = this.getApp_central();
  314 +
  315 + view.removeAll(true);
  316 +
  317 + var newPanel = view.add(config);
  318 +
  319 + view.doLayout();
  320 +
  321 + var nextStep = this.getNextStep();
  322 + var prevStep = this.getPreviousStep();
  323 +
  324 + var nextBtn = this.getNextStepButton();
  325 + var prevBtn = this.getPrevStepButton();
  326 +
  327 + if (nextStep != null)
  328 + {
  329 + nextBtn.enable();
  330 + nextBtn.setTooltip(nextStep.get('description'));
  331 + }
  332 + else
  333 + {
  334 + nextBtn.disable();
  335 + nextBtn.setTooltip('Not available');
  336 + }
  337 +
  338 + if (prevStep != null)
  339 + {
  340 + prevBtn.enable();
  341 + prevBtn.setTooltip(prevStep.get('description'));
  342 + }
  343 + else
  344 + {
  345 + prevBtn.disable();
  346 + prevBtn.setTooltip('Not available');
  347 + }
  348 +
  349 + this.doInitStep();
  350 + }
  351 +});
... ...