Skip to content

Commit

Permalink
Release/v0.6 (#137)
Browse files Browse the repository at this point in the history
* fix client bundling in build

* move catalogue and roster to tabs in classroom view; handle tab routing;

* update testing framework and commit test db dump

* remove teacher from create classrooms

* don't exit 0 from script

* include && for client bundling

* update dump and require enrollment

* Added workflow for tagging onto master

* move navigation opptions from secondary header to dropdown nav

* add classroom home tab component; add join code display modal

* removed old content models

* create block_db.dump to copy blocks/categories to a new db

* let blocks_db.dump slide

* implemented new content models

* update dev dump

* set layout for /classroom/:id#home; fix sticky header

* add toolbox to day

* updated dump

* add grade validation to create classroom

* days have blocks

* update dump

* add learning standard selection modal; add checkbox to filter visible units

* implement modal navigation

* refactor ActivityCatalogue to LearningStandardSelect

* added student classroom retrieval

* narrowed scope of /students/me

* overrode the selection create controller to disable previous selection

* updated dump

* set active learning activity via modal; populate classroom modal and home with learning activity info

* display learning standards by unit; fix search functionality for new data organization

* implement filter on unit functionality

* maintain navigation history of modal state

* fix routing errors; clean up client warning/errors

* begin refactor of activity -> day

* use build github action

* update something

* use env var for heroku token

* finish activity -> day refactor; fix student views; remove redundant selectedDay props

* give CM access to toolbox in dev dump

* use v0.6 of build-test-deploy

* remove old heroku config files

* fix classroom rout; fix join code modal size; handle no fetch classroom error in student view

* create error checking request wrapper function; begin refactoring client for use with makeRequest

* use makeRequest for all requests; check for data/err when called

* classrooms route was getting ovverode

* Bump elliptic from 6.5.2 to 6.5.3 in /server

Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](indutny/elliptic@v6.5.2...v6.5.3)

Signed-off-by: dependabot[bot] <[email protected]>

* add error message in views; add success message for some put/posts

* change canvas panel icon for goBack

* change error messages; fix fetching errors

* fix errors and warnings

* fix issue loading sandbox

* remove redundant default error setting

* created saves

* create findByDay and init create save

* Bump elliptic from 6.5.2 to 6.5.3 in /client

Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](indutny/elliptic@v6.5.2...v6.5.3)

Signed-off-by: dependabot[bot] <[email protected]>

* change makeRequest args to config obj; getToken in makeRequest; log error

* finished create save

* updated db dump

* cleanup

* fix update save bug

* implement autosave on load, close, and every 5 min

* begin implementing load saves

* implement loadable saves; update loadable save options after manual save

* fix autosave time (5 min); add warning message when compilation fails

* Updated tag-master workflow with hotfix version

* rm old naming of cms...

* check student enrollment status on initJoin and join

* autosave more often; fix save erase on load; autoload save; label changes; move load button

* add nav bar to public views; move student join and teacher login to seperate views

* remove workspace info panel

* move code popup to modal

* add easy copy code

* style code box display

* add nav bar to student views

* fix hvr-info locations

* fix warnings

* added add student modal; setup ui for manual input and csv upload/display; implement csv upload

* add student(s) client requests; reset table state on add student

* allow POST /students to take array of students or single student

* resized workspace to prevent scrollbar render

* validate that a name is provided on create student

* add delete student functionality to client

* add student.delete policies; allow CM to delete student in dump

* lookup session on create save; return object with current and past saves on find

* fix find by session issue; return only one current save

* display new saves format correctly in dropdown; fix blank save bug; resolve warnings

* add defult template to saves dropdown; fix autosave blank canvas bug

* allow empty animal entry; remove file and table on add students; warning display if one or more errors occured during parsing

* add emoji picker; reset entered vals on manual input

* fix load save bug; add date to past saves

* Update README.md

* Update README.md

* load default template if no active save exists for the session

* add last logged in to student model and update on login

* add last logged in to view student modal; add last logged in to user model

* swap view and edit table col possitions in roster view

* update last logged in on user login

* add last_logged_in to db dump

