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(inputs): added maxlength for inputs #876

Merged
merged 2 commits into from
Jul 4, 2023
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
3 changes: 3 additions & 0 deletions dashboard/components/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type InputProps = {
value?: string | number | string[];
autofocus?: boolean;
min?: number;
maxLength?: number;
positiveNumberOnly?: boolean;
action: (newData: any, id?: number) => void;
};
Expand All @@ -27,6 +28,7 @@ function Input({
value,
autofocus,
min,
maxLength,
positiveNumberOnly,
action
}: InputProps) {
Expand Down Expand Up @@ -83,6 +85,7 @@ function Input({
value={value}
ref={inputRef}
min={min}
maxLength={maxLength}
autoComplete="off"
data-lpignore="true"
data-form-type="other"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function InventoryLayout({
<input
placeholder="Search views"
value={query}
maxLength={64}
onChange={e => setQuery(e.target.value)}
className="flex w-full items-center rounded-lg border border-black-200 px-4 py-3 pl-10 text-sm font-medium text-black-400 transition-colors hover:border-black-300 focus-visible:outline-primary"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function InventorySearchBar({
autoComplete="off"
data-lpignore="true"
data-form-type="other"
maxLength={64}
/>
<div className="absolute top-[14px] right-4">
<ExportCSV setToast={setToast} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function InventoryTagWrapper({
error="Please provide a valid key name."
action={handleChange}
value={tag.key}
maxLength={64}
/>
<Input
id={id}
Expand All @@ -31,6 +32,7 @@ function InventoryTagWrapper({
error="Please provide a valid value."
action={handleChange}
value={tag.value}
maxLength={64}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ function InventoryFilterOperator({
error="Please provide a tag key"
action={handleTagKey}
autofocus={true}
maxLength={64}
/>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ function InventoryFilterValue({
error="Please provide a value"
action={handleValueInput}
autofocus={true}
maxLength={64}
/>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ function InventoryView({
value={view.name}
action={handleChange}
autofocus={true}
maxLength={64}
/>

<div className="ml-auto">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ function InventoryViewAlertsCreateOrEditAlert({
name="name"
action={handleChange}
value={alert.name}
maxLength={64}
/>
<Input
type="number"
Expand Down Expand Up @@ -234,6 +235,7 @@ function InventoryViewAlertsCreateOrEditAlert({
handleChange({ endpoint: e.target.value });
}}
value={alert.endpoint}
maxLength={64}
autoComplete="off"
data-lpignore="true"
data-form-type="other"
Expand Down
1 change: 1 addition & 0 deletions dashboard/components/select-checkbox/SelectCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ function SelectCheckbox({
placeholder="Search"
className="h-10 w-full rounded-md border border-black-200/50 bg-white py-4 pl-10 pr-6 text-sm text-black-900 caret-secondary placeholder:text-black-300 focus:outline-none"
autoFocus
maxLength={64}
/>
</div>
{error && (
Expand Down