-
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.
Fixes #5497
- Loading branch information
Showing
14 changed files
with
310 additions
and
23 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
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
22 changes: 22 additions & 0 deletions
22
src/plugins/kibana/public/discover/partials/share_search.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,22 @@ | ||
<share object-type="search"></share> | ||
<!-- <form role="form" class="vis-share"> | ||
<p> | ||
<div class="input-group"> | ||
<label> | ||
Embed this dashboard | ||
<small>Add to your html source. Note all clients must still be able to access kibana</small> | ||
</label> | ||
<div class="form-control" disabled>{{opts.shareData().embed}}</div> | ||
</div> | ||
</p> | ||
<p> | ||
<div class="input-group"> | ||
<label> | ||
Share a link | ||
</label> | ||
<div class="form-control" disabled>{{opts.shareData().link}}</div> | ||
</div> | ||
</p> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
define(function (require) { | ||
var angular = require('angular'); | ||
|
||
require('ui/routes') | ||
.when('/goto/:id', { | ||
template: require('plugins/kibana/dashboard/index.html'), | ||
resolve: { | ||
dash: function (savedDashboards, Notifier, $route, $location, courier) { | ||
return savedDashboards.get($route.current.params.id) | ||
.catch(courier.redirectWhenMissing({ | ||
'dashboard' : '/dashboard' | ||
})); | ||
} | ||
} | ||
}); | ||
|
||
require('ui/routes') | ||
.when('/visualize', { | ||
redirectTo: '/visualize/step/1' | ||
}); | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
const crypto = require('crypto'); | ||
|
||
export default function (server) { | ||
async function updateMetadata(urlId, urlDoc) { | ||
const client = server.plugins.elasticsearch.client; | ||
|
||
try { | ||
await client.update({ | ||
index: '.kibana', | ||
type: 'url', | ||
id: urlId, | ||
body: { | ||
doc: { | ||
'access-date': new Date(), | ||
'access-count': urlDoc._source['access-count'] + 1 | ||
} | ||
} | ||
}); | ||
} catch (err) { | ||
console.log(err); | ||
//swallow errors. We don't care if there is no update. | ||
} | ||
} | ||
|
||
return { | ||
async generateUrlId(url) { | ||
const urlId = await new Promise((resolve, reject) => { | ||
const client = server.plugins.elasticsearch.client; | ||
|
||
// const urlId = crypto.createHash('md5') | ||
// .update(url) | ||
// .digest('hex'); | ||
|
||
client.index({ | ||
index: '.kibana', | ||
type: 'url', | ||
body: { | ||
url, | ||
'access-count': 0, | ||
'create-date': new Date(), | ||
'access-date': new Date() | ||
} | ||
}) | ||
.then(response => { | ||
const urlId = response._id; | ||
resolve(urlId); | ||
}) | ||
.catch(err => { | ||
reject(err); | ||
}); | ||
}); | ||
|
||
return urlId; | ||
}, | ||
async getUrl(urlId) { | ||
const url = await new Promise((resolve, reject) => { | ||
const client = server.plugins.elasticsearch.client; | ||
|
||
client.get({ | ||
index: '.kibana', | ||
type: 'url', | ||
id: urlId | ||
}) | ||
.then(response => { | ||
const url = response._source.url; | ||
updateMetadata(urlId, response); | ||
resolve(url); | ||
}) | ||
.catch(err => { | ||
resolve('/'); | ||
}); | ||
}); | ||
|
||
return url; | ||
} | ||
}; | ||
}; |
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,39 @@ | ||
<form role="form" class="vis-share"> | ||
<p> | ||
<input type="checkbox" ng-model="shortenUrls" id="shortenUrls" /> | ||
<label for="shortenUrls">Shorten URLs</label> | ||
</p> | ||
<p> | ||
<div class="input-group"> | ||
<label> | ||
Embed this {{objectType}} | ||
<small>Add to your html source. Note all clients must still be able to access kibana</small> | ||
</label> | ||
<div class="form-control" disabled ng-if="!shortenUrls"> | ||
<iframe src="{{embedUrl}}" height="600" width="800"></iframe> | ||
</div> | ||
<div class="form-control" disabled ng-if="shortenUrls && !shortUrlsLoading"> | ||
<iframe src="{{shortEmbedUrl}}" height="600" width="800"></iframe> | ||
</div> | ||
<div class="form-control" disabled ng-if="shortenUrls && shortUrlsLoading"> | ||
Generating Short URL... | ||
</div> | ||
</div> | ||
</p> | ||
<p> | ||
<div class="input-group"> | ||
<label> | ||
Share a link | ||
</label> | ||
<div class="form-control" disabled ng-if="!shortenUrls"> | ||
{{getUrl()}} | ||
</div> | ||
<div class="form-control" disabled ng-if="shortenUrls && !shortUrlsLoading"> | ||
{{shortUrl}} | ||
</div> | ||
<div class="form-control" disabled ng-if="shortenUrls && shortUrlsLoading"> | ||
Generating Short URL... | ||
</div> | ||
</div> | ||
</p> | ||
</form> |
Oops, something went wrong.