Skip to content

Commit

Permalink
Integrated new props
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhat Sharma <ptsharma@amazon.com>
  • Loading branch information
Prabhat Sharma committed Apr 11, 2024
1 parent fcf609a commit cbf4a2a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 39 deletions.
4 changes: 2 additions & 2 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "3.0.0.0",
"opensearchDashboardsVersion": "3.0.0",
"configPath": ["opensearch_index_management"],
"requiredPlugins": ["navigation", "opensearchDashboardsReact"],
"optionalPlugins": ["managementOverview", "dataSource", "dataSourceManagement"],
"requiredPlugins": ["navigation", "opensearchDashboardsReact", "managementOverview"],
"optionalPlugins": ["dataSource", "dataSourceManagement"],
"server": true,
"ui": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ import CreateRollupStep3 from "../CreateRollupStep3";
import CreateRollupStep4 from "../CreateRollupStep4";
import { compareFieldItem, parseFieldOptions } from "../../utils/helpers";
import { CoreServicesContext } from "../../../../components/core_services";
import {
DataSourceMenuContext,
DataSourceMenuProperties,
DataSourceMenuReadOnlyContext,
DataSourceMenuReadOnlyProperties,
DataSourceProperties,
} from "../../../../services/DataSourceMenuContext";
import { DataSourceMenuContext, DataSourceMenuReadOnlyProperties, DataSourceProperties } from "../../../../services/DataSourceMenuContext";
import { getDataSourcePropsFromContext, useUpdateUrlWithDataSourceProperties } from "../../../../components/MDSEnabledComponent";

interface CreateRollupFormProps extends RouteComponentProps, DataSourceMenuProperties, DataSourceMenuReadOnlyProperties {
interface CreateRollupFormProps extends RouteComponentProps, DataSourceProperties, DataSourceMenuReadOnlyProperties {
rollupService: RollupService;
indexService: IndexService;
}
Expand Down
2 changes: 1 addition & 1 deletion public/pages/Indices/containers/Indices/Indices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class Indices extends MDSEnabledComponent<IndicesProps, IndicesState> {
try {
const { indexService, history } = this.props;
const queryObject = this.getQueryObjectFromState(this.state);
const queryParamsString = queryString.stringify({ queryObject });
const queryParamsString = queryString.stringify(queryObject);
history.replace({ ...this.props.location, search: queryParamsString });

const getIndicesResponse = await indexService.getIndices({
Expand Down
64 changes: 36 additions & 28 deletions public/pages/Main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import {
DataSourceSelectableConfig,
DataSourceViewConfig,
} from "../../../../../src/plugins/data_source_management/public";
import _ from "lodash";

enum Navigation {
IndexManagement = "Index Management",
Expand Down Expand Up @@ -380,27 +381,20 @@ export default class Main extends Component<MainProps, MainState> {
ROUTES.TRANSFORM_DETAILS,
ROUTES.EDIT_TRANSFORM,
]}
render={(props) =>
React.useMemo(
() => (
<DataSourceMenuSelectable
setMenuMountPoint={this.props.setActionMenu}
componentType={"DataSourceSelectable"}
componentConfig={{
fullWidth: false,
onSelectedDataSources: (dataSources) => {
this.setState({ dataSource: dataSources });
},
savedObjects: core.savedObjects.client,
notifications: core.notifications,
activeOption:
this.state.dataSource[0].id !== undefined ? [{ id: this.state.dataSource[0].id }] : undefined,
}}
/>
),
[core.savedObjects.client, core.notifications, this.props.setActionMenu]
)
}
render={() => (
<DataSourceMenuView
setMenuMountPoint={this.props.setActionMenu}
componentType={"DataSourceView"}
componentConfig={{
fullWidth: false,
savedObjects: core.savedObjects.client,
notifications: core.notifications,
activeOption: this.state.dataSource[0]?.id
? [{ id: this.state.dataSource[0].id, label: this.state.dataSource[0].label }]
: [{ id: "", label: "" }],
}}
/>
)}
/>
<Route
path={[
Expand All @@ -420,17 +414,25 @@ export default class Main extends Component<MainProps, MainState> {
ROUTES.ROLLUPS,
ROUTES.TRANSFORMS,
]}
render={() => (
<DataSourceMenuView
render={(props) => (
<DataSourceMenuSelectable
setMenuMountPoint={this.props.setActionMenu}
componentType={"DataSourceView"}
componentType={"DataSourceSelectable"}
componentConfig={{
fullWidth: false,
onSelectedDataSources: (dataSources) => {
if (
this.props.multiDataSourceEnabled &&
dataSources.length > 0 &&
!_.isEqual(dataSources[0], this.state.dataSource[0])
) {
this.setState({ dataSource: dataSources });
}
},
savedObjects: core.savedObjects.client,
notifications: core.notifications,
activeOption: this.state.dataSource[0]?.id
? [{ id: this.state.dataSource[0].id, label: this.state.dataSource[0].label }]
: [{ id: "", label: "" }],
activeOption:
this.state.dataSource[0].id !== undefined ? [{ id: this.state.dataSource[0].id }] : undefined,
}}
/>
)}
Expand Down Expand Up @@ -458,7 +460,13 @@ export default class Main extends Component<MainProps, MainState> {
componentConfig={{
fullWidth: false,
onSelectedDataSources: (dataSources) => {
this.setState({ dataSource: dataSources });
if (
this.props.multiDataSourceEnabled &&
dataSources.length > 0 &&
!_.isEqual(dataSources[0], this.state.dataSource[0])
) {
this.setState({ dataSource: dataSources });
}
},
savedObjects: core.savedObjects.client,
notifications: core.notifications,
Expand Down

0 comments on commit cbf4a2a

Please sign in to comment.