diff --git a/superset-frontend/temporary_superset_ui/superset-ui/temporary-plugins/hold-potentially-deprecate/superset-ui-legacy-plugin-chart-event-flow/package.json b/superset-frontend/temporary_superset_ui/superset-ui/temporary-plugins/hold-potentially-deprecate/superset-ui-legacy-plugin-chart-event-flow/package.json index 4869b3d7f2196..651b4058be79a 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/temporary-plugins/hold-potentially-deprecate/superset-ui-legacy-plugin-chart-event-flow/package.json +++ b/superset-frontend/temporary_superset_ui/superset-ui/temporary-plugins/hold-potentially-deprecate/superset-ui-legacy-plugin-chart-event-flow/package.json @@ -33,7 +33,9 @@ }, "peerDependencies": { "@superset-ui/chart": "^0.13.0", + "@superset-ui/control-utils": "^0.13.12", "@superset-ui/translation": "^0.13.0", + "@superset-ui/validator": "^0.13.3", "react": "^15 || ^16" } } diff --git a/superset-frontend/temporary_superset_ui/superset-ui/temporary-plugins/hold-potentially-deprecate/superset-ui-legacy-plugin-chart-event-flow/src/controlPanel.jsx b/superset-frontend/temporary_superset_ui/superset-ui/temporary-plugins/hold-potentially-deprecate/superset-ui-legacy-plugin-chart-event-flow/src/controlPanel.jsx new file mode 100644 index 0000000000000..214f81425bb72 --- /dev/null +++ b/superset-frontend/temporary_superset_ui/superset-ui/temporary-plugins/hold-potentially-deprecate/superset-ui-legacy-plugin-chart-event-flow/src/controlPanel.jsx @@ -0,0 +1,128 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; +import { t } from '@superset-ui/translation'; +import { validateNonEmpty } from '@superset-ui/validator'; +import { + ColumnOption, + internalSharedControls, + formatSelectOptionsForRange, +} from '@superset-ui/control-utils'; + +const { columnChoices } = internalSharedControls; + +export default { + requiresTime: true, + controlPanelSections: [ + { + label: t('Event definition'), + controlSetRows: [ + ['entity'], + [ + { + name: 'all_columns_x', + config: { + type: 'SelectControl', + label: t('Column containing event names'), + default: control => + control.choices && control.choices.length > 0 ? control.choices[0][0] : null, + }, + description: t('Columns to display'), + mapStateToProps: state => ({ + choices: columnChoices(state.datasource), + }), + validators: [validateNonEmpty], + }, + ], + ['row_limit'], + [ + { + name: 'order_by_entity', + config: { + type: 'CheckboxControl', + label: t('Order by entity id'), + description: t( + 'Important! Select this if the table is not already sorted by entity id, ' + + 'else there is no guarantee that all events for each entity are returned.', + ), + default: true, + }, + }, + ], + [ + { + name: 'min_leaf_node_event_count', + config: { + type: 'SelectControl', + freeForm: false, + label: t('Minimum leaf node event count'), + default: 1, + choices: formatSelectOptionsForRange(1, 10), + description: t( + 'Leaf nodes that represent fewer than this number of events will be initially ' + + 'hidden in the visualization', + ), + }, + }, + ], + ], + }, + { + label: t('Query'), + expanded: true, + controlSetRows: [['adhoc_filters']], + }, + { + label: t('Additional metadata'), + controlSetRows: [ + [ + { + name: 'all_columns', + config: { + type: 'SelectControl', + multi: true, + label: t('Meta data'), + default: [], + description: t('Select any columns for metadata inspection'), + optionRenderer: c => , + valueRenderer: c => , + valueKey: 'column_name', + allowAll: true, + mapStateToProps: state => ({ + options: state.datasource ? state.datasource.columns : [], + }), + commaChoosesOption: false, + freeForm: true, + }, + }, + ], + ], + }, + ], + controlOverrides: { + entity: { + label: t('Column containing entity ids'), + description: t('e.g., a "user id" column'), + }, + row_limit: { + label: t('Event count limit'), + description: t('The maximum number of events to return, equivalent to the number of rows'), + }, + }, +}; diff --git a/superset-frontend/temporary_superset_ui/superset-ui/temporary-plugins/hold-potentially-deprecate/superset-ui-legacy-plugin-chart-event-flow/src/index.js b/superset-frontend/temporary_superset_ui/superset-ui/temporary-plugins/hold-potentially-deprecate/superset-ui-legacy-plugin-chart-event-flow/src/index.js index b88e29e6b79ea..fef15f7d4ecbf 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/temporary-plugins/hold-potentially-deprecate/superset-ui-legacy-plugin-chart-event-flow/src/index.js +++ b/superset-frontend/temporary_superset_ui/superset-ui/temporary-plugins/hold-potentially-deprecate/superset-ui-legacy-plugin-chart-event-flow/src/index.js @@ -19,6 +19,7 @@ import { t } from '@superset-ui/translation'; import { ChartMetadata, ChartPlugin } from '@superset-ui/chart'; import thumbnail from './images/thumbnail.png'; +import controlPanel from './controlPanel'; const metadata = new ChartMetadata({ credits: ['https://github.com/williaster/data-ui'], @@ -34,6 +35,7 @@ export default class EventFlowChartPlugin extends ChartPlugin { loadChart: () => import('./EventFlow'), loadTransformProps: () => import('./transformProps.js'), metadata, + controlPanel, }); } }