Skip to content

Commit

Permalink
-s
Browse files Browse the repository at this point in the history
  • Loading branch information
keskami committed Nov 24, 2023
1 parent b5b3c34 commit dfa2d45
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/plugins/vis_type_drilldown/opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"data",
"visDefaultEditor"
],
"optionalPlugins": []
"optionalPlugins": [],
"requiredBundles": ["opensearchDashboardsUtils", "opensearchDashboardsReact", "home"]
}
71 changes: 68 additions & 3 deletions src/plugins/vis_type_drilldown/public/drilldown_options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import React, { useCallback, useState } from 'react';
import React, { useCallback, Fragment, useState, useEffect } from 'react';
import {
EuiPanel,
EuiTitle,
Expand All @@ -12,23 +12,72 @@ import {
EuiFlexItem,
EuiFieldText,
EuiAccordion,
EuiSuperSelect,
EuiText,
} from '@elastic/eui';
import { FormattedMessage } from '@osd/i18n/react';

import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
import { DrilldownVisParams } from './types';
import { useOpenSearchDashboards } from 'src/plugins/opensearch_dashboards_react/public';
import { DrilldownServices, DrilldownVisParams } from './types';

function DrilldownOptions({ stateParams, setValue }: VisOptionsProps<DrilldownVisParams>) {
const onMarkdownUpdate = useCallback(
(value: DrilldownVisParams['cardName']) => setValue('cardName', value),
[setValue]
);

const {
services: { savedObjectsClient },
} = useOpenSearchDashboards<DrilldownServices>();

useEffect(() => {
const savedObject = savedObjectsClient.find({
type: 'dashboard',
});
});

const onDescriptionUpdate = useCallback(
(value: DrilldownVisParams['cardDescription']) => setValue('cardDescription', value),
[setValue]
);

const activeVisName = '';
const handleVisTypeChange = () => {};
const options = [
{
value: '1',
inputDisplay: 'Option 1',
dropdownDisplay: (
<Fragment>
<strong>Name</strong>
<EuiText size="s" color="subdued">
<p className="euiTextColor--subdued">
id
<br />
text
</p>
</EuiText>
</Fragment>
),
},
{
value: '2',
inputDisplay: 'Option 2',
dropdownDisplay: (
<Fragment>
<strong>Name</strong>
<EuiText size="s" color="subdued">
<p className="euiTextColor--subdued">
id
<br />
text
</p>
</EuiText>
</Fragment>
),
},
];

return (
<EuiAccordion buttonContent="Drilldown 1">
<EuiPanel paddingSize="s">
Expand Down Expand Up @@ -70,6 +119,22 @@ function DrilldownOptions({ stateParams, setValue }: VisOptionsProps<DrilldownVi
data-test-subj="markdownTextarea"
/>
</EuiFlexItem>

<EuiFlexItem>
<EuiTitle size="xs">
<h2>
<label htmlFor="drilldownVisInput">Select a Destination</label>
</h2>
</EuiTitle>
</EuiFlexItem>

<EuiSuperSelect
options={options}
valueOfSelected={activeVisName}
onChange={handleVisTypeChange}
fullWidth
data-test-subj="chartPicker"
/>
</EuiFlexGroup>
</EuiPanel>
</EuiAccordion>
Expand Down
7 changes: 6 additions & 1 deletion src/plugins/vis_type_drilldown/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { SavedObjectsClientContract } from 'src/core/public/saved_objects/saved_objects_client';
import { CoreStart } from 'src/core/server';
import { NavigationPublicPluginStart } from '../../navigation/public';
import { VisualizationsSetup } from '../../visualizations/public';
import { Arguments } from '../../vis_type_markdown/public/types';

export interface VisDrilldownPluginSetup {
getGreeting: () => string;
Expand Down Expand Up @@ -39,3 +40,7 @@ export interface DrilldownVisParams {
cardName: DrilldownArguments['cardName'];
cardDescription: DrilldownArguments['cardDescription'];
}

export interface DrilldownServices extends CoreStart {
savedObjectsClient: SavedObjectsClientContract;
}

0 comments on commit dfa2d45

Please sign in to comment.