Coder Social home page Coder Social logo

esri / solution.js Goto Github PK

View Code? Open in Web Editor NEW
36.0 45.0 11.0 44.39 MB

TypeScript wrappers running in Node.js and modern browsers for transferring ArcGIS Online items from one organization to another.

Home Page: https://esri.github.io/solution.js/

License: Apache License 2.0

TypeScript 99.47% JavaScript 0.24% Shell 0.05% HTML 0.12% Batchfile 0.11%
data-management typescript rest-api esri arcgis javascript

solution.js's Introduction

npm status Build status Coverage status Apache 2.0 licensed

Solution.js

TypeScript wrappers running in Node.js and modern browsers for transferring ArcGIS Online items from one organization to another. Video introduction from the 2020 Developer Summit.

Table of Contents


API Overview

Common terms

An ArcGIS Online (AGO) item is transformed into a template that contains all of its defining information. If the item depends on other items, those items are also transformed into templates.

A Solution Item can contain either

  • a list of Item Templates
  • a list of references to deployed items

When it contains Item Templates, it can be used for organizing and distributing Solutions, e.g., for displaying in a gallery of Solutions.

When a Solution is deployed into an organization, a new Solution is created that contains references to the items deployed into the organization; it serves as a table of contents for the deployment.

Packages

The API is divided into packages to make it easier to use just the parts that you want:

  • common, which contains common helper functions for the other packages
  • creator, which contains functions for transforming items into templates
  • deployer, which contains functions for deploying item templates into items in a destination organization
  • feature-layer, which contains functions for Feature Service items
  • file, which contains functions for items that contain files
  • form, which contains functions for form items
  • group, which contains functions for Groups
  • hub-types, which contains functions supporting ArcGIS Hub Sites and Initiatives
  • simple-types, which contains functions for the simpler item types Dashboard, Form, Web Map, Web Mapping Application, and Workforce Project
  • storymap, which contains functions for Storymap items
  • velocity, which contains functions to support ArcGIS Velocity items
  • viewer, which contains functions to support displaying Solution items
  • web-experience, which contains functions for Experience Builder items
  • workflow, which contains functions for Workflow items

Additional information

The API documentation is published at https://esri.github.io/solution.js/

Supported ArcGIS Online Item Types

Currently, the ArcGIS Online item types that can be converted into a template are:

  • App types: Dashboard, Form, Hub Initiative, Hub Page, Hub Site Application, Insights Model, Notebook, Oriented Imagery Catalog, QuickCapture Project, Site Application, Site Page, StoryMap, Web Experience, Web Mapping Application, Workforce Project

  • Map types: Web Map, Web Scene

  • Layer types: Big Data Analytic, Feature Collection, Feature Service, Feed, Map Service, Real Time Analytic

  • File types: 360 VR Experience, AppBuilder Extension, AppBuilder Widget Package, Application Configuration, ArcGIS Pro Add In, ArcGIS Pro Configuration, ArcPad Package, Basemap Package, CAD Drawing, CityEngine Web Scene, Code Attachment, Code Sample, Color Set, Compact Tile Package, CSV Collection, CSV, Deep Learning Package, Desktop Add In, Desktop Application Template, Desktop Style, Document Link, Explorer Add In, Explorer Layer, Explorer Map, Feature Collection Template, File Geodatabase, GeoJson, GeoPackage, Geoprocessing Package, Geoprocessing Sample, Globe Document, Image Collection, Image, iWork Keynote, iWork Numbers, iWork Pages, KML Collection, Layer Package, Layer Template, Layer, Layout, Locator Package, Map Document, Map Package, Map Template, Microsoft Excel, Microsoft Powerpoint, Microsoft Word, Mobile Basemap Package, Mobile Map Package, Mobile Scene Package, Native Application, Native Application Installer, Native Application Template, netCDF, Operation View, Operations Dashboard Add In, Operations Dashboard Extension, PDF, Pro Layer Package, Pro Layer, Pro Map Package, Pro Map, Pro Report, Project Package, Project Template, Published Map, Raster function template, Report Template, Rule Package, Scene Document, Scene Package, Service Definition, Shapefile, Statistical Data Collection, Style, Survey123 Add In, Symbol Set, Task File, Tile Package, Toolbox Package, Vector Tile Package, Viewer Configuration, Visio Document, Window Mobile Package, Windows Mobile Package, Windows Viewer Add In, Windows Viewer Configuration, Workflow, Workflow Manager Package

