@akohn/dashql-react 0.0.0-stage → 0.0.20-dev.1001.g5e5121808
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/NOTICE +118 -0
- package/README.md +133 -2
- package/dist/_virtual/_vite/preload-helper.js +100 -0
- package/dist/brand/brand.d.ts +13 -0
- package/dist/brand/brand.js +14 -0
- package/dist/brand/landing_backdrop.d.ts +56 -0
- package/dist/brand/landing_backdrop.js +1019 -0
- package/dist/brand/wobble_morph.d.ts +54 -0
- package/dist/brand/wobble_morph.js +439 -0
- package/dist/components/action_list.d.ts +31 -0
- package/dist/components/action_list.js +63 -0
- package/dist/components/action_list.module.js +11 -0
- package/dist/components/anchored_overlay.d.ts +28 -0
- package/dist/components/anchored_overlay.js +93 -0
- package/dist/components/button.d.ts +42 -0
- package/dist/components/button.js +97 -0
- package/dist/components/button.module.js +20 -0
- package/dist/components/button_group.d.ts +7 -0
- package/dist/components/button_group.js +18 -0
- package/dist/components/button_group.module.js +3 -0
- package/dist/components/card_placeholder.d.ts +9 -0
- package/dist/components/card_placeholder.js +39 -0
- package/dist/components/card_placeholder.module.js +6 -0
- package/dist/components/clipboard.d.ts +19 -0
- package/dist/components/clipboard.js +54 -0
- package/dist/components/data_table/computation_tables.d.ts +12 -0
- package/dist/components/data_table/computation_tables.js +42 -0
- package/dist/components/data_table/data_table.d.ts +39 -0
- package/dist/components/data_table/data_table.js +415 -0
- package/dist/components/data_table/data_table.module.js +41 -0
- package/dist/components/data_table/data_table_cell.d.ts +7 -0
- package/dist/components/data_table/data_table_cell.js +9 -0
- package/dist/components/data_table/data_table_cell_data.d.ts +22 -0
- package/dist/components/data_table/data_table_cell_data.js +103 -0
- package/dist/components/data_table/data_table_cell_header_name.d.ts +17 -0
- package/dist/components/data_table/data_table_cell_header_name.js +73 -0
- package/dist/components/data_table/data_table_cell_header_plots.d.ts +29 -0
- package/dist/components/data_table/data_table_cell_header_plots.js +120 -0
- package/dist/components/data_table/data_table_colors.d.ts +19 -0
- package/dist/components/data_table/data_table_colors.js +27 -0
- package/dist/components/data_table/data_table_column_resize.d.ts +21 -0
- package/dist/components/data_table/data_table_column_resize.js +121 -0
- package/dist/components/data_table/data_table_focus.d.ts +15 -0
- package/dist/components/data_table/data_table_focus.js +53 -0
- package/dist/components/data_table/data_table_layout.d.ts +18 -0
- package/dist/components/data_table/data_table_layout.js +103 -0
- package/dist/components/data_table/data_table_ordering.d.ts +9 -0
- package/dist/components/data_table/data_table_ordering.js +39 -0
- package/dist/components/data_table/data_table_portals.d.ts +9 -0
- package/dist/components/data_table/data_table_portals.js +29 -0
- package/dist/components/data_table/data_table_row_detail.d.ts +22 -0
- package/dist/components/data_table/data_table_row_detail.js +68 -0
- package/dist/components/data_table/data_table_row_detail.module.js +7 -0
- package/dist/components/data_table/data_table_sticky_views.d.ts +35 -0
- package/dist/components/data_table/data_table_sticky_views.js +161 -0
- package/dist/components/data_table/data_table_window.d.ts +18 -0
- package/dist/components/data_table/data_table_window.js +118 -0
- package/dist/components/data_table/format_peek.d.ts +2 -0
- package/dist/components/data_table/format_peek.js +17 -0
- package/dist/components/data_table/histogram_bars.d.ts +36 -0
- package/dist/components/data_table/histogram_bars.js +100 -0
- package/dist/components/data_table/histogram_brush.d.ts +22 -0
- package/dist/components/data_table/histogram_brush.js +105 -0
- package/dist/components/data_table/histogram_cell.d.ts +17 -0
- package/dist/components/data_table/histogram_cell.js +324 -0
- package/dist/components/data_table/histogram_cell.module.js +9 -0
- package/dist/components/data_table/histogram_label.d.ts +1 -0
- package/dist/components/data_table/histogram_label.js +7 -0
- package/dist/components/data_table/memo_props.d.ts +1 -0
- package/dist/components/data_table/memo_props.js +17 -0
- package/dist/components/data_table/mostfrequent_cell.d.ts +17 -0
- package/dist/components/data_table/mostfrequent_cell.js +316 -0
- package/dist/components/data_table/mostfrequent_cell.module.js +10 -0
- package/dist/components/data_table/use_cross_filters.d.ts +14 -0
- package/dist/components/data_table/use_cross_filters.js +47 -0
- package/dist/components/deferred.d.ts +11 -0
- package/dist/components/deferred.js +41 -0
- package/dist/components/deferred.module.js +5 -0
- package/dist/components/error_boundary.d.ts +18 -0
- package/dist/components/error_boundary.js +15 -0
- package/dist/components/graph.module.js +15 -0
- package/dist/components/graph_port.d.ts +10 -0
- package/dist/components/graph_port.js +34 -0
- package/dist/components/inspector_overlay.d.ts +32 -0
- package/dist/components/inspector_overlay.js +72 -0
- package/dist/components/inspector_overlay.module.js +18 -0
- package/dist/components/json/json_arrow_symbol.d.ts +4 -0
- package/dist/components/json/json_arrow_symbol.js +25 -0
- package/dist/components/json/json_copy_button.d.ts +11 -0
- package/dist/components/json/json_copy_button.js +61 -0
- package/dist/components/json/json_ellipsis_symbol.d.ts +7 -0
- package/dist/components/json/json_ellipsis_symbol.js +11 -0
- package/dist/components/json/json_item_count.d.ts +5 -0
- package/dist/components/json/json_item_count.js +12 -0
- package/dist/components/json/json_key_name.d.ts +6 -0
- package/dist/components/json/json_key_name.js +40 -0
- package/dist/components/json/json_key_values.d.ts +12 -0
- package/dist/components/json/json_key_values.js +99 -0
- package/dist/components/json/json_literal.d.ts +8 -0
- package/dist/components/json/json_literal.js +140 -0
- package/dist/components/json/json_nested_close.d.ts +11 -0
- package/dist/components/json/json_nested_close.js +31 -0
- package/dist/components/json/json_nested_open.d.ts +18 -0
- package/dist/components/json/json_nested_open.js +150 -0
- package/dist/components/json/json_nested_state.d.ts +14 -0
- package/dist/components/json/json_nested_state.js +28 -0
- package/dist/components/json/json_tool_state.d.ts +18 -0
- package/dist/components/json/json_tool_state.js +46 -0
- package/dist/components/json/json_value.d.ts +10 -0
- package/dist/components/json/json_value.js +46 -0
- package/dist/components/json/json_view.d.ts +14 -0
- package/dist/components/json/json_view.js +37 -0
- package/dist/components/json/json_view.module.js +41 -0
- package/dist/components/json/json_view_state.d.ts +14 -0
- package/dist/components/json/json_view_state.js +32 -0
- package/dist/components/json/unique_key.d.ts +1 -0
- package/dist/components/json/unique_key.js +8 -0
- package/dist/components/keyvalue_list.d.ts +25 -0
- package/dist/components/keyvalue_list.js +106 -0
- package/dist/components/keyvalue_list.module.js +15 -0
- package/dist/components/name_input.d.ts +12 -0
- package/dist/components/name_input.js +63 -0
- package/dist/components/overlay.d.ts +53 -0
- package/dist/components/overlay.js +183 -0
- package/dist/components/overlay.module.js +32 -0
- package/dist/components/panel_resize_handle.d.ts +12 -0
- package/dist/components/panel_resize_handle.js +39 -0
- package/dist/components/portal.d.ts +8 -0
- package/dist/components/portal.js +53 -0
- package/dist/components/progress_bar.d.ts +7 -0
- package/dist/components/progress_bar.js +21 -0
- package/dist/components/progress_bar.module.js +3 -0
- package/dist/components/query_history_viewer.d.ts +31 -0
- package/dist/components/query_history_viewer.js +271 -0
- package/dist/components/query_history_viewer.module.js +7 -0
- package/dist/components/query_profile/engine_profile_view.d.ts +19 -0
- package/dist/components/query_profile/engine_profile_view.js +94 -0
- package/dist/components/query_profile/numeric_limits.d.ts +1 -0
- package/dist/components/query_profile/numeric_limits.js +2 -0
- package/dist/components/query_profile/profile_execution_controller.d.ts +12 -0
- package/dist/components/query_profile/profile_execution_controller.js +44 -0
- package/dist/components/query_profile/profile_fit.d.ts +24 -0
- package/dist/components/query_profile/profile_fit.js +22 -0
- package/dist/components/query_profile/profile_navigation.d.ts +3 -0
- package/dist/components/query_profile/profile_navigation.js +34 -0
- package/dist/components/query_profile/profile_scene.d.ts +64 -0
- package/dist/components/query_profile/profile_scene.js +422 -0
- package/dist/components/query_profile/query_profile_view.d.ts +36 -0
- package/dist/components/query_profile/query_profile_view.js +953 -0
- package/dist/components/query_profile/query_profile_view.module.js +23 -0
- package/dist/components/query_progress/query_profile_overlay.d.ts +7 -0
- package/dist/components/query_progress/query_profile_overlay.js +67 -0
- package/dist/components/query_progress/query_profile_overlay.module.js +6 -0
- package/dist/components/query_progress/query_progress_panel.d.ts +14 -0
- package/dist/components/query_progress/query_progress_panel.js +255 -0
- package/dist/components/query_progress/query_progress_panel.module.js +10 -0
- package/dist/components/query_result/cell_detail_overlay.d.ts +34 -0
- package/dist/components/query_result/cell_detail_overlay.js +277 -0
- package/dist/components/query_result/cell_detail_overlay.module.js +21 -0
- package/dist/components/query_result/query_result_action_menu.d.ts +12 -0
- package/dist/components/query_result/query_result_action_menu.js +62 -0
- package/dist/components/query_result/query_result_action_menu.module.js +2 -0
- package/dist/components/query_result/query_result_details.d.ts +17 -0
- package/dist/components/query_result/query_result_details.js +46 -0
- package/dist/components/query_result/query_result_details.module.js +5 -0
- package/dist/components/query_result/query_result_download_button.d.ts +8 -0
- package/dist/components/query_result/query_result_download_button.js +38 -0
- package/dist/components/query_result/query_result_header.d.ts +21 -0
- package/dist/components/query_result/query_result_header.js +72 -0
- package/dist/components/query_result/query_result_header.module.js +3 -0
- package/dist/components/query_result/query_result_search_controls.d.ts +12 -0
- package/dist/components/query_result/query_result_search_controls.js +141 -0
- package/dist/components/query_result/query_result_search_controls.module.js +7 -0
- package/dist/components/query_result/query_result_toolbar.d.ts +21 -0
- package/dist/components/query_result/query_result_toolbar.js +74 -0
- package/dist/components/query_result/result_table_overlay.d.ts +9 -0
- package/dist/components/query_result/result_table_overlay.js +73 -0
- package/dist/components/query_result/result_table_overlay.module.js +6 -0
- package/dist/components/query_result/use_query_result_search.d.ts +8 -0
- package/dist/components/query_result/use_query_result_search.js +28 -0
- package/dist/components/segmented_control.d.ts +58 -0
- package/dist/components/segmented_control.js +116 -0
- package/dist/components/segmented_control.module.js +17 -0
- package/dist/components/separator.d.ts +21 -0
- package/dist/components/separator.js +79 -0
- package/dist/components/separator.module.js +7 -0
- package/dist/components/sheet.d.ts +11 -0
- package/dist/components/sheet.js +65 -0
- package/dist/components/sheet.module.js +7 -0
- package/dist/components/size_observer.d.ts +7 -0
- package/dist/components/size_observer.js +57 -0
- package/dist/components/skeleton.d.ts +2 -0
- package/dist/components/skeleton.js +14 -0
- package/dist/components/skeleton.module.js +2 -0
- package/dist/components/spinners.d.ts +8 -0
- package/dist/components/spinners.js +33 -0
- package/dist/components/spinners.module.js +8 -0
- package/dist/components/status_indicator.d.ts +36 -0
- package/dist/components/status_indicator.js +182 -0
- package/dist/components/status_indicator.module.js +3 -0
- package/dist/components/symbol_icon.d.ts +65 -0
- package/dist/components/symbol_icon.js +213 -0
- package/dist/components/tab_header.d.ts +11 -0
- package/dist/components/tab_header.js +55 -0
- package/dist/components/tab_header.module.js +7 -0
- package/dist/components/tag.d.ts +10 -0
- package/dist/components/tag.js +17 -0
- package/dist/components/tag.module.js +4 -0
- package/dist/components/text_field.d.ts +44 -0
- package/dist/components/text_field.js +159 -0
- package/dist/components/text_field.module.js +15 -0
- package/dist/components/text_input.d.ts +25 -0
- package/dist/components/text_input.js +90 -0
- package/dist/components/text_input.module.js +13 -0
- package/dist/components/text_input_action.d.ts +19 -0
- package/dist/components/text_input_action.js +33 -0
- package/dist/components/text_input_action.module.js +2 -0
- package/dist/components/toggle_switch.d.ts +7 -0
- package/dist/components/toggle_switch.js +22 -0
- package/dist/components/toggle_switch.module.js +6 -0
- package/dist/components/tooltip.d.ts +22 -0
- package/dist/components/tooltip.js +139 -0
- package/dist/components/tooltip.module.js +2 -0
- package/dist/components/tree_entry.d.ts +17 -0
- package/dist/components/tree_entry.js +48 -0
- package/dist/components/tree_entry.module.js +9 -0
- package/dist/components/value_list.d.ts +17 -0
- package/dist/components/value_list.js +70 -0
- package/dist/components/value_list.module.js +8 -0
- package/dist/components/vegalite_chart.d.ts +16 -0
- package/dist/components/vegalite_chart.js +149 -0
- package/dist/components/vegalite_chart.module.js +3 -0
- package/dist/components/vegalite_view.d.ts +26 -0
- package/dist/components/vegalite_view.js +239 -0
- package/dist/components/vegalite_view.module.js +5 -0
- package/dist/components/vertical_scroll_shadows.d.ts +14 -0
- package/dist/components/vertical_scroll_shadows.js +55 -0
- package/dist/components/vertical_scroll_shadows.module.js +5 -0
- package/dist/components/vertical_split.d.ts +15 -0
- package/dist/components/vertical_split.js +112 -0
- package/dist/components/vertical_split.module.js +5 -0
- package/dist/components/vertical_tabs.d.ts +36 -0
- package/dist/components/vertical_tabs.js +169 -0
- package/dist/components/vertical_tabs.module.js +23 -0
- package/dist/components/visualization/capped_rows.d.ts +9 -0
- package/dist/components/visualization/capped_rows.js +23 -0
- package/dist/components/visualization/capped_rows.module.js +3 -0
- package/dist/components/visualization/chart_download_button.d.ts +12 -0
- package/dist/components/visualization/chart_download_button.js +41 -0
- package/dist/components/visualization/kpi_view.d.ts +10 -0
- package/dist/components/visualization/kpi_view.js +215 -0
- package/dist/components/visualization/kpi_view.module.js +17 -0
- package/dist/components/visualization/markdown_view.d.ts +17 -0
- package/dist/components/visualization/markdown_view.js +154 -0
- package/dist/components/visualization/markdown_view.module.js +4 -0
- package/dist/components/visualization/result_rows.d.ts +17 -0
- package/dist/components/visualization/result_rows.js +82 -0
- package/dist/components/visualization/vegalite_preview.d.ts +8 -0
- package/dist/components/visualization/vegalite_preview.js +17 -0
- package/dist/components/visualization/vegalite_preview.module.js +2 -0
- package/dist/components/visualization/visualization_dispatch.d.ts +13 -0
- package/dist/components/visualization/visualization_dispatch.js +40 -0
- package/dist/components/visualization/visualization_panel.d.ts +10 -0
- package/dist/components/visualization/visualization_panel.js +36 -0
- package/dist/components/visualization/visualization_panel.module.js +3 -0
- package/dist/dom/anchored_position.d.ts +42 -0
- package/dist/dom/anchored_position.js +255 -0
- package/dist/dom/app_host.d.ts +2 -0
- package/dist/dom/app_host.js +7 -0
- package/dist/dom/calm_frames.d.ts +29 -0
- package/dist/dom/calm_frames.js +120 -0
- package/dist/dom/classnames.d.ts +8 -0
- package/dist/dom/classnames.js +20 -0
- package/dist/dom/download_file.d.ts +1 -0
- package/dist/dom/download_file.js +12 -0
- package/dist/dom/focus.d.ts +29 -0
- package/dist/dom/focus.js +84 -0
- package/dist/dom/graph_edges.d.ts +53 -0
- package/dist/dom/graph_edges.js +450 -0
- package/dist/dom/key_events.d.ts +9 -0
- package/dist/dom/key_events.js +33 -0
- package/dist/dom/media_query.d.ts +5 -0
- package/dist/dom/media_query.js +18 -0
- package/dist/dom/outside_click.d.ts +8 -0
- package/dist/dom/outside_click.js +32 -0
- package/dist/dom/rerender_ref.d.ts +2 -0
- package/dist/dom/rerender_ref.js +11 -0
- package/dist/dom/row_context_menu.d.ts +7 -0
- package/dist/dom/row_context_menu.js +32 -0
- package/dist/dom/scrollbar.d.ts +3 -0
- package/dist/dom/scrollbar.js +23 -0
- package/dist/format/format.d.ts +11 -0
- package/dist/format/format.js +72 -0
- package/dist/format/query_progress_format.d.ts +17 -0
- package/dist/format/query_progress_format.js +69 -0
- package/dist/format/time_format.d.ts +5 -0
- package/dist/format/time_format.js +45 -0
- package/dist/hooks.d.ts +72 -0
- package/dist/hooks.js +305 -0
- package/dist/host.d.ts +10 -0
- package/dist/host.js +12 -0
- package/dist/logger.d.ts +4 -0
- package/dist/logger.js +13 -0
- package/dist/models/computation_model.d.ts +14 -0
- package/dist/models/computation_model.js +27 -0
- package/dist/models/query_model.d.ts +12 -0
- package/dist/models/query_model.js +27 -0
- package/dist/models/script_model.d.ts +17 -0
- package/dist/models/script_model.js +59 -0
- package/dist/platform/content_length.d.ts +1 -0
- package/dist/platform/content_length.js +7 -0
- package/dist/platform/core_provider.d.ts +18 -0
- package/dist/platform/core_provider.js +106 -0
- package/dist/platform/embedded_database_provider.d.ts +19 -0
- package/dist/platform/embedded_database_provider.js +53 -0
- package/dist/platform/page_runtime.d.ts +3 -0
- package/dist/platform/page_runtime.js +29 -0
- package/dist/style.css +4386 -0
- package/dist/svg_symbols.d.ts +2 -0
- package/dist/svg_symbols.js +2 -0
- package/dist/symbols.svg +1197 -0
- package/dist/theme/color_scheme.d.ts +4 -0
- package/dist/theme/color_scheme.js +28 -0
- package/dist/theme/xcode_palette.d.ts +22 -0
- package/dist/theme/xcode_palette.js +4 -0
- package/dist/theme/xcode_palettes.js +41 -0
- package/dist/utils/plan_engine.d.ts +2 -0
- package/dist/utils/plan_engine.js +13 -0
- package/dist/vegalite/vegalite_check.d.ts +1 -0
- package/dist/vegalite/vegalite_check.js +7 -0
- package/dist/vegalite/vegalite_crossfilter.d.ts +54 -0
- package/dist/vegalite/vegalite_crossfilter.js +187 -0
- package/dist/vegalite/vegalite_image.d.ts +14 -0
- package/dist/vegalite/vegalite_image.js +28 -0
- package/dist/vegalite/vegalite_loader.d.ts +7 -0
- package/dist/vegalite/vegalite_loader.js +15 -0
- package/dist/vegalite/vegalite_rows.d.ts +3 -0
- package/dist/vegalite/vegalite_rows.js +23 -0
- package/dist/vegalite/vegalite_theme.d.ts +13 -0
- package/dist/vegalite/vegalite_theme.js +141 -0
- package/fonts/InstrumentSans-Bold.ttf +0 -0
- package/fonts/InstrumentSans-Medium.ttf +0 -0
- package/fonts/InstrumentSans-OFL.txt +93 -0
- package/fonts/InstrumentSans-Regular.ttf +0 -0
- package/fonts/InstrumentSans-SemiBold.ttf +0 -0
- package/fonts/JetBrainsMono-Bold.ttf +0 -0
- package/fonts/JetBrainsMono-Medium.ttf +0 -0
- package/fonts/JetBrainsMono-OFL.txt +93 -0
- package/fonts/JetBrainsMono-Regular.ttf +0 -0
- package/fonts/JetBrainsMono-SemiBold.ttf +0 -0
- package/fonts/fonts.css +61 -0
- package/package.json +403 -4
- package/styles/colors.css +110 -0
- package/styles/flavors/dbcom.css +48 -0
- package/styles/tokens.css +192 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as dashql from '@akohn/dashql';
|
|
3
|
+
import { ProfileExecutionState } from '@akohn/dashql/platform/query/profile_execution_state';
|
|
4
|
+
type ProfileEngine = dashql.buffers.profile.ProfileEngine;
|
|
5
|
+
export interface EngineProfileViewProps {
|
|
6
|
+
engine: ProfileEngine;
|
|
7
|
+
planText: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
fallback?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface QueryProfileState {
|
|
12
|
+
plan: dashql.FlatBufferPtr<dashql.buffers.profile.QueryProfile> | null;
|
|
13
|
+
execution: ProfileExecutionState;
|
|
14
|
+
rejected: boolean;
|
|
15
|
+
rotate?: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function useQueryProfile(engine: ProfileEngine, planText: string | null): QueryProfileState;
|
|
18
|
+
export declare function EngineProfileView(props: EngineProfileViewProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { QueryProfileView, createProfileLayoutConfig as createProfileLayoutConfig$1 } from "./query_profile_view.js";
|
|
2
|
+
import { useHost } from "../../host.js";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import * as dashql from "@akohn/dashql";
|
|
6
|
+
import { ProfileExecutionState } from "@akohn/dashql/platform/query/profile_execution_state";
|
|
7
|
+
import { rotateProfileLayoutOrientation } from "@akohn/dashql/platform/query/profile_layout_config";
|
|
8
|
+
function loadPlan(viewModel, engine, planText) {
|
|
9
|
+
switch (engine) {
|
|
10
|
+
case dashql.buffers.profile.ProfileEngine.HYPER: return viewModel.loadHyperPlan(planText);
|
|
11
|
+
case dashql.buffers.profile.ProfileEngine.TRINO: return viewModel.loadTrinoPlan(planText);
|
|
12
|
+
default: throw new Error(`Plans of engine ${engine} are not supported`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function useQueryProfile(engine, planText) {
|
|
16
|
+
const coreSetup = useHost().setupCore;
|
|
17
|
+
const layoutConfig = React.useMemo(() => createProfileLayoutConfig$1(), []);
|
|
18
|
+
const viewModelRef = React.useRef(null);
|
|
19
|
+
const [state, setState] = React.useState({
|
|
20
|
+
plan: null,
|
|
21
|
+
execution: ProfileExecutionState.EMPTY,
|
|
22
|
+
rejected: false
|
|
23
|
+
});
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
let cancelled = false;
|
|
26
|
+
setState({
|
|
27
|
+
plan: null,
|
|
28
|
+
execution: ProfileExecutionState.EMPTY,
|
|
29
|
+
rejected: false
|
|
30
|
+
});
|
|
31
|
+
if (planText == null || coreSetup == null) return;
|
|
32
|
+
const load = async () => {
|
|
33
|
+
const core = await coreSetup("engine_profile_view");
|
|
34
|
+
if (cancelled) return;
|
|
35
|
+
viewModelRef.current ??= core.createQueryProfile(layoutConfig);
|
|
36
|
+
try {
|
|
37
|
+
const plan = loadPlan(viewModelRef.current, engine, planText);
|
|
38
|
+
if (plan.read().operatorsLength() === 0) throw new Error("Plan contains no operators");
|
|
39
|
+
const execution = ProfileExecutionState.EMPTY.withEvents(viewModelRef.current.snapshotEvents().read());
|
|
40
|
+
if (!cancelled) setState({
|
|
41
|
+
plan,
|
|
42
|
+
execution,
|
|
43
|
+
rejected: false
|
|
44
|
+
});
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.warn(error);
|
|
47
|
+
if (!cancelled) setState({
|
|
48
|
+
plan: null,
|
|
49
|
+
execution: ProfileExecutionState.EMPTY,
|
|
50
|
+
rejected: true
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
load();
|
|
55
|
+
return () => {
|
|
56
|
+
cancelled = true;
|
|
57
|
+
};
|
|
58
|
+
}, [
|
|
59
|
+
coreSetup,
|
|
60
|
+
layoutConfig,
|
|
61
|
+
engine,
|
|
62
|
+
planText
|
|
63
|
+
]);
|
|
64
|
+
React.useEffect(() => () => {
|
|
65
|
+
viewModelRef.current?.destroy();
|
|
66
|
+
viewModelRef.current = null;
|
|
67
|
+
}, []);
|
|
68
|
+
const rotate = React.useCallback(() => {
|
|
69
|
+
const viewModel = viewModelRef.current;
|
|
70
|
+
if (viewModel == null) return;
|
|
71
|
+
const plan = viewModel.relayout(createProfileLayoutConfig$1(rotateProfileLayoutOrientation(viewModel.layout.orientation)));
|
|
72
|
+
setState((current) => current.plan == null ? current : {
|
|
73
|
+
...current,
|
|
74
|
+
plan
|
|
75
|
+
});
|
|
76
|
+
}, []);
|
|
77
|
+
return React.useMemo(() => state.plan == null ? state : {
|
|
78
|
+
...state,
|
|
79
|
+
rotate
|
|
80
|
+
}, [state, rotate]);
|
|
81
|
+
}
|
|
82
|
+
function EngineProfileView(props) {
|
|
83
|
+
const { plan, execution, rejected, rotate } = useQueryProfile(props.engine, props.planText);
|
|
84
|
+
if (rejected) return props.fallback ?? null;
|
|
85
|
+
return /* @__PURE__ */ jsx("div", {
|
|
86
|
+
className: props.className,
|
|
87
|
+
children: plan != null && /* @__PURE__ */ jsx(QueryProfileView, {
|
|
88
|
+
plan,
|
|
89
|
+
execution,
|
|
90
|
+
onRotate: rotate
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
export { EngineProfileView, useQueryProfile };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const U32_MAX = 4294967295;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ProfileExecutionState } from '@akohn/dashql/platform/query/profile_execution_state';
|
|
2
|
+
export declare class ProfileExecutionController {
|
|
3
|
+
private operatorElements;
|
|
4
|
+
private pipelinePaths;
|
|
5
|
+
private statuses;
|
|
6
|
+
reset(operatorCount: number, pipelineCount: number): void;
|
|
7
|
+
registerOperator(id: number, element: SVGGElement | null): void;
|
|
8
|
+
registerPipeline(id: number, path: SVGPathElement | null): void;
|
|
9
|
+
private setOperatorStatus;
|
|
10
|
+
private setPipelineStatus;
|
|
11
|
+
applyState(state: ProfileExecutionState, operatorFragments?: readonly number[]): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as dashql from "@akohn/dashql";
|
|
2
|
+
var view = dashql.buffers.profile;
|
|
3
|
+
var ProfileExecutionController = class {
|
|
4
|
+
operatorElements = [];
|
|
5
|
+
pipelinePaths = [];
|
|
6
|
+
statuses = /* @__PURE__ */ new Uint8Array();
|
|
7
|
+
reset(operatorCount, pipelineCount) {
|
|
8
|
+
this.operatorElements.length = operatorCount;
|
|
9
|
+
this.pipelinePaths.length = pipelineCount;
|
|
10
|
+
this.statuses = new Uint8Array(operatorCount);
|
|
11
|
+
for (const element of this.operatorElements) if (element != null) element.dataset.status = `${view.ProfileExecutionStatus.UNKNOWN}`;
|
|
12
|
+
for (const path of this.pipelinePaths) if (path != null) delete path.dataset.status;
|
|
13
|
+
}
|
|
14
|
+
registerOperator(id, element) {
|
|
15
|
+
this.operatorElements[id] = element;
|
|
16
|
+
if (element != null) element.dataset.status = `${this.statuses[id] ?? view.ProfileExecutionStatus.UNKNOWN}`;
|
|
17
|
+
}
|
|
18
|
+
registerPipeline(id, path) {
|
|
19
|
+
this.pipelinePaths[id] = path;
|
|
20
|
+
}
|
|
21
|
+
setOperatorStatus(id, status) {
|
|
22
|
+
if (id >= this.statuses.length || this.statuses[id] === status) return;
|
|
23
|
+
this.statuses[id] = status;
|
|
24
|
+
const element = this.operatorElements[id];
|
|
25
|
+
if (element != null) element.dataset.status = `${status}`;
|
|
26
|
+
}
|
|
27
|
+
setPipelineStatus(id, status) {
|
|
28
|
+
const path = this.pipelinePaths[id];
|
|
29
|
+
if (path != null) path.dataset.status = `${status}`;
|
|
30
|
+
}
|
|
31
|
+
applyState(state, operatorFragments = []) {
|
|
32
|
+
for (let id = 0; id < this.statuses.length; ++id) {
|
|
33
|
+
const own = state.operators[id]?.status ?? view.ProfileExecutionStatus.UNKNOWN;
|
|
34
|
+
const fragment = operatorFragments[id];
|
|
35
|
+
const inherited = fragment == null ? void 0 : state.fragments[fragment]?.status;
|
|
36
|
+
const status = own !== view.ProfileExecutionStatus.UNKNOWN ? own : inherited;
|
|
37
|
+
if (status != null) this.setOperatorStatus(id, status);
|
|
38
|
+
}
|
|
39
|
+
state.pipelines.forEach((pipeline, id) => {
|
|
40
|
+
if (pipeline != null) this.setPipelineStatus(id, pipeline.status);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
export { ProfileExecutionController };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** The padding between the viewport and the fitted plan */
|
|
2
|
+
export declare const PROFILE_FIT_PADDING = 24;
|
|
3
|
+
/** The padding at the bottom of the viewport, which also clears the controls in the bottom corners */
|
|
4
|
+
export declare const PROFILE_FIT_PADDING_BOTTOM = 44;
|
|
5
|
+
/** The bounds of the drawn plan in scene coordinates */
|
|
6
|
+
export interface ProfileFitBounds {
|
|
7
|
+
left: number;
|
|
8
|
+
top: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ProfileFitTransform {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
scale: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Compute the transform that shows a plan as a whole in a viewport.
|
|
19
|
+
*
|
|
20
|
+
* The bounds are those of the drawn plan, which need not start at the origin of the scene. The plan is scaled down
|
|
21
|
+
* until it fits (but never enlarged beyond scale 1) and centered in the space left by the paddings. Large plans
|
|
22
|
+
* shrink as far as needed, zooming in is up to the user.
|
|
23
|
+
*/
|
|
24
|
+
export declare function computeProfileFitTransform(bounds: ProfileFitBounds, viewportWidth: number, viewportHeight: number): ProfileFitTransform;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** The padding between the viewport and the fitted plan */
|
|
2
|
+
var PROFILE_FIT_PADDING = 24;
|
|
3
|
+
/** The padding at the bottom of the viewport, which also clears the controls in the bottom corners */
|
|
4
|
+
var PROFILE_FIT_PADDING_BOTTOM = 44;
|
|
5
|
+
/**
|
|
6
|
+
* Compute the transform that shows a plan as a whole in a viewport.
|
|
7
|
+
*
|
|
8
|
+
* The bounds are those of the drawn plan, which need not start at the origin of the scene. The plan is scaled down
|
|
9
|
+
* until it fits (but never enlarged beyond scale 1) and centered in the space left by the paddings. Large plans
|
|
10
|
+
* shrink as far as needed, zooming in is up to the user.
|
|
11
|
+
*/
|
|
12
|
+
function computeProfileFitTransform(bounds, viewportWidth, viewportHeight) {
|
|
13
|
+
const availableWidth = Math.max(1, viewportWidth - 48);
|
|
14
|
+
const availableHeight = Math.max(1, viewportHeight - 24 - 44);
|
|
15
|
+
const scale = Math.min(1, availableWidth / bounds.width, availableHeight / bounds.height);
|
|
16
|
+
return {
|
|
17
|
+
x: 24 + (availableWidth - bounds.width * scale) / 2 - bounds.left * scale,
|
|
18
|
+
y: 24 + (availableHeight - bounds.height * scale) / 2 - bounds.top * scale,
|
|
19
|
+
scale
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export { PROFILE_FIT_PADDING, PROFILE_FIT_PADDING_BOTTOM, computeProfileFitTransform };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ProfileSceneEdge, ProfileSceneOperator } from './profile_scene.js';
|
|
2
|
+
export type ProfileNavigationDirection = 'left' | 'right' | 'up' | 'down';
|
|
3
|
+
export declare function findProfileOperatorInDirection(operators: readonly ProfileSceneOperator[], edges: readonly Pick<ProfileSceneEdge, 'childOperator' | 'parentOperator'>[], current: ProfileSceneOperator | null, direction: ProfileNavigationDirection, leftToRight?: boolean): ProfileSceneOperator | null;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function findProfileOperatorInDirection(operators, edges, current, direction, leftToRight = false) {
|
|
2
|
+
if (operators.length === 0) return null;
|
|
3
|
+
if (current == null) {
|
|
4
|
+
const sign = direction === "left" || direction === "up" ? -1 : 1;
|
|
5
|
+
const coordinate = direction === "left" || direction === "right" ? "x" : "y";
|
|
6
|
+
return [...operators].sort((left, right) => sign * (left.rect[coordinate] - right.rect[coordinate]) || left.id - right.id)[0];
|
|
7
|
+
}
|
|
8
|
+
const toChild = leftToRight ? "right" : "down";
|
|
9
|
+
const toParent = leftToRight ? "left" : "up";
|
|
10
|
+
if (direction === toChild) {
|
|
11
|
+
const child = edges.find((edge) => edge.parentOperator === current.id)?.childOperator;
|
|
12
|
+
return child == null ? null : operators.find((operator) => operator.id === child) ?? null;
|
|
13
|
+
}
|
|
14
|
+
if (direction === toParent) {
|
|
15
|
+
const parent = edges.find((edge) => edge.childOperator === current.id)?.parentOperator;
|
|
16
|
+
return parent == null ? null : operators.find((operator) => operator.id === parent) ?? null;
|
|
17
|
+
}
|
|
18
|
+
const level = (operator) => leftToRight ? operator.rect.x - operator.rect.width / 2 : operator.rect.y;
|
|
19
|
+
const position = (operator) => leftToRight ? operator.rect.y : operator.rect.x;
|
|
20
|
+
const backwards = direction === "left" || direction === "up";
|
|
21
|
+
const candidates = operators.flatMap((operator) => {
|
|
22
|
+
if (operator.id === current.id) return [];
|
|
23
|
+
const delta = position(operator) - position(current);
|
|
24
|
+
if (level(operator) !== level(current)) return [];
|
|
25
|
+
if (backwards ? delta >= 0 : delta <= 0) return [];
|
|
26
|
+
return [{
|
|
27
|
+
operator,
|
|
28
|
+
distance: Math.abs(delta)
|
|
29
|
+
}];
|
|
30
|
+
});
|
|
31
|
+
candidates.sort((left, right) => left.distance - right.distance || left.operator.id - right.operator.id);
|
|
32
|
+
return candidates[0]?.operator ?? null;
|
|
33
|
+
}
|
|
34
|
+
export { findProfileOperatorInDirection };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as dashql from '@akohn/dashql';
|
|
2
|
+
export interface ProfileSceneRect {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export interface ProfileSceneOperator {
|
|
9
|
+
id: number;
|
|
10
|
+
kind: dashql.buffers.profile.ProfileOperatorKind;
|
|
11
|
+
typeName: string | null;
|
|
12
|
+
label: string;
|
|
13
|
+
displayLabel: string;
|
|
14
|
+
rect: ProfileSceneRect;
|
|
15
|
+
ports: number;
|
|
16
|
+
estimatedRows: number;
|
|
17
|
+
fragment: number;
|
|
18
|
+
properties: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export declare const PROFILE_OPERATOR_PORT_OUTPUT = 1;
|
|
21
|
+
export declare const PROFILE_OPERATOR_PORT_INPUT = 2;
|
|
22
|
+
export interface ProfileSceneEdge {
|
|
23
|
+
id: number;
|
|
24
|
+
childOperator: number;
|
|
25
|
+
parentOperator: number;
|
|
26
|
+
slot: number;
|
|
27
|
+
outputCardinalityEstimated: number | null;
|
|
28
|
+
path: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ProfileSceneCrossEdge {
|
|
31
|
+
id: number;
|
|
32
|
+
sourceOperator: number;
|
|
33
|
+
targetOperator: number;
|
|
34
|
+
kind: string;
|
|
35
|
+
properties: Record<string, unknown>;
|
|
36
|
+
path: string;
|
|
37
|
+
}
|
|
38
|
+
export interface ProfileScenePipeline {
|
|
39
|
+
id: number;
|
|
40
|
+
operatorIds: readonly number[];
|
|
41
|
+
path: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ProfileSceneFragment {
|
|
44
|
+
id: number;
|
|
45
|
+
operatorIds: readonly number[];
|
|
46
|
+
path: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ProfileScene {
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
leftToRight: boolean;
|
|
52
|
+
layoutConfig: dashql.buffers.profile.DerivedProfileLayoutConfigT;
|
|
53
|
+
operators: readonly ProfileSceneOperator[];
|
|
54
|
+
edges: readonly ProfileSceneEdge[];
|
|
55
|
+
crossEdges: readonly ProfileSceneCrossEdge[];
|
|
56
|
+
fragments: readonly ProfileSceneFragment[];
|
|
57
|
+
pipelines: readonly ProfileScenePipeline[];
|
|
58
|
+
}
|
|
59
|
+
export declare function estimateRelativeDifference(estimated: number, actual: number): number;
|
|
60
|
+
export declare function buildCrossEdgePath(source: ProfileSceneRect, target: ProfileSceneRect, minHandleLength?: number, minInputHandleLength?: number, leftToRight?: boolean): string;
|
|
61
|
+
export declare function truncateProfileLabel(label: string, maxChars: number): string;
|
|
62
|
+
export declare function buildPipelinePath(operatorIds: readonly number[], operators: readonly Pick<ProfileSceneOperator, "rect">[]): string;
|
|
63
|
+
export declare function buildFragmentPath(operatorIds: readonly number[], operators: readonly Pick<ProfileSceneOperator, 'rect'>[], edges?: readonly Pick<ProfileSceneEdge, 'childOperator' | 'parentOperator'>[], padding?: number, corridorWidth?: number, leftToRight?: boolean): string;
|
|
64
|
+
export declare function materializeProfileScene(viewModel: dashql.FlatBufferPtr<dashql.buffers.profile.QueryProfile>): ProfileScene;
|