forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement multiple drilldown forms & remove unused import
Signed-off-by: Willie Hung <[email protected]>
- Loading branch information
1 parent
0452554
commit 93f08de
Showing
4 changed files
with
120 additions
and
15 deletions.
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
src/plugins/vis_type_drilldown/public/components/card_form.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { | ||
EuiPanel, | ||
EuiTitle, | ||
EuiTextArea, | ||
EuiFlexItem, | ||
EuiFieldText, | ||
EuiAccordion, | ||
EuiFlexGroup, | ||
} from '@elastic/eui'; | ||
import { Card } from '../types'; | ||
|
||
interface CardFormProps { | ||
index: number; | ||
card: Card; | ||
updateCard: (index: number, card: Card) => void; | ||
} | ||
|
||
const CardForm = ({ index, card, updateCard }: CardFormProps) => { | ||
return ( | ||
<EuiAccordion | ||
id={index} | ||
buttonContent={`Drilldown ${index + 1}`} | ||
paddingSize="s" | ||
initialIsOpen={true} | ||
> | ||
<EuiPanel paddingSize="s"> | ||
<EuiFlexGroup direction="column" gutterSize="m" className="eui-fullHeight"> | ||
<EuiFlexItem> | ||
<EuiTitle size="xs"> | ||
<h2> | ||
<label htmlFor="drilldownVisInput">Card Name</label> | ||
</h2> | ||
</EuiTitle> | ||
</EuiFlexItem> | ||
|
||
<EuiFlexItem> | ||
<EuiFieldText | ||
id="drilldownVisInput" | ||
className="eui-fullHeight" | ||
value={card.cardName} | ||
onChange={({ target: { value } }) => { | ||
updateCard(index, { ...card, cardName: value }); | ||
}} | ||
fullWidth={true} | ||
/> | ||
</EuiFlexItem> | ||
|
||
<EuiFlexItem> | ||
<EuiTitle size="xs"> | ||
<h2> | ||
<label htmlFor="drilldownVisInput">Description</label> | ||
</h2> | ||
</EuiTitle> | ||
</EuiFlexItem> | ||
|
||
<EuiFlexItem> | ||
<EuiTextArea | ||
id="markdownVisInput" | ||
className="eui-fullHeight" | ||
value={card.cardDescription} | ||
onChange={({ target: { value } }) => { | ||
updateCard(index, { ...card, cardDescription: value }); | ||
}} | ||
fullWidth={true} | ||
data-test-subj="markdownTextarea" | ||
/> | ||
</EuiFlexItem> | ||
|
||
<EuiFlexItem> | ||
<EuiTitle size="xs"> | ||
<h2> | ||
<label htmlFor="drilldownVisInput">Url</label> | ||
</h2> | ||
</EuiTitle> | ||
</EuiFlexItem> | ||
|
||
<EuiFlexItem> | ||
<EuiFieldText | ||
id="drilldownVisInput" | ||
placeholder="" | ||
className="eui-fullHeight" | ||
value={card.cardUrl} | ||
onChange={({ target: { value } }) => { | ||
updateCard(index, { ...card, cardUrl: value }); | ||
}} | ||
fullWidth={true} | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiPanel> | ||
</EuiAccordion> | ||
); | ||
}; | ||
|
||
export { CardForm }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters