Giter Site home page Giter Site logo

esri / application-boilerplate-3x-js Goto Github PK

View Code? Open in Web Editor NEW
90.0 52.0 68.0 5.73 MB

Starter application that simplifies the process of building templates for the ArcGIS.com template gallery.

Home Page: https://developers.arcgis.com/javascript/

License: Apache License 2.0

JavaScript 92.16% CSS 1.89% HTML 5.94%
arcgis-js-api javascript app-template publishing-sharing

application-boilerplate-3x-js's Issues

Get only items with type="Web Map" in group

I want to get only items with type="Web Map" in group, I don't see any options to change the query in groupParams. Where should i update the parameter to get only webmaps.

Create 4.x helper class for URL params

Create a 4.x helper class to convert all the common url params like extent and such to their appropriate classes. In the 3x boilerplate, this was called map params.

I think in the new boilerplate it should be called urlHelper or something similar since it will work for scene and webmap.

4.1: IdentityManager console error

Good news: The IdentityManager is styled and no other .css refs are required. Yeah!
Bad news: IdentityManager is throwing a console error in the boilerplate.js.

Just swap the 4.0 refs to 4.1 and you should see:

init.js:153 Error: User is not signed in.(โ€ฆ) "Error: User is not signed in.
    at Error (native)
...

Add support for boolean url parameters to template.js

Many of the url params I use in templates are boolean but when retrieved as url params they are strings. I think we should add some logic into the _getUrlParamValues function to handle the conversion. Something like this?

var item = urlObject.query[items[i]];
obj[items[i]] = item === "true" || (item == "false" ? false : item);

@driskull thoughts?

4x boilerplate: Add support for reading app values from local storage

I'd like to add support for reading app values from local storage so we can take advantage of this capability in the app config panel. If the app was able to read app values from local storage we'd be able to support live preview and undo/redo capability in the default template config panel.
The app could use the values from app storage to provide live preview and then once the save button was hit on the config panel we'd write out the appid and clear local storage.

@driskull thoughts?

Approach to get GroupInfo of the Private Group

@driskull ,

When using boilerplate for developing a gallery app, we see that it does not get the group info and does not invoke identity manager too in case of private groups.

It is required in our case to show the identity manager on app load, hence we are invoking it after boilerplate runs. As the group is private, and boilerplate did not provide the detailed group info, we want to now get the group info again after user signs in.

We are able to get the groupInfo by using method _queryGroupInfo(). However, we think this is a private method of the boilerplate.

Please suggest if this approach is OK.

GroupID Configured from Application configuration panel is not honoured in Boiler Plate

Hi @driskull,

@MikeTschudi , @NikkiGolding , @ScottOppmann

If a group template has a default group configured in default.js, then we are seeing that the boiler plate fetches groupinfo and groupitems of this default group even after publishing an app and changing the group using application configuration panel(Displayed on right hand side).

This is occurring since in the code (located at line no 115 in "template.js") all the configs are mixed after getting group info and group items.

So to fix this issue can we mixin "this.config", "this.commonConfig", "this.appConfig" once the app config is available at line no 100 in "template.js".

We have added this code lang.mixin(this.config, this.commonConfig, this.appConfig); at line 100 in template.js and it is solving the issue.
Should I send a pull request?

Please let us know if we are missing something obvious.

Thanks,
Sumit Zarkar

GroupID Configured from App values is not honoured in boilerplate

HI @driskull ,

GroupID Configured from App values is not honoured in boilerplate.
This can be fixed by adding following code in the method _queryApplicationConfiguration in template.js at line #382

//Get the groupID from the app values
if (response.itemData.values.group !== "") {
 this.config.group = response.itemData.values.group;
}

4x enh: strong decoupling between boilerplate and app that uses it

The boilerplate main program does necessary app setup (setting direction, creating the webmap/webscene/group gallery), but is subject to change as the JSAPI evolves. If the boilerplate's main file includes the app's customizations, it can be difficult to re-graft an app onto the updated boilerplate--a careful line-by-line merge is required.

The proposed enhancement separates the main file into two main files:

  • the boilerplate's main, responsible for its current activities
  • the app's main, responsible for app-specific setup and running

The boilerplate main would be coupled as little as possible with the app's main; so far, a single entrypoint has been sufficient for a 3D 4.x app: a run function that's called after the dom, map (WebMap or WebScene), and view (MapView or SceneView) are ready and resolved; this function is given the boilerplate's config object, the map, and the view. (I've not explored what the run function should be like for group apps.)

Two other entrypoints might be useful. For both, if the app's main provides the function, it's called; otherwise, the boilerplate runs as it does now.

  • an initialization function that provides the boilerplate's config object to the app to permit it to tweak the config before the webmap/webscene/group gallery is created
  • a notification function for the notification part of the boilerplate's main file's reportError function

It does not appear to be necessary to add the i18n resources to the config object or the run() signature: the app's main file can simply include the i18n invocation without incurring another network fetch because the boilerplate's main program has already loaded the i18n resources.

With this setup, if the boilerplate very rarely changes the contract between the two main files, it becomes possible to re-graft an app onto an updated boilerplate in the time it takes to copy files.

Changing group from configuration panel has no effect

