Permalink
Browse files

Typescript Frontend (#164)

* add some basic types and titlebar

* finish up titlebar

* add map

* add stops and begin centering

* add vehicle updates and displays

* add vehicle messages, admin message, types

* update to service refactor

* fix hound violations

* fix hound violations

* fix svg render and dev server proxy

* finish up a few points

* fix hound being picky

* remove trailing whitespace

* update readme

* remove a test that wont work with current webpack config

* clean a test and change travis yaml

* test travis

* build and copy files

* build and copy files

* build and copy files

* fix dockerfile

* remove unused item from struct

* fix adminMessage variable names

* @ paths

* don't show shuttle if backend doesn't return an update

* @ paths

* output to static directory

* remove static directory and copy admin interface through webpack

* remove static directory, ignore

* fix directory link and update favicon

* fix dockerfile and travis config

* remove extra readme and improve documentation

* remove dev flat

* update styles on ui elements and update links for schedules

* fix bad merge

* remove redundant directories

* fix sample config

* remove trailing comma

* fix a bug where admin message would not display

* update dockerfile, readme, cardinalDirection.ts

* 'Node-.-js'

* switch to history mode, serve /about

* fix live indicator in firefox

* change margin on legend

* Remove dead dark mode selector
  • Loading branch information...
jlyon1 authored and garoller committed Oct 27, 2018
1 parent 6210c9d commit 80623cc9611f17e03d0589133de63358ab719d66
Showing with 16,062 additions and 1,066 deletions.
  1. +3 −0 .dockerignore
  2. +1 −0 .gitignore
  3. +1 −0 .travis.yml
  4. +12 −0 Dockerfile
  5. +11 −6 README.md
  6. +6 −5 api/api.go
  7. +1 −1 api/api_test.go
  8. +1 −1 conf.json.sample
  9. +3 −0 frontend/.browserslistrc
  10. +24 −0 frontend/.gitignore
  11. +5 −0 frontend/.postcssrc.js
  12. +5 −0 frontend/babel.config.js
  13. +14,567 −0 frontend/package-lock.json
  14. +36 −0 frontend/package.json
  15. BIN {static/images → frontend/public}/favicon.ico
  16. +17 −0 frontend/public/index.html
  17. +27 −0 frontend/src/App.vue
  18. +13 −0 frontend/src/StoreState.ts
  19. +32 −0 frontend/src/admin/admin.html
  20. 0 {static → frontend/src/admin}/css/admin.css
  21. +0 −4 {static → frontend/src/admin}/css/application.css
  22. 0 {static → frontend/src/admin}/dist/bulma-0.6.2/css/bulma.css
  23. 0 {static → frontend/src/admin}/dist/bulma-0.6.2/css/bulma.css.map
  24. 0 {static → frontend/src/admin}/dist/leaflet-routing/leaflet-routing-machine.css
  25. 0 {static → frontend/src/admin}/dist/leaflet-routing/leaflet-routing-machine.js
  26. 0 {static → frontend/src/admin}/dist/leaflet-routing/leaflet-routing-machine.min.js
  27. BIN {static → frontend/src/admin}/dist/leaflet-routing/leaflet.routing.icons.png
  28. 0 {static → frontend/src/admin}/dist/leaflet-routing/leaflet.routing.icons.svg
  29. BIN {static → frontend/src/admin}/dist/leaflet-routing/routing-icon.png
  30. BIN {static → frontend/src/admin}/dist/leaflet/images/layers-2x.png
  31. BIN {static → frontend/src/admin}/dist/leaflet/images/layers.png
  32. BIN {static → frontend/src/admin}/dist/leaflet/images/marker-icon-2x.png
  33. BIN {static → frontend/src/admin}/dist/leaflet/images/marker-icon.png
  34. BIN {static → frontend/src/admin}/dist/leaflet/images/marker-shadow.png
  35. 0 {static → frontend/src/admin}/dist/leaflet/leaflet.css
  36. 0 {static → frontend/src/admin}/dist/leaflet/leaflet.js
  37. 0 {static → frontend/src/admin}/dist/leaflet/leaflet.rotatedMarker.js
  38. 0 {static → frontend/src/admin}/dist/vue/vue.min.js
  39. BIN {static → frontend/src/admin}/images/car.png
  40. 0 {static → frontend/src/admin}/images/circle.svg
  41. BIN frontend/src/admin/images/favicon.ico
  42. BIN {static → frontend/src/admin}/images/logo.png
  43. 0 {static → frontend/src/admin}/images/menu.svg
  44. 0 {static → frontend/src/admin}/images/moon.svg
  45. BIN {static → frontend/src/admin}/images/shuttle.png
  46. 0 {static → frontend/src/admin}/images/shuttle.svg
  47. BIN {static → frontend/src/admin}/images/shuttle_arrow.png
  48. BIN {static → frontend/src/admin}/images/shuttle_icon.png
  49. BIN {static → frontend/src/admin}/images/stop.png
  50. 0 {static → frontend/src/admin}/images/sun.svg
  51. 0 {static → frontend/src/admin}/images/triangular-arrow.svg
  52. 0 {static → frontend/src/admin}/images/user.svg
  53. 0 {static → frontend/src/admin}/images/wtg.svg
  54. 0 {static → frontend/src/admin}/js/admin.js
  55. 0 {static → frontend/src/admin}/js/messages.js
  56. 0 {static → frontend/src/admin}/js/routes.js
  57. 0 {static → frontend/src/admin}/js/stops.js
  58. 0 {static → frontend/src/admin}/js/vehicles.js
  59. +4 −0 frontend/src/assets/circle.svg
  60. +1 −0 frontend/src/assets/menu.svg
  61. +11 −0 frontend/src/assets/shuttle.svg
  62. +14 −0 frontend/src/assets/styles.scss
  63. +4 −0 frontend/src/assets/user.svg
  64. +35 −0 frontend/src/assets/wtg.svg
  65. +346 −0 frontend/src/components/Public.vue
  66. +31 −0 frontend/src/components/about.vue
  67. +44 −0 frontend/src/components/adminmessage.vue
  68. +189 −0 frontend/src/components/dropdown.vue
  69. +22 −0 frontend/src/index.ts
  70. +17 −0 frontend/src/main.ts
  71. +13 −0 frontend/src/shims-tsx.d.ts
  72. +4 −0 frontend/src/shims-vue.d.ts
  73. +143 −0 frontend/src/store.ts
  74. +17 −0 frontend/src/structures/adminMessageUpdate.ts
  75. +18 −0 frontend/src/structures/cardinalDirection.ts
  76. +15 −0 frontend/src/structures/leaflet/rotatedMarker.ts
  77. +28 −0 frontend/src/structures/route.ts
  78. +88 −0 frontend/src/structures/serviceproviders/info.service.ts
  79. +23 −0 frontend/src/structures/stop.ts
  80. +15 −0 frontend/src/structures/update.ts
  81. +132 −0 frontend/src/structures/vehicle.ts
  82. +40 −0 frontend/tsconfig.json
  83. +22 −0 frontend/tslint.json
  84. +21 −0 frontend/vue.config.js
  85. +0 −304 static/js/app.js
  86. +0 −745 static/js/frontend.js
View
@@ -13,3 +13,6 @@
!*.go
!index.html
!CHECKS
!frontend
frontend/node_modules
frontend/dist
View
@@ -2,3 +2,4 @@
/vendor/*/
/coverage.txt
/shuttletracker
/static/*
View
@@ -23,6 +23,7 @@ before_install:
- go get -u github.com/kardianos/govendor && govendor sync -v
- go get -u github.com/alecthomas/gometalinter && gometalinter --install
- go get -u github.com/bradleyfalzon/revgrep/...
- cd frontend && npm install && npm run build && cd ..
install:
- go install github.com/wtg/shuttletracker/cmd/shuttletracker
View
@@ -1,3 +1,13 @@
FROM node:8 as npmenv
ADD /frontend /frontend
WORKDIR /frontend
# Install npm dependencies and build
RUN npm install
RUN npm run build
FROM golang:1.11
RUN go get -u github.com/kardianos/govendor
@@ -8,6 +18,8 @@ RUN govendor sync
COPY . /go/src/github.com/wtg/shuttletracker
RUN go install github.com/wtg/shuttletracker/cmd/shuttletracker
COPY --from=npmenv /static/ /go/src/github.com/wtg/shuttletracker/static/
# Dokku checks http://dokku.viewdocs.io/dokku/deployment/zero-downtime-deploys/
RUN mkdir /app
COPY CHECKS /app
View
@@ -16,12 +16,17 @@ Check it out in action at [shuttles.rpi.edu](https://shuttles.rpi.edu).
8. Run `createdb shuttletracker` to create a Postgres database.
9. Rename `conf.json.sample` to `conf.json`
10. Edit `conf.json` with the following, if necessary:
* `API.MapboxAPIKey`: Necessary for creating routes through the admin interface. [Create your own token](https://www.mapbox.com/help/how-access-tokens-work/) or ask a Shuttle Tracker developer to provide you with one.
* `Postgres.URL`: URL where Postgres is located. The provided default typically won't need to be modified.
11. Build Shuttle Tracker by running `go build -o shuttletracker cmd/shuttletracker/main.go` in the project root directory.
12. Start the app by running `./shuttletracker` in the project root directory.
13. You can add yourself as an administrator by using `./shuttletracker admins --add RCS_ID`, replacing `RCS_ID` with your RCS ID. See the "Administrators" section below for more information.
14. Visit http://localhost:8080/ to view the tracking application and http://localhost:8080/admin to view the administration panel
- `API.MapboxAPIKey`: Necessary for creating routes through the admin interface. [Create your own token](https://www.mapbox.com/help/how-access-tokens-work/) or ask a Shuttle Tracker developer to provide you with one.
- `Postgres.URL`: URL where Postgres is located. The provided default typically won't need to be modified.
11. Install Node.js and npm.
12. Switch to the `./frontend` directory.
13. Run `npm install`
14. Build the frontend using `npx vue-cli-service build --mode development`
- _Note: if you are working on the frontend, you may instead use `npx vue-cli-service build --mode development --watch` in another terminal to continuously watch for changes and rebuild._
15. Go back up to the project root directory and build Shuttle Tracker by running `go build -o shuttletracker cmd/shuttletracker/main.go`
16. Start the app by running `./shuttletracker` in the project root directory.
17. You can add yourself as an administrator by using `./shuttletracker admins --add RCS_ID`, replacing `RCS_ID` with your RCS ID. See the "Administrators" section below for more information.
18. Visit http://localhost:8080/ to view the tracking application and http://localhost:8080/admin to view the administration panel.
## Configuration
View
@@ -42,7 +42,6 @@ func New(cfg Config, ms shuttletracker.ModelService, msg shuttletracker.MessageS
if err != nil {
return nil, err
}
// Create API instance to store database session and collections
api := API{
cfg: cfg,
@@ -118,10 +117,11 @@ func New(cfg Config, ms shuttletracker.ModelService, msg shuttletracker.MessageS
r.Get("/getKey/", api.KeyHandler)
})
// Static files
r.Get("/", IndexHandler)
r.Method("GET", "/static/*", http.StripPrefix("/static/", http.FileServer(staticFileSystem{http.Dir("static/")})))
r.Get("/", api.IndexHandler)
r.Get("/about", api.IndexHandler)
// iTRAK data feed endpoint
r.Get("/datafeed", api.DataFeedHandler)
@@ -145,11 +145,12 @@ func (api *API) Run() {
if err := http.ListenAndServe(api.cfg.ListenURL, api.handler); err != nil {
log.WithError(err).Error("Unable to serve.")
}
}
// IndexHandler serves the index page.
func IndexHandler(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "index.html")
func (api *API) IndexHandler(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "static/index.html")
}
// AdminHandler serves the admin page.
View
@@ -26,7 +26,7 @@ func TestStatic(t *testing.T) {
},
{
method: "GET",
path: "/static/js/frontend.js",
path: "/static/js/admin.js",
},
}
View
@@ -15,4 +15,4 @@
"Log": {
"Level": "debug"
}
}
}
View
@@ -0,0 +1,3 @@
> 1%
last 2 versions
not ie <= 8
View
@@ -0,0 +1,24 @@
.DS_Store
node_modules
/dist
/tests/e2e/reports/
selenium-debug.log
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
View
@@ -0,0 +1,5 @@
module.exports = {
plugins: {
autoprefixer: {}
}
};
View
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/app'
]
};
Oops, something went wrong.

0 comments on commit 80623cc

Please sign in to comment.