forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[D&D] Adds Bar line and Area charts to Wizard (opensearch-project#2266)
* Working histogram Signed-off-by: Ashwin Pc <[email protected]> * Adds histogram options Signed-off-by: Ashwin Pc <[email protected]> * Adds line chart Signed-off-by: Ashwin Pc <[email protected]> * Adds area chart Signed-off-by: Ashwin Pc <[email protected]> * updates nav sizes Signed-off-by: Ashwin Pc <[email protected]> * adds resizeable container to right nav Signed-off-by: Ashwin Pc <[email protected]> * Misc fixes Signed-off-by: Ashwin Pc <[email protected]> * Adds chart switcher test Signed-off-by: Ashwin Pc <[email protected]> * Github comment feedback Co-authored-by: Josh Romero <[email protected]> Signed-off-by: Ashwin Pc <[email protected]> * Updates copy Signed-off-by: Ashwin Pc <[email protected]> Signed-off-by: Ashwin Pc <[email protected]> Co-authored-by: Josh Romero <[email protected]> Signed-off-by: Sergey V. Osipov <[email protected]>
- Loading branch information
Showing
35 changed files
with
811 additions
and
80 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
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
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
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
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
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
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
43 changes: 43 additions & 0 deletions
43
src/plugins/wizard/public/visualizations/common/expression_helpers.ts
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,43 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { cloneDeep } from 'lodash'; | ||
import { OpenSearchaggsExpressionFunctionDefinition } from '../../../../data/public'; | ||
import { ExpressionFunctionOpenSearchDashboards } from '../../../../expressions'; | ||
import { buildExpressionFunction } from '../../../../expressions/public'; | ||
import { VisualizationState } from '../../application/utils/state_management'; | ||
import { getAggService, getIndexPatterns } from '../../plugin_services'; | ||
|
||
export const getAggExpressionFunctions = async (visualization: VisualizationState) => { | ||
const { activeVisualization, indexPattern: indexId = '' } = visualization; | ||
const { aggConfigParams } = activeVisualization || {}; | ||
|
||
const indexPatternsService = getIndexPatterns(); | ||
const indexPattern = await indexPatternsService.get(indexId); | ||
// aggConfigParams is the serealizeable aggConfigs that need to be reconstructed here using the agg servce | ||
const aggConfigs = getAggService().createAggConfigs(indexPattern, cloneDeep(aggConfigParams)); | ||
|
||
const opensearchDashboards = buildExpressionFunction<ExpressionFunctionOpenSearchDashboards>( | ||
'opensearchDashboards', | ||
{} | ||
); | ||
|
||
// soon this becomes: const opensearchaggs = vis.data.aggs!.toExpressionAst(); | ||
const opensearchaggs = buildExpressionFunction<OpenSearchaggsExpressionFunctionDefinition>( | ||
'opensearchaggs', | ||
{ | ||
index: indexId, | ||
metricsAtAllLevels: false, | ||
partialRows: false, | ||
aggConfigs: JSON.stringify(aggConfigs.aggs), | ||
includeFormatHints: false, | ||
} | ||
); | ||
|
||
return { | ||
aggConfigs, | ||
expressionFns: [opensearchDashboards, opensearchaggs], | ||
}; | ||
}; |
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.