| | |
| | | systemScripts: [], |
| | | median: {}, |
| | | visible: false, |
| | | editLineId: '', |
| | | pvisible: false, |
| | | reload: false, |
| | | script: null, |
| | |
| | | return |
| | | } |
| | | |
| | | let editLineId = '' |
| | | if (script) { |
| | | editLineId = script.uuid |
| | | _scripts = _scripts.map(item => { |
| | | if (script.uuid === item.uuid) { |
| | | item.sql = scriptValue |
| | |
| | | status: 'true' |
| | | } |
| | | |
| | | editLineId = _script.uuid |
| | | _scripts.push(_script) |
| | | } |
| | | |
| | | this.setState({loading: true}) |
| | | this.setState({loading: true, editLineId}) |
| | | |
| | | this.sqlverify(() => {this.setState({scripts: _scripts, script: null, scriptValue: '', loading: false})}, () => {this.setState({loading: false})}, 'script', _scripts) |
| | | } |
| | |
| | | |
| | | render() { |
| | | const { config } = this.props |
| | | const { columns, subColumns, median, setting, scripts, colColumns, scriptsColumns, activeKey, loading, searches, defaultsql, visible, pvisible, reload, script, scriptValue, searchKey } = this.state |
| | | const { columns, subColumns, median, setting, scripts, colColumns, scriptsColumns, activeKey, loading, searches, defaultsql, visible, pvisible, reload, script, scriptValue, searchKey, editLineId } = this.state |
| | | |
| | | return ( |
| | | <div className="model-data-source-wrap"> |
| | |
| | | }) |
| | | return |
| | | } |
| | | this.setState({visible: true, script: null, scriptValue: ''}) |
| | | this.setState({visible: true, script: null, scriptValue: '', editLineId: ''}) |
| | | }}/> : null} |
| | | <CustomScriptsForm |
| | | type={config.type} |
| | |
| | | </div> |
| | | ) |
| | | } else { |
| | | let sign = '' |
| | | if (script && script.uuid === item.uuid) { |
| | | sign = 'active' |
| | | } else if (editLineId === item.uuid) { |
| | | sign = 'edited' |
| | | } |
| | | return ( |
| | | <div className={'script-item ' + (script && script.uuid === item.uuid ? 'active' : '') } key={item.uuid}> |
| | | <div className={'script-item ' + sign} key={item.uuid}> |
| | | <div style={{cursor: 'pointer'}} onClick={() => { |
| | | this.setState({script: item, scriptValue: item.sql}) |
| | | }}> |