Update the conflict data to show all index names per type

Fixes #7661

Feedback from review is that it would be better to display a list of indices
for each field type as would be easier to distinguish the outliers in this
case.
This commit is contained in:
Martin Hickey 2016-09-16 16:14:57 +01:00
parent 0af13831d5
commit ee698c4f0b
3 changed files with 14 additions and 14 deletions

View file

@ -177,18 +177,16 @@
</div>
<div ng-if="editor.field.conflictDescriptions.length > 0" class="alert alert-warning">
<!-- {{editor.field.conflictDescriptions}} -->
<!-- {{editor.field.indicesTypes}} -->
The type of this field changes across indices. It is unavailable for many analysis functions. The types per index are as follows:
<div ng-if="editor.conflictDescriptionsLength > 0" class="alert alert-warning">
The type of this field changes across indices. It is unavailable for many analysis functions. The indices per type are as follows:
<table class="table">
<thead>
<th> Index Name </th>
<th> Field Type </th>
<th> Index Names </th>
</thead>
<tbody>
<tr ng-repeat="obj in editor.field.conflictDescriptions">
<td>{{obj.index}}</td> <td>{{obj.type}}</td>
<tr ng-repeat="(type, indices) in editor.field.conflictDescriptions">
<td>{{type}}</td> <td>{{indices}}</td>
</tr>
</tbody>
</table>

View file

@ -46,6 +46,7 @@ uiModules
self.indexPattern = $scope.getIndexPattern();
self.field = shadowCopy($scope.getField());
self.formatParams = self.field.format.params();
self.conflictDescriptionsLength = (self.field.conflictDescriptions) ? Object.keys(self.field.conflictDescriptions).length : 0;
// only init on first create
self.creating = !self.indexPattern.fields.byName[self.field.name];

View file

@ -25,12 +25,9 @@ export default function transformMappingIntoFields(Private, kbnIndex, config) {
let mapping = mapField(field, name);
let conflictDescription = {
index: indexName,
type: mapping.type
};
mapping.conflictDescriptions = [];
mapping.conflictDescriptions.push(conflictDescription);
const origType = mapping.type;
mapping.conflictDescriptions = {};
mapping.conflictDescriptions[origType] = [indexName];
if (fields[name]) {
if (fields[name].type !== mapping.type) {
@ -41,7 +38,11 @@ export default function transformMappingIntoFields(Private, kbnIndex, config) {
}
if (conflictFields[name]) {
mapping.conflictDescriptions = conflictFields[name].conflictDescriptions;
mapping.conflictDescriptions.push(conflictDescription);
if (mapping.conflictDescriptions.hasOwnProperty(origType)) {
mapping.conflictDescriptions[origType].push(indexName);
} else {
mapping.conflictDescriptions[origType] = [indexName];
}
}
fields[name] = _.pick(mapping, 'type', 'indexed', 'analyzed', 'doc_values');
conflictFields[name] = _.pick(mapping, 'type', 'indexed', 'analyzed', 'doc_values', 'conflictDescriptions');