Browse Source

Started work on adding a server backend

update-deps
Alex Mikhalev 7 years ago
parent
commit
18dbefbdb7
  1. 6
      app/script/components/App.tsx
  2. 4
      app/script/components/DeviceView.tsx
  3. 3
      app/script/components/DurationInput.tsx
  4. 3
      app/script/components/MessagesView.tsx
  5. 3
      app/script/components/ProgramTable.tsx
  6. 3
      app/script/components/RunSectionForm.tsx
  7. 3
      app/script/components/SectionRunnerView.tsx
  8. 4
      app/script/components/SectionTable.tsx
  9. 4
      app/script/index.tsx
  10. 7
      app/script/mqtt.ts
  11. 3
      app/script/ui.ts
  12. 7
      app/tsconfig.json
  13. 0
      common/sprinklers.ts
  14. 0
      common/utils.ts
  15. 16
      webpack/base.config.js
  16. 2
      webpack/dev.config.js

6
app/script/components/App.tsx

@ -1,11 +1,11 @@
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import DevTools from "mobx-react-devtools"; import DevTools from "mobx-react-devtools";
import * as React from "react"; import * as React from "react";
import { Item } from "semantic-ui-react"; import { Item } from "semantic-ui-react";
import { UiStore } from "app/ui";
import { SprinklersDevice } from "common/sprinklers";
import { DeviceView, MessagesView } from "."; import { DeviceView, MessagesView } from ".";
import { SprinklersDevice } from "../sprinklers";
import { UiStore } from "../ui";
import "app/style/app.css"; import "app/style/app.css";
import "font-awesome/css/font-awesome.css"; import "font-awesome/css/font-awesome.css";

4
app/script/components/DeviceView.tsx

