Commit 33db0a915e84f209238f28ff28723083396df95c

Authored by Nathanael Jourdane
1 parent c4959ce7

Add Get button (wip)

js/app/controllers/EpnTapModule.js
... ... @@ -68,6 +68,7 @@ Ext.define('amdaDesktop.EpnTapModule', {
68 68 this.previousPageBtn = Ext.getCmp('epnTapPreviousPageBtn');
69 69 this.nextPageBtn = Ext.getCmp('epnTapNextPageBtn');
70 70 this.lastPageBtn = Ext.getCmp('epnTapLastPageBtn');
  71 + this.getBtn = Ext.getCmp('epnTapGetBtn');
71 72  
72 73 // stores elements
73 74 this.servicesStore = Ext.data.StoreManager.lookup('servicesStore');
... ... @@ -78,6 +79,14 @@ Ext.define('amdaDesktop.EpnTapModule', {
78 79 },
79 80  
80 81 addUIListeners: function() {
  82 + this.targetNameCB.on('change', function() {
  83 + this.updateGetBtnStatus();
  84 + }, this);
  85 +
  86 + this.productTypeCB.on('change', function() {
  87 + this.updateGetBtnStatus();
  88 + }, this);
  89 +
81 90 this.servicesGrid.on('cellclick', function(grid, td, cellIndex, record) {
82 91 this.onServiceSelected(record.data['id']);
83 92 }, this);
... ... @@ -101,6 +110,10 @@ Ext.define('amdaDesktop.EpnTapModule', {
101 110 this.lastPageBtn.on('click', function() {
102 111 this.onLastPageBtnClicked();
103 112 }, this);
  113 +
  114 + this.getBtn.on('click', function() {
  115 + this.onGetBtnClicked();
  116 + }, this);
104 117 },
105 118  
106 119 /**********************
... ... @@ -144,6 +157,16 @@ Ext.define('amdaDesktop.EpnTapModule', {
144 157 this.lastPageBtn.setDisabled(last);
145 158 },
146 159  
  160 + updateGetBtnStatus: function() {
  161 + var shouldEnabled = this.targetNameCB.rawValue.length > 0 && this.productTypeCB.rawValue.length > 0;
  162 + if(shouldEnabled) {
  163 + this.getBtn.enable();
  164 + } else {
  165 + this.getBtn.disable();
  166 + }
  167 +
  168 + },
  169 +
147 170 /****************************
148 171 *** Service filter events ***
149 172 ****************************/
... ... @@ -238,6 +261,13 @@ Ext.define('amdaDesktop.EpnTapModule', {
238 261 AmdaAction.epnTapGetGranules(selectedService['table_name'], selectedService['access_url'], this.filter, limit, offset, this.fillGranules);
239 262 },
240 263  
  264 + /**
  265 + Trigerred when the 'Get results' button is clicked.
  266 + */
  267 + onGetBtnClicked: function() {
  268 + console.log('Getting results...');
  269 + },
  270 +
241 271 /*******************
242 272 *** Grids events ***
243 273 *******************/
... ...
js/app/controllers/InteropModule.js
... ... @@ -407,7 +407,7 @@ Ext.define('amdaDesktop.InteropModule', {
407 407 layout: 'anchor',
408 408 width: 800,
409 409 height: 600,
410   - minWidth: 700,
  410 + minWidth: 650,
411 411 modal: true,
412 412 minimizable: false,
413 413 iconCls: this.icon,
... ...
js/app/views/EpnTapUI.js
... ... @@ -194,7 +194,7 @@ Ext.define('amdaUI.EpnTapUI', {
194 194 id: 'epnTapServiceFilterPanel',
195 195 layout: { type: 'hbox', pack: 'start', align: 'stretch' },
196 196 region: 'north',
197   - defaults: { margin: 5 },
  197 + defaults: { margin: '5 0 5 5'},
198 198 items: [{ // Left part
199 199 xtype : 'container',
200 200 flex: 1,
... ... @@ -210,10 +210,10 @@ Ext.define('amdaUI.EpnTapUI', {
210 210 ]
211 211 }, { // Right part
212 212 xtype : 'container',
213   - flex: 1,
214 213 items: [
215 214 this.createRowPerPageNf(),
216   - this.createNavigationPanel()
  215 + this.createNavigationPanel(),
  216 + this.createSendButton()
217 217 ]
218 218  
219 219 }]
... ... @@ -238,7 +238,7 @@ Ext.define('amdaUI.EpnTapUI', {
238 238 valueField: 'id',
239 239 multiSelect: true,
240 240 displayField: 'name',
241   - labelWidth: 80,
  241 + labelWidth: 71,
242 242 editable: false,
243 243 listeners: {
244 244 select: function(combo, records) {
... ... @@ -275,7 +275,8 @@ Ext.define('amdaUI.EpnTapUI', {
275 275 queryParam: 'input',
276 276 displayField: 'name',
277 277 valueField: 'id',
278   - labelWidth: 80,
  278 + margin: '15 0 5 0',
  279 + labelWidth: 71,
279 280 minWidth: 20,
280 281 minChars: 2,
281 282 hideTrigger: true,
... ... @@ -288,7 +289,7 @@ Ext.define('amdaUI.EpnTapUI', {
288 289 render: function(c) {
289 290 new Ext.ToolTip({
290 291 target: c.getEl(),
291   - html: 'Type a text then select the correct target.'
  292 + html: 'Start to type a text then select a target.'
292 293 });
293 294 }
294 295 }
... ... @@ -324,8 +325,9 @@ Ext.define('amdaUI.EpnTapUI', {
324 325 xtype: 'numberfield',
325 326 id: 'epnTapRowsPerPageNf',
326 327 fieldLabel: 'Rows per page',
  328 + labelWidth: 85,
327 329 margin: '4 0 4 0',
328   - width: 160,
  330 + width: 140,
329 331 height: 20,
330 332 value: 20,
331 333 minValue: 1,
... ... @@ -355,43 +357,63 @@ Ext.define('amdaUI.EpnTapUI', {
355 357 */
356 358 createNavigationPanel: function() {
357 359 return {
358   - xtype: 'panel',
359   - border: false,
360   - margin: '2 0 2 50',
361   - defaults: { margin: '0 5 0 5', width: 20, xtype: 'button', disabled: true},
  360 + xtype: 'container',
  361 + width: 145,
  362 + defaults: {margin: '0 5 0 0', xtype: 'button', disabled: true},
362 363 items: [{
363 364 id: 'epnTapFirstPageBtn',
364 365 text: '|<',
  366 + width: 26,
365 367 tooltip: 'First page'
366 368 }, {
367 369 id: 'epnTapPreviousPageBtn',
368 370 text: '<',
  371 + width: 26,
369 372 tooltip: 'Previous page'
370 373 }, {
371 374 xtype: 'label',
372 375 id: 'epnTapCurrentPageLb',
373 376 tooltip: 'Current page',
374   - text: '-'
  377 + text: '0',
  378 + margin: 0
375 379 }, {
376 380 xtype: 'label',
377   - text: '/'
  381 + text: '/',
  382 + margin: 0
378 383 }, {
379 384 xtype: 'label',
380 385 id: 'epnTapTotalPagesLb',
381 386 tooltip: 'Total pages',
382   - text: '-'
  387 + text: '0',
383 388 }, {
384 389 id: 'epnTapNextPageBtn',
385 390 text: '>',
  391 + width: 26,
386 392 tooltip: 'Next page'
387 393 }, {
388 394 id: 'epnTapLastPageBtn',
389 395 text: '>|',
  396 + width: 26,
  397 + margin: 0,
390 398 tooltip: 'Last page'
391 399 }]
392 400 };
393 401 },
394 402  
  403 + /**
  404 + The button used to send the query.
  405 + */
  406 + createSendButton: function() {
  407 + return {
  408 + xtype: 'button',
  409 + id: 'epnTapGetBtn',
  410 + text: 'Get results',
  411 + disabled: true,
  412 + width: 140,
  413 + margin: '5 0 0 0'
  414 + }
  415 + },
  416 +
395 417 /************
396 418 *** Grids ***
397 419 ************/
... ... @@ -407,7 +429,7 @@ Ext.define(&#39;amdaUI.EpnTapUI&#39;, {
407 429 xtype: 'panel',
408 430 id: 'epnTapGridsPanel',
409 431 layout: 'fit',
410   - height: 400,
  432 + height: 440,
411 433 region: 'center',
412 434 items: [{
413 435 xtype: 'container',
... ...