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.
Merge pull request #9 from Willie-The-Lord/feature/multiple-form
[Feature] Implement multiple drilldownform
- Loading branch information
Showing
13 changed files
with
234 additions
and
188 deletions.
There are no files selected for viewing
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
128 changes: 128 additions & 0 deletions
128
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,128 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { | ||
EuiPanel, | ||
EuiTitle, | ||
EuiTextArea, | ||
EuiFlexItem, | ||
EuiFieldText, | ||
EuiAccordion, | ||
EuiFlexGroup, | ||
EuiSuperSelect, | ||
} from '@elastic/eui'; | ||
import { Card } from '../types'; | ||
|
||
interface CardFormProps { | ||
index: number; | ||
card: Card; | ||
updateCard: (index: number, card: Card) => void; | ||
options: any; | ||
valueOfSelected: string; | ||
onChange: () => void; | ||
} | ||
|
||
const CardForm = ({ | ||
index, | ||
card, | ||
updateCard, | ||
options, | ||
valueOfSelected, | ||
onChange, | ||
}: CardFormProps) => { | ||
return ( | ||
<EuiAccordion | ||
id={String(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> | ||
|
||
<EuiFlexItem> | ||
<EuiTitle size="xs"> | ||
<h2> | ||
<label htmlFor="drilldownVisInput">Select a Destination</label> | ||
</h2> | ||
</EuiTitle> | ||
</EuiFlexItem> | ||
|
||
<EuiSuperSelect | ||
options={options} | ||
valueOfSelected={valueOfSelected} | ||
onChange={onChange} | ||
fullWidth={true} | ||
data-test-subj="chartPicker" | ||
/> | ||
</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
Oops, something went wrong.