Skip to content

Spring Feature: Offline Netgraph Viewing #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed

Conversation

daveseah
Copy link
Collaborator

@daveseah daveseah commented Jan 9, 2019

PLACEHOLDER

This pull request closes #39 "Offline Viewing Mode", which implements the technical needs to view and interacting with the netgraph in READ ONLY mode when the NetCreate AppServer is offline. This commit handles two cases when the server is offline:

  1. The server shuts down: the netgraph is still usable by client browsers, and clients cache the data to local storage so...
  2. When a client browser accesses the URL last used, the cached data is restored.

TESTING

THIS FEATURE IS NOT COMPLETE as I'll need Ben to add additional the additional UI hooks to reflect "read only" mode.

START TESTING PROCEDURE (WIP)

  • Start NetCreate npm run dev from Terminal.
  • Connect to the NetCreate AppServer with Chrome. Open the Javascript Console (CMD-OPT-J). Note the "application cache" messages in the console indicating what files are cached.
  • Login to NetCreate using a valid access token (e.g. MEEP-ONE-9V3). Manipulate the netgraph data to see that it works as expected

TEST OFFLINE DATA CACHING

  • in the Terminal window running NetCreate, CTRL-C to stop the server
  • in the Chrome Javascript console, look for messages indicating that data is cached
  • in the Terminal window, restart NetCreate and reconnect, and see that the application works normally and that the data is as expected (e.g. nothing was lost)

TEST OFFLINE VIEW FROM CACHE

  • Copy the URL from the Chrome address bar used in the previous test. It looks something like https://localhost/#/edit/MEEP-ONE-9V3.
  • In the Terminal window, CTRL-C again to stop the server
  • close Chrome, then reopen it.
  • enter the exact URL you copied a few steps ago
  • check that the browser loads the last view with cached data
  • confirm that the NetCreate AppServer isn't running
  • try reloading the page
  • try visiting another URL

KNOWN ISSUES

  • The AppCache mechanism relies on a manifest file called netcreate.cache that's stored in the app/assets directory and copied to /public, and this makes it difficult to debug code changes with live reload since the OLD scripts are cached. A workaround is in progress.
  • NOTE: All template files have to be listed in the netcreate.cache manifest. Currently only alexander.json is listed
  • There is no UI indicating that NetCreate is in an offline state
  • The EDGE lines are not being initialized correctly in the netgraph when loading from cache

@kalanicraig
Copy link
Collaborator

kalanicraig commented Jan 9, 2019 via email

# Conflicts:
#	build/app/unisys/common-netmessage-class.js
#	build/app/view/netcreate/nc-logic.js
@daveseah
Copy link
Collaborator Author

@kalanicraig Ooops, I had lost that target when reviewing the change notes. I will have to rework the feature.

@daveseah
Copy link
Collaborator Author

daveseah commented Jan 10, 2019

@kalanicraig Ok, I think I see where we are deviating! From notes:

Finish class, instructor triggers a save, have a file (e.g. a self-contained HTML file with current dataset) that they can share with students so students can view (and not edit) the network (after the server disappears being shut off).

I interpreted this as meaning "we want students can view the network data after the server disappears. I assumed that this was the "take away your laptop, access the data later" scenario we talked about, where "the data is still working in the laptop after the server goes away, so maybe it's easy to just retain it". My current implementation does this.

I had missed the implications you outlined in your comment: We’ll have students who didn’t have laptops (or we’ll have directed students to only use 1 laptop for every 3 students). I think I remember you talking about being able to distribute NetCreate stand-alone apps (but thought it was a future thing)

I think I can probably get something to work; thankfully the work I did implementing the above feature is related to being able to make a stand-alone package! :D Will check back later.

Thanks for staying on top of the pull requests reports, @kalanicraig !

@kalanicraig
Copy link
Collaborator

kalanicraig commented Jan 10, 2019 via email

@daveseah
Copy link
Collaborator Author

Also @kalanicraig @jdanish I've asked for clarification on the offline data logging requirement (at least this is what I think it is) here on the next steps doc

@kalanicraig
Copy link
Collaborator

kalanicraig commented Jan 10, 2019 via email

@jdanish
Copy link
Collaborator

jdanish commented Jan 10, 2019 via email

@daveseah
Copy link
Collaborator Author

@kalanicraig @jdanish @benloh

Ok, here is what I am thinking of implementing...double-check please!

The "OFFLINE PACKAGE" is:

  • A HTML file that a student can double-click after downloading and unpacking a ZIP archive.
  • The ZIP archive is generated at the end of a classroom session on the AppServer laptop (the laptop that has the NetCreate development environment installed) by executing a command like npm run makepackage after the server has been stopped.
  • NOTE: The ZIP archive will contain multiple files (e.g. combined scripts, css), so it would be distributed as a zip archive that is unpacked on a computer. I'm thinking the HTML file will be called something like RunNetCreate.html

CANVAS LMS and LOGGING SUPPORT for OFFLINE PACKAGE

  • To support Canvas, the RunNetCreate.html file will have a script link that magically logs the data you need. I don't have any information on this at all. If you are planning on doing surgery on the standalone file yourself I won't worry about it for the first pass.
  • I'm guessing that logging will be limited to "the file has been viewed on such-and-such a date by anonymous user" since we have no integration information for Canvas that I know of.
  • The OFFLINE PACKAGE does not export any other data.

@jdanish
Copy link
Collaborator

jdanish commented Jan 10, 2019 via email

@jdanish
Copy link
Collaborator

jdanish commented Jan 10, 2019 via email

@daveseah
Copy link
Collaborator Author

daveseah commented Jan 10, 2019

@jdanish

Thanks for the clarification! Knowing that you will deploy on a web server somewhere, as opposed to providing the files on an FTP server, is very helpful in picking a shorter path to feature delivery!

SPECIFICATION 1.1

The "OFFLINE PACKAGE" is a "snapshot" of NetCreate data that is deployed on a web page by IU. This is a stand-alone READ-ONLY version of the NetCreate webapp, provided as a ZIP archive.

  • The ZIP archive is generated at the end of a classroom session on the AppServer laptop (the laptop that has the NetCreate development environment installed) by executing a command like npm run makepackage after the server has been stopped.
  • The ZIP archive is unpacked to a directory, which is uploaded to a webserver by IU. The HTML file will be called index.html
  • CANVAS LMS SUPPORT is inserted into index.html by IU manually.
  • The OFFLINE PACKAGE does not export ANY other data.

@jdanish
Copy link
Collaborator

jdanish commented Jan 10, 2019 via email

@daveseah
Copy link
Collaborator Author

I'm writing a new pull request that reflects the updated functionality. Closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants