Skip to content

Commit

Permalink
draft avec panel size en dur
Browse files Browse the repository at this point in the history
  • Loading branch information
bjacomy committed Nov 25, 2020
1 parent 0d38554 commit f98cf46
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 28 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@webcomponents/shadydom": "^1.6.0",
"brace": "^0.11.1",
"mustache": "^4.0.1",
"react-shadow": "^16.3.2"
"react-shadow": "^16.3.2",
"timefilter": "^1.0.0"
}
}
2 changes: 1 addition & 1 deletion public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class TransformPlugin implements Plugin<void, void> {
{ expressions, visualizations, data }: TransformPluginSetupDependencies
) {
//setData(dataStart);
const config = createTransformVisDefinition({ uiSettings: core.uiSettings, data, timefilter: data.query.timefilter.timefilter});
const config = createTransformVisDefinition({ uiSettings: core.uiSettings, data/*, timefilter: data.query.timefilter.timefilter*/});
visualizations.createReactVisualization(config);
////console.log("dataStartold",dataStartold)
expressions.registerFunction(() =>
Expand Down
8 changes: 4 additions & 4 deletions public/transform_options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function getTransformOptions(param: TransformVisParamsNames) {
current.aceEditor.editor.resize();
}
}, [codeEditor]);

return (
<EuiPanel paddingSize="s">
<EuiCodeEditor
Expand All @@ -45,8 +45,8 @@ function getTransformOptions(param: TransformVisParamsNames) {
value={stateParams[param]}
onChange={onChange}
data-test-subj="transformCodeeditor"
width="100%"
height="100%"
width="700px"
height="500px"
setOptions={{
useSoftTabs: true,
tabSize: 2,
Expand All @@ -55,7 +55,7 @@ function getTransformOptions(param: TransformVisParamsNames) {
enableSnippets: true,
enableLiveAutocompletion: true,
}}
minLines={6}
//minLines={6}
/>
<ReactResizeDetector handleWidth handleHeight onResize={onResize} />
</EuiPanel>
Expand Down
6 changes: 3 additions & 3 deletions public/transform_vis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import { Timefilter } from '../../../src/plugins/data/public/query/timefilter';
export const createTransformVisDefinition = ({
uiSettings,
data,
timefilter}: {
/*timefilter*/}: {
uiSettings: IUiSettingsClient;
data: DataPublicPluginSetup;
timefilter:Timefilter
//timefilter:Timefilter
}) => {
const transformRequestHandler = getTransformRequestHandler({ uiSettings: uiSettings, timeFilter :timefilter });
const transformRequestHandler = getTransformRequestHandler({ uiSettings: uiSettings, timeFilter :data.query.timefilter.timefilter });
const transformVisWrapper = getTransformVisWrapper(data);

return {
Expand Down
27 changes: 10 additions & 17 deletions public/transform_vis_controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ShadowDOM from 'react-shadow';
import { saveAs } from '@elastic/filesaver';
import OnMount from './on_mount';
import { Vis } from '../../../src/plugins/visualizations/public/vis';
import { ExprVis } from '../../../src/plugins/visualizations/public/expressions/vis';
//import { Vis } from '../../../src/legacy/core_plugins/visualizations/public/np_ready/public';
import { TransformVisData } from './types';
import { DataPublicPluginSetup } from '../../../src/plugins/data/public';
Expand Down Expand Up @@ -34,18 +35,7 @@ class TransformVisComponent extends React.Component<TransformVisComponentProps>
}

async afterRender() {
if (this.props.meta){
console.log("this.props.meta",this.props.meta);
}
if (typeof this.props.meta.after_render === 'function'){
console.log("this.props.meta.after_render" );
}
console.log(this.transformVis.current);
console.log(this.transformVis.current.parentNode);
if (this.transformVis.current.parentNode instanceof ShadowRoot){
console.log("ShadowRoot")

}

if (
this.props.meta &&
typeof this.props.meta.after_render === 'function' &&
Expand All @@ -60,13 +50,16 @@ class TransformVisComponent extends React.Component<TransformVisComponentProps>
container: root.host,
root,
vis: {
...this.props.vis,
...this.props,
API: {
...this.props.vis,
timeFilter: {
getBounds: this.props.timefilter.getBounds.bind(this.props.timefilter),
getActiveBounds: this.props.timefilter.getBounds.bind(this.props.timefilter),
getTime: this.props.timefilter.getTime.bind(this.props.timefilter),
getBounds: this.props.data.query.timefilter.timefilter.getBounds.bind(this.props.timefilter),
//getBounds: this.props.timefilter.getBounds.bind(this.props.timefilter),
//getActiveBounds: this.props.timefilter.getBounds.bind(this.props.timefilter),
getActiveBounds: this.props.data.query.timefilter.timefilter.getActiveBounds.bind(this.props.timefilter),
//getTime: this.props.timefilter.getTime.bind(this.props.timefilter),
getTime: this.props.data.query.timefilter.timefilter.getTime.bind(this.props.timefilter),
},
},
//size: [root.host.parentNode.clientWidth, root.host.parentNode.clientHeight],
Expand All @@ -75,7 +68,7 @@ class TransformVisComponent extends React.Component<TransformVisComponentProps>
es: this.props.es,
context: this.props.context,
timeRange: this.props.timeRange,
timefilter: this.props.timefilter,
timefilter: this.props.data.query.timefilter.timefilter,
filterManager: this.props.data.query.filterManager,
meta: this.props.meta,
saveAs,
Expand Down
4 changes: 2 additions & 2 deletions public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DslQuery } from 'src/plugins/data/common/es_query/es_query/es_query_dsl
import { TimeRange } from 'src/plugins/data/public';
import { timefilter } from 'ui/timefilter';
import { LegacyApiCaller } from '../../../src/plugins/data/public/search/legacy/es_client';
import { SearchAPI } from './data_model/search_api'
//import { SearchAPI } from './data_model/search_api'

export interface Arguments {
multiquerydsl: string;
Expand All @@ -22,7 +22,7 @@ export interface TransformVisParams {
export interface TransformVisData {
transform: string;
meta?: Record<string, any>;
es?: SearchAPI;
es?: LegacyApiCaller;
context?: {
bool: {
must: DslQuery[];
Expand Down

0 comments on commit f98cf46

Please sign in to comment.