diff --git a/ui/src/pages/Applications.js b/ui/src/pages/Applications.js index 5f05c66..393bafd 100644 --- a/ui/src/pages/Applications.js +++ b/ui/src/pages/Applications.js @@ -14,10 +14,13 @@ import * as AppAction from '../actions/AppAction'; import DefaultPage from '../component/DefaultPage'; import PropTypes from 'prop-types'; import Delete from 'material-ui-icons/Delete'; +import Avatar from 'material-ui/Avatar'; +import Edit from 'material-ui-icons/Edit'; class Applications extends Component { constructor() { super(); + this.uploadId = -1; this.state = {apps: [], createDialog: false, deleteId: -1}; } @@ -32,6 +35,22 @@ class Applications extends Component { updateApps = () => this.setState({...this.state, apps: AppStore.get()}); + uploadImage = (id) => { + this.uploadId = id; + this.upload.click(); + }; + onUploadImage = (e) => { + const file = e.target.files[0]; + if (!file) { + return; + } + if (['image/png', 'image/jpeg', 'image/gif'].indexOf(file['type']) !== -1) { + AppAction.uploadImage(this.uploadId, file); + } else { + alert('Uploaded file must be of type png, jpeg or gif.'); + } + }; + showCreateDialog = () => this.setState({...this.state, createDialog: true}); hideCreateDialog = () => this.setState({...this.state, createDialog: false}); @@ -48,6 +67,7 @@ class Applications extends Component {