The implemented-types demo generates its list from the source code.

Instructions

Setup

The repository can be built using the Windows batch file build.bat.

npm commands

For a list of all available commands run npm run.

These commands are

  • building

    • npm run build creates symlinks among packages and creates node, umd, and esm outputs for each package
    • npm run clean runs clean:src and clean:dist (requires bash console)
      • npm run clean:src deletes .d.ts, .js, and .js.map files
      • npm run clean:dist deletes .rpt2_cache and dist folders
    • npm run lint lints the TypeScript files
    • npm run lint:fix lints the TypeScript files and fixes
    • npm run prettify beautifies TypeScript files
  • testing

    • npm run test lints, then runs test:chrome tests to confirm that the API is functioning as expected
    • npm run test:browsers runs karma in the Chrome, Firefox, and Chromium Edge browsers
    • npm run test:chrome runs karma in the Chrome browser
    • npm run test:chrome:ci runs karma in the ChromeHeadlessCI browser
    • npm run test:chrome:debug runs karma in the Chrome browser and leaves the browser open for debugging tests
    • npm run test:edge runs karma in the Edge (Chromium) browser
    • npm run test:firefox runs karma in the Firefox browser
    • npm run test:ci lints, then runs test:chrome:ci, test:firefox, and coveralls from a bash window
    • npm run test:ci:win lints, then runs test:chrome:ci, test:firefox, and coveralls:win from a Windows window
    • npm run test:all runs test:chrome and test:edge and test:firefox
    • npm run coveralls updates code coverage info from a bash window
    • npm run coveralls:win updates code coverage info from a Windows window
  • publishing doc

    • npm run docs:build builds the documentation (note that this script creates a docs folder, deleting any existing one)
    • npm run docs:deploy pushes the documentation to the repository's gh-pages
  • publishing code

    • npm run release:prepare1 fetch, compile, and test (requires bash shell)
    • npm run release:prepare2 bundles packages and asks you for the new version number (use arrow keys to put cursor on line above desired version) (requires Windows shell)
    • npm run release:review shows summary of git changes
    • npm run release:publish-git publishes a version to GitHub (requires bash shell)
    • npm run release:publish-npm publishes a version to npm (requires Windows shell)
  • lifecycle

    • postinstall runs bootstrap
    • bootstrap
    • precommit

Frequently Asked Questions

Guides

Issues

Found a bug or want to request a new feature? Please take a look at previously logged issues; if you don't see your concern, please let us know by submitting an issue.

Versioning

For transparency into the release cycle and in striving to maintain backward compatibility, @esri/solution.js is maintained under Semantic Versioning guidelines and will adhere to these rules whenever possible. For more information on SemVer, please visit http://semver.org/.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.

License

Copyright © 2018 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's LICENSE file.

Third-Party Licenses

solution.js's People

Contributors

alexanderbeyn avatar chris-fox avatar cosbyr avatar dbouwman avatar dependabot[bot] avatar drewdaemon avatar jgravois avatar jmhauck avatar miketschudi avatar mpayson avatar rweber-esri avatar sonofflynn89 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

solution.js's Issues

Manage Web Map with hosted duplicate feature layer

Web Map http://arcgis4localgov2.maps.arcgis.com/home/item.html?id=cbeb7b2f0ae14e75b44061c26f5d6eec has the same feature layer used for two operational layers, but one instance has an itemId and the other does not:

image

@chris-fox:

