mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 00:25:46 -06:00
* Fix: make webpack pickup workers written in TS * Add comlink to dependencies * Temporary fix: copy paste `toDataQueryError` from @grafana/runtime to avoid web dependencies * Implemented comlink-based centrifuge worker & worker proxy * Temporary fix: implement comlink transferHandlers for subscriptions and streamingdataframes * Move liveTimer filtering from CentrifugeService into GrafanaLiveService * Switch from CentrifugeService to CentrifugeServiceWorkerProxy in GrafanaLive * Naming fix * Refactor: move liveTimer-based data filtering from GrafanaLiveService to CentrifugeServiceWorker * observe dataStream on an async scheduler * Fix: - Unsubscribe is now propagated from the main thread to the worker, - improve worker&workerProxy types * Fix: Prettify types * Fix: Add error & complete observers * Docs: Add comment explaining the `subscriberTransferHandler` * Fix: Replace `StreamingDataFrameHandler` with explicitly converting StreamingDataFrame to a DataFrameDTO * Refactor: move liveTimer filtering to service.ts to make it easy to implement a `live-service-web-worker` feature flag * Feat: add `live-service-web-worker` feature flag * Fix: extract toDataQueryError.ts to a separate file within `@grafana-runtime` to avoid having a dependency from webworker to the whole package (@grafana-runtime/index.ts) * Update public/app/features/dashboard/dashgrid/liveTimer.ts Co-authored-by: Leon Sorokin <leeoniya@gmail.com> * Fix: fixed default import class in worker file * Fix: cast worker as Endpoint * Migrate from worker-loader to webpack native worker support v1 - broken prod build * Fix: Use custom path in HtmlWebpackPlugin * Fix: Loading workers from CDNs * Fix: Avoid issues with jest ESM support by mocking `createWorker` files * Fix: move the custom mockWorker rendering layout to `test/mocks` Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
57 lines
1.7 KiB
TypeScript
57 lines
1.7 KiB
TypeScript
import React from 'react';
|
|
import { render, screen } from '@testing-library/react';
|
|
import { UnconnectedNodeGraphContainer } from './NodeGraphContainer';
|
|
import { getDefaultTimeRange, MutableDataFrame } from '@grafana/data';
|
|
import { ExploreId } from '../../types';
|
|
|
|
describe('NodeGraphContainer', () => {
|
|
it('is collapsed if shown with traces', () => {
|
|
const { container } = render(
|
|
<UnconnectedNodeGraphContainer
|
|
dataFrames={[emptyFrame]}
|
|
exploreId={ExploreId.left}
|
|
range={getDefaultTimeRange()}
|
|
splitOpen={(() => {}) as any}
|
|
withTraceView={true}
|
|
/>
|
|
);
|
|
|
|
// Make sure we only show header in the collapsible
|
|
expect(container.firstChild?.childNodes.length).toBe(1);
|
|
});
|
|
|
|
it('shows the graph if not with trace view', async () => {
|
|
const { container } = render(
|
|
<UnconnectedNodeGraphContainer
|
|
dataFrames={[nodes]}
|
|
exploreId={ExploreId.left}
|
|
range={getDefaultTimeRange()}
|
|
splitOpen={(() => {}) as any}
|
|
/>
|
|
);
|
|
|
|
expect(container.firstChild?.childNodes.length).toBe(2);
|
|
expect(container.querySelector('svg')).toBeInTheDocument();
|
|
await screen.findByLabelText(/Node: tempo-querier/);
|
|
});
|
|
});
|
|
|
|
const emptyFrame = new MutableDataFrame();
|
|
|
|
const nodes = new MutableDataFrame({
|
|
fields: toFields([
|
|
['id', ['3fa414edcef6ad90']],
|
|
['title', ['tempo-querier']],
|
|
['subTitle', ['HTTP GET - api_traces_traceid']],
|
|
['mainStat', ['1049.14ms (100%)']],
|
|
['secondaryStat', ['1047.29ms (99.82%)']],
|
|
['color', [0.9982395121342127]],
|
|
]),
|
|
});
|
|
|
|
function toFields(fields: Array<[string, any[]]>) {
|
|
return fields.map(([name, values]) => {
|
|
return { name, values };
|
|
});
|
|
}
|