-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5790 from Bargs/filebeatWizard
Filebeat wizard
- Loading branch information
Showing
17 changed files
with
279 additions
and
2 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
src/plugins/kibana/public/settings/sections/indices/directives/install_filebeat_step.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<h2>Install filebeat step</h2> | ||
|
||
<div> | ||
Results: | ||
<ul> | ||
<li>Logs: {{results.samples}}</li> | ||
<li>Docs: {{results.sampleDocs}}</li> | ||
<li>Pattern: {{results.indexPattern}}</li> | ||
</ul> | ||
</div> |
16 changes: 16 additions & 0 deletions
16
src/plugins/kibana/public/settings/sections/indices/directives/install_filebeat_step.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var modules = require('ui/modules'); | ||
var template = require('plugins/kibana/settings/sections/indices/directives/install_filebeat_step.html'); | ||
|
||
modules.get('apps/settings') | ||
.directive('installFilebeatStep', function () { | ||
return { | ||
template: template, | ||
scope: { | ||
results: '=' | ||
}, | ||
controller: function ($scope) { | ||
var results = $scope.results; | ||
} | ||
}; | ||
}); | ||
|
3 changes: 3 additions & 0 deletions
3
src/plugins/kibana/public/settings/sections/indices/directives/paste_samples_step.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<h2>Paste samples step</h2> | ||
|
||
<button ng-click="samples = 'some sample logs'">Do Stuff</button> |
13 changes: 13 additions & 0 deletions
13
src/plugins/kibana/public/settings/sections/indices/directives/paste_samples_step.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var modules = require('ui/modules'); | ||
var template = require('plugins/kibana/settings/sections/indices/directives/paste_samples_step.html'); | ||
|
||
modules.get('apps/settings') | ||
.directive('pasteSamplesStep', function () { | ||
return { | ||
template: template, | ||
scope: { | ||
samples: '=' | ||
} | ||
}; | ||
}); | ||
|
7 changes: 7 additions & 0 deletions
7
src/plugins/kibana/public/settings/sections/indices/directives/pattern_review_step.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<h2>Pattern review step</h2> | ||
|
||
<div> | ||
Docs: {{sampleDocs}} | ||
</div> | ||
|
||
<button ng-click="indexPattern = {id: 'logstash-*', title: 'myFirstIndexPattern'}">Create an index pattern</button> |
15 changes: 15 additions & 0 deletions
15
src/plugins/kibana/public/settings/sections/indices/directives/pattern_review_step.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var modules = require('ui/modules'); | ||
var template = require('plugins/kibana/settings/sections/indices/directives/pattern_review_step.html'); | ||
|
||
modules.get('apps/settings') | ||
.directive('patternReviewStep', function () { | ||
return { | ||
template: template, | ||
scope: { | ||
sampleDocs: '=', | ||
indexPattern: '=', | ||
pipeline: '=' | ||
} | ||
}; | ||
}); | ||
|
7 changes: 7 additions & 0 deletions
7
src/plugins/kibana/public/settings/sections/indices/directives/pipeline_step.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<h2>Build pipeline step</h2> | ||
|
||
<div> | ||
Logs: {{samples}} | ||
</div> | ||
|
||
<button ng-click="sampleDocs = {results: {os: 'osx'}}; pipeline = {processor: 'I processor'};">Build a pipeline</button> |
15 changes: 15 additions & 0 deletions
15
src/plugins/kibana/public/settings/sections/indices/directives/pipeline_step.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
var modules = require('ui/modules'); | ||
var template = require('plugins/kibana/settings/sections/indices/directives/pipeline_step.html'); | ||
|
||
modules.get('apps/settings') | ||
.directive('pipelineStep', function () { | ||
return { | ||
template: template, | ||
scope: { | ||
samples: '=', | ||
sampleDocs: '=', | ||
pipeline: '=' | ||
} | ||
}; | ||
}); | ||
|
70 changes: 70 additions & 0 deletions
70
src/plugins/kibana/public/settings/sections/indices/filebeat/directives/filebeat_wizard.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<div> | ||
<div class="page-header"> | ||
<h1>Tail a File</h1> | ||
Let's send some log data to Elasticsearch. | ||
</div> | ||
</div> | ||
|
||
<div> | ||
<div class="wizard-step-headings" ng-class="{complete: wizard.complete}"> | ||
<span ng-class="{active: wizard.currentStep === 0}" | ||
class="wizard-step-heading" | ||
ng-click="wizard.setCurrentStep(0)"> | ||
1. Paste | ||
</span> | ||
<span ng-class="{active: wizard.currentStep === 1, aheadActive: wizard.currentStep < 1}" | ||
class="wizard-step-heading" | ||
ng-click="wizard.currentStep < 1 || wizard.setCurrentStep(1)"> | ||
2. Parse | ||
</span> | ||
<span ng-class="{active: wizard.currentStep === 2, aheadActive: wizard.currentStep < 2}" | ||
class="wizard-step-heading" | ||
ng-click="wizard.currentStep < 2 || wizard.setCurrentStep(2)"> | ||
3. Review | ||
</span> | ||
<span ng-class="{active: wizard.currentStep === 3, aheadActive: wizard.currentStep < 3}" | ||
class="wizard-step-heading" | ||
ng-click="wizard.currentStep < 3 || wizard.setCurrentStep(3)"> | ||
4. Install Filebeat | ||
</span> | ||
</div> | ||
|
||
<div ng-switch="wizard.currentStep"> | ||
<div ng-switch-when="0"> | ||
<paste-samples-step samples="wizard.stepResults.samples"></paste-samples-step> | ||
<div class="nav-buttons"> | ||
<button ng-disabled="!wizard.stepResults.samples" ng-click="wizard.nextStep()">Next</button> | ||
</div> | ||
</div> | ||
|
||
<div ng-switch-when="1"> | ||
<pipeline-step | ||
samples="wizard.stepResults.samples" | ||
pipeline="wizard.stepResults.pipeline" | ||
sample-docs="wizard.stepResults.sampleDocs"> | ||
</pipeline-step> | ||
|
||
<div class="nav-buttons"> | ||
<button ng-click="wizard.prevStep()">Prev</button> | ||
<button ng-disabled="!wizard.stepResults.pipeline || !wizard.stepResults.sampleDocs" ng-click="wizard.nextStep()">Next</button> | ||
</div> | ||
</div> | ||
|
||
<div ng-switch-when="2"> | ||
<pattern-review-step | ||
index-pattern="wizard.stepResults.indexPattern" | ||
sample-docs="wizard.stepResults.sampleDocs" | ||
pipeline="wizard.stepResults.pipeline"> | ||
</pattern-review-step> | ||
|
||
<div class="nav-buttons"> | ||
<button ng-click="wizard.prevStep()">Prev</button> | ||
<button ng-disabled="!wizard.stepResults.indexPattern" ng-click="wizard.nextStep()">Save</button> | ||
</div> | ||
</div> | ||
|
||
<div ng-switch-when="3"> | ||
<install-filebeat-step results="wizard.stepResults"></install-filebeat-step> | ||
</div> | ||
</div> | ||
</div> |
75 changes: 75 additions & 0 deletions
75
src/plugins/kibana/public/settings/sections/indices/filebeat/directives/filebeat_wizard.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
var modules = require('ui/modules'); | ||
var template = require('plugins/kibana/settings/sections/indices/filebeat/directives/filebeat_wizard.html'); | ||
|
||
require('plugins/kibana/settings/sections/indices/directives/pattern_review_step'); | ||
require('plugins/kibana/settings/sections/indices/directives/paste_samples_step'); | ||
require('plugins/kibana/settings/sections/indices/directives/pipeline_step'); | ||
require('plugins/kibana/settings/sections/indices/directives/install_filebeat_step'); | ||
|
||
// wrapper directive, which sets up the breadcrumb for all filebeat steps | ||
modules.get('apps/settings') | ||
.directive('filebeatWizard', function () { | ||
return { | ||
restrict: 'E', | ||
template: template, | ||
scope: {}, | ||
bindToController: true, | ||
controllerAs: 'wizard', | ||
controller: function ($scope, AppState, safeConfirm) { | ||
var $state = this.state = new AppState(); | ||
var totalSteps = 4; | ||
this.stepResults = {}; | ||
|
||
this.setCurrentStep = (step) => { | ||
if (!this.complete) { | ||
$state.currentStep = step; | ||
$state.save(); | ||
} | ||
}; | ||
this.setCurrentStep(0); | ||
|
||
this.nextStep = () => { | ||
if ($state.currentStep + 1 < totalSteps) { | ||
this.setCurrentStep($state.currentStep + 1); | ||
} | ||
}; | ||
this.prevStep = () => { | ||
if ($state.currentStep > 0) { | ||
this.setCurrentStep($state.currentStep - 1); | ||
} | ||
}; | ||
|
||
$scope.$watch('wizard.state.currentStep', (newValue, oldValue) => { | ||
if (this.complete) { | ||
$state.currentStep = totalSteps - 1; | ||
$state.save(); | ||
return; | ||
} | ||
if (newValue + 1 === totalSteps) { | ||
this.complete = true; | ||
} | ||
if (newValue < oldValue) { | ||
return safeConfirm('Going back will reset any changes you\'ve made to this step, do you want to continue?') | ||
.then( | ||
() => { | ||
if ($state.currentStep < 1) { | ||
delete this.stepResults.pipeline; | ||
} | ||
if ($state.currentStep < 2) { | ||
delete this.stepResults.indexPattern; | ||
} | ||
this.currentStep = newValue; | ||
}, | ||
() => { | ||
$state.currentStep = oldValue; | ||
$state.save(); | ||
} | ||
); | ||
} | ||
else { | ||
this.currentStep = newValue; | ||
} | ||
}); | ||
} | ||
}; | ||
}); |
5 changes: 5 additions & 0 deletions
5
src/plugins/kibana/public/settings/sections/indices/filebeat/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<kbn-settings-app section="indices"> | ||
<kbn-settings-indices> | ||
<filebeat-wizard /> | ||
</kbn-settings-indices> | ||
</kbn-settings-app> |
8 changes: 8 additions & 0 deletions
8
src/plugins/kibana/public/settings/sections/indices/filebeat/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var routes = require('ui/routes'); | ||
var template = require('plugins/kibana/settings/sections/indices/filebeat/index.html'); | ||
|
||
require('plugins/kibana/settings/sections/indices/filebeat/directives/filebeat_wizard'); | ||
|
||
routes.when('/settings/indices/create/filebeat', { | ||
template: template | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters