import PropTypes from 'prop-types'; // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import React from 'react'; import * as Utils from 'utils/utils.jsx'; import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; import {ldapSyncNow} from 'actions/admin_actions.jsx'; export default class SyncNowButton extends React.Component { static get propTypes() { return { disabled: PropTypes.bool }; } constructor(props) { super(props); this.handleSyncNow = this.handleSyncNow.bind(this); this.state = { buisy: false, fail: null }; } handleSyncNow(e) { e.preventDefault(); this.setState({ buisy: true, fail: null }); ldapSyncNow( () => { this.setState({ buisy: false }); }, (err) => { this.setState({ buisy: false, fail: err.message + ' - ' + err.detailed_error }); } ); } render() { let failMessage = null; if (this.state.fail) { failMessage = (