Skip to content

Commit

Permalink
Update vega related modules (main) (#119663)
Browse files Browse the repository at this point in the history
* Update vega related modules (main)

* update types

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
alexwizp and kibanamachine authored Nov 29, 2021
1 parent ae9d51b commit d9ee4d7
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 130 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,12 @@
"usng.js": "^0.4.5",
"utility-types": "^3.10.0",
"uuid": "3.3.2",
"vega": "^5.19.1",
"vega": "^5.21.0",
"vega-interpreter": "^1.0.4",
"vega-lite": "^5.0.0",
"vega-schema-url-parser": "^2.1.0",
"vega-lite": "^5.2.0",
"vega-schema-url-parser": "^2.2.0",
"vega-spec-injector": "^0.0.2",
"vega-tooltip": "^0.25.1",
"vega-tooltip": "^0.27.0",
"venn.js": "0.2.20",
"vinyl": "^2.2.0",
"vt-pbf": "^3.1.1",
Expand Down
38 changes: 31 additions & 7 deletions src/plugins/vis_types/vega/public/vega_inspector/vega_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,35 @@
* Side Public License, v 1.
*/

import { i18n } from '@kbn/i18n';

import { Observable, ReplaySubject, fromEventPattern, merge, timer } from 'rxjs';
import { map, switchMap, filter, debounce } from 'rxjs/operators';
import { View, Runtime, Spec } from 'vega';
import { i18n } from '@kbn/i18n';
import { Assign } from '@kbn/utility-types';
import type { View, Spec } from 'vega';
import type { Assign } from '@kbn/utility-types';

interface DebugValues {
view: View;
view: Assign<
{
_runtime: {
data: Record<
string,
{
values: {
value: Array<Record<string, unknown>>;
};
}
>;
signals: Record<
string,
{
value: unknown;
}
>;
};
},
View
>;
spec: Spec;
}

Expand All @@ -38,8 +59,11 @@ const vegaAdapterValueLabel = i18n.translate('visTypeVega.inspector.vegaAdapter.
/** Get Runtime Scope for Vega View
* @link https://vega.github.io/vega/docs/api/debugging/#scope
**/
const getVegaRuntimeScope = (debugValues: DebugValues) =>
(debugValues.view as any)._runtime as Runtime;
const getVegaRuntimeScope = (debugValues: DebugValues) => {
const { data, signals } = debugValues.view._runtime ?? {};

return { data, signals };
};

const serializeColumns = (item: Record<string, unknown>, columns: string[]) => {
const nonSerializableFieldLabel = '(..)';
Expand Down Expand Up @@ -69,7 +93,7 @@ export class VegaAdapter {
const runtimeScope = getVegaRuntimeScope(debugValues);

return Object.keys(runtimeScope.data || []).reduce((acc: InspectDataSets[], key) => {
const value = runtimeScope.data[key].values.value;
const { value } = runtimeScope.data[key].values;

if (value && value[0]) {
const columns = Object.keys(value[0]);
Expand Down
Loading

0 comments on commit d9ee4d7

Please sign in to comment.