removed gist loading/saving
This commit is contained in:
@@ -97,28 +97,6 @@ function (angular, _, moment) {
|
||||
window.saveAs(blob, $scope.dashboard.title + '-' + new Date().getTime());
|
||||
};
|
||||
|
||||
$scope.save_gist = function() {
|
||||
$scope.dashboard.save_gist($scope.gist.title).then(function(link) {
|
||||
if (!_.isUndefined(link)) {
|
||||
$scope.gist.last = link;
|
||||
alertSrv.set('Gist saved','You will be able to access your exported dashboard file at '+
|
||||
'<a href="'+link+'">'+link+'</a> in a moment','success');
|
||||
} else {
|
||||
alertSrv.set('Save failed','Gist could not be saved','error',5000);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.gist_dblist = function(id) {
|
||||
$scope.dashboard.gist_list(id).then(function(files) {
|
||||
if (files && files.length > 0) {
|
||||
$scope.gist.files = files;
|
||||
} else {
|
||||
alertSrv.set('Gist Failed','Could not retrieve dashboard list from gist','error',5000);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// function $scope.zoom
|
||||
// factor :: Zoom factor, so 0.5 = cuts timespan in half, 2 doubles timespan
|
||||
$scope.zoom = function(factor) {
|
||||
|
||||
@@ -104,20 +104,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="editor-row" ng-show='dashboard.loader.load_gist'>
|
||||
<h5>Gist <tip>Enter a gist number or url</tip></h5>
|
||||
<form>
|
||||
<input type="text" ng-model="gist.url" placeholder="Gist number or URL"><br>
|
||||
<button class="btn" ng-click="gist_dblist(dashboard.gist_id(gist.url))" ng-show="dashboard.is_gist(gist.url)"><i class="icon-github-alt"></i> Get gist:{{gist.url | gistid}}</button>
|
||||
<h6 ng-show="gist.files.length">Dashboards in gist:{{gist.url | gistid}} <small>click to load</small></h6>
|
||||
<h6 ng-hide="gist.files.length || !gist.url.length">No gist dashboards found</h6>
|
||||
<table class="table table-condensed table-striped">
|
||||
<tr ng-repeat="file in gist.files">
|
||||
<td><a ng-click="dashboard.dash_load(file)">{{file.title}}</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -95,63 +95,5 @@ function (angular, $, kbn, _) {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
var gist_pattern = /(^\d{5,}$)|(^[a-z0-9]{10,}$)|(gist.github.com(\/*.*)\/[a-z0-9]{5,}\/*$)/;
|
||||
|
||||
this.gist_id = function(string) {
|
||||
if(self.is_gist(string)) {
|
||||
return string.match(gist_pattern)[0].replace(/.*\//, '');
|
||||
}
|
||||
};
|
||||
|
||||
this.is_gist = function(string) {
|
||||
if(!_.isUndefined(string) && string !== '' && !_.isNull(string.match(gist_pattern))) {
|
||||
return string.match(gist_pattern).length > 0 ? true : false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
this.save_gist = function(title,dashboard) {
|
||||
var save = _.clone(dashboard || self.current);
|
||||
save.title = title || self.current.title;
|
||||
return $http({
|
||||
url: "https://api.github.com/gists",
|
||||
method: "POST",
|
||||
data: {
|
||||
"description": save.title,
|
||||
"public": false,
|
||||
"files": {
|
||||
"kibana-dashboard.json": {
|
||||
"content": angular.toJson(save,true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}).then(function(data) {
|
||||
return data.data.html_url;
|
||||
}, function() {
|
||||
return false;
|
||||
});
|
||||
};
|
||||
|
||||
this.gist_list = function(id) {
|
||||
return $http.jsonp("https://api.github.com/gists/"+id+"?callback=JSON_CALLBACK"
|
||||
).then(function(response) {
|
||||
var files = [];
|
||||
_.each(response.data.data.files,function(v) {
|
||||
try {
|
||||
var file = JSON.parse(v.content);
|
||||
files.push(file);
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return files;
|
||||
}, function() {
|
||||
return false;
|
||||
});
|
||||
};
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user