Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Commit

Permalink
Merge branch '285-cancelar-ensaio' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcstiago committed Jun 25, 2019
2 parents 138c2ec + 00e41c4 commit 1d8851d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 27 deletions.
4 changes: 2 additions & 2 deletions unbrake-api/production/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ def get_secret(secret_name, filename):
CORS_ORIGIN_ALLOW_ALL = False

CORS_ORIGIN_WHITELIST = (
'unbrake-hom.ml', 'unbrake.ml'
'unbrake-hom.ml', 'unbrake.ml', 'api.unbrake-hom.ml'
)

CSRF_TRUSTED_ORIGINS = (
'unbrake-hom.ml', 'unbrake.ml'
'unbrake-hom.ml', 'unbrake.ml', 'api.unbrake-hom.ml'
)

LANGUAGE_CODE = 'en-us'
Expand Down
40 changes: 16 additions & 24 deletions unbrake-frontend/src/configuration/Configuration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Configuration extends React.Component {
}

componentDidMount() {
const { configId } = this.props;
const { configId, sendMessage, dispatch } = this.props;

const url = `${API_URL_GRAPHQL}?query=query{configNotDefault{id, name}}`;
const method = "GET";
Expand All @@ -83,7 +83,16 @@ class Configuration extends React.Component {
if (data !== null) this.setState({ allConfiguration: data });
});

if (configId > invalidId) this.handleSelectConfig(configId);
if (configId > invalidId)
selectConfigurationDataBase(configId, sendMessage, dispatch);
}

componentDidUpdate(prevProps) {
const { configId } = this.props;
if (configId !== prevProps.configId) {
return true;
}
return false;
}

handleNext() {
Expand Down Expand Up @@ -130,28 +139,8 @@ class Configuration extends React.Component {
}
}

resetState() {
this.setState({
configuration: {
CONFIG_ENSAIO: {
LSL: "",
LWT: "",
NOS: "",
TAO: false,
TAS: "",
TAT: "",
TBS: "",
TMO: false,
USL: "",
UWT: ""
}
}
});
}

handleUpDefault() {
this.resetState();
const { sendMessage } = this.props;
const { sendMessage, changeConfig } = this.props;
const url = `${API_URL_GRAPHQL}?query=query{configDefault{${query}}}`;

const method = "GET";
Expand All @@ -174,20 +163,23 @@ class Configuration extends React.Component {
});
const position = response.data.configDefault.length - positionVector;
const data = response.data.configDefault[position];
changeConfig({ configId: data.id });
const configurationDefault = createConfig(data);

// dispatch(initialize("configuration", configurationDefault.CONFIG_ENSAIO));
this.setState({ configuration: configurationDefault });
});
}

handleChange(event) {
this.resetState();
const { changeConfig, sendMessage, dispatch } = this.props;
const { target } = event;

if (target.name === "name") {
this.setState({ [event.target.name]: event.target.value });
return;
}

const idSelect = target.value === invalidId ? "" : target.value;

changeConfig({ configId: idSelect });
Expand Down
1 change: 1 addition & 0 deletions unbrake-frontend/src/testModule/TestFunctions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ const requestTest = (states, functions, dispatchs) => {
url = `${API_URL_GRAPHQL}?query=mutation{submitTesting(mqttHost:"${MQTT_HOST}",mqttPort:8080,testingId:${
testing.id
}){succes}}`;

Request(url, "POST").then(json => {
const dataLocal = json.data;
const errosLocal = json.errors;
Expand Down
2 changes: 1 addition & 1 deletion unbrake-frontend/src/utils/Constants.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const API_URL = process.env.REACT_APP_API_URL;
export const API_URL_GRAPHQL = process.env.REACT_APP_API_URL;
export const MQTT_HOST = process.env.REACT_APP_MQTT_HOST;
export const MQTT_HOST = "unbrake.ml"; // process.env.REACT_APP_MQTT_HOST;
export const MQTT_PORT = process.env.REACT_APP_MQTT_PORT;
export const base10 = 10;

Expand Down

0 comments on commit 1d8851d

Please sign in to comment.