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

Commit f501390

Browse files
author
Ben Junya
authored
Required config check (#1006)
Required config check
2 parents 695a6c3 + 6b0c050 commit f501390

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

web/init/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@replicatedhq/ship-init",
3-
"version": "1.6.6",
3+
"version": "1.6.7",
44
"description": "Shared component that contains the Ship Init app",
55
"author": "Replicated, Inc.",
66
"license": "Apache-2.0",

web/init/src/components/config_only/ConfigOnly.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ export default class ConfigOnly extends React.Component {
145145
const { configErrors } = this.props;
146146
if (!configErrors.length) return;
147147
configErrors.map((err) => {
148+
// TODO: Refactor to pass errors down instead of manipulating
149+
// the DOM
148150
const el = document.getElementById(`${err.fieldName}-errblock`);
149151
el.innerHTML = err.message;
150152
el.classList.add("visible");

web/init/src/components/config_render/ConfigGroup.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import isEmpty from "lodash/isEmpty";
77
import { ConfigService } from "../../services/ConfigService";
88

99
import ConfigInput from "./ConfigInput";
10-
import ConfigTextara from "./ConfigTextarea";
10+
import ConfixTextarea from "./ConfigTextarea";
1111
import ConfigSelectOne from "./ConfigSelectOne";
1212
import ConfigItemTitle from "./ConfigItemTitle";
1313
import ConfigCheckbox from "./ConfigCheckbox";
@@ -37,7 +37,7 @@ export default class ConfigGroup extends React.Component {
3737
);
3838
case "textarea":
3939
return (
40-
<ConfigTextara
40+
<ConfixTextarea
4141
key={`${i}-${item.name}`}
4242
handleOnChange={this.handleItemChange}
4343
hidden={item.hidden}

web/init/src/components/config_render/ConfigInput.jsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ export default class ConfigInput extends React.Component {
3131
this.setState({ inputVal: this.props.value });
3232
}
3333
}
34-
34+
// p1-2019-06-27
35+
// Fields that are required sometimes don't have a title associated with them.
36+
// Use title -OR- required prop to render <ConfigItemTitle> to make sure error
37+
// elements are rendered.
3538
render() {
3639
return (
3740
<div className={`field field-type-text ${this.props.hidden ? "hidden" : "u-marginTop--15"}`}>
38-
{this.props.title !== "" ?
41+
{this.props.title !== "" || this.props.required ?
3942
<ConfigItemTitle
4043
title={this.props.title}
4144
recommended={this.props.recommended}

0 commit comments

Comments
 (0)