Skip to content

Commit

Permalink
Bump version to 7.16.0. Fix 7.16 API changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Jul 10, 2022
1 parent f0a2a49 commit 1371537
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 72 deletions.
36 changes: 18 additions & 18 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cd ~/dev/kibana-7.x-git/kibana
git fetch --all --tags

# Check out the release in Kibana
git checkout v7.15.0
git checkout v7.16.0

# Switch to updated node-js if necessary
nvm use
Expand Down Expand Up @@ -55,22 +55,22 @@ yarn kbn bootstrap
yarn build

# Next, download, install and run the corresponding Elasticsearch
mkdir ~/dev/elasticsearch-7.15.0-release
cd ~/dev/elasticsearch-7.15.0-release
curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.0-darwin-x86_64.tar.gz
gunzip -c elasticsearch-7.15.0-darwin-x86_64.tar.gz | tar xopf -
cd elasticsearch-7.15.0
mkdir ~/dev/elasticsearch-7.16.0-release
cd ~/dev/elasticsearch-7.16.0-release
curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.16.0-darwin-x86_64.tar.gz
gunzip -c elasticsearch-7.16.0-darwin-x86_64.tar.gz | tar xopf -
cd elasticsearch-7.16.0
./bin/elasticsearch

# Next, in another terminal tab, download and install the corresponding Kibana release to test the build
mkdir ~/dev/kibana-7.15.0-release
cd ~/dev/kibana-7.15.0-release/
curl -O https://artifacts.elastic.co/downloads/kibana/kibana-7.15.0-darwin-x86_64.tar.gz
gunzip -c kibana-7.15.0-darwin-x86_64.tar.gz | tar xopf -
cd kibana-7.15.0-darwin-x86_64
mkdir ~/dev/kibana-7.16.0-release
cd ~/dev/kibana-7.16.0-release/
curl -O https://artifacts.elastic.co/downloads/kibana/kibana-7.16.0-darwin-x86_64.tar.gz
gunzip -c kibana-7.16.0-darwin-x86_64.tar.gz | tar xopf -
cd kibana-7.16.0-darwin-x86_64

# Install the built plugin
./bin/kibana-plugin install 'file:///<your-path>/kibana-7.x-git/kibana/plugins/kibana_milestones_vis/build/kibanaMilestonesVis-7.15.0.zip'
./bin/kibana-plugin install 'file:///<your-path>/kibana-7.x-git/kibana/plugins/kibana_milestones_vis/build/kibanaMilestonesVis-7.16.0.zip'

# Start Kibana and test the UI if the plugin works.
# Use Kibana's `flights` sample dataset and create a milestones visualization.
Expand All @@ -81,15 +81,15 @@ cd ~/dev/kibana-7.x-git/kibana/plugins/kibana_milestones_vis
git add DEVELOPMENT.md
git add README.md
git add package.json
git commit -m "Bump version to 7.15.0."
git tag v7.15.0
git push origin 7.15
git commit -m "Bump version to 7.16.0."
git tag v7.16.0
git push origin 7.16
git push --tags

# On Github, edit the new release at
# https://github.com/walterra/kibana-milestones-vis/releases/new?tag=v7.15.0
# Use `Kibana v7.15.0 compatibility release.` as the release text.
# Add the build file `kibanaMilestonesVis-7.15.0.zip` to the releases' binaries.
# https://github.com/walterra/kibana-milestones-vis/releases/new?tag=v7.16.0
# Use `Kibana v7.16.0 compatibility release.` as the release text.
# Add the build file `kibanaMilestonesVis-7.16.0.zip` to the releases' binaries.

# Almost done! Before the next release, a little cleanup: Just delete the temporary plugin you create so you can create another one for comparison for the next release.
rm -r ~/dev/kibana-7.x-git/kibana/plugins/plugin_tmp
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ The releases of this plugin are synced with Kibana's release cycle. In the "Asse
Run the following from within your Kibana folder:

```
bin/kibana-plugin install https://github.com/walterra/kibana-milestones-vis/releases/download/v7.15.0/kibanaMilestonesVis-7.15.0.zip
bin/kibana-plugin install https://github.com/walterra/kibana-milestones-vis/releases/download/v7.16.0/kibanaMilestonesVis-7.16.0.zip
```

### Installing by first downloading a zipped release

- Head over to https://github.com/walterra/kibana-milestones-vis/releases and download the ZIP of the version you want to use, e.g. https://github.com/walterra/kibana-milestones-vis/releases/download/v7.15.0/kibanaMilestonesVis-7.15.0.zip
- Inside your kibana directory, run `bin/kibana-plugin install file:///<path-to-file>/kibanaMilestonesVis-7.15.0.zip`, then `npm run start`
- Head over to https://github.com/walterra/kibana-milestones-vis/releases and download the ZIP of the version you want to use, e.g. https://github.com/walterra/kibana-milestones-vis/releases/download/v7.16.0/kibanaMilestonesVis-7.16.0.zip
- Inside your kibana directory, run `bin/kibana-plugin install file:///<path-to-file>/kibanaMilestonesVis-7.16.0.zip`, then `npm run start`

