mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
- Added new Profiling settings so users can customize the CO2 variables
- Fixed Embeddable components to also read the new settings
- Moved code from APM to obs-shared to create the custom settings page
in Profiling.
- New Settings Page was created in Profiling UI so users can easily find
the settings:
<img width="2053" alt="Screenshot 2023-09-22 at 11 18 35"
src="6969b079
-745d-4302-8ff2-4f0f256c7f51">
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
61 lines
1.9 KiB
TypeScript
61 lines
1.9 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
* 2.0.
|
|
*/
|
|
import { Embeddable, EmbeddableOutput, IContainer } from '@kbn/embeddable-plugin/public';
|
|
import { EMBEDDABLE_FUNCTIONS } from '@kbn/observability-shared-plugin/public';
|
|
import React from 'react';
|
|
import { render, unmountComponentAtNode } from 'react-dom';
|
|
import { AsyncEmbeddableComponent } from '../async_embeddable_component';
|
|
import { EmbeddableFunctionsEmbeddableInput } from './embeddable_functions_factory';
|
|
import { EmbeddableFunctionsGrid } from './embeddable_functions_grid';
|
|
import {
|
|
ProfilingEmbeddableProvider,
|
|
ProfilingEmbeddablesDependencies,
|
|
} from '../profiling_embeddable_provider';
|
|
|
|
export class EmbeddableFunctions extends Embeddable<
|
|
EmbeddableFunctionsEmbeddableInput,
|
|
EmbeddableOutput
|
|
> {
|
|
readonly type = EMBEDDABLE_FUNCTIONS;
|
|
private _domNode?: HTMLElement;
|
|
|
|
constructor(
|
|
private deps: ProfilingEmbeddablesDependencies,
|
|
initialInput: EmbeddableFunctionsEmbeddableInput,
|
|
parent?: IContainer
|
|
) {
|
|
super(initialInput, {}, parent);
|
|
}
|
|
|
|
render(domNode: HTMLElement) {
|
|
this._domNode = domNode;
|
|
const { data, isLoading, rangeFrom, rangeTo } = this.input;
|
|
const totalSeconds = (rangeTo - rangeFrom) / 1000;
|
|
render(
|
|
<ProfilingEmbeddableProvider deps={this.deps}>
|
|
<AsyncEmbeddableComponent isLoading={isLoading}>
|
|
<div style={{ width: '100%' }}>
|
|
<EmbeddableFunctionsGrid data={data} totalSeconds={totalSeconds} />
|
|
</div>
|
|
</AsyncEmbeddableComponent>
|
|
</ProfilingEmbeddableProvider>,
|
|
domNode
|
|
);
|
|
}
|
|
|
|
public destroy() {
|
|
if (this._domNode) {
|
|
unmountComponentAtNode(this._domNode);
|
|
}
|
|
}
|
|
|
|
reload() {
|
|
if (this._domNode) {
|
|
this.render(this._domNode);
|
|
}
|
|
}
|
|
}
|