@ -1,11 +1,11 @@
import * as classNames from "classnames"; import * as classNames from "classnames";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import FontAwesome = require("react-fontawesome");
import { Header, Item } from "semantic-ui-react"; import { Header, Item } from "semantic-ui-react";
import { ProgramTable, RunSectionForm, SectionRunnerView, SectionTable } from "."; import { ProgramTable, RunSectionForm, SectionRunnerView, SectionTable } from ".";
import { SprinklersDevice } from "../sprinklers"; import { SprinklersDevice } from "common/sprinklers";
import FontAwesome = require("react-fontawesome");
const ConnectionState = ({ connected }: { connected: boolean }) => { const ConnectionState = ({ connected }: { connected: boolean }) => {
const classes = classNames({ const classes = classNames({

3
app/script/components/DurationInput.tsx

@ -1,6 +1,7 @@
import * as React from "react"; import * as React from "react";
import { Input, InputOnChangeData } from "semantic-ui-react"; import { Input, InputOnChangeData } from "semantic-ui-react";
import { Duration } from "../sprinklers";
import { Duration } from "common/sprinklers";
export default class DurationInput extends React.Component<{ export default class DurationInput extends React.Component<{
duration: Duration, duration: Duration,

3
app/script/components/MessagesView.tsx

@ -1,7 +1,8 @@
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import { Message, MessageList, TransitionGroup } from "semantic-ui-react"; import { Message, MessageList, TransitionGroup } from "semantic-ui-react";
import { Message as UiMessage, UiStore } from "../ui";
import { Message as UiMessage, UiStore } from "app/ui";
class MessageView extends React.Component<{ class MessageView extends React.Component<{
uiStore: UiStore, uiStore: UiStore,

3
app/script/components/ProgramTable.tsx

@ -1,7 +1,8 @@
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import { Table } from "semantic-ui-react"; import { Table } from "semantic-ui-react";
import { Program, Schedule } from "../sprinklers";
import { Program, Schedule } from "common/sprinklers";
@observer @observer
export class ScheduleView extends React.Component<{ schedule: Schedule }> { export class ScheduleView extends React.Component<{ schedule: Schedule }> {

3
app/script/components/RunSectionForm.tsx

@ -2,8 +2,9 @@ import {computed} from "mobx";
import {observer} from "mobx-react"; import {observer} from "mobx-react";
import * as React from "react"; import * as React from "react";
import {DropdownItemProps, DropdownProps, Form, Header, Segment} from "semantic-ui-react"; import {DropdownItemProps, DropdownProps, Form, Header, Segment} from "semantic-ui-react";
import {Duration, Section} from "common/sprinklers";
import {DurationInput} from "."; import {DurationInput} from ".";
import {Duration, Section} from "../sprinklers";
@observer @observer
export default class RunSectionForm extends React.Component<{ export default class RunSectionForm extends React.Component<{

3
app/script/components/SectionRunnerView.tsx

@ -1,7 +1,8 @@
import {observer} from "mobx-react"; import {observer} from "mobx-react";
import * as React from "react"; import * as React from "react";
import {Segment} from "semantic-ui-react"; import {Segment} from "semantic-ui-react";
import {SectionRunner} from "../sprinklers";
import {SectionRunner} from "common/sprinklers";
@observer @observer
export default class SectionRunnerView extends React.Component<{ sectionRunner: SectionRunner }, {}> { export default class SectionRunnerView extends React.Component<{ sectionRunner: SectionRunner }, {}> {

4
app/script/components/SectionTable.tsx

@ -1,10 +1,10 @@
import * as classNames from "classnames"; import * as classNames from "classnames";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import FontAwesome = require("react-fontawesome");
import { Table } from "semantic-ui-react"; import { Table } from "semantic-ui-react";
import { Section } from "../sprinklers"; import { Section } from "common/sprinklers";
import FontAwesome = require("react-fontawesome");
/* tslint:disable:object-literal-sort-keys */ /* tslint:disable:object-literal-sort-keys */

4
app/script/index.tsx

@ -25,8 +25,8 @@ const doRender = (Component: typeof App) => {
doRender(App); doRender(App);
if (module.hot) { if (module.hot) {
module.hot.accept("./components/App", () => { module.hot.accept("app/components/App", () => {
const NextApp = require<any>("./components/App").default as typeof App; const NextApp = require<any>("app/components/App").default as typeof App;
doRender(NextApp); doRender(NextApp);
}); });
} }

7
app/script/mqtt.ts

@ -1,5 +1,7 @@
import { EventEmitter } from "events"; import { EventEmitter } from "events";
import "paho-mqtt"; import "paho-mqtt";
import MQTT = Paho.MQTT;
import { import {
Duration, Duration,
ISprinklersApi, ISprinklersApi,
@ -11,9 +13,8 @@ import {
SectionRunner, SectionRunner,
SprinklersDevice, SprinklersDevice,
TimeOfDay, TimeOfDay,
} from "./sprinklers"; } from "common/sprinklers";
import { checkedIndexOf } from "./utils"; import { checkedIndexOf, getRandomId } from "common/utils";
import MQTT = Paho.MQTT;
export class MqttApiClient implements ISprinklersApi { export class MqttApiClient implements ISprinklersApi {
client: MQTT.Client; client: MQTT.Client;

3
app/script/ui.ts

@ -1,5 +1,6 @@
import {observable} from "mobx"; import {observable} from "mobx";
import { getRandomId } from "./utils";
import { getRandomId } from "common/utils";
export class Message { export class Message {
id: string; id: string;

7
tsconfig.json → app/tsconfig.json

@ -6,7 +6,12 @@
"target": "es5", "target": "es5",
"lib": ["es6", "dom"], "lib": ["es6", "dom"],
"typeRoots": ["node_modules/@types"], "typeRoots": ["node_modules/@types"],
"strict": true "strict": true,
"baseUrl": "..",
"paths": {
"common/*": [ "../common/*" ],
"app/*": [ "./*" ]
}
}, },
"files": [ "files": [
"./node_modules/@types/webpack-env/index.d.ts", "./node_modules/@types/webpack-env/index.d.ts",

0
app/script/sprinklers.ts → common/sprinklers.ts

0
app/script/utils.ts → common/utils.ts

16
webpack/base.config.js

@ -3,7 +3,7 @@ const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin"); const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = { module.exports = {
devtool: "inline-source-map", devtool: "eval-source-map",
output: { output: {
path: path.resolve(__dirname, "..", "build"), path: path.resolve(__dirname, "..", "build"),
filename: "bundle.js" filename: "bundle.js"
@ -11,14 +11,20 @@ module.exports = {
resolve: { resolve: {
extensions: [".ts", ".tsx", ".js"], extensions: [".ts", ".tsx", ".js"],
alias: { alias: {
app: path.resolve(__dirname, "..", "app") app: path.resolve(__dirname, "..", "app"),
common: path.resolve(__dirname, "..", "common"),
} }
}, },
module: { module: {
rules: [ rules: [
{ test: /\.css$/, loader: "style-loader!css-loader" }, { test: /\.css$/, use: "style-loader!css-loader" },
{ test: /\.(ttf|eot|svg|woff(2)?|png|jpg)(\?[a-z0-9=&.]+)?$/, loader: "file-loader" }, { test: /\.(ttf|eot|svg|woff(2)?|png|jpg)(\?[a-z0-9=&.]+)?$/, use: "file-loader" },
{ test: /\.tsx?$/, loader: "awesome-typescript-loader" }, {
test: /\.tsx?$/, use: {
loader: "awesome-typescript-loader",
options: { configFileName: path.resolve(__dirname, "..", "app", "tsconfig.json") }
},
},
] ]
}, },
plugins: [ plugins: [

2
webpack/dev.config.js

@ -10,7 +10,7 @@ module.exports = webpackMerge.smart(base, {
"core-js", "core-js",
"./app/script/index.tsx" "./app/script/index.tsx"
], ],
devtool: "inline-source-map", devtool: "eval-source-map",
plugins: [ plugins: [
new webpack.NamedModulesPlugin(), new webpack.NamedModulesPlugin(),
// new webpack.HotModuleReplacementPlugin(), // new webpack.HotModuleReplacementPlugin(),

Loading…
Cancel
Save