mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 05:37:55 +01:00
only request doodle printers when adding or managing printers
This commit is contained in:
parent
0119c91001
commit
f109147e62
@ -25,7 +25,6 @@ import { Doodle3DManager } from 'doodle3d-api';
|
|||||||
|
|
||||||
const DOODLE_3D_MANAGER = new Doodle3DManager();
|
const DOODLE_3D_MANAGER = new Doodle3DManager();
|
||||||
DOODLE_3D_MANAGER.checkNonServerBoxes = false;
|
DOODLE_3D_MANAGER.checkNonServerBoxes = false;
|
||||||
DOODLE_3D_MANAGER.setAutoUpdate(true, 5000);
|
|
||||||
|
|
||||||
const CONNECT_URL = 'http://connect.doodle3d.com/';
|
const CONNECT_URL = 'http://connect.doodle3d.com/';
|
||||||
|
|
||||||
@ -127,8 +126,8 @@ class Settings extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const eventListener = ({ boxes }) => this.setState({ wifiBoxes: boxes });
|
const eventListener = ({ boxes }) => this.setState({ wifiBoxes: boxes });
|
||||||
this.setState({ wifiBoxes: DOODLE_3D_MANAGER.boxes, eventListener });
|
|
||||||
DOODLE_3D_MANAGER.addEventListener('boxeschanged', eventListener);
|
DOODLE_3D_MANAGER.addEventListener('boxeschanged', eventListener);
|
||||||
|
this.setState({ eventListener });
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
@ -361,7 +360,13 @@ class Settings extends React.Component {
|
|||||||
|
|
||||||
closeAddPrinterDialog = (override) => this.setAddPrinterDialog(false, override);
|
closeAddPrinterDialog = (override) => this.setAddPrinterDialog(false, override);
|
||||||
openAddPrinterDialog = (override) => this.setAddPrinterDialog(true, override);
|
openAddPrinterDialog = (override) => this.setAddPrinterDialog(true, override);
|
||||||
setAddPrinterDialog = (open, override = {}) => this.setState({
|
setAddPrinterDialog = (open, override = {}) => {
|
||||||
|
if (open) {
|
||||||
|
DOODLE_3D_MANAGER.setAutoUpdate(true, 10000);
|
||||||
|
} else {
|
||||||
|
DOODLE_3D_MANAGER.setAutoUpdate(false);
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
addPrinter: {
|
addPrinter: {
|
||||||
ip: '',
|
ip: '',
|
||||||
name: '',
|
name: '',
|
||||||
@ -371,12 +376,22 @@ class Settings extends React.Component {
|
|||||||
...override
|
...override
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
closeManagePrinterDialog = () => this.setManagePrinterDialog(false);
|
closeManagePrinterDialog = () => this.setManagePrinterDialog(false);
|
||||||
openManagePrinterDialog = () => this.setManagePrinterDialog(true);
|
openManagePrinterDialog = () => this.setManagePrinterDialog(true);
|
||||||
setManagePrinterDialog = (open) => {
|
setManagePrinterDialog = (open) => {
|
||||||
const { localStorage: { active, printers } } = this.state;
|
const { localStorage: { active, printers } } = this.state;
|
||||||
if (!active) return this.setState({ managePrinter: { open: false } });
|
if (!active) {
|
||||||
|
DOODLE_3D_MANAGER.setAutoUpdate(false);
|
||||||
|
return this.setState({ managePrinter: { open: false } });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (open) {
|
||||||
|
DOODLE_3D_MANAGER.setAutoUpdate(true, 10000);
|
||||||
|
} else {
|
||||||
|
DOODLE_3D_MANAGER.setAutoUpdate(false);
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
managePrinter: {
|
managePrinter: {
|
||||||
open,
|
open,
|
||||||
|
Loading…
Reference in New Issue
Block a user