@MikeTschudi, As you have seen itemId is not a required property of an operational layer in the web map. Depending on how the layer is added to the map it may or may not have the itemId property set. In addition, non hosted services may not have an item id at all. The url is the only requirement. What I have done in my python logic is to check for a 'serviceItemId' property on the FeatureService, this will be on all hosted feature services and corresponds to the item id of the service in the Portal.

Add Support for Groups

Need to support templatizing and deploying groups. Specifically we are using them for Web Mapping Application group templates like Crowdsource Reporter and Crowdsource Manager and for Workforce projects.

Add Support swizzling of feature services in Pro Project Package type

In some cases we will be shipping hosted feature services with Pro Project Packages. We need to be able to clone the feature service and the Pro Project Package and swizzle the service references in the package. A Pro Project is a 7 zip containing a series of json and xml files. We need to be able to extract, modify and recompress so the resulting package references the new feature services in the user's organization.

Add the ability to reference a sub layer of a feature service item directly when templating

We need to reference the layer directly in the template as the ID of the layer may change when a user is allowed to browse to their own layer as an input to the deployment.

For example instead of referencing the url of a feature layer in a web map like this:

"{{33298a2612ba4899adc41180c435425f.url}}/1"

We should reference it like this:

"{{33298a2612ba4899adc41180c435425f.layer1.ur}}"

This is very similar to how we handle fields today i.e. {{33298a2612ba4899adc41180c435425.fieldInfos.layer1.fields}}

@jmhauck to investigate if we can just drop fieldInfos above and get to the fields like below:
{{33298a2612ba4899adc41180c435425.layer1.fields}}

This will allow us to consistently get and reference information about the layer. Other properties of the layer would include:

33298a2612ba4899adc41180c435425f.layer1.layerId - ID of the layer (e.x 0,1,2)
33298a2612ba4899adc41180c435425f.layer1.name - Name of the layer
33298a2612ba4899adc41180c435425f.layer1.itemId - Item ID of the feature service the layer belongs to

Reduce the amount of information persisted in deployed solution item data

@MikeTschudi, @jmhauck, Currently in a deployed solution we are still storing the full item details and data definition with the deployed solution. I think we should minimize this to the minimum required to support the solution contents tree. At this point it seems like all that is would be the templates array with a series of objects with an item id and a list of dependencies.

Thoughts?

Feature Service Object ID field is being created with a non-unique index

I have the same issue in my python code, but when I create the feature service using the templates in Online it is created successfully with a unique index. Having a unique index is important in some workflows, for example when appending data through the item details can fail if there is no unique field index.

We should work with the hosted feature service team to understand how we pass the field definition to ensure the object id is created with a unique index.

Add ability to swizzle feature services in Pro Project Package item type

@chris-fox:

Support swizzling of feature services in Pro Project Package type
In some cases we will be shipping hosted feature services with Pro Project Packages. We need to be able to clone the feature service and the Pro Project Package and swizzle the service references in the package. A Pro Project is a 7 zip containing a series of json and xml files. We need to be able to extract, modify and recompress so the resulting package references the new feature services in the user's organization.

Feature Service Naming Convention

@chris-fox:

Following the pattern in other apps (Survey123, Workforce) when we deploy a Solution we should first create the Solution item, from this we will get the item id of the Solution. This item id then should be added at the end of the feature service name to ensure it is unique in the organization:

ROWPermits_299c12aa9ba442418079603f5c39f8c3
ROWPermits_dashboard_299c12aa9ba442418079603f5c39f8c3
ROWPermits_locator_299c12aa9ba442418079603f5c39f8c3

After the service is created we should update the title of the item to match that of the original item defined in the template:

ROWPermits
ROWPermits_dashboard
ROWPermits_locator

The name will be used in the url of the service, but this is really the only place the user would see this quid, everywhere else they would see the nice item title.

If a service already has an item id quid in the name as defined in the template, we should swap it out for the new item id of the Solution.

Need to templatize Ops Dashboard dataset references

Operations Dashboard allows you to reference data sources outside the web map as standalone sources. We need to templatize these during the solution creation as well.