@driskull
Steps to reproduce:

  1. Share group "A" using a gallery template app
  2. Open configuration panel, it correctly displays group "A" that was used to publish the app
  3. Now change the group to "B" using configuration panel
  4. Notice that the app reloads and shows group "B"
  5. Click Save and Done and launch the app again from the app item
  6. Notice that the app launches and displays group "A" instead of group "B"
  7. Changing the group has no effect

We see that when a gallery app is published, the app url contains the groupid of the group that was used to publish the app. When a different group is chosen using the configuration panel, it is saved to app configuration. However, the app url still retains the original groupid that was used to publish the app. Hence, when the app launches, boilerplate gives highest priority to URL parameters and ignores the groupid that was saved to app configuration.

We don't think this is a boilerplate issue, since we are of the opinion that url parameters must always be given highest priority. What would be ideal is that the configuration app (configureApp.html) should update the app url with the new groupid when the group is changed.

Please suggest a solution or a workaround that will reflect the changed group.

Add an "error" event for the Template class

The Template class uses Deferreds that get resolved but when something fails there is no way to report that. My app needs to know when there was an error to stop the loading spinner and display the error. It would be nice if the Deferreds were rejected on error and a 'error' event was emitted. @kellyhutchins What do you think?

Issue when appID is set in default.js, not in url

template.js
_queryApplicationConfiguration functions

if (!esriLang.isDefined(webmapParam.webmap) && response.itemData.values.webmap && this.config.webmap)
{
this.config.webmap = response.itemData.values.webmap;
}

Command Window of the values:

? response.itemData.values.webmap
"40f993fccee34ebb9e9c1c6ecc9bf9fb"
? this.config.webmap
""
? esriLang.isDefined(webmapParam.webmap)
false

4: Identity dijit needs 3.x reference

I know this will be fixed soon but if you want styling for the identity manager to login, you'll need this stylesheet from 3.x:

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <!-- Define the versions of IE that will be used to render the page. See Microsoft documentation for details. Optional. -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <!-- Responsive -->
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <meta name="mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
  <!-- End Responsive -->
  <!-- Use protocol relative urls that way if the browser is viewing the page via HTTPS the js/css file will be requested using the HTTPS protocol -->
  <link rel="stylesheet" href="//js.arcgis.com/4.0/esri/css/main.css">
  <!-- Load any application specific styles -->
  <link rel="stylesheet" href="css/boilerplate.css">

  <!-- Calcite - only for IdentityManager -->
  <link rel="stylesheet" href="https://js.arcgis.com/3.17/esri/themes/calcite/dijit/calcite.css">

</head>

<body class="calcite boilerplate--loading">
  <div class="boilerplate-loading-indicator">
    <div class="boilerplate-loading-message" id="loading_message"></div>
  </div>
  <div id="viewDiv" class="boilerplate-view"></div>
  <script type="text/javascript" src="js/dojoConfig.js"></script>
  <script type="text/javascript" src="//js.arcgis.com/4.0/"></script>
  <script type="text/javascript">
    require([
      "boilerplate",
      "dojo/text!boilerplate/settings.json",
      "application"
    ], function (
      Boilerplate,
      boilerplateSettings,
      applicationMain
    ) {

      // create my main application. Start placing your logic in the main.js file.
      var mainApp = new applicationMain();

      // create the template. This will take care of all the logic required for template applications.
      new Boilerplate(JSON.parse(boilerplateSettings)).always(function (boilerplate) {
        mainApp.init(boilerplate);
      });

    });

  </script>
</body>

</html>

After signing in, the call to groupInfo() always looks for the group in the same organization where app is published

@driskull,

When we publish a gallery app based on boilerplate and configure a group that is public but from a different organization then we see that,

  1. If you do not sign in, everything works fine
  2. If you sign in, then it doesnt find the group

This is because after signing in, the call to groupInfo() is automatically appending the orgId in the query parameters and thus trying to look for that group in the same organization.

This is what gets sent before signing in and it finds the group despite it being from different organization
image

This is what gets sent after signing in and it doesnt find the group inspite it being public. Notice the orgid appended in the query parameters
image

getViewProperties() shouldn't take string array

We might not want to depend on splitting an incoming string for ui components because UI doesn't support loading all widgets (components) by string - just zoom, compass and attribution. Furthermore, the location e.g. top-right of the ui component should also be passed in so I think we need to re-think this structure.

https://github.com/Esri/application-boilerplate-js/blob/4master/js/boilerplate/UrlParamHelper.js#L56

Here's how I handle it in config.json and and use main.js to set up the UI.

{
  "appid": "",
  "group": "",
  "title": "",
  "subtitle": "",
  "about": "",
  "webmap": "de5fe9b1be9b43a9aa195164438b557f",
  "webscene": "",
  "uiComponents": {
    "zoom": {
      "visible": true,
      "position": "top-left"
    },
    "attribution": {
      "visible": true,
      "position": "top-left"
    },
    "search": {
      "visible": true,
      "position": "custom"
    }
  },
...

'on' is not defined

small issue in js/main.js:

JSHint notes: "'on' is not defined." Line 49.

define(["dojo/on"],function(on){...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.