Skip to content

Commit

Permalink
Simplify and make text consistent for both edit modals
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
ohltyler committed Jul 23, 2024
1 parent a8ee86a commit 291bacc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ interface SourceDataProps {
export function SourceData(props: SourceDataProps) {
const { values, setFieldValue } = useFormikContext<WorkspaceFormValues>();

// load modal state
const [isLoadModalOpen, setIsLoadModalOpen] = useState<boolean>(false);
// edit modal state
const [isEditModalOpen, setIsEditModalOpen] = useState<boolean>(false);

// files state. when a file is read, update the form value.
const fileReader = new FileReader();
Expand All @@ -55,14 +55,14 @@ export function SourceData(props: SourceDataProps) {

return (
<>
{isLoadModalOpen && (
{isEditModalOpen && (
<EuiModal
onClose={() => setIsLoadModalOpen(false)}
onClose={() => setIsEditModalOpen(false)}
style={{ width: '70vw' }}
>
<EuiModalHeader>
<EuiModalHeaderTitle>
<p>{`Configure sample JSON documents`}</p>
<p>{`Edit source data`}</p>
</EuiModalHeaderTitle>
</EuiModalHeader>
<EuiModalBody>
Expand Down Expand Up @@ -96,7 +96,7 @@ export function SourceData(props: SourceDataProps) {
</EuiModalBody>
<EuiModalFooter>
<EuiButton
onClick={() => setIsLoadModalOpen(false)}
onClick={() => setIsEditModalOpen(false)}
fill={false}
color="primary"
>
Expand All @@ -116,9 +116,9 @@ export function SourceData(props: SourceDataProps) {
fill={false}
style={{ width: '100px' }}
size="s"
onClick={() => setIsLoadModalOpen(true)}
onClick={() => setIsEditModalOpen(true)}
>
Configure
Edit
</EuiButton>
</EuiFlexItem>
<EuiFlexItem grow={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export function ConfigureSearchRequest(props: ConfigureSearchRequestProps) {
undefined
);

// Query modal state
const [isQueryModalOpen, setIsQueryModalOpen] = useState<boolean>(false);
// Edit modal state
const [isEditModalOpen, setIsEditModalOpen] = useState<boolean>(false);

// Hook to listen when the query form value changes.
// Try to set the query request if possible
Expand All @@ -72,14 +72,14 @@ export function ConfigureSearchRequest(props: ConfigureSearchRequestProps) {

return (
<>
{isQueryModalOpen && (
{isEditModalOpen && (
<EuiModal
onClose={() => setIsQueryModalOpen(false)}
onClose={() => setIsEditModalOpen(false)}
style={{ width: '70vw' }}
>
<EuiModalHeader>
<EuiModalHeaderTitle>
<p>{`Configure query`}</p>
<p>{`Edit query`}</p>
</EuiModalHeaderTitle>
</EuiModalHeader>
<EuiModalBody>
Expand All @@ -93,7 +93,7 @@ export function ConfigureSearchRequest(props: ConfigureSearchRequestProps) {
</EuiModalBody>
<EuiModalFooter>
<EuiButton
onClick={() => setIsQueryModalOpen(false)}
onClick={() => setIsEditModalOpen(false)}
fill={false}
color="primary"
>
Expand Down Expand Up @@ -136,9 +136,9 @@ export function ConfigureSearchRequest(props: ConfigureSearchRequestProps) {
fill={false}
style={{ width: '100px' }}
size="s"
onClick={() => setIsQueryModalOpen(true)}
onClick={() => setIsEditModalOpen(true)}
>
Configure
Edit
</EuiButton>
</EuiFlexItem>
<EuiFlexItem grow={false}>
Expand Down

0 comments on commit 291bacc

Please sign in to comment.