Commit 094025a40d02cfaa6efaf2090be2a83dbdd3390e

Authored by Nathanael Jourdane
1 parent 272186a0

Use an extjs panel instead the builtin js alert() popup.

Showing 1 changed file with 40 additions and 7 deletions   Show diff stats
js/app/controllers/EpnTapModule.js
... ... @@ -122,7 +122,7 @@ Ext.define('amdaDesktop.EpnTapModule', {
122 122 if(target) {
123 123 // --- Select product types ---
124 124 if (! target[0] in this.productTypeCB.getStore()) {
125   - alert("Sorry, product type " + target[0] + " is not found in available services.");
  125 + this.display_message("Sorry, product type " + target[0] + " is not found in available services.");
126 126 return;
127 127 }
128 128 this.productTypeCB.select(target[0]);
... ... @@ -130,7 +130,7 @@ Ext.define('amdaDesktop.EpnTapModule', {
130 130  
131 131 // --- Select target class ---
132 132 if (! target[1] in this.targetClassCB.getStore()) {
133   - alert("Sorry, target class " + this.pretify(target[1]) + " is not found in available services.");
  133 + this.display_message("Sorry, target class " + this.pretify(target[1]) + " is not found in available services.");
134 134 return;
135 135 }
136 136 this.targetClassCB.select(target[1]);
... ... @@ -138,7 +138,7 @@ Ext.define('amdaDesktop.EpnTapModule', {
138 138  
139 139 // --- Select target name ---
140 140 if (! target[2] in this.targetNameCB.getStore()) {
141   - alert("Sorry, target name " + this.pretify(target[2]) + " is not found in available services.");
  141 + this.display_message("Sorry, target name " + this.pretify(target[2]) + " is not found in available services.");
142 142 return;
143 143 }
144 144 this.targetNameCB.select(target[2]);
... ... @@ -437,12 +437,29 @@ Ext.define('amdaDesktop.EpnTapModule', {
437 437 Among other things, fill the `epnTapGranulesGrid` table (see `EpnTapUI.granulesStore`).
438 438 */
439 439 fillGranules: function(granules) {
  440 + function display_message(text) {
  441 + var messageWindow = new Ext.form.Panel({
  442 + width: 200,
  443 + height: 100,
  444 + title: 'Oops',
  445 + floating: true,
  446 + closable : true,
  447 + items: [
  448 + { xtype: 'label', text: text, margin: 10},
  449 + { xtype: 'button', text: 'Ok', margin: 10, listeners: {
  450 + click: function() { messageWindow.close(); }
  451 + }}
  452 + ],
  453 + });
  454 + messageWindow.show();
  455 + };
  456 +
440 457 if (granules["error"] != null) {
441 458 console.log('Can not get request response:', granules["error"]);
442 459 if(granules["error"] == "no result") {
443   - alert("There is no result for this query.");
  460 + display_message('There is no result for this query.');
444 461 } else {
445   - alert("Can not display granules due to an error from the selected epn-tap service.");
  462 + display_message('Can not display granules due to an error from the selected epn-tap service.');
446 463 }
447 464 } else {
448 465 try {
... ... @@ -450,7 +467,7 @@ Ext.define('amdaDesktop.EpnTapModule', {
450 467 Ext.getCmp('epnTapGranulesGrid').getStore().add(granules);
451 468 } catch( e ) {
452 469 console.log('Can not add granules: ' + e);
453   - alert("Can not display granules due to an error from the selected epn-tap service.");
  470 + display_message('Can not display granules due to an error from the selected epn-tap service.');
454 471 }
455 472 }
456 473 Ext.getCmp('epnTapServicesGrid').setDisabled(false);
... ... @@ -468,6 +485,22 @@ Ext.define('amdaDesktop.EpnTapModule', {
468 485 this.servicesGrid.getEl().setStyle('cursor', 'wait'); // CSS is correctly changed but without visible result.
469 486 this.servicesGrid.setDisabled(true);
470 487 this.granulesGrid.setDisabled(true);
471   - }
  488 + },
472 489  
  490 + display_message: function(text) {
  491 + var messageWindow = new Ext.form.Panel({
  492 + width: 200,
  493 + height: 100,
  494 + title: 'Oops',
  495 + floating: true,
  496 + closable : true,
  497 + items: [
  498 + { xtype: 'label', text: text, margin: 10},
  499 + { xtype: 'button', text: 'Ok', margin: 10, listeners: {
  500 + click: function() { messageWindow.close(); }
  501 + }}
  502 + ],
  503 + });
  504 + messageWindow.show();
  505 + }
473 506 });
... ...