A datasource reference will look like below and can be found in the Widgets collections as well as the selectors within the Header or Left Panel.
"dataSource": {
"type": "featureServiceDataSource",
"itemId": "e6f6f748903e4528b004b7c2e4136073",
"layerId": 0,
"table": false
},

Below is the current python code showing how these datasources are found

The Election Results solution has an example where a datasource to a feature service is specified. We should only be templatizing featureServiceDataSources that have an itemId, i.e hosted.

In terms of listing the dependencies. I would like to see the feature service as a dependency of the dashboard only if it is not also a dependency of a web map also referenced in the dashboard. For example in Election Results the feature service is also used in one of the web maps, So I don't think we should list it as a dependency of both the dashboard and the web map.

        if 'widgets' in self.data:
            for widget in app_json['widgets']:
                if widget['type'] == 'mapWidget':
                    if 'itemId' in widget:
                        widget['itemId'] = clone_mapping['Item IDs'][widget['itemId']]
                elif "datasets" in widget:
                    for dataset in widget["datasets"]:
                        if "dataSource" in dataset and "itemId" in dataset["dataSource"]:
                            # in some cases the layer ids may have changed when cloning
                            # so we can use a mapping between the old and new to update it
                            for url, cloned_service in clone_mapping['Services'].items():
                                if cloned_service['id'] == clone_mapping['Item IDs'][dataset["dataSource"]["itemId"]]:
                                    # update the layer id
                                    dataset["dataSource"]["layerId"] = cloned_service['layer_id_mapping'][dataset["dataSource"]["layerId"]]
                            # update the item id
                            dataset["dataSource"]["itemId"] = clone_mapping['Item IDs'][dataset["dataSource"]["itemId"]]

        if "headerPanel" in app_json and "selectors" in app_json["headerPanel"]:
            for selector in app_json["headerPanel"]["selectors"]:
                if "datasets" in selector:
                    for dataset in selector["datasets"]:
                        if "dataSource" in dataset and "itemId" in dataset["dataSource"]:
                            # in some cases the layer ids may have changed when cloning
                            # so we can use a mapping between the old and new to update it
                            for url, cloned_service in clone_mapping['Services'].items():
                                if cloned_service['id'] == clone_mapping['Item IDs'][dataset["dataSource"]["itemId"]]:
                                    # update the layer id
                                    dataset["dataSource"]["layerId"] = cloned_service['layer_id_mapping'][dataset["dataSource"]["layerId"]]
                            # update the item id
                            dataset["dataSource"]["itemId"] = clone_mapping['Item IDs'][dataset["dataSource"]["itemId"]]

        if "leftPanel" in app_json and "selectors" in app_json["leftPanel"]:
            for selector in app_json["leftPanel"]["selectors"]:
                if "datasets" in selector:
                    for dataset in selector["datasets"]:
                        if "dataSource" in dataset and "itemId" in dataset["dataSource"]:
                            # in some cases the layer ids may have changed when cloning
                            # so we can use a mapping between the old and new to update it
                            for url, cloned_service in clone_mapping['Services'].items():
                                if cloned_service['id'] == clone_mapping['Item IDs'][dataset["dataSource"]["itemId"]]:
                                    # update the layer id
                                    dataset["dataSource"]["layerId"] = cloned_service['layer_id_mapping'][dataset["dataSource"]["layerId"]]
                            # update the item id
                            dataset["dataSource"]["itemId"] = clone_mapping['Item IDs'][dataset["dataSource"]["itemId"]]

Use org's default extent for item extents and feature service initial extent

When deploying a solution any new items and feature service/view's initial extent should be set to the default extent of the organization/portal.

When implementing this consider we may want to make this an optional parameter to keep the original extent during the deployment, but the default behavior should be to use the org's extent.

Templatize Feature Service item data

Similar to the web map, pop-up and other layer settings can be persisted with the feature service (and views) in the item data. We need carry this information over in the solution template and when deployed because when not explicitly defined in the web map, the feature layer pop-up info will be what is shown in the web map or apps.

