Skip to content

Commit

Permalink
Merge pull request #410 from rashidkpc/fix/index-pattern-flicker
Browse files Browse the repository at this point in the history
Fix index pattern create flicker
  • Loading branch information
spenceralger committed Sep 26, 2014
2 parents 52a8364 + ce57f6d commit 6e32b9d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 4 additions & 6 deletions src/kibana/apps/settings/sections/indices/_create.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ <h1>Configure an index pattern</h1>
</div>
</section>

<div class="form-group" ng-if="index.isTimeBased">
<div class="form-group" ng-if="index.isTimeBased && !index.fetchFieldsError">
<label>
Time-field name
&nbsp;
Expand All @@ -108,16 +108,14 @@ <h1>Configure an index pattern</h1>
ng-model="index.timeField"
class="form-control">
</select>
<select ng-if="index.fetchFieldsError" class="form-control" disabled >
<option>{{index.fetchFieldsError}}</option>
</select>
</div>

<button
ng-disabled="form.$invalid || index.fetchFieldsError"
ng-class="index.fetchFieldsError ? 'btn-default' : 'btn-success'"
type="submit"
class="btn btn-success">
{{index.fetchFieldsError ? "No indices found" : "Create" }}
class="btn">
{{index.fetchFieldsError || "Create" }}
</button>
</form>
</div>
Expand Down
11 changes: 7 additions & 4 deletions src/kibana/apps/settings/sections/indices/_create.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ define(function (require) {
};

$scope.refreshFieldList = _.debounce(function () {
index.dateFields = index.timeField = index.fetchFieldsError = index.listUsed = null;
index.dateFields = index.timeField = index.listUsed = null;
var useIndexList = index.isTimeBased && index.nameIsPattern;

// we don't have enough info to continue
Expand Down Expand Up @@ -118,9 +118,12 @@ define(function (require) {
});
})
.then(function (fields) {
index.dateFields = fields.filter(function (field) {
return field.type === 'date';
});
if (fields.length > 0) {
index.fetchFieldsError = null;
index.dateFields = fields.filter(function (field) {
return field.type === 'date';
});
}
}, notify.fatal);
}, 50, { leading: true, trailing: false });

Expand Down

0 comments on commit 6e32b9d

Please sign in to comment.