Skip to content

Commit

Permalink
addressing comments
Browse files Browse the repository at this point in the history
Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
  • Loading branch information
abbyhu2000 committed Mar 2, 2023
1 parent ca312bc commit a0a3e6b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Multiple DataSource] Add support for SigV4 authentication ([#3058](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3058))
- Make build scripts find and use the latest version of Node.js that satisfies `engines.node` ([#3467](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3467))
- [Multiple DataSource] Refactor test connection to support SigV4 auth type ([#3456](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3456))
- [Vis Builder] Add metric to metric, bucket to bucket aggregation persistence ([#3495](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3495))
- [Vis Builder] Add metric-to-metric, bucket-to-bucket aggregation persistence ([#3495](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3495))

### 🐛 Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ export const RightNav = () => {
const StyleSection = ui.containerConfig.style.render;

const { activeVisualization } = useTypedSelector((state) => state.visualization);
const oldAggParams = activeVisualization?.aggConfigParams ?? [];
const persistedAggParams = usePersistedAggParams(types, oldAggParams, activeVisName, newVisType);
const aggConfigParams = activeVisualization?.aggConfigParams ?? [];
const persistedAggParams = usePersistedAggParams(
types,
aggConfigParams,
activeVisName,
newVisType
);

const options: Array<EuiSuperSelectOption<string>> = types.all().map(({ name, icon, title }) => ({
value: name,
Expand Down Expand Up @@ -77,7 +82,7 @@ export const RightNav = () => {
setActiveVisualization({
name: newVisType,
style: types.get(newVisType)?.ui.containerConfig.style.defaults,
aggParams: persistedAggParams,
aggConfigParams: persistedAggParams,
})
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { VisualizationType } from '../../../services/type_service/visualization_
interface ActiveVisPayload {
name: VisualizationType['name'];
style: VisualizationType['ui']['containerConfig']['style']['defaults'];
aggParams: CreateAggConfigParams[];
aggConfigParams: CreateAggConfigParams[];
}

export const setActiveVisualization = createAction<ActiveVisPayload>('setActiveVisualzation');
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { integer } from '@opensearch-project/opensearch/api/types';
import { AggGroupNames, CreateAggConfigParams } from '../../../../../data/common';
import { Schema } from '../../../../../vis_default_editor/public';

Expand Down Expand Up @@ -41,8 +40,8 @@ export const getSchemaMapping = (

export interface AggMapping {
name: string;
maxCount: integer;
currentCount: integer;
maxCount: number;
currentCount: number;
}

export const mapAggParamsSchema = (
Expand Down Expand Up @@ -70,13 +69,7 @@ export const updateAggParams = (
oldAggParam: CreateAggConfigParams,
aggMap: Map<string, AggMapping>
) => {
const newAggParam = {
params: oldAggParam.params,
type: oldAggParam.type,
enabled: oldAggParam.enabled,
id: oldAggParam.id,
schema: oldAggParam.schema,
};
const newAggParam = { ...oldAggParam };
if (oldAggParam.schema) {
const newSchema = aggMap.get(oldAggParam.schema);
if (newSchema) {
Expand Down

0 comments on commit a0a3e6b

Please sign in to comment.