Skip to content

Commit

Permalink
Add a placeholder (*) for unspecified RSE expression
Browse files Browse the repository at this point in the history
  • Loading branch information
MytsV authored and maany committed Aug 8, 2024
1 parent 60444ca commit 2ad685b
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/component-library/Pages/RSE/ListRSE.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@ import { TextInput } from "@/component-library/Input/TextInput";
import { useState } from "react";
import { Button } from "@/component-library/Button/Button";

const defaultRSEQuery = "*";

export const ListRSE = (
props: {
comdom: UseComDOM<RSEViewModel>
setRSEQuery: (rseExpression: string) => void
}
) => {

const [rseSearchQuery, setRSESearchQuery] = useState<string>("")
const [rseSearchQuery, setRSESearchQuery] = useState<string>(defaultRSEQuery)
const setInputAsQuery = (searchPattern: string) => {
setRSESearchQuery(searchPattern !== '' ? searchPattern : defaultRSEQuery)
}

const columnHelper = createColumnHelper<RSEViewModel>()
const tablecolumns = [
Expand Down Expand Up @@ -144,21 +149,22 @@ export const ListRSE = (
RSE Search Pattern
</label>
<TextInput
onBlur={(event: any) => { setRSESearchQuery(event.target.value) }}
onEnterkey={async (e: any) => {
onBlur={(event: any) => { setInputAsQuery(event.target.value) }}
onEnterkey={(e) => {
e.preventDefault()
await props.setRSEQuery(e.target.value)
setRSESearchQuery(e.target.value)
setInputAsQuery(e.target.value)
props.setRSEQuery(rseSearchQuery)
props.comdom.start()
}}
id="rse-search-pattern"
placeholder={defaultRSEQuery}
/>
<Button
type="button"
label="Search"
onClick={async (e: any) => {
onClick={(e: any) => {
e.preventDefault()
await props.setRSEQuery(rseSearchQuery)
props.setRSEQuery(rseSearchQuery)
props.comdom.start()
}}
className={twMerge(
Expand Down

0 comments on commit 2ad685b

Please sign in to comment.