summaryrefslogtreecommitdiff
path: root/app/client
diff options
context:
space:
mode:
Diffstat (limited to 'app/client')
-rw-r--r--app/client/common/buttonGrid.component.js73
-rw-r--r--app/client/common/currentTask.component.js6
-rw-r--r--app/client/modules/pix2pixhd/pix2pixhd.actions.js25
-rw-r--r--app/client/socket/socket.actions.js1
-rw-r--r--app/client/system/system.actions.js11
-rw-r--r--app/client/types.js2
6 files changed, 88 insertions, 30 deletions
diff --git a/app/client/common/buttonGrid.component.js b/app/client/common/buttonGrid.component.js
index 4b86d62..6c7c105 100644
--- a/app/client/common/buttonGrid.component.js
+++ b/app/client/common/buttonGrid.component.js
@@ -1,32 +1,51 @@
import { h, Component } from 'preact'
-export default function ButtonGrid(props) {
- const max = props.max || Infinity
- return (
- <table className='buttonGrid'>
- <tr className='row'>
- <th>{" "}</th>
- {props.x.map(x => (
- <th>{x}</th>
- ))}
- </tr>
- {props.y.map(y => (
+export default class ButtonGrid extends Component {
+ state = {
+ x: 0, y: 0,
+ }
+
+ render() {
+ const {
+ x: _x,
+ y: _y,
+ } = this.state
+ const {
+ x: X,
+ y: Y,
+ max = Infinity,
+ onClick,
+ onHover,
+ } = this.props
+ return (
+ <table className='buttonGrid'>
<tr className='row'>
- <th>{y}</th>
- {props.x.map(x => (
- <td>
- {x * y > max ? " " :
- <button
- onClick={() => props.onClick(x, y)}
- onMouseEnter={() => props.onHover(x, y)}
- >
- {" "}
- </button>
- }
- </td>
+ <th>{" "}</th>
+ {X.map(x => (
+ <th className={x === _x && 'bold'}>{x}</th>
))}
- </tr>
- ))}
- </table>
- )
+ </tr>
+ {Y.map(y => (
+ <tr className='row'>
+ <th className={y === _y && 'bold'}>{y}</th>
+ {X.map(x => (
+ <td>
+ {x * y > max ? " " :
+ <button
+ onClick={() => onClick(x, y)}
+ onMouseEnter={() => {
+ this.setState({ x, y })
+ onHover(x, y)
+ }}
+ >
+ {" "}
+ </button>
+ }
+ </td>
+ ))}
+ </tr>
+ ))}
+ </table>
+ )
+ }
}
diff --git a/app/client/common/currentTask.component.js b/app/client/common/currentTask.component.js
index a4d9750..3c71a88 100644
--- a/app/client/common/currentTask.component.js
+++ b/app/client/common/currentTask.component.js
@@ -22,10 +22,10 @@ function CurrentTask ({ cpu, gpu, processor }) {
const { last_message, pid, task } = p
const { activity, epoch, epochs, dataset, module } = task
return (
- <div>
+ <div className='currentTask'>
#{pid}: <b>{module} {activity}</b> <i>{dataset}</i>
- {epochs
- ? <span>{epoch} epoch{util.courtesy_s(epoch)}</span>
+ {!!epochs
+ ? <span>{epochs} epoch{util.courtesy_s(epochs)}</span>
: ""}
{epoch
? <span>(currently #{epoch})</span>
diff --git a/app/client/modules/pix2pixhd/pix2pixhd.actions.js b/app/client/modules/pix2pixhd/pix2pixhd.actions.js
index c1cd2b1..811f913 100644
--- a/app/client/modules/pix2pixhd/pix2pixhd.actions.js
+++ b/app/client/modules/pix2pixhd/pix2pixhd.actions.js
@@ -200,4 +200,29 @@ export const list_epochs = (checkpoint_name) => (dispatch) => {
},
})
})
+}
+
+export const count_sequence_dataset = (checkpoint_name) => (dispatch) => {
+ const module = pix2pixhdModule.name
+ util.allProgress([
+ actions.socket.count_directory({ module, dir: 'sequences/' + checkpoint_name + '/' }),
+ actions.socket.count_directory({ module, dir: 'datasets/' + checkpoint_name + '/train_A/' }),
+ ], (percent, i, n) => {
+ console.log('pix2pixhd load progress', i, n)
+ dispatch({
+ type: types.app.load_progress,
+ progress: { i, n },
+ data: { module: 'pix2pixhd' },
+ })
+ }).then(res => {
+ const [sequenceCount, datasetCount] = res //, datasets, results, output, datasetUsage, lossReport] = res
+ console.log(sequenceCount, datasetCount)
+ dispatch({
+ type: types.pix2pixhd.load_results,
+ results: {
+ sequenceCount,
+ datasetCount,
+ }
+ })
+ })
} \ No newline at end of file
diff --git a/app/client/socket/socket.actions.js b/app/client/socket/socket.actions.js
index 78b0517..b80a0fa 100644
--- a/app/client/socket/socket.actions.js
+++ b/app/client/socket/socket.actions.js
@@ -4,6 +4,7 @@ import { socket } from './socket.connection'
export const run_system_command = opt => syscall_async('run_system_command', opt)
export const disk_usage = opt => syscall_async('run_system_command', { cmd: 'du', ...opt })
export const list_directory = opt => syscall_async('list_directory', opt).then(res => res.files)
+export const count_directory = opt => syscall_async('count_directory', opt).then(res => res.count)
export const list_sequences = opt => syscall_async('list_sequences', opt).then(res => res.sequences)
export const run_script = opt => syscall_async('run_script', opt)
export const upload_file = opt => syscall_async('upload_file', opt)
diff --git a/app/client/system/system.actions.js b/app/client/system/system.actions.js
index a34bd58..ccd9acd 100644
--- a/app/client/system/system.actions.js
+++ b/app/client/system/system.actions.js
@@ -25,6 +25,17 @@ export const listDirectory = (opt) => (dispatch) => {
})
}
+export const countDirectory = (opt) => (dispatch) => {
+ dispatch({ type: types.system.counting_directory, opt })
+ socket.actions.count_directory(opt)
+ .then(data => {
+ dispatch({
+ type: types.system.count_directory,
+ data: data,
+ })
+ })
+}
+
export const changeTool = (tool) => {
localStorage.setItem('system.last_tool', tool)
return { type: types.app.change_tool, tool }
diff --git a/app/client/types.js b/app/client/types.js
index 2df494b..b551a3c 100644
--- a/app/client/types.js
+++ b/app/client/types.js
@@ -11,6 +11,8 @@ export default {
rpc_disconnected: 'SYSTEM_RPC_DISCONNECTED',
list_directory: 'SYSTEM_LIST_DIRECTORY',
listing_directory: 'SYSTEM_LISTING_DIRECTORY',
+ count_directory: 'SYSTEM_COUNT_DIRECTORY',
+ counting_directory: 'SYSTEM_COUNTING_DIRECTORY',
stdout: 'SYSTEM_STDOUT',
stderr: 'SYSTEM_STDERR',
},