Closed tjones0808 closed 6 years ago
@tjones0808 Can you paste the console.log here from an offline restart? Lets see if there are any errors.
I see a number of errors. You can ignore the ones stating ERR_NAME_NOT_RESOLVED
, but any other errors such as dojo.io.script error Error(…)
or XMLHttpRequest cannot load
indicate there is a problem.
The following error tells me you'll need a proxy or you'll need to set up CORS on the gis.aoscloud.net server:
XMLHttpRequest cannot load https://gis.aoscloud.net/gissandbox/rest/info?f=json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://localhost:44300' is therefore not allowed access.
Recommendation 2 is to fix the HTTPS Mixed Content error and host tiny-image.png
on your own server.
Mixed Content: The page at 'https://localhost:44300/viewer/index.html' was loaded over HTTPS, but requested an insecure image 'http://esri.github.io/offline-editor-js/tiny-image.png?_=152282965'. This content should also be served over HTTPS.
Oh wait, I may have misunderstood. You are talking about when the app comes back up after an offline restart.
Is your Application Cache set up correctly?
Can you paste a screenshot of your console log when the application first loads?
This may be related to https://github.com/Esri/offline-editor-js/issues/434. In general, the Editor Widget isn't supported for this library since it's not compliant with full offline requirements. That's why the appcache-features.html sample uses a custom-built editor widget that is fully offline capable. I'll dig a bit deeper and see what I can find.
Just to clarify the Editor Widget is supported by OfflineEditBasic
and not supported by OfflineEditAdvanced
when using it for full offline. If there is something in OfflineEditAdvanced I can tweak then I'll certainly do that. I'll let you know.
Ok, I didn't know that because in your documentation that is not specified. It says for OfflineEditBasic: "This library is optimized for Partial Offline Support ONLY".
Where does it say it supports the Editor Widget?
I'll add a TODO to clarify that in the Limitations section of the README. I've been tackling Editor Widget issues on a case-by-case issue. Unfortunately, since most of the problems I've seen involved proprietary code and/or were not documented here on github as an issue, it's not clear what the exact nature of the issues were or any potential workarounds.
@tjones0808 Have you tried to fix the obvious code errors? For example, https://gis.aoscloud.net/gissandbox/rest/info?f=json
needs to be added to your Application Cache:
XMLHttpRequest cannot load https://gis.aoscloud.net/gissandbox/rest/info?f=json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://localhost:44300' is therefore not allowed access.
Yes I have. That url IS added to the appcache and I DO have a proxy setup. For some reason just that URL gets blocked. I was able to workaround the problem by changing how I configured the Editor Widget settings when recreating the featureLayers offline. It seems when I recreate my layers offline they don't get recreated exactly the same so I have to do some manual tweaking. Now my problem is when restarting offline, the editor will open up and edit any feature...but it is not calling apply edits anymore. Will keep chugging along until I have a full fix.
Just a quick addition here. We have been working with the library for some time. Those using it will naturally turn to the Editor Widget first. The widget is a black box at the minute (since not open sourced). We asked for it to be open sourced in ideas.esri.com last year. Our focus is full offline not partial. We have extended one of Andy's samples so we can test (in a simple environment) full offline using the Editor Widget. We think we have isolated an issue #434 whether this is a library issue or Editor Widget issue we are unsure. Regardless, we would like to find if the Editor Widget is or is not causing problems in full offline mode, and update the docs with what is found.
On 6 January 2016 at 07:22, tjones0808 notifications@github.com wrote:
Yes I have. That url IS added to the appcache and I DO have a proxy setup. For some reason just that URL gets blocked. I was able to workaround the problem by changing how I configured the Editor Widget settings when recreating the featureLayers offline. It seems when I recreate my layers offline they don't get recreated exactly the same so I have to do some manual tweaking. Now my problem is when restarting offline, the editor will open up and edit any feature...but it is not calling apply edits anymore. Will keep chugging along until I have a full fix.
— Reply to this email directly or view it on GitHub https://github.com/Esri/offline-editor-js/issues/437#issuecomment-169334355 .
Matt Sheehan | WebMapSolutions
Mobile: 801-733-0723 | Email: matt@webmapsolutions.com Email%3Amatt@webmapsolutions.com
The editor widget IS causing problems for full offline, when the featureLayers are reconstituted the editor widget doesn't play well with them. When we go to an offline state from an online state, the editor widget works perfectly and saves all edits and re-syncs them no problem. I am looking more into the specific problem today of why starting in an offline state the editor widget doesn't cooperate, but I've had to make changes to the way the editor widget creates and updates features and how it calls the applyEdits function.
It sounds like we need a generic custom editor widget added to the library (or at least extended version of Andy's sample). Most who are interested in using the library will we think want full offline capabilities, and naturally turn to the Editor Widget. If that is not an option it will put many off going further with the library.
On 6 January 2016 at 08:11, tjones0808 notifications@github.com wrote:
The editor widget IS causing problems for full offline, when the featureLayers are reconstituted the editor widget doesn't play well with them. When we go to an offline state from an online state, the editor widget works perfectly and saves all edits and re-syncs them no problem. I am looking more into the specific problem today of why starting in an offline state the editor widget doesn't cooperate, but I've had to make changes to the way the editor widget creates and updates features and how it calls the applyEdits function.
— Reply to this email directly or view it on GitHub https://github.com/Esri/offline-editor-js/issues/437#issuecomment-169348890 .
Matt Sheehan | WebMapSolutions
Mobile: 801-733-0723 | Email: matt@webmapsolutions.com Email%3Amatt@webmapsolutions.com
I agree. I will post what I find when I have it fully working.
Excellent as will I from the testing we are doing.
On 6 January 2016 at 08:31, tjones0808 notifications@github.com wrote:
I agree. I will post what I find when I have it fully working.
— Reply to this email directly or view it on GitHub https://github.com/Esri/offline-editor-js/issues/437#issuecomment-169358783 .
Matt Sheehan | WebMapSolutions
Mobile: 801-733-0723 | Email: matt@webmapsolutions.com Email%3Amatt@webmapsolutions.com
Thanks for the input and the effort, it's much appreciated!
FWIW, the Editor Widget (JS API v3.x) is great for laptops and tablets, but doesn't work well on smartphones. There are folks who have built custom, focused editing functionality that fits well into a mobile, responsive application. I've also referred a number of folks to this mobile attribute editing sample.
That is very cool Andy. If we could roll a sample into the library (maybe using this code as a base) it would be a great jumpstart for others.
On 6 January 2016 at 08:49, Andy notifications@github.com wrote:
Thanks for the input and the effort, it's much appreciated!
FWIW, the Editor Widget (JS API v3.x) is great for laptops and tablets, but doesn't work well on smartphones. There are folks who have built custom, focused editing functionality that fits well into a mobile, responsive application. I've also referred a number of folks to this mobile attribute editing https://developers.arcgis.com/javascript/jssamples/mobile_citizenrequest.html sample.
— Reply to this email directly or view it on GitHub https://github.com/Esri/offline-editor-js/issues/437#issuecomment-169364159 .
Matt Sheehan | WebMapSolutions
Mobile: 801-733-0723 | Email: matt@webmapsolutions.com Email%3Amatt@webmapsolutions.com
@tjones0808 @webmapsolutions Another note, I've long suspect that theEditor Widget issue is related to the FeatureLayer.toJson() functionality. The OfflineEditAdvanced library uses that when converting the current feature layer into a featureCollection for storage in the database.
It's a fact that the toJson()
method does NOT do a 1:1 conversion and that's caused other issues, such as #280, when reconstituting feature layers. I wouldn't be surprised if there is something missing that's important to the Editor Widget. If we can narrow that piece down it might be something that can be programmatically added to the library.
Yes, I have to manually correct the featureLayer.id and featureLayer._outFields to even get the editor to open up and edit the correct attributes. Trying to figure out why now it wont call applyEdits after offline restart.
Take a look at this sample it might help:
http://webmapsolutions.com/offline-editor-v3/samples/appcache-twofeatureslayer-edit-wms.html
It works end to end for editing using Editor Widget in full offline mode. Applyedits functions correctly. The issue we are finding is rendering a new point (added in full offline) after a full offline reload.
On 6 January 2016 at 09:11, tjones0808 notifications@github.com wrote:
Yes, I have to manually correct the featureLayer.id and featureLayer._outFields to even get the editor to open up and edit the correct attributes. Trying to figure out why now it wont call applyEdits after offline restart.
— Reply to this email directly or view it on GitHub https://github.com/Esri/offline-editor-js/issues/437#issuecomment-169372532 .
Matt Sheehan | WebMapSolutions
Mobile: 801-733-0723 | Email: matt@webmapsolutions.com Email%3Amatt@webmapsolutions.com
@webmapsolutions your having the same problem I did. When you restart offline your editor doesn't let you edit the attributes. It pops up and seems like it works... but the attributes dont show up.
Yep, I talked to @webmapsolutions earlier today. I think the consensus now is that FeatureLayer.toJson()
is, in fact, missing certain properties. Once we've identified all of them, we'll need to verify "if" they can be stringified or not.
Just thinking out loud: If it can't be stringified we can then attempt to store them as their native ArcGIS JS API objects. IndexedDB uses a structured clone algorithm to serialize complex JavaScript objects. The caveat is it the algorithm sometimes balks if it detects recursion or deep nested functions. Mozilla does offer sample code showing how to do a deep copy that we could always try if we run into problems.
@tjones0808 @webmapsolutions please review this and let me know your thoughts?
Conclusion: the default Editor Widget will not work for offline restarts.
I took a deep look into why the graphics aren't showing up after an offline restart. The Editor Widget uses map.graphics instead of the FeatureLayer.graphics. OfflineEditAdvanced extends FeatureLayer and uses FeatureLayer.graphics. So, anything stored in map.graphics gets blow away during the browser restart process, the new feature you created won't get displayed.
The Editor Widget also does not provide any hooks into public events were you might be able to copy new features from the widget to FeatureLayer.graphics.
Recommended approach: Build custom, focused editing functionality that applies ADD operations directly to FeatureLayer.graphics.
The Editor Widget is a one-size-fits-all approach. It's a swiss army knife of editing so it wouldn't make any sense to reproduce all of its functionality for the purposes of this repo.
As I mentioned above, the mobile attribute editor sample seems like it will fit the bill for this. When offline, you'd need to make sure any new graphics were added to FeatureLayer.graphics before calling FeatureLayer.applyEdits().
Option A: I could build a small sample demonstrating how to do an ADD feature. This is the most obvious solution.
Option B: I could create a heavily modified and redacted version of the mobile attribute editor sample that fits the purposes of this repo. That would take a while.
Option C:??
Great work Andy. The mystery revealed. Having a sample custom editor included in the library, I think would be huge particularly as the library gets more attention this year from the wider community (which it will given the increasing realisation of the importance of offline). That means B above. Given your workload Andy are we talking late Spring here? Just wondering how we might be able to help (divide and conquer)?
On 8 January 2016 at 09:59, Andy notifications@github.com wrote:
@tjones0808 https://github.com/tjones0808 @webmapsolutions https://github.com/webmapsolutions please review this and let me know your thoughts?
Conclusion: the default Editor Widget will not work for offline restarts.
I took a deep look into why the graphics aren't showing up after an offline restart. The Editor Widget uses map.graphics instead of the FeatureLayer.graphics. OfflineEditAdvanced extends FeatureLayer and uses FeatureLayer.graphics. So, anything stored in map.graphics gets blow away during the browser restart process, the new feature you created won't get displayed.
The Editor Widget also does not provide any hooks into public events were you might be able to copy new features from the widget to FeatureLayer.graphics.
Recommended approach: Build custom, focused editing functionality that applies ADD operations directly to FeatureLayer.graphics.
The Editor Widget is a one-size-fits-all approach. It's a swiss army knife of editing so it wouldn't make any sense to reproduce all of its functionality for the purposes of this repo.
As I mentioned above, the mobile attribute editor https://developers.arcgis.com/javascript/jssamples/mobile_citizenrequest.html sample seems like it will fit the bill for this. When offline, you'd need to make sure any new graphics were added to FeatureLayer.graphics before calling FeatureLayer.applyEdits().
Option A: I could build a small sample demonstrating how to do an ADD feature. This is the most obvious solution.
Option B: I could create a heavily modified and redacted version of the mobile attribute editor sample that fits the purposes of this repo. That would take a while.
Option C:??
— Reply to this email directly or view it on GitHub https://github.com/Esri/offline-editor-js/issues/437#issuecomment-170055190 .
Matt Sheehan | WebMapSolutions
Mobile: 801-733-0723 | Email: matt@webmapsolutions.com Email%3Amatt@webmapsolutions.com
Thanks. I'll take a close(r) look at the sample today and take a first stab at outlining the TODO tasks. That will give me a much better feel for the work involved. Sound cool?
Sounds great Andy. Let us know where/if we can help with some of these tasks. Thx
On 8 January 2016 at 10:42, Andy notifications@github.com wrote:
Thanks. I'll take a close(r) look at the sample today and take a first stab at outline the TODO tasks. That will give me a much better feel for the work involved. Sound cool?
— Reply to this email directly or view it on GitHub https://github.com/Esri/offline-editor-js/issues/437#issuecomment-170070044 .
Matt Sheehan | WebMapSolutions
Mobile: 801-733-0723 | Email: matt@webmapsolutions.com Email%3Amatt@webmapsolutions.com
Will do. I'll post the TODO list.
Here's the TODOs for the mobile editor sample. Next week I'll create a branch on my own repo and share that. Once it's up we can start chipping away at it.
Because it's a small project, we'll need to be careful to not step on each others work. My recommendation will be that we post comments directly in the branch's commit page to ask questions and for you to verify before working on a particular item.
@webmapsolutions @tjones0808 here's the working branch for the sample-in-progress.
The new sample is currently called appcache-features-edit. If you are looking to tackle one of the TODOs above or something I missed, just let me know beforehand. That way we can avoid duplication of effort.
I'll be addressing number 3 and 4 today.
Forgot to mention: please add comments related to the sample app directly in-line to the 3.1 branch. That way we can focus the message traffic and not bombard everyone else.
Sounds good. Thanks Andy.
On 11 January 2016 at 12:12, Andy notifications@github.com wrote:
Forgot to mention: please add comments related to the sample app directly in-line to the 3.1 branch. That way we can focus the message traffic and not bombard everyone else.
— Reply to this email directly or view it on GitHub https://github.com/Esri/offline-editor-js/issues/437#issuecomment-170656416 .
Matt Sheehan | WebMapSolutions
Mobile: 801-733-0723 | Email: matt@webmapsolutions.com Email%3Amatt@webmapsolutions.com
@tjones0808 https://github.com/tjones0808 A quick note here. Our work is focused around offline enabling Universal Map Viewer. We have gone a long way down this path. Looking at the code posted it looks like you are attempting something similar. Happy to compare notes.
On 8 January 2016 at 09:59, Andy notifications@github.com wrote:
@tjones0808 https://github.com/tjones0808 @webmapsolutions https://github.com/webmapsolutions please review this and let me know your thoughts?
Conclusion: the default Editor Widget will not work for offline restarts.
I took a deep look into why the graphics aren't showing up after an offline restart. The Editor Widget uses map.graphics instead of the FeatureLayer.graphics. OfflineEditAdvanced extends FeatureLayer and uses FeatureLayer.graphics. So, anything stored in map.graphics gets blow away during the browser restart process, the new feature you created won't get displayed.
The Editor Widget also does not provide any hooks into public events were you might be able to copy new features from the widget to FeatureLayer.graphics.
Recommended approach: Build custom, focused editing functionality that applies ADD operations directly to FeatureLayer.graphics.
The Editor Widget is a one-size-fits-all approach. It's a swiss army knife of editing so it wouldn't make any sense to reproduce all of its functionality for the purposes of this repo.
As I mentioned above, the mobile attribute editor https://developers.arcgis.com/javascript/jssamples/mobile_citizenrequest.html sample seems like it will fit the bill for this. When offline, you'd need to make sure any new graphics were added to FeatureLayer.graphics before calling FeatureLayer.applyEdits().
Option A: I could build a small sample demonstrating how to do an ADD feature. This is the most obvious solution.
Option B: I could create a heavily modified and redacted version of the mobile attribute editor sample that fits the purposes of this repo. That would take a while.
Option C:??
— Reply to this email directly or view it on GitHub https://github.com/Esri/offline-editor-js/issues/437#issuecomment-170055190 .
Matt Sheehan | WebMapSolutions
Mobile: 801-733-0723 | Email: matt@webmapsolutions.com Email%3Amatt@webmapsolutions.com
@tjones0808 https://github.com/tjones0808 sorry my last entry should have read Configurable Map Viewer.
On 14 January 2016 at 12:00, Matt Sheehan matt@webmapsolutions.com wrote:
@tjones0808 https://github.com/tjones0808 A quick note here. Our work is focused around offline enabling Universal Map Viewer. We have gone a long way down this path. Looking at the code posted it looks like you are attempting something similar. Happy to compare notes.
On 8 January 2016 at 09:59, Andy notifications@github.com wrote:
@tjones0808 https://github.com/tjones0808 @webmapsolutions https://github.com/webmapsolutions please review this and let me know your thoughts?
Conclusion: the default Editor Widget will not work for offline restarts.
I took a deep look into why the graphics aren't showing up after an offline restart. The Editor Widget uses map.graphics instead of the FeatureLayer.graphics. OfflineEditAdvanced extends FeatureLayer and uses FeatureLayer.graphics. So, anything stored in map.graphics gets blow away during the browser restart process, the new feature you created won't get displayed.
The Editor Widget also does not provide any hooks into public events were you might be able to copy new features from the widget to FeatureLayer.graphics.
Recommended approach: Build custom, focused editing functionality that applies ADD operations directly to FeatureLayer.graphics.
The Editor Widget is a one-size-fits-all approach. It's a swiss army knife of editing so it wouldn't make any sense to reproduce all of its functionality for the purposes of this repo.
As I mentioned above, the mobile attribute editor https://developers.arcgis.com/javascript/jssamples/mobile_citizenrequest.html sample seems like it will fit the bill for this. When offline, you'd need to make sure any new graphics were added to FeatureLayer.graphics before calling FeatureLayer.applyEdits().
Option A: I could build a small sample demonstrating how to do an ADD feature. This is the most obvious solution.
Option B: I could create a heavily modified and redacted version of the mobile attribute editor sample that fits the purposes of this repo. That would take a while.
Option C:??
— Reply to this email directly or view it on GitHub https://github.com/Esri/offline-editor-js/issues/437#issuecomment-170055190 .
Matt Sheehan | WebMapSolutions
Mobile: 801-733-0723 | Email: matt@webmapsolutions.com Email%3Amatt@webmapsolutions.com
Matt Sheehan | WebMapSolutions
Mobile: 801-733-0723 | Email: matt@webmapsolutions.com Email%3Amatt@webmapsolutions.com
hey thanks @webmapsolutions , i was consulting for a company and they halted the project on Monday. As soon as it starts back up I will continue work on the offline editor. Really appreciate the help though!
Closing.
I have implemented the offline functionality with no problems when using the partial editing offline solutions. I can go offline cut all internet make edits, come back online and everything works fine. The problems arise when restarting the browser. For some reason it seems the extending isn't working, when trying to make any edits, nothing happens. I see an attempting progress bar on the editor widget but then it just quits
Code that inits layers: