diff --git a/console/src/components/Services/EventTrigger/Add/AddTrigger.js b/console/src/components/Services/EventTrigger/Add/AddTrigger.js index ee5af1a146e..a48f497fc2c 100644 --- a/console/src/components/Services/EventTrigger/Add/AddTrigger.js +++ b/console/src/components/Services/EventTrigger/Add/AddTrigger.js @@ -26,21 +26,58 @@ import { showErrorNotification } from '../Notification'; import { createTrigger } from './AddActions'; import { fetchTableListBySchema } from './AddActions'; +import semverCheck from '../../../../helpers/semver'; + class AddTrigger extends Component { constructor(props) { super(props); this.props.dispatch(fetchTableListBySchema('public')); - this.state = { advancedExpanded: false }; + this.state = { + advancedExpanded: false, + supportColumnChangeFeature: false, + }; } componentDidMount() { // set defaults this.props.dispatch(setDefaults()); + if (this.props.serverVersion) { + this.checkSemVer(this.props.serverVersion); + } + } + componentWillReceiveProps(nextProps) { + if (nextProps.serverVersion !== this.props.serverVersion) { + this.checkSemVer(nextProps.serverVersion); + } } componentWillUnmount() { // set defaults this.props.dispatch(setDefaults()); } + checkSemVer(version) { + try { + const supportColumnChangeFeature = semverCheck( + 'supportColumnChangeTrigger', + version + ); + if (supportColumnChangeFeature) { + this.updateSupportColumnChangeFeature(true); + } else { + this.updateSupportColumnChangeFeature(false); + } + } catch (e) { + this.updateSupportColumnChangeFeature(false); + console.error(e); + } + } + + updateSupportColumnChangeFeature(val) { + this.setState({ + ...this.state, + supportColumnChangeFeature: val, + }); + } + submitValidation(e) { // validations e.preventDefault(); @@ -136,6 +173,9 @@ class AddTrigger extends Component { internalError, headers, } = this.props; + + const { supportColumnChangeFeature } = this.state; + const styles = require('../TableCommon/Table.scss'); let createBtnText = 'Create'; if (ongoingRequest) { @@ -216,6 +256,94 @@ class AddTrigger extends Component { return null; }; + const advancedColumnSection = supportColumnChangeFeature ? ( +
+

+ Listen columns for update     + +