From 25815ab4916dc8c9e3256cbfe53bea0535930f30 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 4 Sep 2018 13:53:30 +0200 Subject: fix loading bars --- app/client/common/index.js | 4 +- app/client/common/numberInput.component.js | 49 +++++++ app/client/common/textInput.component.js | 7 +- app/client/dashboard/dashboard.actions.js | 6 +- app/client/dashboard/dashboard.component.js | 12 +- app/client/dashboard/dashboard.reducer.js | 10 ++ app/client/dashboard/dashboardHeader.component.js | 1 - app/client/dataset/dataset.reducer.js | 1 + app/client/modules/morph/morph.actions.js | 6 +- app/client/modules/pix2pixhd/index.js | 1 + app/client/modules/pix2pixhd/pix2pixhd.actions.js | 12 +- app/client/modules/pix2pixhd/pix2pixhd.tasks.js | 32 +++++ .../modules/pix2pixhd/views/pix2pixhd.live.js | 3 +- .../modules/pix2pixhd/views/pix2pixhd.train.js | 156 +++++++++++++++++++++ app/client/modules/samplernn/samplernn.actions.js | 12 +- app/relay/modules/pix2pixhd.js | 67 +++++++-- 16 files changed, 350 insertions(+), 29 deletions(-) create mode 100644 app/client/common/numberInput.component.js create mode 100644 app/client/modules/pix2pixhd/views/pix2pixhd.train.js (limited to 'app') diff --git a/app/client/common/index.js b/app/client/common/index.js index 025b56c..eeb8bfc 100644 --- a/app/client/common/index.js +++ b/app/client/common/index.js @@ -8,6 +8,7 @@ import Gallery from './gallery.component' import Group from './group.component' import Header from './header.component' import Loading from './loading.component' +import NumberInput from './numberInput.component' import Param from './param.component' import ParamGroup from './paramGroup.component' import Player from './player.component' @@ -24,6 +25,7 @@ export { FolderList, FileList, FileRow, FileUpload, Gallery, Player, Group, ParamGroup, Param, - TextInput, Slider, Select, SelectGroup, Button, Checkbox, + TextInput, NumberInput, + Slider, Select, SelectGroup, Button, Checkbox, CurrentTask, } \ No newline at end of file diff --git a/app/client/common/numberInput.component.js b/app/client/common/numberInput.component.js new file mode 100644 index 0000000..c3ad24c --- /dev/null +++ b/app/client/common/numberInput.component.js @@ -0,0 +1,49 @@ +import { h, Component } from 'preact' + +class NumberInput extends Component { + constructor(props){ + super(props) + this.state = { value: null, changed: false } + this.handleInput = this.handleInput.bind(this) + this.handleKeydown = this.handleKeydown.bind(this) + } + handleInput(e){ + this.setState({ + value: e.target.value, + changed: true, + }) + this.props.onInput && this.props.onInput(e.target.value, e.target.name) + } + handleKeydown(e){ + if (e.keyCode === 13) { + this.setState({ + value: e.target.value, + changed: false, + }) + this.props.onSave && this.props.onSave(e.target.value, e.target.name) + } + } + render() { + return ( +
+ +
+ ) + } +} + +export default NumberInput diff --git a/app/client/common/textInput.component.js b/app/client/common/textInput.component.js index a3739d4..44e1349 100644 --- a/app/client/common/textInput.component.js +++ b/app/client/common/textInput.component.js @@ -12,7 +12,7 @@ class TextInput extends Component { value: e.target.value, changed: true, }) - this.props.onInput && this.props.onInput(e.target.value) + this.props.onInput && this.props.onInput(e.target.value, e.target.name) } handleKeydown(e){ if (e.keyCode === 13) { @@ -20,7 +20,7 @@ class TextInput extends Component { value: e.target.value, changed: false, }) - this.props.onSave && this.props.onSave(e.target.value) + this.props.onSave && this.props.onSave(e.target.value, e.target.name) } } render() { @@ -29,7 +29,8 @@ class TextInput extends Component {