[Sense] Added snapshot status to the KB

See https://github.com/elasticsearch/elasticsearch/issues/4946
This commit is contained in:
Boaz Leskes 2014-03-18 10:35:01 +01:00
parent 1450f0609f
commit 6f3cdaa2ab
2 changed files with 24 additions and 3 deletions

View file

@ -105,8 +105,9 @@ define([
})(FieldUrlComponent.prototype);
function IdUrlComponent(name, parent) {
function IdUrlComponent(name, parent, multi) {
autocomplete_engine.SharedComponent.call(this, name, parent);
this.multi_match = multi
}
IdUrlComponent.prototype = _.create(
@ -115,10 +116,16 @@ define([
(function (cls) {
cls.match = function (token, context, editor) {
if (_.isArray(token) || !token) {
if (!token) {
return null;
}
if (token.match(/[\/,]/)) {
if (!this.multi_match && _.isArray(token)) {
return null;
}
token = _.isArray(token) ? token : [token];
if (_.find(token, function (t) {
return t.match(/[\/,]/);
})) {
return null;
}
var r = Object.getPrototypeOf(cls).match.call(this, token, context, editor);
@ -145,6 +152,9 @@ define([
'id': function (part, parent, endpoint) {
return new IdUrlComponent(part, parent);
},
'ids': function (part, parent, endpoint) {
return new IdUrlComponent(part, parent, true);
},
'fields': function (part, parent, endpoint) {
return new FieldUrlComponent(part, parent, true);
},

View file

@ -19,6 +19,7 @@ define(function () {
}
});
api.addEndpointDescription('single_snapshot', {
methods: ['GET', 'DELETE'],
patterns: [
@ -49,6 +50,16 @@ define(function () {
}
});
api.addEndpointDescription('_snapshot_status', {
methods: ['GET'],
patterns: [
'_snapshot/_status',
'_snapshot/{id}/_status',
'_snapshot/{id}/{ids}/_status'
]
});
function getRepositoryType(context) {
var iter = context.editor.iterForCurrentLoc();
// for now just iterate back to the first "type" key