mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-14 09:48:10 -05:00
cleaner code...
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,26 +1,13 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import ReactDOM from "react-dom";
|
|
||||||
import {
|
import {
|
||||||
Container,
|
|
||||||
Header,
|
|
||||||
Dropdown,
|
|
||||||
Divider,
|
Divider,
|
||||||
TextArea,
|
|
||||||
Form,
|
Form,
|
||||||
Grid,
|
|
||||||
Segment,
|
|
||||||
Input,
|
|
||||||
Button,
|
Button,
|
||||||
Message,
|
Message,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Icon
|
Icon
|
||||||
} from "semantic-ui-react";
|
} from "semantic-ui-react";
|
||||||
|
|
||||||
// ----------------------------------------------------
|
|
||||||
const checkInputMessagestyle = {
|
|
||||||
color: "red"
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
class SystemForm extends Component {
|
class SystemForm extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -94,7 +81,7 @@ class SystemForm extends Component {
|
|||||||
this.setState({ nameError: false });
|
this.setState({ nameError: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.shortName.length == 0 || this.state.shortName.length > 10) {
|
if (this.state.shortName.length === 0 || this.state.shortName.length > 10) {
|
||||||
this.setState({ shortNameError: true });
|
this.setState({ shortNameError: true });
|
||||||
checkInputMessages.push(
|
checkInputMessages.push(
|
||||||
"Short Name for the system has to be 4-10 charecters"
|
"Short Name for the system has to be 4-10 charecters"
|
||||||
@@ -416,7 +403,7 @@ class SystemForm extends Component {
|
|||||||
|
|
||||||
<div style={floatStyle}>
|
<div style={floatStyle}>
|
||||||
<Button type="submit" size="large" floated="right" value="Login">
|
<Button type="submit" size="large" floated="right" value="Login">
|
||||||
{isEditing != true ? "Create" : "Update"}
|
{isEditing !== true ? "Create" : "Update"}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ class UpdateSystem extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { dispatch } = this.props
|
|
||||||
this.props.fetchSystems()
|
this.props.fetchSystems()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,15 +18,6 @@ function fetchError(data) {
|
|||||||
data };
|
data };
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeUserRequest(method, data, api) {
|
|
||||||
// returns a Promise
|
|
||||||
return axios({
|
|
||||||
method: method,
|
|
||||||
url: api,
|
|
||||||
data: data
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function changeUrl(url) {
|
export function changeUrl(url) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(push(url));
|
dispatch(push(url));
|
||||||
@@ -39,7 +30,7 @@ export function fetch(shortName) {
|
|||||||
dispatch(beginFetch());
|
dispatch(beginFetch());
|
||||||
|
|
||||||
return axios
|
return axios
|
||||||
.get(process.env.REACT_APP_BACKEND_SERVER + "/" + shortName + "/errors")
|
.get(process.env.REACT_APP_BACKEND_SERVER + "/" + shortName + "/errors", {withCredentials: true})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
var data ={
|
var data ={
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ export function fetchErrors(shortName) {
|
|||||||
dispatch(beginFetchError());
|
dispatch(beginFetchError());
|
||||||
|
|
||||||
return axios
|
return axios
|
||||||
.get(process.env.REACT_APP_BACKEND_SERVER + "/" + shortName + "/systems")
|
.get(process.env.REACT_APP_BACKEND_SERVER + "/" + shortName + "/systems", {withCredentials: true})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
dispatch(fetchErrorsSuccess(shortName, response.data));
|
dispatch(fetchErrorsSuccess(shortName, response.data));
|
||||||
|
|||||||
@@ -1,16 +1,5 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import ReactDOM from "react-dom";
|
|
||||||
import { Link } from 'react-router-dom'
|
|
||||||
import {
|
import {
|
||||||
Container,
|
|
||||||
Header,
|
|
||||||
Form,
|
|
||||||
Grid,
|
|
||||||
Segment,
|
|
||||||
Input,
|
|
||||||
Button,
|
|
||||||
Message,
|
|
||||||
Icon,
|
|
||||||
Table
|
Table
|
||||||
} from "semantic-ui-react";
|
} from "semantic-ui-react";
|
||||||
|
|
||||||
@@ -20,11 +9,6 @@ import {
|
|||||||
|
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
class ListTalkgroups extends Component {
|
class ListTalkgroups extends Component {
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//https://stackoverflow.com/questions/36559661/how-can-i-dispatch-from-child-components-in-react-redux
|
//https://stackoverflow.com/questions/36559661/how-can-i-dispatch-from-child-components-in-react-redux
|
||||||
//https://stackoverflow.com/questions/42597602/react-onclick-pass-event-with-parameter
|
//https://stackoverflow.com/questions/42597602/react-onclick-pass-event-with-parameter
|
||||||
|
|||||||
@@ -26,15 +26,6 @@ function beginExportTalkgroup() {
|
|||||||
return { type: types.EXPORT_TALKGROUP };
|
return { type: types.EXPORT_TALKGROUP };
|
||||||
}
|
}
|
||||||
|
|
||||||
function exportTalkgroupSuccess() {
|
|
||||||
return { type: types.EXPORT_SUCCESS_TALKGROUP };
|
|
||||||
}
|
|
||||||
|
|
||||||
function exportTalkgroupError() {
|
|
||||||
return { type: types.EXPORT_ERROR_TALKGROUP };
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function beginFetchTalkgroup() {
|
function beginFetchTalkgroup() {
|
||||||
return { type: types.FETCH_TALKGROUP };
|
return { type: types.FETCH_TALKGROUP };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user