How to use the @esri/solution-common.PLACEHOLDER_SERVER_NAME function in @esri/solution-common

To help you get started, we’ve selected a few @esri/solution-common 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 / solution.js / packages / simple-types / src / webmap.ts View on Github external
return new Promise((resolve, reject) => {
    // Templatize the app URL
    itemTemplate.item.url =
      common.PLACEHOLDER_SERVER_NAME +
      WEBMAP_APP_URL_PART +
      itemTemplate.item.id; // templatized id

    // Extract dependencies
    _extractDependencies(itemTemplate, authentication).then(
      (results: any) => {
        itemTemplate.dependencies = results.dependencies;

        // Templatize the map layer ids after we've extracted them as dependencies
        if (itemTemplate.data) {
          _templatizeWebmapLayerIdsAndUrls(
            itemTemplate.data.operationalLayers,
            results.urlHash
          );
          _templatizeWebmapLayerIdsAndUrls(
            itemTemplate.data.tables,
github Esri / solution.js / packages / simple-types / src / webmappingapplication.ts View on Github external
return new Promise((resolve, reject) => {
    // update properties of values collection for web app templates
    let values: any = common.getProp(itemTemplate, widgetPath);
    let serviceRequests: any[] = [];
    let requestUrls: string[] = [];

    if (values) {
      if (common.getProp(values, "icon")) {
        setValues(values, ["icon"], common.PLACEHOLDER_SERVER_NAME);
      }

      const sConfig: string = JSON.stringify(values);
      const urlResults: any = findUrls(
        sConfig,
        portalUrl,
        requestUrls,
        serviceRequests,
        authentication
      );

      values = JSON.parse(urlResults.testString);
      serviceRequests = urlResults.serviceRequests;
      requestUrls = urlResults.requestUrls;
    }
github Esri / solution.js / packages / simple-types / src / webmappingapplication.ts View on Github external
"WAB3D",
        "Web AppBuilder"
      ])
    ) {
      common
        .createItemWithData(
          {
            tags: originalTemplate.item.tags,
            title: originalTemplate.item.title,
            type: "Code Attachment",
            typeKeywords: ["Code", "Javascript", "Web Mapping Application"],
            relationshipType: "WMA2Code",
            originItemId: newlyCreatedItem.itemId,
            url:
              common.replaceInTemplate(
                common.PLACEHOLDER_SERVER_NAME,
                templateDictionary
              ) +
              "/sharing/rest/content/items/" +
              newlyCreatedItem.itemId +
              "/package"
          },
          {},
          destinationAuthentication,
          templateDictionary.folderId
        )
        .then(
          () => resolve(),
          () => resolve()
        );
    } else {
      // Otherwise, nothing extra needed
github Esri / solution.js / packages / simple-types / src / webmappingapplication.ts View on Github external
testString = replaceUrl(
          testString,
          url,
          common.PLACEHOLDER_NA_SERVER_NAME
        );
      } else if (url.indexOf("GeocodeServer") > -1) {
        testString = replaceUrl(
          testString,
          url,
          common.PLACEHOLDER_GEOCODE_SERVER_NAME
        );
      } else if (portalUrl && url.indexOf(portalUrl) > -1) {
        testString = replaceUrl(
          testString,
          url,
          common.PLACEHOLDER_SERVER_NAME
        );
      } else if (url.indexOf("FeatureServer") > -1) {
        if (requestUrls.indexOf(url) === -1) {
          requestUrls.push(url);
          serviceRequests.push(common.rest_request(url, options));
        }
      }
    });
  }
github Esri / solution.js / packages / simple-types / src / webmappingapplication.ts View on Github external
Object.keys(dataSources).forEach(k => {
        const ds: any = dataSources[k];
        common.setProp(ds, "portalUrl", common.PLACEHOLDER_SERVER_NAME);
        const itemId: any = common.getProp(ds, "itemId");
        if (common.getProp(ds, "url")) {
          if (itemId) {
            const layerId = ds.url.substr(
              (ds.url as string).lastIndexOf("/") + 1
            );
            ds.itemId = common.templatizeTerm(
              itemId,
              itemId,
              ".layer" + layerId + ".itemId"
            );
          }
          const urlResults: any = findUrls(
            ds.url,
            portalUrl,
            [],
github Esri / solution.js / packages / simple-types / src / webmappingapplication.ts View on Github external
widgets.forEach(widget => {
      if (common.getProp(widget, "icon")) {
        setValues(widget, ["icon"], common.PLACEHOLDER_SERVER_NAME);
      }
      const config: any = widget.config;
      if (config) {
        const sConfig: string = JSON.stringify(config);
        const urlResults: any = findUrls(
          sConfig,
          portalUrl,
          requestUrls,
          serviceRequests,
          authentication
        );

        widget.config = JSON.parse(urlResults.testString);
        serviceRequests = urlResults.serviceRequests;
        requestUrls = urlResults.requestUrls;
      }