Skip to content
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

Add Data Paste Sample Logs Screen #6005

Merged
merged 8 commits into from
Feb 4, 2016
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
const modules = require('ui/modules');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind using import here? several prs are working on moving everything this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing. I'll make sure to use import in the future as well.

const template = require('plugins/kibana/settings/sections/indices/add_data_steps/paste_samples_step.html');
const _ = require('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
11 changes: 11 additions & 0 deletions src/plugins/kibana/public/settings/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,14 @@ kbn-settings-indices {
}
}
}

.wizard-step-title {
padding-bottom: 1em;
}

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