Skip to content

Dead Code Quest: Fix DownloadTool's doDownload #942

Description

@theduckylittle

In: gm3/src/gm3/components/catalog/tools/download.js

function mapDispatch() {
  return {
    onDownload: (src, mapSource, downloadFormat) => {
      // find the layer and check to see if it has features,
      //  if features is undefined, then just return an empty collection.
      let features = mapSource.features;

      // check to see if there is a filter on the specified layer
      let filter = null;
      for (let i = 0, ii = mapSource.layers.length; filter === null && i < ii; i++) {
        const layer = mapSource.layers[i];
        if (layer.name === src.layerName && layer.filter !== undefined) {
          filter = layer.filter;
        }
      }

      // if a filter is found on the layer,
      // then ensure only those features are matched.
      if (filter !== null) {
        features = matchFeatures(features, filter);
      }

      doDownload(features, downloadFormat);
    },
  };
}

Does not use dispatch or props so can likely be moved to a separate function with no react or redux dependencies.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions