Select to view content in your preferred language

AddData Widget Modifications

1686
15
Jump to solution
12-04-2017 01:17 PM
JamesCrandall
MVP Frequent Contributor

Problem: The AddData widget does not filter out ESRI Premium Content from its search results and publicly shared WAB apps will have many non-organizational account users.  The WAB refreshes if attempting to add ESRI premium content (after signing in) and is a very confusing user experience.

Question: Is there an easy way to filter out ESRI Premium Content from the AddData widget search results?

We're interested in an interim quick solution that we can implement to our WAB apps we build with WAB Developer and would like to alter the AddData widget as described above.  In the longer term, an enhancement request will be made to fix this issue as it seems to be a design flaw in general.  There should not be interruptions to the logical flow and is quite confusing to the user.

0 Kudos
15 Replies
JamesCrandall
MVP Frequent Contributor

Edit: perhaps it actually does filter it out -- I've gone thru several iterations of clearing browser history and kept seeing the usgs content in the search results until now when I just made another attempt.  I'll continue to test but looks promising.  Thanks again!

Robert,

I've deployed a test WAB with the changes and have set it and its web map source to shared public.  When it opens I am not prompted to login (expected) and open the AddData widget, which defaults to "ArcGIS Online" as the search location (expected).  If I type in "usgs", I get the USGS Live Stream Gauges (Flooding) map service that is considered "subscriber" content and distributed by ESRI. 

Do you get the same?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

James,

  What is your app extent when opening? A City, State, the US, the World?

0 Kudos
JamesCrandall
MVP Frequent Contributor

State (majority of Florida)

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

I see that the 

Live Stream Gauges (Flooding)

does not have the tag "Premium Content".

RobertScheitlin__GISP
MVP Emeritus

James,

  This change should do it:

      buildQueryParams: function(task) {
        var qRequired = null;
        if (typeof this.qRequiredFilter === "string" && this.qRequiredFilter.length > 0) {
          qRequired = this.qRequiredFilter;
        }
        var params = {
          q: qRequired,
          canSortByRelevance: false
        };
        array.forEach(this.getComponents(), function(component) {
          component.appendQueryParams(params, task);
        });
        if(params.q.indexOf("orgid") === -1 && params.q.indexOf("owner") === -1){
          var portal = this.searchContext.portal;

          if(!portal.haveSignIn()){
            var q = "(-\"Requires Subscription\")";
            if (params.q !== null && params.q.length > 0) {
              params.q += " AND " + q;
            } else {
              params.q = q;
            }
          }
        }
        delete params.canSortByRelevance;
        if (params.q === null && typeof this.qDefaultFilter === "string" &&
          this.qDefaultFilter.length > 0) {
          params.q = this.qDefaultFilter;
        }
        return params;
      },
JamesCrandall
MVP Frequent Contributor

I do believe this is it! 

Much appreciated!

0 Kudos