8000 Serial feature by mjkl-gh · Pull Request #309 · rjwats/esp8266-react · GitHub
[go: up one dir, main page]

Skip to content

Serial feature #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4b372f3
Add Streamserver
mjkl-gh Jan 2, 2021
21e092c
add Streamserver to main
mjkl-gh Jan 2, 2021
f6fd0bd
Add EventConsole
mjkl-gh Dec 25, 2021
b8145c6
Merge branch 'master' of https://github.com/rjwats/esp8266-react into…
mjkl-gh Dec 25, 2021
5e3b6e2
Merge branch 'serial' of https://github.com/mjkl-gh/esp-dsmr into ser…
mjkl-gh Dec 25, 2021
d99de58
Add SerialService
mjkl-gh Feb 7, 2021
ebbf9f4
Comment out LogEventController
mjkl-gh Dec 25, 2021
5a69d33
Merge ser2net
mjkl-gh Dec 25, 2021
39a8d2d
Rename ser2net to serial
mjkl-gh Dec 25, 2021
c72cbc0
add baud to SerialStatus
mjkl-gh Feb 7, 2021
dc7b28c
WIP Serial page
mjkl-gh Feb 7, 2021
2b3996a
Merge fixes from main branch
mjkl-gh Dec 25, 2021
0c9d454
Merge remote-tracking branch 'refs/remotes/Upstream/master'
mjkl-gh Dec 25, 2021
9249d1e
WIP update serial feature to new format
mjkl-gh Jun 6, 2022
5888bdc
Merge remote-tracking branch 'Upstream/master' into SerialFeature-Fix
mjkl-gh Jun 6, 2022
cddf41e
fix Tab moved to @mui/material from @material-ui/core
mjkl-gh Jun 6, 2022
11fb837
styleguide fixes
mjkl-gh Jun 8, 2022
6725888
Fix typo in Serial status title
mjkl-gh Jun 16, 2022
70ec5fc
Set sensible defaults for serial pins for both platforms
mjkl-gh Jun 16, 2022
8710636
WIP logevent console
mjkl-gh Jun 16, 2022
a7148b4
Fix endpoint.ts and env.ts names
mjkl-gh Jun 16, 2022
0760a5e
Fix double dependency
mjkl-gh Jun 16, 2022
956aacc
Simplify serial feature
mjkl-gh Jun 19, 2022
436a00e
add numbervalue to serialsettingsform
mjkl-gh Jun 19, 2022
44b5c7e
Fix settings forms
mjkl-gh Jun 20, 2022
35f37f3
Remove unnecessary this
mjkl-gh Jun 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename ser2net to serial
  • Loading branch information
