Dont need the dashboard controller anymore
|
@ -53,4 +53,10 @@ node_modules/
|
|||
# SmarfDoc Documentation
|
||||
api_docs.md
|
||||
# RailsERD Output
|
||||
erd.pdf
|
||||
erd.pdf
|
||||
# Ignore frontend packages that are source related.
|
||||
public/src
|
||||
public/app
|
||||
public/typings
|
||||
public/node_modules
|
||||
public/tools
|
|
@ -1,7 +0,0 @@
|
|||
# A non-resourceful controller for the 'glue' that holds this SPA together.
|
||||
# Let's try not to overwhelm this control and write as much API as possible.
|
||||
class DashboardController < ApplicationController
|
||||
def index
|
||||
render :index, layout: false
|
||||
end
|
||||
end
|
|
@ -1,10 +0,0 @@
|
|||
!!!
|
||||
%html{lang: "en"}
|
||||
%head
|
||||
%meta{charset: "utf-8"}/
|
||||
%meta{content: "width=device-width, initial-scale=1", name: "viewport"}/
|
||||
= favicon_link_tag 'favicon.png'
|
||||
%title= content_for?(:title) ? yield(:title) : "FarmBot"
|
||||
%body
|
||||
#root
|
||||
%script{ src: ENV["JS_FILE_URL"] || "YOU_DIDNT_SET_JS_FILE_URL_IN_YOUR_ENV" }
|
|
@ -17,7 +17,7 @@ FarmBot::Application.routes.draw do
|
|||
devise_for :users, :controllers => {:registrations => "registrations"}
|
||||
|
||||
# Routes for the single page Javascript app.
|
||||
get "/app", to: 'dashboard#index', as: :dashboard
|
||||
match "/app/*path", to: redirect("/app"), via: :all
|
||||
# get "/app", to: 'dashboard#index', as: :dashboard
|
||||
# match "/app/*path", to: redirect("/app"), via: :all
|
||||
|
||||
end
|
||||
|
|
|
@ -3,13 +3,13 @@ require_relative '../key_gen'
|
|||
namespace :frontend do
|
||||
desc "Install the frontend into /public"
|
||||
task install: :environment do
|
||||
`
|
||||
|
||||
git clone https://github.com/FarmBot/farmbot-web-frontend.git public
|
||||
cd public
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
`
|
||||
`rm -rf /tmp/farmbot_frontend`
|
||||
`mkdir /tmp/farmbot_frontend`
|
||||
`git clone https://github.com/rickcarlino/farmbot-web-frontend.git /tmp/farmbot_frontend
|
||||
rm -rf /tmp/farmbot_frontend/.git
|
||||
cp -R /tmp/farmbot_frontend/* public/
|
||||
cd public
|
||||
npm install --production
|
||||
npm run build`
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Farmbot.io
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
|
@ -0,0 +1,34 @@
|
|||
# Farmbot Web Frontend
|
||||
|
||||
This is the Javascript / HTML / CSS related to Farmbot's browser control app. It depends on a [backend API](https://github.com/FarmBot/farmbot-web-app) (my.farmbot.io by default).
|
||||
|
||||
# Up and Running
|
||||
|
||||
0. [Install node](https://nodejs.org/en/download/) if you haven't already.
|
||||
1. git clone https://github.com/FarmBot/farmbot-web-frontend.git
|
||||
2. cd farmbot-web-frontend
|
||||
3. npm install
|
||||
4. run `npm start`
|
||||
5. Visit `http://localhost:8080/`
|
||||
|
||||
# Deploy to Production
|
||||
|
||||
1. run `npm run build`
|
||||
2. Upload `tools/dist/farmbot-production.min.js` to your server.
|
||||
3. Add `<script src="entry.min.js">` to the page at `app/index.html`. This is the only endpoint we support at the moment. PRs welcome.
|
||||
4. Please, [raise an issue](https://github.com/FarmBot/farmbot-web-frontend/issues/new?title=Help,%20I%20cant%20setup!) if you have any trouble setting up.
|
||||
|
||||
# Configuration
|
||||
|
||||
All config is in the user auth token. There's no need to point to an MQTT URL or a particular bot. That information is contained in your auth token.
|
||||
|
||||
# Low Hanging Fruit
|
||||
|
||||
Are you a developer? Do you want to help? Don't know where to start?
|
||||
|
||||
Here are some easy-to-do tasks that our (small) team hasn't gotten around to yet:
|
||||
|
||||
- [ ] Writing unit tests for existing code.
|
||||
- [ ] Factoring out implcity `any` types. This was originally a vanilla JS project that later became TypeScript. We have a lot of "unsafe" code that does not have type annotations yet.
|
||||
- [ ] DRY up URL usage into a URL config object. A lot of AJAX requests are still relying on hardcoded strings rather than DRY configuration.
|
||||
- [ ] Any comment in sourcode with the word `HACK` or `TODO`.
|
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 7.3 KiB |
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" standalone="yes"?>
|
||||
|
||||
<svg version="1.1" viewBox="0.0 0.0 274.0 274.0" fill="none" stroke="none" stroke-linecap="square" stroke-miterlimit="10" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><clipPath id="p.0"><path d="m0 0l274.0 0l0 274.0l-274.0 0l0 -274.0z" clip-rule="nonzero"></path></clipPath><g clip-path="url(#p.0)"><path fill="#000000" fill-opacity="0.0" d="m0 0l274.57742 0l0 274.10236l-274.57742 0z" fill-rule="nonzero"></path><path fill="#316318" d="m242.54068 211.16011l0 14.718033l-105.244095 33.78589l-105.24408 -33.78589l0 -14.718033z" fill-rule="nonzero"></path><path stroke="#316318" stroke-width="24.0" stroke-linejoin="round" stroke-linecap="butt" d="m242.54068 211.16011l0 14.718033l-105.244095 33.78589l-105.24408 -33.78589l0 -14.718033z" fill-rule="nonzero"></path><path fill="#783f04" d="m242.75066 62.934383l0 -13.995205l-105.46457 -34.63472l-105.46457 34.63472l0 13.995205z" fill-rule="nonzero"></path><path stroke="#783f04" stroke-width="24.0" stroke-linejoin="round" stroke-linecap="butt" d="m242.75066 62.934383l0 -13.995205l-105.46457 -34.63472l-105.46457 34.63472l0 13.995205z" fill-rule="nonzero"></path><path fill="#b7b7b7" d="m19.792614 62.939632l234.99213 0l0 148.22047l-234.99213 0z" fill-rule="nonzero"></path><path fill="#000000" d="m20.14927 62.299126l234.24213 0l0 0l-234.24213 0zm0 149.50146l234.24213 0l0 0l-234.24213 0z" fill-rule="nonzero"></path><path stroke="#000000" stroke-width="16.0" stroke-linejoin="round" stroke-linecap="butt" d="m20.14927 62.299126l234.24213 0l0 0l-234.24213 0zm0 149.50146l234.24213 0l0 0l-234.24213 0z" fill-rule="nonzero"></path><path fill="#999999" d="m19.813744 70.28609l0 66.83464l234.96063 -66.83464z" fill-rule="nonzero"></path><path fill="#000000" fill-opacity="0.0" d="m19.792643 72.22835l234.99213 0l0 129.63779l-234.99213 0z" fill-rule="nonzero"></path><path fill="#000000" d="m71.51386 141.29723q-7.718746 1.0625 -12.765621 1.0625q-1.734375 0 -1.734375 -1.328125q0 -3.0625 4.1875 -6.453125q4.187496 -3.390625 13.640621 -5.921875q4.25 -15.156242 9.703125 -27.796867q-13.296875 0.65625 -21.812496 8.78125q-2.125 2.125 -3.453125 3.328125q-1.328125 1.1875 -2.328125 1.1875q-1.0 0 -1.9375 -1.59375q-0.921875 -1.59375 -0.921875 -4.25q0.125 -10.25 13.828121 -16.625q13.703125 -6.390625 33.78125 -6.25l39.906258 0.65625q3.578125 0 3.578125 2.796875q0 0.796875 -1.0625 2.859375q-1.0625 2.0625 -1.859375 4.453125q-1.734375 4.78125 -7.453125 4.78125l-4.25 0l-17.687508 -0.125l-10.234375 0q-1.078125 7.578125 -6.390625 24.734375l24.34375 0.40625q2.125 0 2.125 2.5156174q0 0.796875 -0.671875 2.796875q-0.65625 2.0 -1.1875 4.125q-1.0625 4.390625 -4.53125 4.390625l-20.21875 -0.9375l-1.71875 0q-0.796875 0 -1.859375 0.140625q-6.921875 25.40625 -6.921875 40.15625q0 7.859375 -15.296875 7.859375q-3.328125 0 -3.921875 -3.390625q-0.59375 -3.390625 -0.59375 -8.984375q0 -11.96875 5.71875 -33.375zm110.84083 -2.9375q-12.90625 0 -12.640625 -6.515625q0 -6.1093674 12.375 -6.1093674q2.921875 0 5.578125 0.65625q4.390625 -4.390625 4.390625 -13.296875q0 -15.421875 -20.609375 -15.421875q-10.78125 0 -20.484375 4.65625q-3.59375 1.71875 -6.453125 3.1875q-2.859375 1.453125 -5.25 1.453125q-2.390625 0 -2.390625 -1.453125q0 -1.734375 2.65625 -5.125q2.65625 -3.390625 7.453125 -6.84375q12.234375 -8.515625 27.796875 -8.65625q20.34375 0 29.921875 8.125q8.25 6.78125 8.25 18.484375q0 13.5625 -13.3125 20.749992q12.78125 7.3125 15.171875 17.953125q0.796875 3.71875 0.796875 9.84375q0 6.109375 -3.328125 11.5625q-3.328125 5.453125 -8.90625 9.1875q-11.171875 7.171875 -28.59375 7.171875q-12.375 0 -27.53125 -5.578125q-10.109375 -3.734375 -14.90625 -8.921875q-2.390625 -2.515625 -2.328125 -5.046875q0.078125 -2.53125 2.53125 -2.53125q2.46875 0 9.375 1.734375l0 -0.140625q0 -10.375 2.390625 -21.28125q4.125 -19.015617 9.578125 -29.781242q5.859375 -11.96875 12.109375 -11.96875q1.734375 0 1.734375 5.984375q0 5.984375 -1.140625 12.234375q-1.125 6.2499924 -2.390625 12.312492q-1.265625 6.046875 -2.40625 10.96875q-1.125 4.90625 -1.125 7.046875l-1.328125 20.078125q7.859375 2.125 13.3125 2.125q5.453125 0 9.828125 -1.859375q11.046875 -4.65625 11.046875 -16.234375q0 -6.90625 -1.328125 -11.421875q-1.328125 -4.53125 -4.796875 -7.984375q-3.046875 0.65625 -5.046875 0.65625z" fill-rule="nonzero"></path></g></svg>
|
||||
|
Before Width: | Height: | Size: 4.2 KiB |
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"name": "farmbot-web-frontend",
|
||||
"version": "1.1.0",
|
||||
"description": "Farmbot web frontend.",
|
||||
"main": "dist/entry.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/farmbot/farmbot-web-frontend"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "webpack --config tools/webpack.config.prd.js",
|
||||
"start": "webpack-dev-server --config tools/webpack.config.dev.js",
|
||||
"test": "karma start karma.config.js"
|
||||
},
|
||||
"keywords": [
|
||||
"farmbot"
|
||||
],
|
||||
"author": "farmbot.io",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"codelyzer": "0.0.19",
|
||||
"css-loader": "^0.23.1",
|
||||
"jasmine-core": "^2.4.1",
|
||||
"karma": "^1.0.0",
|
||||
"karma-chrome-launcher": "^0.2.2",
|
||||
"karma-coverage": "^0.5.3",
|
||||
"karma-jasmine": "^0.3.6",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "^1.7.0",
|
||||
"loader-utils": "^0.2.12",
|
||||
"moxios": "^0.3.0",
|
||||
"node-sass": "^3.4.2",
|
||||
"react-addons-test-utils": "^15.2.1",
|
||||
"redux-immutable-state-invariant": "^1.2.3",
|
||||
"sass-loader": "^3.1.2",
|
||||
"style-loader": "^0.13.0",
|
||||
"ts-loader": "^0.8.1",
|
||||
"webpack": "^1.12.11",
|
||||
"webpack-dev-server": "^1.14.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.13.0",
|
||||
"farmbot": "1.3.4",
|
||||
"joi-browser": "^8.0.5",
|
||||
"jquery": "^2.1.4",
|
||||
"lodash": "^3.10.1",
|
||||
"moment": "^2.13.0",
|
||||
"react": "^15.0.0",
|
||||
"react-dom": "^15.0.0",
|
||||
"react-redux": "^4.4.1",
|
||||
"react-router": "^2.0.1",
|
||||
"react-router-redux": "^4.0.1",
|
||||
"redux": "^3.3.1",
|
||||
"redux-thunk": "^2.0.1",
|
||||
"toastr": "^2.1.2",
|
||||
"typescript": "^2.0.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
var testsContext = require.context('./src', true, /pec\.(ts|tsx)$/);
|
||||
testsContext.keys().forEach(testsContext);
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"jsx": "react",
|
||||
"experimentalDecorators": true,
|
||||
"noImplicitAny": false,
|
||||
"allowUnreachableCode": false,
|
||||
"strictNullChecks": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"typings"
|
||||
],
|
||||
"compileOnSave": false,
|
||||
"buildOnSave": false
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
{
|
||||
"rules": {
|
||||
"max-line-length": [true, 100],
|
||||
"no-inferrable-types": true,
|
||||
"class-name": true,
|
||||
"comment-format": [
|
||||
true,
|
||||
"check-space"
|
||||
],
|
||||
"indent": [
|
||||
true,
|
||||
"spaces"
|
||||
],
|
||||
"eofline": true,
|
||||
"no-duplicate-variable": true,
|
||||
"no-arg": true,
|
||||
"no-internal-module": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-bitwise": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-unused-expression": true,
|
||||
"no-unused-variable": true,
|
||||
"one-line": [
|
||||
true,
|
||||
"check-catch",
|
||||
"check-else",
|
||||
"check-open-brace",
|
||||
"check-whitespace"
|
||||
],
|
||||
"quotemark": [
|
||||
true,
|
||||
"double",
|
||||
"avoid-escape"
|
||||
],
|
||||
"semicolon": [true, "always"],
|
||||
"typedef-whitespace": [
|
||||
true,
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
}
|
||||
],
|
||||
"curly": true,
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type"
|
||||
],
|
||||
"no-any": true
|
||||
}
|
||||
}
|