Skip to content

Commit b4350f9

Browse files
author
guyplusplus
committed
Timefilter button
1 parent fdbdcff commit b4350f9

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ $ git checkout v7.8.0
8888

8989
```shell
9090
$ cd kibana
91-
$ nvm use
91+
$ nvm use 10.21.0 [or expected version]
9292
$ yarn kbn bootstrap
9393
$ yarn start --oss
9494
```
@@ -171,7 +171,7 @@ vis_type_custom_form_filter_accounts_7.8.0_1.0.0.zip
171171

172172
## Installing the plugin
173173

174-
The plugin can then be installed like this for an apt-get installed Kibana.
174+
The plugin can then be installed like this for an apt installed Kibana.
175175

176176
```shell
177177
$ cd /usr/share/kibana
@@ -193,7 +193,7 @@ $
193193
## Project TODO List
194194

195195
- [ ] Create form content (i.e. dropdown, slider) with actual data
196-
- [ ] Sample code to modify time filter
196+
- [X] Sample code to modify time filter
197197
- [ ] Create a script to replace 'accounts' in filenames and file content
198198
- [ ] Add internationalization example
199199
- [ ] Create test script

vis_type_custom_form_filter_accounts/public/custom_form_filter_accounts_vis_controller.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ class CustomFormFilterAccountsVisComponent extends React.Component<CustomFormFil
126126
this.forceUpdate();
127127
};
128128

129+
onClickButtonToday = () => {
130+
this.props.timefilter.setTime(
131+
{from: 'now/d', to: 'now/d'}
132+
);
133+
};
134+
129135
onFormChange = (event) => {
130136
const target = event.target;
131137
const valueStr = target.value;
@@ -153,7 +159,8 @@ class CustomFormFilterAccountsVisComponent extends React.Component<CustomFormFil
153159
<EuiSpacer />
154160
<EuiButton onClick={this.onClickButtonApplyFilter} fill>Apply filter</EuiButton>&nbsp;
155161
<EuiButton onClick={this.onClickButtonDeleteFilter} >Delete filter</EuiButton>&nbsp;
156-
<EuiButton onClick={this.onClickButtonClearForm} >Clear form</EuiButton>
162+
<EuiButton onClick={this.onClickButtonClearForm} >Clear form</EuiButton>&nbsp;
163+
<EuiButton onClick={this.onClickButtonToday} color="secondary">Time: today</EuiButton>
157164
</EuiForm>
158165
</div>
159166
);

0 commit comments

Comments
 (0)