-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removes the "Index contains time-based events" checkbox #11409
Changes from 11 commits
203c89c
997adf7
4064c99
df0e18b
dba8583
442467a
5348a55
d60eda0
244cb72
c3270a6
3688f12
a1c86d7
f701b58
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
<div class="form-group"> | ||
<label translate="KIBANA-INDEX_NAME_OR_PATTERN"></label> | ||
<p class="help-block" ng-if="!controller.newIndexPattern.nameIsPattern" translate="KIBANA-WILDCARD_DYNAMIC_INDEX_PATTERNS"></p> | ||
<p class="help-block" ng-if="controller.newIndexPattern.isTimeBased && controller.newIndexPattern.nameIsPattern"><span translate="KIBANA-STATIC_TEXT_IN_DYNAMIC_INDEX_PATTERNS"></span> — | ||
<p class="help-block" ng-if="controller.newIndexPattern.nameIsPattern"><span translate="KIBANA-STATIC_TEXT_IN_DYNAMIC_INDEX_PATTERNS"></span> — | ||
<small><a target="_blank" href="http://momentjs.com/docs/#/displaying/format/" translate="KIBANA-DATE_FORMAT_DOCS"></a></small></p> | ||
<input | ||
data-test-subj="createIndexPatternNameInput" | ||
|
@@ -41,19 +41,9 @@ | |
</small> | ||
</div> | ||
|
||
<div class="form-group time-and-pattern"> | ||
<label> | ||
<input | ||
data-test-subj="createIndexPatternIsTimeBasedCheckBox" | ||
ng-model="controller.newIndexPattern.isTimeBased" | ||
type="checkbox"> | ||
<span translate="KIBANA-CONTAINS_TIME_BASED_EVENTS"></span> | ||
</label> | ||
</div> | ||
|
||
<div class="form-group" ng-if="controller.newIndexPattern.isTimeBased"> | ||
<div class="form-group"> | ||
<label> | ||
<span translate="KIBANA-TIME_FIELD_NAME"></span> | ||
<span translate="KIBANA-TIME_FILTER_FIELD_NAME"></span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious: what does time filter mean in this context? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm using that per this suggestion: #10444 (comment). I think "time picker" might be more appropriate but I'm not sure if users know what that is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm... I guess "time filter" works. I like "time picker" because I know what that is, but I'm afraid that might couple these field too closely to a particular UI component. |
||
| ||
<kbn-info info="{{ 'KIBANA-FIELD_FILTER_EVENTS_GLOBAL_TIME' | translate }}"></kbn-info> | ||
| ||
|
@@ -63,13 +53,16 @@ | |
</label> | ||
<select | ||
data-test-subj="createIndexPatternTimeFieldSelect" | ||
ng-disabled="controller.fetchFieldsError" | ||
ng-disabled="controller.fetchFieldsError || (controller.dateFields.length === 1)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be clearer to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yes, that was introduced later and should definitely be used here. Thanks! |
||
ng-required="!controller.fetchFieldsError" | ||
ng-options="field.name for field in controller.dateFields" | ||
ng-model="controller.newIndexPattern.timeField" | ||
auto-select-if-only-one="controller.dateFields" | ||
class="form-control" | ||
></select> | ||
<p class="help-block" ng-if="!controller.fetchFieldsError && !controller.doesIndexHaveDateFields"> | ||
The indices which match this index pattern don’t contain any time fields. | ||
</p> | ||
</div> | ||
|
||
<div class="form-group" ng-if="controller.canExpandIndices()"> | ||
|
@@ -92,7 +85,7 @@ | |
</div> | ||
|
||
<div class="form-group time-and-pattern"> | ||
<label ng-if="controller.newIndexPattern.isTimeBased"> | ||
<label> | ||
<input | ||
data-test-subj="createIndexPatternNameIsPatternCheckBox" | ||
ng-model="controller.newIndexPattern.nameIsPattern" | ||
|
@@ -103,7 +96,7 @@ | |
</label> | ||
</div> | ||
|
||
<div class="form-group" ng-if="controller.newIndexPattern.isTimeBased && controller.newIndexPattern.nameIsPattern"> | ||
<div class="form-group" ng-if="controller.newIndexPattern.nameIsPattern"> | ||
<div class="alert alert-warning"> | ||
</p> | ||
<h4 translate="KIBANA-ALERT_INDEX_PATTERN_DEPRECATED"></h4> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,6 @@ uiModules.get('apps/management') | |
// Configure the new index pattern we're going to create. | ||
this.newIndexPattern = { | ||
name: config.get('indexPattern:placeholder'), | ||
isTimeBased: true, | ||
nameIsPattern: false, | ||
expandable: false, | ||
nameInterval: _.find(intervals, { name: 'daily' }), | ||
|
@@ -40,9 +39,18 @@ uiModules.get('apps/management') | |
this.patternErrors = []; | ||
this.fetchFieldsError = $translate.instant('KIBANA-LOADING'); | ||
|
||
const TIME_FILTER_FIELD_OPTIONS = { | ||
NO_DATE_FIELD_SELECTED: { | ||
name: $translate.instant('KIBANA-NO_DATE_FIELD_SELECTED') | ||
}, | ||
NO_DATE_FIELDS_IN_INDICES: { | ||
name: $translate.instant('KIBANA-NO_DATE_FIELDS_IN_INDICES') | ||
} | ||
}; | ||
|
||
const fetchFieldList = () => { | ||
this.dateFields = this.newIndexPattern.timeField = null; | ||
const useIndexList = this.newIndexPattern.isTimeBased && this.newIndexPattern.nameIsPattern; | ||
const useIndexList = this.newIndexPattern.nameIsPattern; | ||
let fetchFieldsError; | ||
let dateFields; | ||
|
||
|
@@ -89,7 +97,18 @@ uiModules.get('apps/management') | |
|
||
const updateFieldList = results => { | ||
this.fetchFieldsError = results.fetchFieldsError; | ||
this.dateFields = results.dateFields; | ||
if (this.fetchFieldsError) { | ||
return; | ||
} | ||
|
||
this.dateFields = results.dateFields || []; | ||
this.doesIndexHaveDateFields = this.dateFields.length > 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if (this.doesIndexHaveDateFields) { | ||
this.dateFields.unshift(TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELD_SELECTED); | ||
} else { | ||
this.dateFields.unshift(TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELDS_IN_INDICES); | ||
} | ||
this.newIndexPattern.timeField = this.dateFields[0]; | ||
}; | ||
|
||
const updateFieldListAndSetTimeField = (results, timeFieldName) => { | ||
|
@@ -100,12 +119,13 @@ uiModules.get('apps/management') | |
} | ||
|
||
const matchingTimeField = results.dateFields.find(field => field.name === timeFieldName); | ||
const defaultTimeField = results.dateFields[0]; | ||
|
||
//assign the field from the results-list | ||
//angular recreates a new timefield instance, each time the list is refreshed. | ||
//This ensures the selected field matches one of the instances in the list. | ||
this.newIndexPattern.timeField = matchingTimeField ? matchingTimeField : defaultTimeField; | ||
if (matchingTimeField) { | ||
this.newIndexPattern.timeField = matchingTimeField; | ||
} | ||
}; | ||
|
||
const resetIndex = () => { | ||
|
@@ -168,7 +188,7 @@ uiModules.get('apps/management') | |
this.canExpandIndices = () => { | ||
// to maximize performance in the digest cycle, move from the least | ||
// expensive operation to most | ||
return this.newIndexPattern.isTimeBased && !this.newIndexPattern.nameIsPattern && _.includes(this.newIndexPattern.name, '*'); | ||
return !this.newIndexPattern.nameIsPattern && _.includes(this.newIndexPattern.name, '*'); | ||
}; | ||
|
||
this.refreshFieldList = () => { | ||
|
@@ -184,14 +204,15 @@ uiModules.get('apps/management') | |
|
||
this.createIndexPattern = () => { | ||
const id = this.newIndexPattern.name; | ||
const timeFieldName = | ||
this.newIndexPattern.isTimeBased | ||
? this.newIndexPattern.timeField.name | ||
: undefined; | ||
let timeFieldName; | ||
if ((this.newIndexPattern.timeField !== TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELD_SELECTED) | ||
&& (this.newIndexPattern.timeField !== TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELDS_IN_INDICES)) { | ||
timeFieldName = this.newIndexPattern.timeField.name; | ||
} | ||
|
||
// Only event-time-based index patterns set an intervalName. | ||
const intervalName = | ||
this.newIndexPattern.isTimeBased && this.newIndexPattern.nameIsPattern | ||
this.newIndexPattern.nameIsPattern | ||
? this.newIndexPattern.nameInterval.name | ||
: undefined; | ||
|
||
|
@@ -228,11 +249,9 @@ uiModules.get('apps/management') | |
}; | ||
|
||
$scope.$watchMulti([ | ||
'controller.newIndexPattern.isTimeBased', | ||
'controller.newIndexPattern.nameIsPattern', | ||
'controller.newIndexPattern.nameInterval.name' | ||
], (newVal, oldVal) => { | ||
const isTimeBased = newVal[0]; | ||
const nameIsPattern = newVal[1]; | ||
const newDefault = getDefaultPatternForInterval(newVal[2]); | ||
const oldDefault = getDefaultPatternForInterval(oldVal[2]); | ||
|
@@ -241,10 +260,6 @@ uiModules.get('apps/management') | |
this.newIndexPattern.name = newDefault; | ||
} | ||
|
||
if (!isTimeBased) { | ||
this.newIndexPattern.nameIsPattern = false; | ||
} | ||
|
||
if (!nameIsPattern) { | ||
delete this.newIndexPattern.nameInterval; | ||
delete this.newIndexPattern.timeField; | ||
|
@@ -301,7 +316,6 @@ uiModules.get('apps/management') | |
}); | ||
|
||
$scope.$watchMulti([ | ||
'controller.newIndexPattern.isTimeBased', | ||
'controller.sampleCount' | ||
], () => { | ||
this.refreshFieldList(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to update the functional tests to remove references to this element.