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

[#523] Added help_text in Change Permission View #539

Merged
merged 1 commit into from
Mar 6, 2025
Merged
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 @@ -65,6 +65,7 @@ const PermissionForm = ({objectFields, tokenChoices, objecttypeChoices, modeChoi
id="id_object_type"
label="Object type:"
choices={objecttypeChoices}
helpText="Changing the Object type will not maintain the previously selected authorization fields."
initialValue={values["object_type"]}
errors={errors["object_type"]}
onChange={(value) => {
Expand Down
9 changes: 6 additions & 3 deletions src/objects/js/components/forms/inputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useState } from "react";
import { ErrorList } from "./error-list";


const CheckboxInput = ({name, id, value, label, disabled, onChange}) => {
const CheckboxInput = ({name, id, value, label, disabled, onChange, helpText}) => {
return (
<div className="checkbox-row">
<input
Expand All @@ -19,12 +19,13 @@ const CheckboxInput = ({name, id, value, label, disabled, onChange}) => {
}}
/>
{label ? <label className="vCheckboxLabel" htmlFor={id}>{ label }</label> : null}
{helpText ? <div><span className="help" htmlFor={id}>{helpText}</span></div>: null}
</div>
);
};


const TextInput = ({id, name, value, label, onChange, hidden}) => {
const TextInput = ({id, name, value, label, onChange, hidden, helpText}) => {

return (
<div>
Expand All @@ -41,12 +42,13 @@ const TextInput = ({id, name, value, label, onChange, hidden}) => {
}}
value={value}
/>
{helpText ? <div><span className="help" htmlFor={id}>{helpText}</span></div>: null}
</div>
);
};


const SelectInput = ({choices, name, id, label, onChange, initialValue, errors}) => {
const SelectInput = ({choices, name, id, label, onChange, initialValue, errors, helpText}) => {

const [currentValue, setCurrentValue] = useState(initialValue || "");
const [_errors, setErrors] = useState(errors || []);
Expand Down Expand Up @@ -74,6 +76,7 @@ const SelectInput = ({choices, name, id, label, onChange, initialValue, errors})
>
{options}
</select>
{helpText ? <div><span className="help" htmlFor={id}>{helpText}</span></div>: null}
</div>
)
}
Expand Down