Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
Add config item error field
Browse files Browse the repository at this point in the history
  • Loading branch information
sgalsaleh committed Feb 21, 2020
1 parent 83d1a45 commit 40e01ad
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions web/init/src/components/config_render/ConfigFileInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default class ConfigFileInput extends React.Component {
recommended={this.props.recommended}
required={this.props.required}
name={this.props.name}
error={this.props.error}
/>
: null}
<div className="input input-type-file clearfix">
Expand Down
5 changes: 3 additions & 2 deletions web/init/src/components/config_render/ConfigGroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import isEmpty from "lodash/isEmpty";
import { ConfigService } from "../../services/ConfigService";

import ConfigInput from "./ConfigInput";
import ConfixTextarea from "./ConfigTextarea";
import ConfigTextarea from "./ConfigTextarea";
import ConfigSelectOne from "./ConfigSelectOne";
import ConfigItemTitle from "./ConfigItemTitle";
import ConfigCheckbox from "./ConfigCheckbox";
Expand Down Expand Up @@ -38,7 +38,7 @@ export default class ConfigGroup extends React.Component {
);
case "textarea":
return (
<ConfixTextarea
<ConfigTextarea
key={`${i}-${item.name}`}
handleOnChange={this.handleItemChange}
hidden={item.hidden}
Expand Down Expand Up @@ -66,6 +66,7 @@ export default class ConfigGroup extends React.Component {
hidden={item.hidden}
when={item.when}
name={item.name}
error={item.error}
/>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions web/init/src/components/config_render/ConfigInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default class ConfigInput extends React.Component {
recommended={this.props.recommended}
required={this.props.required}
name={this.props.name}
error={this.props.error}
/>
: null}
{this.props.help_text !== "" ? <p className="field-section-help-text u-marginTop--small u-lineHeight--normal">{this.props.help_text}</p> : null}
Expand Down
6 changes: 4 additions & 2 deletions web/init/src/components/config_render/ConfigItemTitle.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import Markdown from "react-remarkable";
import classNames from "classnames";

export default class ConfigItemTitle extends React.Component {

Expand All @@ -9,7 +10,8 @@ export default class ConfigItemTitle extends React.Component {
recommended,
required,
hidden,
when
when,
error = ""
} = this.props;

var isHidden = hidden || when === "false" || (!title && !required && !recommended);
Expand Down Expand Up @@ -38,7 +40,7 @@ export default class ConfigItemTitle extends React.Component {
recommended ?
<span className="field-label recommended">Recommended</span> :
null}
<span className="u-marginLeft--small config-errblock" id={`${this.props.name}-errblock`}></span>
<span className={classNames("u-marginLeft--small config-errblock", { "visible": !!error })} id={`${this.props.name}-errblock`}>{error || ""}</span>
</div>
</h4>
);
Expand Down
1 change: 1 addition & 0 deletions web/init/src/components/config_render/ConfigSelectOne.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default class ConfigSelectOne extends React.Component {
recommended={this.props.recommended}
required={this.props.required}
name={this.props.name}
error={this.props.error}
/>
: null}
{this.props.help_text !== "" ? <p className="field-section-help-text u-marginTop--small u-lineHeight--normal">{this.props.help_text}</p> : null}
Expand Down
1 change: 1 addition & 0 deletions web/init/src/components/config_render/ConfigTextarea.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default class ConfigTextarea extends React.Component {
recommended={this.props.recommended}
required={this.props.required}
name={this.props.name}
error={this.props.error}
/>
: null}
{this.props.help_text !== "" ? <p className="field-section-help-text u-marginTop--small u-lineHeight--normal">{this.props.help_text}</p> : null}
Expand Down

0 comments on commit 40e01ad

Please sign in to comment.