To pass parameters to the embedded CODAP and Sage instances prefix the parameter with either codap:
or sage:
. The prefix will be stripped from the parameter and placed into the correct url location.
Examples:
To hide the inspector panel in Sage use:
?sage:hide=inspectorPanel
To set the guide index in CODAP use:
?codap:guideIndex=1
- Capture the JSON and then save it as a file, eg
sample.json
. - Upload
sample.json
to thesagemodeler-examples/files
folder in the Concord cc-project-resources S3 bucket (https://console.aws.amazon.com/s3/buckets/cc-project-resources/sagemodeler-examples/files/?region=us-east-1) - Download the
index.json
file fromsagemodeler-examples
folder on S3 and add thesample.json
file to the list of files. NOTE: the ordering of the files is preserved when showing the examples in the dialog. - Upload the updated
index.json
file tosagemodeler-examples
on S3 - Reload
https://sagemodeler.concord.org
and verify that the newsample.json
example is available in the File/Open dialog.
Optional (to keep the examples under version control):
- Copy
sample.json
to thesrc/assets/examples/files
folder andindex.json
to thesrc/assets/examples
folder. - Create a pull request with the changes
- Clone this repo and
cd
into it - Run
npm install
to pull dependencies - Run
npm start
to run the dev proxy and server and open your browser to the server in dev mode. NOTE: you may need to manually refresh your browser after webpack is done building the code depending on how each task runs as each tasks runs in parallel.
For local development it is assumed you have the following three additional repos checked out as sibling repos: codap, building-models and cloud-file-manager. In dev mode the iframe points to the dev proxy which proxies requests to the sibling repos based on the first folder in the request and if no match is found proxies to webpack-dev-server. This allows us to serve this app, CODAP, Sage and CFM from the same domain to enable cross-frame communication.
In production mode CloudFront provides the proxying.
To enable faster local development enableLocalStorage
can be added to the query string. This will add
the local storage provider to the list of open/save providers. For example:
https://localhost:10000/app?enableLocalStorage
If you want to build a local version run npm build
, it will create the files in the dist
folder.
You do not need to build to deploy the code, that is automatic. See more info in the Deployment section below.
This project shares a POEditor project with https://github.com/concord-consortium/building-models. Please use https://github.com/concord-consortium/building-models repository to add a new strings, update strings in POEditor using provided scripts, and finally copy over all the JSON files from building-models. Note that you should push the same changes to both repositories, so they stay in sync.
To add a new language:
- Copy over the language file from
building-models
. - Add the new language file in the
languageFiles
map insrc/code/utils/translate.ts
- Make sure if you are using Visual Studio Code that you use the workspace version of TypeScript.
To ensure that you are open a TypeScript file in VSC and then click on the version number next to
TypeScript React
in the status bar and select 'Use Workspace Version' in the popup menu.
Deployments are based on the contents of the /dist folder and are built automatically by GitHub Actions for each branch and tag pushed to GitHub.
Branches are deployed to https://sagemodeler.concord.org/branch/<name>/
.
Tags are deployed to https://sagemodeler.concord.org/version/<name>/
You can view the status of all the branch and tag deploys here.
The production release is available at https://sagemodeler.concord.org
.
Production releases are done using a manual GitHub Actions workflow. You specify which tag you want to release to production and the workflow copies all of the files in that tag's version folder to the root folder.
To deploy a production release:
- Update the version number in
package.json
andpackage-lock.json
npm version --no-git-tag-version [patch|minor|major]
- Verify that everything builds correctly
npm run lint && npm run build && npm run test
- Create
release-<version>
branch and commit changes, push to GitHub, create PR and merge - Test the master build at: https://sagemodeler.concord.org/index-master.html
- Push a version tag to GitHub and/or use https://github.com/concord-consortium/sage-modeler-site/releases to create a new GitHub release
- Stage the release by running the Release Staging Workflow and entering the version tag you just pushed.
- Test the staged release at https://sagemodeler.concord.org/staging/
- Update production by running the Release Workflow and entering the release version tag.
NOTE: This repo and the building-models repo should be released at the same time, with the same version numbers, even if one of the two repos has no changes, in order to keep their version numbers in sync so that the splashscreen and top nav bar show the same version numbers. Refer to the readme in that repo for release steps.
Since this project depends on three other deployed projects (CODAP, Sage and CFM) a set of query parameters is available to override where those projects are deployed. This enables this project to be tested against branch builds of the other projects.
The parameters are:
- ?codap=<
URL
|release
> whereURL
is the url to the CODAP index.html page orrelease
is the CODAP release folder (example:build_0473
) - ?di=<
URL
|branch
> whereURL
is the url to Sage (di is passed to CODAP, it stands for "data interactive") orbranch
is the deployed Sage branch (example:164295027-default-to-zero
) - ?cfmBaseUrl=<
URL
|branch
> whereURL
is the url to the /js folder for CFM orbranch
is the deployed CFM branch (example:fix-example-loads-in-codap
). In order to allow for testing of separate CFM instances in sage-modeler-site, CODAP and building-models you must explicitly also override their cfmBaseUrl's by using either thecodap:
orsage:
prefix. Here is an example url that overrides all the CFMs: https://sagemodeler.concord.org/app/?cfmBaseUrl=add-persistent-saves&sage:cfmBaseUrl=add-persistent-saves&codap:cfmBaseUrl=add-persistent-saves
To test the automatically deploying CODAP branches from Travis builds use ?codap=/codap-dev/branch/BRANCHNAME/
or just ?codap=/codap-dev/
to access the master branch. Here is an example using a branch:
https://sagemodeler.concord.org/app/?codap=/codap-dev/branch/182222132-disable-dirty-sync-on-load/
The files in src/microsite
are generated from the SageModeler WordPress site. This process is automated by using the src/scripts/microsite
script using the following steps.
- Start a static site export at the SageModeler WordPress site in the WP2Static plugin.
- Download the .zip file when the export is complete. For this example we'll assume its downloaded to
~/Downloads/wp-static-html-output-1557755665.zip
- In a terminal change to this repos root folder (you will see an error message in the next step if you don't).
- Checkout master and clean all local changes (you will see an error message in the next step if you don't).
- Run
src/scripts/microsite create-branch
to create a branch for the update. - Run
src/scripts/microsite process-zip ~/Downloads/wp-static-html-output-1557755665.zip
to process the zip file. - Run
src/scripts/microsite view
to view the locally updated microsite folder a browser. - Look around the microsite to ensure that it includes your changes from Wordpress and the links work.
- Run
src/scripts/microsite push-branch
to commit the changes and push the branch to GitHub. - Load https://github.com/concord-consortium/sage-modeler-site/ and create a PR for the newly pushed branch (you should see a notice at the top of the page about the new branch with a button to create a PR).
- Assign the PR to Doug to review and merge to master and production. This may be automated in the future.
TDB.
sage-modeler-site is Copyright 2018 (c) by the Concord Consortium and is distributed under the MIT license.
See LICENSE file for the complete license text.