* wrap update in promise all

* reset load save select to default after save is loaded

* add last logged in info to student card and list view

* pass last_logged_in to card/list views as date obj; sort by last_logged_in in table

* fix formatted date function; filter on enrollment status

* format last_logged_in display on student modal

* created submission content type

* init submission

* add redis to docker

* remove ports from redis and compile; always restart services

* untangle server from compile

* connect to compile queue on boot

* add the submission to the queue on create

* initialized queue listeners

* init get submission and changed create submission logic

* move init queue to submission service

* cleaned up bootstrap

* only return the full submission object with it is complete

* comments are imporatnt

* add some more validation and comments

* initial compile refactor

* finished compile refactor

* fix non-atmoic progress

* change back worker env var

* finished submission updates

* updated db dump

* comments

* Removed extra ref var

* created sandbox endpoints and abstracted start job

* fix csv parser warning issue; allow for 'name', 'student', or 'student name' as col titles

* remove unused form control function

* require formatted name entry; parse names to 'First L.' format

* check name formats and reformat if necessary on add student

* add strapi regex validation for student name, formatted: 'First Middle L.'

* added regex form validation on name entry

* add anchor to existing regex

* update workflow for new build test deploy

* update students added in dump

* use develop version of review

* update

* update compile dockerfile

* add string start anchor to regex

* use v0.7 of auto

* change client build from frontend to client

* change frontend to client

* prepend all requests from client with /api

* create proxy middleware to filter requests based on /api

* remove http(s):// from referer url

* return ctx with client index.html

* remove /api public url from server

* fix middleware order

* WIP: Submission never completed

* Updated to use /sandbox route for sandbox view

* for client views only, serve built index.html

* prevent autosave in sandbox view

* add about view

* add uf, tamu, and nsf logos; add contributors

* add 'How it Works' to about

* add about to nav bar

* changed cms to server in hosts/requests and removed old compile

* implemented the rest of compileArduinoCode

* reorganized compile into multiple files

* fix: isStudentRef didn't exist?? - can someone confirm this plz

* StudentRef removal and logic change

* edit wording

* remove redundant conditional

* Update README.md

* Update README.md

* edit grammar

* create version history modal; pass in saves as prop

* define version history modal layout

* fix contributor order

* fix student login bug

* load workspace on button click

* clean up modal; more specific save times

* add notice of last changes saved in UI

* remove old code; set lastSaved to null on default template load

* change button lable

* add time for active save

* add undo; begin implementing undo stack functionality;

* add /api to hosts

* updated client docs

* updated main readme

* add state to stack on workspace change; working undo button

* reset undo stack on load save

* disabled style for undo when nothing on stack

* reimplement undo; add redo option

* ability to reload last autosave

* fix default loads as active save bug

* add undo/redo functionality in sandbox

* add undo/redo to classroom manager day workspace

* handle matching id bug so last auto-save and active save are not confused

* removed freestanding server scripts

* remove free standing scripts in compile

* updated setup section of compile and server to use main docker-compose

* updated compile docs

* Update README.md

* fix save formatting bug

* Bump bl from 2.2.0 to 2.2.1 in /server

