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

Commit

Permalink
feat(ui): minor fixes to new functionalities
Browse files Browse the repository at this point in the history
refs: #181
  • Loading branch information
ChrisRousey committed Mar 21, 2023
1 parent 79b7c91 commit 6ae2f28
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 28 deletions.
47 changes: 26 additions & 21 deletions ui/src/containers/configs/EditConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class EditConfig extends Component {

handleEventChange(event) {
let stream = this.state.stream;
let config = this.state.config;

const newValue =
event.target.type === "checkbox"
Expand All @@ -162,6 +163,10 @@ class EditConfig extends Component {
stream["spec"]["kafka"]["topic"]["config"][event.target.name] =
newValue;
break;
case "metadata.labels":
config.metadata.labels[event.target.name] =
newValue;
break;
default:
stream[event.target.name] = newValue;
break;
Expand All @@ -170,33 +175,34 @@ class EditConfig extends Component {
creatingConfigFailed: false,
errorMessage: "",
stream: stream,
config: config,
});
this.updateConfigSpec();
}

handleChange(name, value, prefix) {
let config = this.state.config;
let deployment = this.state.deployment;
let stream = this.state.stream;
let config = this.state.config;
let deployment = this.state.deployment;
let stream = this.state.stream;

if(prefix === undefined){
prefix = "";
}
if(prefix === undefined){
prefix = "";
}

if(prefix === "deployment.spec"){
deployment.spec[name] = value;
} else{
config[name] = value;
}
if(prefix === "deployment.spec"){
deployment.spec[name] = value;
} else{
config[name] = value;
}

this.setState({
creatingConfigFailed: false,
errorMessage: "",
config: config,
deployment: deployment,
stream: stream,
});
this.updateConfigSpec();
this.setState({
creatingConfigFailed: false,
errorMessage: "",
config: config,
deployment: deployment,
stream: stream,
});
this.updateConfigSpec();
}

removeLabel(event) {
Expand Down Expand Up @@ -283,7 +289,6 @@ class EditConfig extends Component {
if (config == null) {
return <></>;
}
console.log(config);

const kindOptions = getConfigKindOptions();
const defaultKind = "STREAM";
Expand Down Expand Up @@ -397,7 +402,7 @@ return (
id={labels}
data-prefix="metadata.labels"
name={labels}
onChange={this.handleChange}
onChange={this.handleEventChange}
value={this.state.config.metadata.labels[labels] || ""}
/>
</div>
Expand Down
8 changes: 7 additions & 1 deletion ui/src/containers/configs/NewConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class NewConfig extends Component {

handleEventChange(event) {
let stream = this.state.stream;
let config = this.state.config;

const newValue =
event.target.type === "checkbox"
Expand All @@ -161,6 +162,10 @@ class NewConfig extends Component {
stream["spec"]["kafka"]["topic"]["config"][event.target.name] =
newValue;
break;
case "metadata.labels":
config.metadata.labels[event.target.name] =
newValue;
break;
default:
stream[event.target.name] = newValue;
break;
Expand All @@ -169,6 +174,7 @@ class NewConfig extends Component {
creatingConfigFailed: false,
errorMessage: "",
stream: stream,
config: config,
});
this.updateConfigSpec();
}
Expand Down Expand Up @@ -386,7 +392,7 @@ class NewConfig extends Component {
id={labels}
data-prefix="metadata.labels"
name={labels}
onChange={this.handleChange}
onChange={this.handleEventChange}
value={this.state.config.metadata.labels[labels] || ""}
/>
</div>
Expand Down
6 changes: 0 additions & 6 deletions ui/src/containers/configs/ShowConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ class ShowConfig extends Component {
>
Edit
</a>
<a
href={`/configs/${config.uuid}/inspect`}
className="btn btn-light ms-2"
>
Inspect
</a>
<a
href={`/configs/${config.uuid}`}
onClick={this.handleDelete}
Expand Down
5 changes: 5 additions & 0 deletions ui/src/containers/streams/EditStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ class EditStream extends Component {
event.preventDefault();
const tempLabel = this.state.tempLabel;
let stream = this.state.stream;

if(stream.configSelector == null){
stream.configSelector = {};
}

stream.configSelector[tempLabel.labelKey] = tempLabel.labelValue;
this.setState({ stream: stream, tempLabel: tempLabel });
}
Expand Down

0 comments on commit 6ae2f28

Please sign in to comment.