You can test this using the ElectionGeography feature service delivered with the Election Outreach solution.

Ensure this can be used from Node and Browsers

This looks awesome! Judging by how popular the "Admin Tools for ArcGIS" are, this is clearly something we've needed for some time.

Anyhow - hopefully this ask is in line with your plans @MikeTschudi, but it would be great if this was build in a way that it can be npm install-ed for both browser apps and node apps.

Add Vector Tile Layer type (Authored w/ Vector Tile Style Editor)

We need to support deploying custom basemaps that are authored using the Vector Tile Style Editor. These items have the type "Vector Tile Service", but they are a unique subset of this item type in that they just store the definition of how the vector tiles are symbolized, not the actual tiles themselves.

This request is to support this specific kind of Vector Tile Services, not all as the api for creating a hosted Vector Tile Service is much more complicated and would require additional research.

The kind of Vector Tile Service that I would like to support in this issue will have the typeKeyword 'Vector Tile Style Editor". Here is an example of this item type in AGOL: 8001dcfd09584a8282084ee78f54b792. This item type has no data property, it just has a collection of resources that need to be included in the solution. There are no dependencies of this item type, as long as the resources are copied with the item, it will work as expected.

During creation I would like to look in web maps for this item type. It could be in the operationalLayers or more likely it will be in the "baseMap": { "baseMapLayers" : [] property. I would like during creation to loop over the baseMapLayers and if the layer has an "itemId" property, we check that itemId and see if it is a Vector Tile Service like described above. If it is we should templatize it and bring it into the solution item. We also then need to add variables for the itemId property and the "styleUrl" property of the basemapLayer. Below is a sample web map that you can test with. It has the same Vector Tile Service in the operationalLayers and the baseMap.

4e7652554b9f43bd9423e3b27b56d3dc

Folder Naming Convention

@chris-fox:

When creating a new folder with a deployment we should default the folder name to be the same as the Solution, i.e 'Manage Right of Way Activities'. If that folder already exists we should add a 1, 2, 3, etc. continuing to increment with each instance.

Manage Right of Way Activities
Manage Right of Way Activities 1
Manage Right of Way Activities 2

Add Web Mapping Application item with simple url reference

We have recently started delivering "Getting to Know" story maps with the solution as essentially the help for the Solution. We don't want to clone the story map, but rather are just delivering a Web Mapping Application with its url set to our story map in our try it live org. So this is essentially a really simple item with no data and a url reference.

Carry over editing settings/capabilities from Feature Service (and View) template

@chris-fox:

In the Manage Right of Way Activities solution there are several views that have different editor settings depending on the use case/user who would work with them. Some are intended for the public and should have editing disabled, some are internal and should allow users to add records, and some may have full editing permission. We need to carry these settings over when the solution is deployed.

Feature Layer View definition issues

Discovered a couple issues with the definition of views. To repro deploy 05ad40176eca46b28b6fc99bc55835c1

  1. Variables for viewDefinitionQuery and definitionQuery are not being replaced:
    "viewDefinitionQuery" : "({{02d58f8ad9fa4cc497f95a319af14b0d.fieldInfos.layer0.fields.funded}} = 'Yes') AND ({{02d58f8ad9fa4cc497f95a319af14b0d.fieldInfos.layer0.fields.projtype}} = 'Water Distribution') AND ({{02d58f8ad9fa4cc497f95a319af14b0d.fieldInfos.layer0.fields.projstatus}} = 'Board Authorized') AND ({{02d58f8ad9fa4cc497f95a319af14b0d.fieldInfos.layer0.fields.projphase}} \u003c\u003e 'Complete')",
    "definitionQuery" : "({{02d58f8ad9fa4cc497f95a319af14b0d.fieldInfos.layer0.fields.funded}} = 'Yes') AND ({{02d58f8ad9fa4cc497f95a319af14b0d.fieldInfos.layer0.fields.projtype}} = 'Water Distribution') AND ({{02d58f8ad9fa4cc497f95a319af14b0d.fieldInfos.layer0.fields.projstatus}} = 'Board Authorized') AND ({{02d58f8ad9fa4cc497f95a319af14b0d.fieldInfos.layer0.fields.projphase}} \u003c\u003e 'Complete')"

  2. It is possible for a view to have a different domain then the source service. In the example see the projtype field. In these scenarios we need to update the definition of the view to pass the correct domain.

Important, we don't want to do this for every field, we only should do this when the domain is different from the source field. If you update the domain definition for every field, it breaks the connection between the original service domain and the view domain and means if you update the source it won't update on the view.

This is a bug in my current python code because the majority of time the domains will be the same and users will want to update the domain on the source and have it update the view automatically.

Add Form type

@chris-fox:

@MikeTschudi, for reference, you can find and set the associated feature service of a Survey123 form by querying or creating a relationship of type Survey2Service to the feature service.

https://developers.arcgis.com/rest/users-groups-and-items/relationship-types.htm

@MikeTschudi, @jmhauck, for this issue I think for the first release we can support the simplest case. the form itself is just a zip, the form item has a Survey2Service relationship with its associated feature service. We use the relationship to discover the service (dependency). Cloning the survey is just copying the form and adding a new Survey2Service relationship to the new feature service.

There are more complicated scenarios, but I think we can control for this in the Solutions we author for the first release.

Failure creating joined view in Elections Performance Dashboard

To Repro:

  1. Deploy the Election Performance Dashboard
  2. View the created items, notice there is an item called VoterSatisfactionSurvey_locations_{GUID}.

This item should be renamed to VoterSatisfactionSurvey_locations, but if you inspect the layer it is an empty view. It looks like at some point there is a failure attempting to define the layer in the view and as a result the item isn't renamed properly as well.

Web AppBuilder Apps not swizzling web map

To Repro:

  1. Deploy the Election Outreach solution
  2. Edit the Election Polling Places app
  3. Notice on the map tab the web map is still pointing to the original in deployment org.

image

Web AppBuilder app logo displaying as broken after deployment

To Repro:

  1. Deploy the Election Outreach solution
  2. Edit the Election Polling Places app
  3. Notice the logo is broken in the upper left corner of the app.

Web AppBuilder stores the logo as an app resource when it is uploaded, This is referenced in the item's data from a logo property. It looks like the base url needs to be update to the new org and the itemId is not being properly replaced.

"logo": "https://localdeployment.maps.arcgis.com/sharing/rest/content/items/${itemId}/resources/inConfig/8768163780762088.png",

Need to resolve organization full url to avoid issues in certain applications

For app items the item url is being templatizing as:

{{organization.portalBaseUrl}}/apps/CrowdsourcePolling/index.html?appid={{e3e02b6094144ea29741e33e4c7277d8.itemId}}

When I deploy the item it becomes something like:

https://www.arcgis.com/apps/CrowdsourcePolling/index.html?appid=8b9585982bd44c419757bbe2c9a8004c

This is causing issues in some applications when I attempt to configure the application. For example in Crowdsource Polling.

The app url actually needs to be the org urls name:

https://arcgis4localgov2.maps.arcgis.com/apps/CrowdsourcePolling/index.html?appid=8b9585982bd44c419757bbe2c9a8004c

This is the logic I use in python to construct the org url and seems to have worked so far in both online and portal.

scheme = 'http'
if 'allSSL' in properties and properties['allSSL']:
    scheme = 'https'
if 'urlKey' in properties and 'customBaseUrl' in properties:
    org_url = "{0}://{1}.{2}/".format(scheme, properties['urlKey'], properties['customBaseUrl'])
else:
    url = urlparse(org_url)
    org_url = org_url.replace(url.scheme, scheme)
return org_url.rstrip('/') + '/'

Before you work on this one, let's decide if we should use a different variable for this or if we want to continue to use the portalBaseUrl variable

Add Hosted Feature Layer Views type

@chris-fox:

In the Manage Right of Way Activities, there are several views of the ROWPermits feature service (ROWPermits_dashboard, ROWPermits_manager, etc.). When authoring the Solution the feature service should be seen as a dependency of the view and the when deployed the views should be recreated from the new ROWPermits layer.

The ROWPermits solution has a series of 'simple' views where a view is constructed from a single source. Hosted feature layer views can also be created from a join and we also need to support these types of views. The Citizen Problem Reporter Dashboard uses a joined view and can be used to test this process.

CitizenProblems_surveyresults
CitizenProblems

To reconstruct these views you will need access to the admin info of the service, so we should store this information when authoring the solution. This is a big driver for the user being the owner of the item or an admin in the org to author a Solution item template.

@jmhauck did a lot of work in the python library for cloning feature layer views and should be able to help with some of the associated challenges.

Election Management solution failing to create

Using the Create application I am logging into the Local Gov Deployment org and attempting to create a solution for Election Management. It gets about 90% through the creation and then stops. Looking at the debugger I don't see any error reported in the Console or any failed requests. Not sure what is causing this issue, but something unique about this one is it has a Workforce Project.

http://ec2-18-219-57-96.us-east-2.compute.amazonaws.com/create/#

Failing to create Feature Service (Park Locator)

Attempt to deploy Park Locator (3b81c7134294433baa8b615b30845920), watching in console I am seeing an error during the createService call. The same service is deploying using the python code, so I am not sure what in the createService call the server doesn't like.

Solution Json Structure...

I like the use of the ids as keys on the items object, and the use of the dependencies array. I'll look into the lift to do that in Hub as well...

I think we can transform this structure into what the hub expects w/o much work, but if it's all the same to you, could we change itemSection and dataSection to be just item and data?

Of Gorilla's, Bananas and the Jungle: Thoughts on Reuse and Functional Programming

Just some thoughts on how this can be constructed in a little differently, but with large ramifications for re-use and optimization.

@MikeTschudi - If you are willing to give this a go, @jgravois and I are more than willing to help add the various modules into ArcGIS Rest JS, as well as help with "zen of functionalization" questions, and ideas around how to construct the "orchestrator" code that would remain in this repo.

On to our story... let's start w/ a famous quote about programming and reusability...


I think the lack of reusability comes in object-oriented languages, not functional languages. Because the problem with object-oriented languages is they’ve got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.
If you have referentially transparent code, if you have pure functions — all the data comes in its input arguments and everything goes out and leave no state behind — it’s incredibly reusable.

-- Peter Seibel in Coders at Work


The ArcGIS Rest JS and Hub.js libraries have taken this to heart, and with few exceptions, those libraries are simply collections of functions. While technically not "pure functions" because they communicate with the Portal API, aside from that we follow the tenets of writing functions who's output is directly tied to their inputs - there is no "shared state" involved.

What's great about this, is that from the perspective of a developer consuming the modules, they just import the functions they need.

So - let's suppose we build a module for working with feature services - say feature-service-admin, and we start with two main functions: serializeService and constructService

The serialize function looks at an existing service, and returns a hash that can be used as a template to construct copies of the service. And the construct takes one of those hashes and constructs the Item.

And the arcgis-clone-js module has some class (or just more functions) that "orchestrate" the calls to those functions. This pattern keeps the "stateful" part of the solution (the orchestrator) as small as possible , while also allowing the functions to be composed into other solutions.

What's more, then I can come along and add some function like addFieldToService, and removeFieldFromService to our feature-service-admin module.

All cool... what's great is that my adding those function, does not change the size of your built application. I could add 200 more functions in there... and only apps that import those functions will be impacted. This is possible because modern build tools like webpack or rollup can optimize the packaged code by simply dropping all functions that are not directly import-ed (or used by the imports).

In contrast, using an OOP inheritance hierarchy, if app just needs is one function on a one class... aka the "banana"... well... we know where that ends up.

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.