Bumps [bl](https://github.com/rvagg/bl) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/rvagg/bl/releases)
- [Commits](rvagg/bl@v2.2.0...v2.2.1)

Signed-off-by: dependabot[bot] <[email protected]>

* Removed unnecessary code

* Reworked Navbar logic to remove repeated code

* Fixed currentRoute being wrong on initial render, cleaned up logic

* Fixed popup position in /sandbox

Centered popups instead of having them go into a random direction.

* Fixed bugs in release

* Resolving merge conflicts from release

* Removing files from master

Co-authored-by: Adam Tamargo <[email protected]>
Co-authored-by: Nick <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nicholas Ionata <[email protected]>
  • Loading branch information
5 people authored Sep 21, 2020
1 parent cadaa33 commit 4c0250b
Show file tree
Hide file tree
Showing 99 changed files with 4,387 additions and 735 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Deploy Production
on:
release:
types: [ published ]
types: [ created ]
branches: [ master ]
jobs:
run:
Expand All @@ -13,12 +13,10 @@ jobs:
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Built, test, and deploy app
uses: STEM-C/auto/build-test-deploy@v0.6
uses: STEM-C/auto/build-test-deploy@v0.7
with:
image_name: server
image_tag: ${{ steps.get_version.outputs.VERSION }}
app_name: casmm
app_type: web
github_token: ${{ secrets.GITHUB_TOKEN }}
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_TOKEN }}
4 changes: 1 addition & 3 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ jobs:
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/heads/release/}
- name: Built, test, and deploy app
uses: STEM-C/auto/build-test-deploy@v0.6
uses: STEM-C/auto/build-test-deploy@v0.7
with:
image_name: server
image_tag: staging-${{ steps.get_version.outputs.VERSION }}
app_name: casmm-staging
app_type: web
github_token: ${{ secrets.GITHUB_TOKEN }}
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/end-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v2
- name: Delete review app
id: app
uses: STEM-C/auto/review@v0.4.5
uses: STEM-C/auto/review@v0.7
with:
base: review
pipeline: ${{ secrets.PIPELINE_ID }}
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/start-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
uses: actions/checkout@v2
- name: Create review app
id: app
uses: STEM-C/auto/review@v0.4.5
uses: STEM-C/auto/review@v0.7
with:
base: review
pipeline: ${{ secrets.PIPELINE_ID }}
Expand All @@ -23,12 +23,10 @@ jobs:
DATABASE_URL: ${{ steps.app.outputs.database_url }}
SCRIPT_PATH: ./scripts
- name: Built, test, and deploy app
uses: STEM-C/auto/build-test-deploy@v0.6
uses: STEM-C/auto/build-test-deploy@v0.7
with:
image_name: server
image_tag: ${{ steps.app.outputs.app_name }}
app_name: ${{ steps.app.outputs.app_name }}
app_type: web
github_token: ${{ secrets.GITHUB_TOKEN }}
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_TOKEN }}
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/update-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ jobs:
id: get_name
run: echo ::set-output name=NAME::review-pr-$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
- name: Built, test, and deploy app
uses: STEM-C/auto/build-test-deploy@v0.6
uses: STEM-C/auto/build-test-deploy@v0.7
with:
image_name: server
image_tag: ${{ steps.get_name.outputs.NAME }}
app_name: ${{ steps.get_name.outputs.NAME }}
app_type: web
github_token: ${{ secrets.GITHUB_TOKEN }}
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_TOKEN }}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ yarn-error.log*
# node
node_modules/
build/
server/public/frontend/*
!server/public/frontend/.gitkeep
server/public/client/*
!server/public/client/.gitkeep
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ COPY ./client/package.json .
COPY ./client/yarn.lock .
RUN yarn install
COPY ./client .
RUN PUBLIC_URL=/frontend yarn build
RUN PUBLIC_URL=/client yarn build

WORKDIR /usr/src/app
COPY ./server/package.json .
COPY ./server/yarn.lock .
RUN yarn install
COPY ./server .
ENV NODE_ENV production
RUN yarn build
RUN mv ./client/build/* ./public/frontend \
RUN PUBLIC_URL=/api yarn build
RUN mv ./client/build/* ./public/client \
&& rm -rf ./client
CMD yarn start
48 changes: 15 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ Cloud-based programming interface

<br/>

## Scaffolds
## Application

### `/`

#### `client/`
### `client`
[client](/client#client) is the frontend of the application. It is powered by [React](https://reactjs.org/) and [Blockly](https://developers.google.com/blockly).

#### `server/`
### `server`

[server](/server#server) is the web server and application server. It is powered by [Node](https://nodejs.org/en/) and [Strapi](https://strapi.io/documentation/v3.x/getting-started/introduction.html).

#### `compile/`
### `compile`

[compile](/compile#compile) is an arduino compiler service. It is an unofficial fork of [Chromeduino](https://github.com/spaceneedle/Chromeduino).

Expand All @@ -32,16 +30,15 @@ Cloud-based programming interface
> The project is divided into three conceptual environments.
### Development
This project's dependencies are managed through [yarn](https://classic.yarnpkg.com/en/docs/install/#mac-stable). This effectively replaces npm.

#### Structure

The development environment is composed of four servers. The first one is run with the [Create React App](https://create-react-app.dev/docs/getting-started/) dev server. The later three are containerized with docker and run with [docker compose](https://docs.docker.com/compose/).
The development environment is composed of five servers. The first one is run with the [Create React App](https://create-react-app.dev/docs/getting-started/) dev server. The later four are containerized with docker and run with [docker compose](https://docs.docker.com/compose/).

* `casmm-client-dev` - localhost:3000
* `casmm-server-dev` - localhost:1337
* `casmm-compile-dev` - localhost:8080
* `casmm-compile-dev`
* `casmm-db-dev` - localhost:5432
* `casmm-compile_queue-dev`

#### Running

Expand All @@ -50,7 +47,7 @@ The development environment is composed of four servers. The first one is run wi
1. Follow the [client](/client#setup) setup
2. Run `yarn start` from `/client`

`casmm-server-dev`, `casmm-compile-dev`, and `casmm-db-dev`
`casmm-server-dev`, `casmm-compile-dev`, `casmm-db-dev`, and `casmm-compile_queue-dev`

1. Install [docker](https://docs.docker.com/get-docker/)

Expand All @@ -64,45 +61,30 @@ The development environment is composed of four servers. The first one is run wi

#### Structure

The staging environment is deployed on Heroku. It is composed of one app running a Heroku Postgres instance and a web container.
The staging environment is a Heroku app. It is composed of a web dyno, compile dyno, Heroku Postgres add-on, and Heroku Redis add-on.

* `casmm-staging` - [casmm-staging.herokuapp.com](https://casmm-staging.herokuapp.com/)
* The web container attached to this Heroku app runs `server`, which will serve all static files and the api
* The Heroku Postgres instance is attached as an add-on
* The web dyno runs `server`
* The compile dyno runs `compile`

#### Running

`casmm-staging` is automatically built from the latest commits to `release`. Heroku runs the container orchestration from there.
`casmm-staging` is automatically built from the latest commits to branches matching `release/v[0-9].[0-9]`. Heroku runs the container orchestration from there.

### Production

#### Structure

The production environment is deployed on Heroku. It is composed of two apps. One is running a Heroku Postgres instance and a web container and the other is running just a web container.
The production environment is a Heroku app. It is composed of a web dyno, compile dyno, Heroku Postgres add-on, and Heroku Redis add-on.

* `casmm` - [casmm.herokuapp.com](https://casmm.herokuapp.com/)
* The web container attached to this Heroku app runs `server`, which will serve all static files and the api
* The Heroku Postgres instance is attached as an add-on
* `casmm-compile` - [casmm.herokuapp.com](https://casmm-compile.herokuapp.com/)
* The web container attached to this Heroku app runs `compile`
* The web dyno runs `server`
* The compile dyno runs `compile`

#### Running

`casmm` is automatically built from the latest commits to `master`. Heroku runs the container orchestration from there.

`casmm-compile` is manually deployed through the [Container Registry](https://devcenter.heroku.com/articles/container-registry-and-runtime) and [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli).

1. Install [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli)
2. Run the following commands sequentially

```powershell
heroku login
heroku git:remote -a stem-c-compile
heroku container:login
heroku container:push web
heroku container:release web
```

<br/>

## Contributing
Expand Down
4 changes: 2 additions & 2 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This react project has the following file structure rules:

## Routing

All client routes must be registered in the cms frontend middleware to ensure they are handled by react. Additional information and implementation instructions are in the [cms](/cms#static-assets) documentation.
All client routes are handled by react router. The **index.html** file and all static assets will be served by the [server](/server#static-assets).

<br/>

Expand Down Expand Up @@ -55,7 +55,7 @@ It correctly bundles React in production mode and optimizes the build for the be
To maintain a consistant theme the folowing has been implemented in `\client\src\assets\style.less` for import

### Colors

primary: #3D5C82;
secondary: #5BABDE;
tertiary: #F4F4F5;
Expand Down
2 changes: 2 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
"axios": "^0.19.2",
"craco-less": "^1.17.0",
"cross-env": "^7.0.2",
"emoji-picker-react": "^3.2.1",
"http-server": "^0.12.3",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-papaparse": "^3.7.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1"
},
Expand Down
21 changes: 10 additions & 11 deletions client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,33 @@ import { Route, Switch, useHistory } from 'react-router-dom'
import PrivateRoute from './Utils/PrivateRoute';

import Home from "./views/Home/Home"
import About from "./views/About/About"
import Workspace from "./views/Workspace/Workspace"
import Dashboard from "./views/Dashboard/Dashboard"
import Student from "./views/Student/Student"
import NotFound from "./views/NotFound"
import StudentLogin from "./views/StudentLogin/StudentLogin";
import Sandbox from "./views/Sandbox/Sandbox"
import {removeUserSession} from "./Utils/AuthRequests";
import Day from "./views/Day/Day";
import Classroom from "./views/Classroom/Classroom"
import TeacherLogin from "./views/TeacherLogin/TeacherLogin"

const App = () => {
let history = useHistory();
const handleLogout = () => {
removeUserSession();
history.push('/');
};

return (
<div>
<Switch>
<Route exact path={"/"} render={() => <Home history={history} />}/>
<Route exact path={"/"} render={() => <Home history={history}/>}/>
<Route exact path={"/about"} render={() => <About history={history}/>}/>
<Route exact path={"/teacherlogin"} render={() => <TeacherLogin history={history}/>}/>
<Route exact path={"/login"} render={() => <StudentLogin history={history} />}/>
<PrivateRoute exact path={"/dashboard"} render={() => <Dashboard history={history} handleLogout={handleLogout}/>}/>
<PrivateRoute exact path={"/student"} render={() => <Student history={history}/> } />
<Route path={"/workspace"} render={() => <Workspace history={history} handleLogout={handleLogout}/>}/>
<PrivateRoute exact path={"/dashboard"} render={() => <Dashboard history={history}/>}/>
<PrivateRoute exact path={"/student"} render={() => <Student history={history} /> } />
<Route path={"/workspace"} render={() => <Workspace history={history} />}/>
<Route path={"/sandbox"} render={() => <Sandbox history={history}/>} />
<PrivateRoute exact path={"/day"} render={() => <Day history={history} handleLogout={handleLogout}/> } />
<PrivateRoute path={"/classroom/:id"} render={() => <Classroom history={history} handleLogout={handleLogout}/> } />
<PrivateRoute exact path={"/day"} render={() => <Day history={history} /> } />
<PrivateRoute path={"/classroom/:id"} render={() => <Classroom history={history} /> } />
<Route component={NotFound}/>
</Switch>
</div>
Expand Down
4 changes: 2 additions & 2 deletions client/src/Utils/AuthRequests.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cms } from './hosts'
import { server } from './hosts'
import axios from "axios";

// return user data from session storage
Expand All @@ -9,7 +9,7 @@ export const getUser = () => {

// return user token from strapi
export const postUser = async (body) => {
const response = await axios.post(`${cms}/auth/local`, body);
const response = await axios.post(`${server}/auth/local`, body);
return response;
}

Expand Down
4 changes: 0 additions & 4 deletions client/src/Utils/config/development.json

This file was deleted.

4 changes: 0 additions & 4 deletions client/src/Utils/config/production.json

This file was deleted.

4 changes: 0 additions & 4 deletions client/src/Utils/config/staging.json

This file was deleted.

17 changes: 4 additions & 13 deletions client/src/Utils/hosts.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
import development from './config/development.json'
import staging from './config/staging.json'
import production from './config/production.json'
// get the hostname
const { hostname } = window.location

const getHosts = () => {
const { hostname } = window.location

if (hostname.includes('localhost')) return development
if (hostname.includes('staging')) return staging
return production
}

export const cms = getHosts().cms
export const compile = getHosts().compile
// export the server host
export const server = hostname.includes('localhost') ? 'http://localhost:1337/api' : '/api'
Loading

0 comments on commit 4c0250b

Please sign in to comment.