import React from 'react'; import { ButtonGroup } from 'react-bootstrap'; import Link from './Link'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import * as Actions from '../actions'; import shortid from 'shortid'; // CSS import 'react-select/dist/react-select.css'; class TableWorkspaceElement extends React.Component { selectStar() { let cols = ''; this.props.table.columns.forEach((col, i) => { cols += col.name; if (i < this.props.table.columns.length - 1) { cols += ', '; } }); const sql = `SELECT ${cols}\nFROM ${this.props.table.name}`; const qe = { id: shortid.generate(), title: this.props.table.name, dbId: this.props.table.dbId, autorun: true, sql, }; this.props.actions.addQueryEditor(qe); } render() { let metadata = null; let buttonToggle; if (!this.props.table.expanded) { buttonToggle = ( {this.props.table.name} ); metadata = this.props.table.columns.map((col) =>