diff --git a/src/index.js b/src/index.js index 3afa5e7..f561b92 100644 --- a/src/index.js +++ b/src/index.js @@ -1,7 +1,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { Fetch } from './fetch.js'; -import { ProvideDB, DBQueryConsole, DBTypeEnum, DBSourceEnum } from './database.js'; +import { ProvideDB, DBQueryConsole, DBQueryBar, DBTypeEnum, DBSourceEnum } from './database.js'; import { PhotoView, PhotoThumbView, PhotoTableLine } from './media.js'; import { do_image_query, image_query_with_where } from './queries.js'; @@ -48,6 +48,36 @@ export class PhotoFromDB extends React.Component { } } +export class ImageWhereConsole extends React.Component { + state = { + processing: false, + result: false, + where: "", + } + + onQueryChangeHandler = whereclause => { this.setState({ where: whereclause }); } + onQuerySubmitHandler = () => { + this.setState({ processing: true, result: false }); + this.props.database.queries_async([image_query_with_where(this.state.where)]) + .then(result => { + this.setState({ processing: false, result: JSON.stringify(result) }); + }); + } + + render() { + return ( + <> +
Result:
+ {this.state.result &&{this.state.result}
} +