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

[Feature] Implement multiple drilldownform #8

Closed
Closed
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
7 changes: 0 additions & 7 deletions src/plugins/vis_type_drilldown/.eslintrc.js

This file was deleted.

7 changes: 0 additions & 7 deletions src/plugins/vis_type_drilldown/.i18nrc.json

This file was deleted.

9 changes: 2 additions & 7 deletions src/plugins/vis_type_drilldown/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# vis_type_drilldown

A OpenSearch Dashboards plugin
This drilldown plugin allows users to design their own navigation controls, customized to fit their specific preferences and workflow requirements.
Please refer to [Drilldown functionality for dashboards](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/1308)

---

## Development

See the [OpenSearch Dashboards contributing
guide](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/CONTRIBUTING.md) for instructions
setting up your development environment.
10 changes: 1 addition & 9 deletions src/plugins/vis_type_drilldown/opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
"opensearchDashboardsVersion": "opensearchDashboards",
"server": true,
"ui": true,
"requiredPlugins": [
"opensearchDashboardsReact",
"charts",
"expressions",
"visualizations",
"navigation",
"data",
"visDefaultEditor"
],
"requiredPlugins": ["charts", "expressions", "visualizations", "visDefaultEditor"],
"optionalPlugins": []
}
28 changes: 0 additions & 28 deletions src/plugins/vis_type_drilldown/public/application.tsx

This file was deleted.

101 changes: 101 additions & 0 deletions src/plugins/vis_type_drilldown/public/card_form.tsx
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, { useState } 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 };
124 changes: 0 additions & 124 deletions src/plugins/vis_type_drilldown/public/components/app.tsx

This file was deleted.

42 changes: 7 additions & 35 deletions src/plugins/vis_type_drilldown/public/drilldown_fn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

import { i18n } from '@osd/i18n';
import { ExpressionFunctionDefinition, Render } from '../../expressions/public';
import { DrilldownVisParams } from './types';
import { DrilldownArguments } from './types';
import { DrilldownArguments, DrilldownVisParams } from './types';

export interface DrilldownVisRenderValue {
visType: 'drilldown';
Expand All @@ -24,38 +23,14 @@ export const createDrilldownVisFn = (): DrilldownVisExpressionFunctionDefinition
name: 'drilldownVis',
type: 'render',
inputTypes: [],
help: i18n.translate('visDrilldown.function.help', {
help: i18n.translate('visTypeDrilldown.function.help', {
defaultMessage: 'Drilldown visualization',
}),
args: {
// font: {
// types: ['style'],
// help: i18n.translate('visTypeMarkdown.function.font.help', {
// defaultMessage: 'Font settings.',
// }),
// default: `{font size=12}`,
// },
// openLinksInNewTab: {
// types: ['boolean'],
// default: false,
// help: i18n.translate('visTypeMarkdown.function.openLinksInNewTab.help', {
// defaultMessage: 'Opens links in new tab',
// }),
// },
cardName: {
types: ['string'],
aliases: ['_'],
required: true,
help: i18n.translate('visTypeDrilldown.function.cardName.help', {
defaultMessage: 'Card name',
}),
},
cardDescription: {
types: ['string'],
aliases: ['_'],
required: true,
help: i18n.translate('visTypeDrilldown.function.cardDescription.help', {
defaultMessage: 'Card description',
cards: {
types: [],
help: i18n.translate('visTypeDrilldown.function.cards.help', {
defaultMessage: 'Cards',
}),
},
},
Expand All @@ -66,10 +41,7 @@ export const createDrilldownVisFn = (): DrilldownVisExpressionFunctionDefinition
value: {
visType: 'drilldown',
visParams: {
cardName: args.cardName,
cardDescription: args.cardDescription,
// openLinksInNewTab: args.openLinksInNewTab,
// fontSize: parseInt(args.font.spec.fontSize || '12', 10),
cards: args.cards,
},
},
};
Expand Down
Loading
Loading