UNPKG

stitch-ui

Version:

82 lines (78 loc) 2.41 kB
import React from "react"; // eslint-disable-line no-unused-vars import { connect } from "react-redux"; import { AlertContainer } from "../../../alert"; import * as actions from "../../actions"; import { Banner, Spinner, FormRow, FormRowInputGroup, FormRowLabelGroup, Button } from "../../../core"; import { BaseConfigEditor } from "../../config"; const INPUT_TEAMID = "teamId"; const INPUT_INCOMING_WEBHOOK_URL = "incomingWebhookUrl"; class EditConfig extends BaseConfigEditor { render() { const { configSaveError, savingConfig, serviceConfigInputs, alertKey } = this.props; return ( <div className="service-config"> <Banner message={configSaveError} error /> <FormRow> <FormRowLabelGroup> <label className="form-row-label" htmlFor="teamId"> Team ID </label> </FormRowLabelGroup> <FormRowInputGroup> <input type="text" className="text-input form-row-text-input" placeholder="Team ID" name={INPUT_TEAMID} value={serviceConfigInputs.get(INPUT_TEAMID)} onChange={e => this.setConfigInput(INPUT_TEAMID, e)} /> </FormRowInputGroup> </FormRow> <FormRow last> <FormRowLabelGroup> <label className="form-row-label" htmlFor={INPUT_INCOMING_WEBHOOK_URL} > Incoming Webhook URL </label> </FormRowLabelGroup> <FormRowInputGroup> <input type="text" className="text-input form-row-text-input" placeholder="Incoming Webhook URL" name={INPUT_INCOMING_WEBHOOK_URL} value={serviceConfigInputs.get(INPUT_INCOMING_WEBHOOK_URL)} onChange={e => this.setConfigInput(INPUT_INCOMING_WEBHOOK_URL, e)} /> </FormRowInputGroup> </FormRow> <div> <Button default disabled={savingConfig} onClick={this.saveConfig}> Save </Button> <Spinner open={savingConfig} /> <AlertContainer alertKey={alertKey} /> </div> </div> ); } } export default connect( actions.configEditMapper.mapStateToProps, actions.configEditMapper.mapDispatchToProps )(EditConfig);