Project

General

Profile

« Previous | Next » 

Revision 1861c83d

Added by Andreas Kohlbecker over 4 years ago

ref #8388 UTIS search block: handling empty records and feedback on no results

View differences:

modules/cdm_dataportal/js/utis-client/utis-client.js
195 195
   */
196 196
  executeQuery: function (plugin) {
197 197

  
198
    plugin.resultContainer.show();
198 199
    plugin.spinnerContainer.show();
199 200
    $.getJSON(plugin.options.webserviceUrl + '/search',
200 201
      {
......
209 210
          plugin.resultContainer.empty();
210 211
          plugin.resultContainer.append(plugin.spinnerContainer);
211 212
        }
212
        if (tnrMsg.query[0].response.length === 0 && plugin.pageIndex === 0) {
213
          plugin.resultContainer.hide();
214
        } else {
215
          plugin.resultContainer.show()
216
        }
217 213
        // in UTIS there is always only one query
218 214
        var response = tnrMsg.query[0].response;
215
        var count = 0;
219 216
        $.each(response, function (index, record) {
220
          plugin.spinnerContainer.before(plugin.makeResultEntry(record));
217
          if(record.matchingNameString !== null){
218
            // ignore deleted names (WoRMS, DiatomBase)
219
            plugin.spinnerContainer.before(plugin.makeResultEntry(record));
220
            count++;
221
          }
221 222
        });
223
        if(count === 0){
224
          plugin.spinnerContainer.before($('<div/>', {'class': 'no-results', style: 'height: 100%; text-align: center; v-align: middle;'}).text("No results."))
225
        }
222 226
        plugin.spinnerContainer.hide();
223 227
      });
224 228
  },

Also available in: Unified diff