After create/delete, refresh database list
parent
50a0ae90d5
commit
0e4113de23
|
@ -6,7 +6,7 @@ import VisView from 'src/data_explorer/components/VisView'
|
|||
import {GRAPH, TABLE} from 'shared/constants'
|
||||
import _ from 'lodash'
|
||||
|
||||
const META_QUERY_REGEX = /^show/i
|
||||
const META_QUERY_REGEX = /^(show|create|drop)/i
|
||||
|
||||
class Visualization extends Component {
|
||||
constructor(props) {
|
||||
|
|
|
@ -45,12 +45,18 @@ const DatabaseList = React.createClass({
|
|||
this.getDbRp()
|
||||
},
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if (_.isEqual(prevProps.querySource, this.props.querySource)) {
|
||||
return
|
||||
}
|
||||
componentDidUpdate({querySource: prevSource, query: prevQuery}) {
|
||||
const {querySource: nextSource, query: nextQuery} = this.props
|
||||
const differentSource = !_.isEqual(prevSource, nextSource)
|
||||
|
||||
this.getDbRp()
|
||||
const newMetaQuery =
|
||||
prevQuery.rawText !== nextQuery.rawText &&
|
||||
nextQuery.rawText &&
|
||||
nextQuery.rawText.match(/^(create|drop)/)
|
||||
|
||||
if (differentSource || newMetaQuery) {
|
||||
setTimeout(this.getDbRp, 100)
|
||||
}
|
||||
},
|
||||
|
||||
getDbRp() {
|
||||
|
|
Loading…
Reference in New Issue