Skip to content

Commit

Permalink
Merge pull request #1385 from TheThingsNetwork/feature/1281-console-p…
Browse files Browse the repository at this point in the history
…ubsub-integrations

Add PubSub integrations to the console
  • Loading branch information
kschiffer authored Sep 30, 2019
2 parents 53cee6a + 78cf2c1 commit 675dba4
Show file tree
Hide file tree
Showing 34 changed files with 1,674 additions and 68 deletions.
5 changes: 3 additions & 2 deletions pkg/webui/components/file-input/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default class FileInput extends Component {
const { maxSize } = this.props
const { files } = event.target

if (files[0].size <= maxSize) {
if (files && files[0] && files[0].size <= maxSize) {
this.setState({ filename: files[0].name, error: undefined })
this.reader.readAsDataURL(files[0])
} else {
Expand All @@ -103,7 +103,7 @@ export default class FileInput extends Component {
const { onChange } = this.props

this.setState({ filename: '', error: undefined })
onChange(undefined, true)
onChange('', true)
}

get statusMessage() {
Expand Down Expand Up @@ -145,6 +145,7 @@ export default class FileInput extends Component {
return (
<div className={style.container}>
<Button
type="button"
aria-controls="fileupload"
onClick={this.handleChooseClick}
disabled={disabled}
Expand Down
5 changes: 4 additions & 1 deletion pkg/webui/components/table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ class Tabular extends React.Component {
return (
<Table.Row key={rowKey} id={rowKey} onClick={onRowClick}>
{headers.map(function(header, index) {
const value = getByPath(row, headers[index].name)
const value = headers[index].getValue
? headers[index].getValue(row)
: getByPath(row, headers[index].name)
return (
<Table.DataCell key={index} centered={header.centered} small={small}>
{headers[index].render ? headers[index].render(value) : value}
Expand Down Expand Up @@ -192,6 +194,7 @@ Tabular.propTypes = {
headers: PropTypes.arrayOf(
PropTypes.shape({
displayName: PropTypes.message.isRequired,
getValue: PropTypes.func,
name: PropTypes.string.isRequired,
render: PropTypes.func,
centered: PropTypes.bool,
Expand Down
Loading

0 comments on commit 675dba4

Please sign in to comment.