mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Discover] Hide time picker when an indexpattern without timefield is selected (#62134)
* Assign valid value whether the timepicker should be displayed * Add functional tests
This commit is contained in:
parent
8d21b6b6f3
commit
2a1c8d8de4
5 changed files with 158 additions and 1 deletions
|
@ -11,7 +11,7 @@
|
|||
query="state.query"
|
||||
saved-query-id="state.savedQuery"
|
||||
screen-title="screenTitle"
|
||||
show-date-picker="enableTimeRangeSelector"
|
||||
show-date-picker="indexPattern.isTimeBased()"
|
||||
show-save-query="showSaveQuery"
|
||||
show-search-bar="true"
|
||||
use-default-behaviors="true"
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
||||
export default function({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const esArchiver = getService('esArchiver');
|
||||
const PageObjects = getPageObjects(['common', 'timePicker', 'discover']);
|
||||
|
||||
describe('indexpattern without timefield', function() {
|
||||
before(async function() {
|
||||
await esArchiver.loadIfNeeded('index_pattern_without_timefield');
|
||||
});
|
||||
|
||||
beforeEach(async function() {
|
||||
await PageObjects.common.navigateToApp('discover');
|
||||
await PageObjects.discover.selectIndexPattern('without-timefield');
|
||||
});
|
||||
|
||||
after(async function unloadMakelogs() {
|
||||
await esArchiver.unload('index_pattern_without_timefield');
|
||||
});
|
||||
|
||||
it('should not display a timepicker', async function() {
|
||||
const timepickerExists = await PageObjects.timePicker.timePickerExists();
|
||||
expect(timepickerExists).to.be(false);
|
||||
});
|
||||
|
||||
it('should display a timepicker after switching to an index pattern with timefield', async function() {
|
||||
expect(await PageObjects.timePicker.timePickerExists()).to.be(false);
|
||||
await PageObjects.discover.selectIndexPattern('with-timefield');
|
||||
expect(await PageObjects.timePicker.timePickerExists()).to.be(true);
|
||||
});
|
||||
});
|
||||
}
|
|
@ -47,5 +47,6 @@ export default function({ getService, loadTestFile }) {
|
|||
loadTestFile(require.resolve('./_doc_navigation'));
|
||||
loadTestFile(require.resolve('./_date_nanos'));
|
||||
loadTestFile(require.resolve('./_date_nanos_mixed'));
|
||||
loadTestFile(require.resolve('./_indexpattern_without_timefield'));
|
||||
});
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"type": "index",
|
||||
"value": {
|
||||
"index": "without-timefield",
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"@timestamp": {
|
||||
"type": "date"
|
||||
}
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_replicas": "0",
|
||||
"number_of_shards": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"type": "index",
|
||||
"value": {
|
||||
"index": "with-timefield",
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"@timestamp": {
|
||||
"type": "date"
|
||||
}
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_replicas": "0",
|
||||
"number_of_shards": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue