Skip to content

Commit

Permalink
Merge branch 'feature/ingest' into ingest/patternReview
Browse files Browse the repository at this point in the history
  • Loading branch information
Bargs committed Feb 4, 2016
2 parents bd45e77 + fd1d480 commit ac0974b
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<h2>Paste samples step</h2>
<div class="wizard-step-title">
<h3>Provide some sample logs</h3>
Paste in one or more lines from the file you intend to tail. We'll use these samples in the following steps to help
you build an ingest pipeline and configure a Kibana index pattern. Log lines can be raw strings or
formatted as JSON. If your logs are raw strings but you intend to use
<a target="_window" href="https://www.elastic.co/guide/en/beats/filebeat/current/exported-fields.html">Filebeat's metadata</a>,
you'll want to paste the JSON as it will come out of Filebeat.
</div>

<div class="paste-samples">
<textarea ng-model="pasteStep.rawSamples" placeholder="Paste your sample log lines here, separated by a newline"></textarea>
</div>

<button ng-click="samples = 'some sample logs'">Do Stuff</button>
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
var modules = require('ui/modules');
var template = require('plugins/kibana/settings/sections/indices/add_data_steps/paste_samples_step.html');
import modules from 'ui/modules';
import template from 'plugins/kibana/settings/sections/indices/add_data_steps/paste_samples_step.html';
import _ from 'lodash';

modules.get('apps/settings')
.directive('pasteSamplesStep', function () {
return {
template: template,
scope: {
samples: '='
samples: '=',
rawSamples: '='
},
bindToController: true,
controllerAs: 'pasteStep',
controller: function ($scope) {
if (_.isUndefined(this.rawSamples)) {
this.rawSamples = '';
}

$scope.$watch('pasteStep.rawSamples', (newValue) => {
const splitRawSamples = newValue.split('\n');

try {
this.samples = _.map(splitRawSamples, (sample) => {
return JSON.parse(sample);
});
}
catch (error) {
this.samples = _.map(splitRawSamples, (sample) => {
return {message: sample};
});
}
});
}
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h1>Tail a File</h1>

<div ng-switch="wizard.currentStep">
<div ng-switch-when="0">
<paste-samples-step samples="wizard.stepResults.samples"></paste-samples-step>
<paste-samples-step samples="wizard.stepResults.samples" raw-samples="wizard.stepResults.rawSamples"></paste-samples-step>
<div class="nav-buttons">
<button ng-disabled="!wizard.stepResults.samples" ng-click="wizard.nextStep()">Next</button>
</div>
Expand Down
7 changes: 7 additions & 0 deletions src/plugins/kibana/public/settings/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,10 @@ kbn-settings-indices {
}
}

.paste-samples {
textarea {
width: 100%;
height: 250px;
}
}

0 comments on commit ac0974b

Please sign in to comment.