-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added saving and loading of visualizations from within the visualizat…
…ion editor. #33
- Loading branch information
Spencer Alger
committed
Apr 15, 2014
1 parent
08cbed5
commit cc9bce0
Showing
13 changed files
with
273 additions
and
115 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<form ng-submit="false" role="form"> | ||
<div class="form-group"> | ||
<label for="loadVisFilter">Filter</label> | ||
<input class="form-control" name="loadVisFilter" type="text" ng-model="conf.loadVis.filter"> | ||
</div> | ||
</form> | ||
<ng-switch on="conf.loadVis.list.length"> | ||
<ul ng-switch-default class="media-list vis-load-list"> | ||
<li ng-repeat="saved in conf.loadVis.list" class="media"> | ||
<a ng-href="#{{saved.url}}" class="pull-left"> | ||
<img ng-class="'media-object vis-preview-' + saved.typeName"> | ||
</a> | ||
<div class="media-body"> | ||
<a ng-href="#{{saved.url}}"><h4 class="media-heading">{{saved.title}}</h4></a> | ||
<p ng-if="saved.description">{{saved.description}}</p> | ||
</div> | ||
</li> | ||
</ul> | ||
<p ng-switch-when="0">No matching visualizations</p> | ||
</ul> |
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,12 @@ | ||
<form role="form" ng-submit="conf.doSave()"> | ||
<div class="form-group"> | ||
<label for="visTitle">Title</label> | ||
<input class="form-control" type="text" name="visTitle" ng-model="conf.vis.title" required> | ||
</div> | ||
<div class="form-group"> | ||
<label for="visDescription">Description</label> | ||
<textarea class="form-control" name="visDescription" ng-model="conf.vis.description" placeholder=""></textarea> | ||
</div> | ||
|
||
<button type="submit" class="btn btn-primary">Save</button> | ||
</form> |
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
29 changes: 28 additions & 1 deletion
29
src/kibana/apps/visualize/saved_visualizations/saved_visualizations.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 |
---|---|---|
@@ -1,11 +1,38 @@ | ||
define(function (require) { | ||
var app = require('modules').get('app/visualize'); | ||
var typeDefs = require('./_type_defs'); | ||
|
||
require('./_saved_vis'); | ||
|
||
app.service('savedVisualizations', function (es, courier, $q, $timeout, SavedVis) { | ||
app.service('savedVisualizations', function (es, config, courier, $q, $timeout, SavedVis) { | ||
this.get = function (type, id) { | ||
return (new SavedVis(type, id)).init(); | ||
}; | ||
|
||
this.find = function (searchString) { | ||
return es.search({ | ||
index: config.file.kibanaIndex, | ||
type: 'visualization', | ||
body: { | ||
query: { | ||
multi_match: { | ||
query: searchString || '', | ||
type: 'phrase_prefix', | ||
fields: ['title^3', 'description'], | ||
zero_terms_query: 'all' | ||
} | ||
} | ||
} | ||
}) | ||
.then(function (resp) { | ||
return resp.hits.hits.map(function (hit) { | ||
var source = hit._source; | ||
source.id = hit._id; | ||
source.url = '/visualize/' + source.typeName + '/' + hit._id; | ||
source.typeDef = typeDefs.byName[source.typeName]; | ||
return source; | ||
}); | ||
}); | ||
}; | ||
}); | ||
}); |
Oops, something went wrong.