Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Ansible add directory UI layout #9877

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ export class AnsibleControlNode extends React.Component<PropsType, StateType> {
<NewAnsiblePath
title={t("Add an Inventory file")}
pathType="inventory"
newInventoryPath={this.state.newInventoryPath}
// TODO: @parlt91: Is this bugfix correct?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@parlt91 I added missing types to NewAnsiblePath and found that this prop was not actually connected to anything. I'm guessing it should be the change I made, but I'm not sure and don't know how to test, can you please confirm?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that this is definitely how it should be. This is setting the TextFields value prop, but since it's always empty to begin with and not used anywhere it didn't actually cause any issues. I'd still keep your fix in place though.

newPathValue={this.state.newInventoryPath}
placeholder={t("e.g., /etc/ansible/testing/hosts")}
newPath={(path: string) => this.newPath("inventory", path)}
savePath={() => this.savePath("inventory")}
Expand Down
43 changes: 28 additions & 15 deletions web/html/src/manager/minion/ansible/new-ansible-path.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,39 @@ import * as React from "react";
import { AsyncButton } from "components/buttons";
import { TextField } from "components/fields";

const NewAnsiblePath = (props) => {
type Props = {
title: string;
pathType: string;
newPathValue: string;
newPath: (value: string) => any;
placeholder?: string;
savePath: (...args: any) => any;
};

const NewAnsiblePath = (props: Props) => {
return (
<>
<h4>{props.title}</h4>
<div className="form-group">
<TextField
id={"new_" + props.pathType + "_path_input"}
placeholder={props.placeholder}
value={props.newPathValue}
onChange={(e: any) => props.newPath(e.target.value.toString())}
/>
<div>
<TextField
id={"new_" + props.pathType + "_path_input"}
placeholder={props.placeholder}
value={props.newPathValue}
onChange={(e: any) => props.newPath(e.target.value.toString())}
/>
</div>
</div>
<div className="pull-right btn-group">
<AsyncButton
id={"new_" + props.pathType + "_path_save"}
action={props.savePath}
defaultType="btn-primary"
text={t("Save")}
icon="fa-save"
/>
<div className="d-flex justify-content-end">
<div className="btn-group">
<AsyncButton
id={"new_" + props.pathType + "_path_save"}
action={props.savePath}
defaultType="btn-primary"
text={t("Save")}
icon="fa-save"
/>
</div>
</div>
</>
);
Expand Down
1 change: 1 addition & 0 deletions web/spacewalk-web.changes.eth.ans
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix layout issues on Ansible pages
Loading