How to use the babel/store/AppStore.getState function in babel

To help you get started, we’ve selected a few babel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Esri / storymap-crowdsource / src / app / utils / arcgis / portal / Portal.babel.js View on Github external
Portal.prototype.saveApp = function (options) {
  const dfd = new Deferred();
  const appState = lang.getObject('items.app',false,AppStore.getState());
  const defaults = appState;
  const settings = $.extend(true, {}, defaults, options);

  const username = this.getPortalUser().username;
  const baseRequestPath = this.portalUrl.stripTrailingSlash() + '/content/users/' + (settings.item.owner ? settings.item.owner : username) + (settings.item.ownerFolder ? ('/' + settings.item.ownerFolder) : '');

  // Remove properties that don't have to be committed
  delete settings.item.avgRating;
	delete settings.item.modified;
	delete settings.item.numComments;
	delete settings.item.numRatings;
	delete settings.item.numViews;
	delete settings.item.size;
  delete settings.item.serviceProxyParams;

  // TODO add serviceproxyparams
github Esri / storymap-crowdsource / src / app / utils / arcgis / items / Item.babel.js View on Github external
}).then((res) => {
      if (res.id && res.id === settings.id) {
        response.item = res;
        if (settings.deferredResponseOnly) {
          deferred.resolve(response);
        } else if (settings.item === 'app' && response.data.values.settings) {
          crowdsourceVersionUpdate(response);
        } else if (settings.item === 'app') {
          ArcgisActions.receiveScratchCreationAppItem(response);
        } else if (settings.item === 'webmap') {
          if (lang.getObject('mode.fromScratch',false,AppStore.getState()) && lang.getObject('app.portal.user.username',false,AppStore.getState()) !== res.owner) {
            // If owned by another user, remove id information so app will create a copy of the original webmap in author's content
            $.extend(true,response.item,{
              id: '',
              extent: res.extent.toString(),
              orgId: '',
              owner: '',
              ownerFolder: ''
            });
            ArcgisActions.receiveWebmapItem(response);
            displayDifferentWebmapOwnerMessage();
          } else {
            $.extend(true,response.item,{
              extent: res.extent.toString()
            });
            ArcgisActions.receiveWebmapItem(response);
          }
github Esri / storymap-crowdsource / src / app / controllers / builder / components / Components.babel.js View on Github external
updateAppState() {
    this.appState = AppStore.getState();

    this.updateVisibleComponents();
  }
github Esri / storymap-crowdsource / src / app / actions / MapActions.babel.js View on Github external
export const previousFeature = function () {
  const appState = AppStore.getState();
  const oidField = lang.getObject('app.map.layer.objectIdField',false,appState);
  const currentId = lang.getObject('app.map.selectedFeatureId',false,appState);
  const featuresInExtent = lang.getObject('app.map.featuresInExtent',false,appState);
  let currentIndex;

  featuresInExtent.forEach((current,index) => {
    if (current.attributes[oidField] === currentId) {
      currentIndex = index;
    }
  });

  let id = currentId;

  if (currentIndex === 0) {
    id = featuresInExtent[featuresInExtent.length - 1].attributes[oidField];
  } else if (currentIndex) {
github Esri / storymap-crowdsource / src / app / controllers / contribute / ContrbuteController.babel.js View on Github external
updateAppState() {
    this.appState = AppStore.getState();

    this.checkContributeView();
    this.saveGraphic();
  }
github Esri / storymap-crowdsource / src / app / controllers / layouts / sidePanel / SidePanelController.babel.js View on Github external
updateAppState() {
    if (this.enabled) {
      this.appState = AppStore.getState();

      this.updateAppView();
      this.checkOverlayComponentVisibility();
    }
  }
github Esri / storymap-crowdsource / src / app / utils / arcgis / portal / Portal.babel.js View on Github external
Portal.prototype.shareItems = function (options) {
  const dfd = new Deferred();
  const appState = AppStore.getState();
  const defaults = {
    appState,
    everyone: false,
    org: false
  };

  const settings = $.extend(true, {}, defaults, options);
  const username = this.getPortalUser().username;
  const url = this.portalUrl.stripTrailingSlash() + '/content/users/' + (lang.getObject('appState.items.app.item.owner',false,settings) ? lang.getObject('appState.items.app.item.owner',false,settings) : username) + '/shareItems';

  const appId = lang.getObject('appState.items.app.item.id',false,settings);
  const webmapId = lang.getObject('appState.items.webmap.item.id',false,settings);
  const layers = [].concat(lang.getObject('appState.items.webmap.data.operationalLayers',false,settings)).concat(lang.getObject('appState.items.webmap.data.baseMap.baseMapLayers',false,settings));
  let layerIds = [];

  layers.forEach((layer) => {
github Esri / storymap-crowdsource / src / app / controllers / CrowdsourceController.babel.js View on Github external
updateAppState() {
    this.appState = AppStore.getState();
    this.updatePageTitle();

    if (!this.environmentConfigured && lang.getObject('appState.config.sharingurl',false,this)) {
      this.environmentConfigured = true;
      EnvironmentConfig.configSharingUrl(lang.getObject('appState.config.sharingurl',false,this));
    }
  }
github Esri / storymap-crowdsource / src / app / controllers / builder / review / CrowdsourceReviewController.babel.js View on Github external
updateAppState() {
    this.appState = AppStore.getState();

    this.editReviewedFeatures();
  }