## Usage

Expand Down
6 changes: 5 additions & 1 deletion kibana.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"id": "kibanaMilestonesVis",
"version": "7.15.0",
"version": "7.16.0",
"kibanaVersion": "kibana",
"owner": {
"name": "Walter Rafelsberger <[email protected]",
"githubTeam": "walterra"
},
"server": true,
"ui": true,
"requiredPlugins": [
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kibana-milestones-vis",
"version": "7.15.0",
"version": "7.16.0",
"private": false,
"description": "A d3 based timeline visualization kibana plugin.",
"main": "index.js",
Expand All @@ -26,7 +26,7 @@
"d3": "3.5.17",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-milestones-vis": "^0.4.5-node14"
"react-milestones-vis": "^0.5.0"
},
"resolutions": {
"lodash": "^4.17.21",
Expand Down
1 change: 1 addition & 0 deletions public/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const EXPRESSION_NAME = 'kibana_milestones_vis';
29 changes: 15 additions & 14 deletions public/milestones_fn.ts → public/milestones_function.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { get } from 'lodash';
import { i18n } from '@kbn/i18n';
import { ExecutionContextSearch } from '../../../src/plugins/data/public';
import { Adapters } from '../../../src/plugins/inspector/common';
import {
import type { ExecutionContextSearch } from '../../../src/plugins/data/public';
import type { Adapters } from '../../../src/plugins/inspector/common';
import type {
ExecutionContext,
ExpressionFunctionDefinition,
Render,
} from '../../../src/plugins/expressions/public';
import { MilestonesVisualizationDependencies } from './plugin';
import type { MilestonesVisualizationDependencies } from './plugin';
import { createMilestonesRequestHandler } from './milestones_request_handler';
import { KibanaContext, TimeRange, Query } from '../../../src/plugins/data/public';
import type { KibanaContext, TimeRange, Query } from '../../../src/plugins/data/public';

import { RawVisData } from './milestones_visualization';
import { MilestonesVisParams } from './types';
import { EXPRESSION_NAME } from './constants';
import type { RawVisData } from './milestones_visualization';
import type { MilestonesVisParams } from './types';

type Input = KibanaContext | { type: 'null' };
type Output = Promise<Render<MilestonesRenderValue>>;
Expand All @@ -21,12 +22,12 @@ export type VisParams = Required<MilestonesVisParams>;

export interface MilestonesRenderValue {
visData: RawVisData;
visType: 'milestones';
visConfig: VisParams;
visType: typeof EXPRESSION_NAME;
visParams: VisParams;
}

export type MilestonesExpressionFunctionDefinition = ExpressionFunctionDefinition<
'milestones',
typeof EXPRESSION_NAME,
Input,
MilestonesVisParams,
Output,
Expand All @@ -36,7 +37,7 @@ export type MilestonesExpressionFunctionDefinition = ExpressionFunctionDefinitio
export const createMilestonesFn = (
dependencies: MilestonesVisualizationDependencies
): MilestonesExpressionFunctionDefinition => ({
name: 'milestones',
name: EXPRESSION_NAME,
type: 'render',
inputTypes: ['kibana_context', 'null'],
help: i18n.translate('visTypeMilestones.function.help', {
Expand Down Expand Up @@ -106,11 +107,11 @@ export const createMilestonesFn = (

return {
type: 'render',
as: 'milestones_vis',
as: EXPRESSION_NAME,
value: {
visData: response,
visType: 'milestones',
visConfig: args,
visType: EXPRESSION_NAME,
visParams: args,
},
};
},
Expand Down
19 changes: 14 additions & 5 deletions public/milestones_vis_renderer.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { ExpressionRenderDefinition } from '../../../src/plugins/expressions';
import { i18n } from '@kbn/i18n';

import { MilestonesRenderValue } from './milestones_fn';
import type { ExpressionRenderDefinition } from '../../../src/plugins/expressions';

import { MilestonesRenderValue } from './milestones_function';

import { MilestonesVisualization } from './milestones_visualization';

export const getMilestonesVisRenderer: () => ExpressionRenderDefinition<MilestonesRenderValue> = () => ({
name: 'milestones_vis',
export const getMilestonesVisRenderer = (): ExpressionRenderDefinition<MilestonesRenderValue> => ({
name: 'kibana_milestones_vis',
displayName: i18n.translate('milestones.vis.visualizationName', {
defaultMessage: 'Milestones',
}),
help: '',
validate: () => undefined,
reuseDomNode: true,
render: async (domNode, config, handlers) => {
handlers.onDestroy(() => {
unmountComponentAtNode(domNode);
});

render(<MilestonesVisualization renderComplete={handlers.done} {...config} />, domNode);
render(<MilestonesVisualization {...config} />, domNode, () => {
handlers.done();
});
},
});
25 changes: 9 additions & 16 deletions public/milestones_visualization.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, FC } from 'react';
import React, { FC } from 'react';
import d3 from 'd3';
import { Milestones } from 'react-milestones-vis';

Expand Down Expand Up @@ -40,21 +40,14 @@ const options = {
};

interface MilestonesVisualizationProps {
renderComplete: () => void;
visData: RawVisData;
visConfig: MilestonesVisParams;
visParams: MilestonesVisParams;
}

export const MilestonesVisualization: FC<MilestonesVisualizationProps> = ({
renderComplete,
visData,
visConfig,
}) => {
useEffect(() => {
renderComplete();
}, []);
export const MilestonesVisualization: FC<MilestonesVisualizationProps> = (props) => {
const { visData, visParams } = props;

const data = (visData.data || [])
const data = (visData?.data ?? [])
// data prep
.map((d) => {
if (d.text === undefined) {
Expand Down Expand Up @@ -96,11 +89,11 @@ export const MilestonesVisualization: FC<MilestonesVisualizationProps> = ({
text: options.mapping_text,
}}
parseTime={options.parseTime}
useLabels={visConfig.useLabels}
distribution={visConfig.distribution}
useLabels={visParams.useLabels}
distribution={visParams.distribution}
optimize={options.optimize}
orientation={visConfig.orientation}
aggregateBy={visConfig.aggregateBy}
orientation={visParams.orientation}
aggregateBy={visParams.aggregateBy}
/>
</div>
);
Expand Down
4 changes: 3 additions & 1 deletion public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DataPublicPluginSetup, DataPublicPluginStart } from '../../../src/plugi
import { Plugin as ExpressionsPublicPlugin } from '../../../src/plugins/expressions/public';
import { VisualizationsSetup } from '../../../src/plugins/visualizations/public';

import { createMilestonesFn } from './milestones_fn';
import { createMilestonesFn } from './milestones_function';
import { createMilestonesTypeDefinition } from './milestones_type';
import { getMilestonesVisRenderer } from './milestones_vis_renderer';
import { setData } from './services';
Expand Down Expand Up @@ -55,4 +55,6 @@ export class MilestonesPlugin implements Plugin<void, void> {
public start(core: CoreStart, { data }: MilestonesPluginStartDependencies) {
setData(data);
}

public stop() {}
}
14 changes: 9 additions & 5 deletions public/to_ast.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { buildExpression, buildExpressionFunction } from '../../../src/plugins/expressions/public';
import { Vis } from '../../../src/plugins/visualizations/public';
import { MilestonesExpressionFunctionDefinition, VisParams } from './milestones_fn';
import { EXPRESSION_NAME } from './constants';
import type { MilestonesExpressionFunctionDefinition, VisParams } from './milestones_function';

export const toExpressionAst = (vis: Vis<VisParams>) => {
const milestones = buildExpressionFunction<MilestonesExpressionFunctionDefinition>('milestones', {
...vis.params,
indexPatternId: vis.data.indexPattern!.id!,
});
const milestones = buildExpressionFunction<MilestonesExpressionFunctionDefinition>(
EXPRESSION_NAME,
{
...vis.params,
indexPatternId: vis.data.indexPattern!.id!,
}
);

const ast = buildExpression([milestones]);

Expand Down
8 changes: 5 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./target",
"skipLibCheck": true
"outDir": "./target/types"
},
"include": [
"index.ts",
Expand All @@ -14,6 +13,9 @@
],
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
{ "path": "../../src/core/tsconfig.json" },
{ "path": "../../src/plugins/data/tsconfig.json" },
{ "path": "../../src/plugins/visualizations/tsconfig.json" },
{ "path": "../../src/plugins/vis_default_editor/tsconfig.json" }
]
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2805,10 +2805,10 @@ react-is@^17.0.1:
resolved "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==

react-milestones-vis@^0.4.5-node14:
version "0.4.5-node14"
resolved "https://registry.yarnpkg.com/react-milestones-vis/-/react-milestones-vis-0.4.5-node14.tgz#489a3b01d5d1876f9a198666db786316c84d72cf"
integrity sha512-M4j5dMkN5gU7EwSS2yo6JL/OsK/ynj/Ro7cSTS+u6XrlG87bkcVrlOJGpaiLbwBU7yTX+5f1jWAq4mp86ab+/A==
react-milestones-vis@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/react-milestones-vis/-/react-milestones-vis-0.5.0.tgz#3a7d52f58f1e88f5f3d1c4d3f2e71d469d71fda4"
integrity sha512-KiuWjDMOAXER/MstwEcgmwVy8Dvzx7mgsfiL+XCqrR5HIHuJFFQfc/zdjqJwldTBlkxc/LyLK/kpZjHX8W8HUQ==
dependencies:
d3-milestones "^1.4.2"

Expand Down

0 comments on commit 1371537

Please sign in to comment.