mjkl-gh committed Dec 25, 2021
commit 39a8d2d07a158bcecd8321963cab9327bba41d2d
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Customize the settings as you see fit. A value of 0 will disable the specified f
-D FT_SECURITY=1
-D FT_MQTT=1
-D FT_NTP=1
-D FT_SER2NET=1
-D FT_SERIAL=1
-D FT_OTA=1
-D FT_UPLOAD_FIRMWARE=1
```
Expand Down
6 changes: 3 additions & 3 deletions interface/src/AppRouting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import AccessPoint from './ap/AccessPoint';
import NetworkTime from './ntp/NetworkTime';
import Security from './security/Security';
import System from './system/System';
import Ser2net from './ser2net/Ser2net';
import Serial from './serial/Serial';

import { PROJECT_PATH } from './api';
import Mqtt from './mqtt/Mqtt';
Expand Down Expand Up @@ -47,8 +47,8 @@ class AppRouting extends Component<WithFeaturesProps> {
{features.mqtt && (
<AuthenticatedRoute exact path="/mqtt/*" component={Mqtt} />
)}
{features.ser2net && (
<AuthenticatedRoute exact path="/ser2net/*" component={Ser2net} />
{features.serial && (< 8000 /span>
<AuthenticatedRoute exact path="/serial/*" component={Serial} />
)}
{features.security && (
<AuthenticatedRoute exact path="/security/*" component={Security} />
Expand Down
4 changes: 2 additions & 2 deletions interface/src/api/Endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export const OTA_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "otaSettings";
export const UPLOAD_FIRMWARE_ENDPOINT = ENDPOINT_ROOT + "uploadFirmware";
export const MQTT_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "mqttSettings";
export const MQTT_STATUS_ENDPOINT = ENDPOINT_ROOT + "mqttStatus";
export const SER2NET_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "ser2netSettings";
export const SER2NET_STATUS_ENDPOINT = ENDPOINT_ROOT + "ser2netStatus";
export const SERIAL_SETTINGS_ENDPOINT = ENDPOINT_ROOT + "serialSettings";
export const SERIAL_STATUS_ENDPOINT = ENDPOINT_ROOT + "serialStatus";
export const SYSTEM_STATUS_ENDPOINT = ENDPOINT_ROOT + "systemStatus";
export const SIGN_IN_ENDPOINT = ENDPOINT_ROOT + "signIn";
export const VERIFY_AUTHORIZATION_ENDPOINT = ENDPOINT_ROOT + "verifyAuthorization";
Expand Down
6 changes: 3 additions & 3 deletions interface/src/components/MenuAppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ class MenuAppBar extends React.Component<MenuAppBarProps, MenuAppBarState> {
<ListItemText primary="MQTT" />
</ListItem>
)}
{features.ser2net && (
<ListItem to='/ser2net/' selected={path.startsWith('/ser2net/')} button component={Link}>
{features.serial && (
<ListItem to='/serial/' selected={path.startsWith('/serial/')} button component={Link}>
<ListItemIcon>
<Icon icon={serialPort} width="24" height="24" />
</ListItemIcon>
<ListItemText primary="Ser2net" />
<ListItemText primary="Serial" />
</ListItem>
)}
{features.security && (
Expand Down
2 changes: 1 addition & 1 deletion interface/src/features/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export interface Features {
project: boolean;
security: boolean;
mqtt: boolean;
ser2net: boolean;
serial: boolean;
ntp: boolean;
ota: boolean;
upload_firmware: boolean;
Expand Down
37 changes: 0 additions & 37 deletions interface/src/ser2net/Ser2net.tsx

This file was deleted.

30 changes: 0 additions & 30 deletions interface/src/ser2net/Ser2netSettingsController.tsx

This file was deleted.

45 changes: 0 additions & 45 deletions interface/src/ser2net/Ser2netStatus.ts

This file was deleted.

29 changes: 0 additions & 29 deletions interface/src/ser2net/Ser2netStatusController.tsx

This file was deleted.

29 changes: 0 additions & 29 deletions interface/src/ser2net/types.ts

This file was deleted.

40 changes: 40 additions & 0 deletions interface/src/serial/Serial.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React, { Component } from 'react';
import { Redirect, Switch, RouteComponentProps } from 'react-router-dom'

import { Tabs, Tab } from '@material-ui/core';

import { AuthenticatedContextProps, withAuthenticatedContext, AuthenticatedRoute } from '../authentication';
import { MenuAppBar } from '../components';
import SerialStatusController from './SerialStatusController';
import SerialSettingsController from './SerialSettingsController';
import LogEventController from './LogEventController';

type SerialProps = AuthenticatedContextProps & RouteComponentProps;

class Serial extends Component<SerialProps> {

handleTabChange = (event: React.ChangeEvent<{}>, path: string) => {
this.props.history.push(path);
};

render() {
const { authenticatedContext } = this.props;
return (
<MenuAppBar sectionTitle="Serial">
<Tabs value={this.props.match.url} onChange={this.handleTabChange} variant="fullWidth">
<Tab value="/serial/status" label="Serial Status" />
<Tab value="/serial/log" label="Remote Log" />
<Tab value="/serial/settings" label="Serial Settings" disabled={!authenticatedContext.me.admin} />
</Tabs>
<Switch>
<AuthenticatedRoute exact path="/serial/status" component={SerialStatusController} />
<AuthenticatedRoute exact path="/serial/log" component={LogEventController} />
<AuthenticatedRoute exact path="/serial/settings" component={SerialSettingsController} />
<Redirect to="/serial/status" />
</Switch>
</MenuAppBar>
)
}
}

export default withAuthenticatedContext(Serial);
30 changes: 30 additions & 0 deletions interface/src/serial/SerialSettingsController.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { Component } from 'react';

import {restController, RestControllerProps, RestFormLoader, SectionContent } from '../components';
import { SERIAL_SETTINGS_ENDPOINT } from '../api';

import SerialSettingsForm from './SerialSettingsForm';
import { SerialSettings } from './types';

type SerialSettingsControllerProps = RestControllerProps<SerialSettings>;

class SerialSettingsController extends Component<SerialSettingsControllerProps> {

componentDidMount() {
this.props.loadData();
}

render() {
return (
<SectionContent title="Serial Settings" titleGutter>
<RestFormLoader
{...this.props}
render={formProps => <SerialSettingsForm {...formProps} />}
/>
</SectionContent>
)
}

}

export default restController(SERIAL_SETTINGS_ENDPOINT, SerialSettingsController);
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import SaveIcon from '@material-ui/icons/Save';

import { RestFormProps, FormActions, FormButton, BlockFormControlLabel } from '../components';

import { Ser2netSettings } from './types';
import { SerialSettings } from './types';

type Ser2netSettingsFormProps = RestFormProps<Ser2netSettings>;
type SerialSettingsFormProps = RestFormProps<SerialSettings>;

class Ser2netSettingsForm extends React.Component<Ser2netSettingsFormProps> {
class SerialSettingsForm extends React.Component<SerialSettingsFormProps> {

componentDidMount() {
}
Expand All @@ -30,7 +30,7 @@ class Ser2netSettingsForm extends React.Component<Ser2netSettingsFormProps> {
color="primary"
/>
}
label="Enable Ser2net"
label="Enable Serial"
/>
<FormActions>
<FormButton startIcon={<SaveIcon />} variant="contained" color="primary" type="submit">
Expand All @@ -42,4 +42,4 @@ class Ser2netSettingsForm extends React.Component<Ser2netSettingsFormProps> {
}
}

export default Ser2netSettingsForm;
export default SerialSettingsForm;
39 changes: 39 additions & 0 deletions interface/src/serial/SerialStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Theme } from "@material-ui/core";
import { SerialStatus } from "./types";

export const serialStatusHighlight = ({ enabled }: SerialStatus, theme: Theme) => {
if (!enabled) {
return theme.palette.info.main;
}
return theme.palette.success.main;
}

export const serialStatus = ({ enabled }: SerialStatus) => {
if (!enabled) {
return "Not enabled";
}
return "Enabled";
}

// export const disconnectReason = ({ disconnect_reason }: SerialStatus) => {
// switch (disconnect_reason) {
// case SerialDisconnectReason.TCP_DISCONNECTED:
// return "TCP disconnected";
// case SerialDisconnectReason.SERIAL_UNACCEPTABLE_PROTOCOL_VERSION:
// return "Unacceptable protocol version";
// case SerialDisconnectReason.SERIAL_IDENTIFIER_REJECTED:
// return "Client ID rejected";
// case SerialDisconnectReason.SERIAL_SERVER_UNAVAILABLE:
// return "Server unavailable";
// case SerialDisconnectReason.SERIAL_MALFORMED_CREDENTIALS:
// return "Malformed credentials";
// case SerialDisconnectReason.SERIAL_NOT_AUTHORIZED:
// return "Not authorized";
// case SerialDisconnectReason.ESP8266_NOT_ENOUGH_SPACE:
// return "Device out of memory";
// case SerialDisconnectReason.TLS_BAD_FINGERPRINT:
// return "Server fingerprint invalid";
// default:
// return "Unknown"
// }
// }
Loading
0