add timestamp to json

This commit is contained in:
Cora Johnson-Roberson 2015-11-18 11:26:24 -08:00
parent 534d2bd6c1
commit 0b0abf6801

View File

@ -384,15 +384,17 @@ ClusteringDialog.prototype._export = function() {
var clusters = this._getRestrictedClusters(); var clusters = this._getRestrictedClusters();
var projectName = theProject.metadata.name; var projectName = theProject.metadata.name;
var columnName = this._columnName; var columnName = this._columnName;
var timeStamp = (new Date()).toISOString();
var obj = { var obj = {
'projectName': projectName, 'projectName': projectName,
'columnName': columnName, 'columnName': columnName,
'timeStamp': timeStamp,
'clusters': clusters, 'clusters': clusters,
}; };
var data = "text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(obj)); var data = "text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(obj));
var link=document.createElement('a'); var link=document.createElement('a');
link.href='data:' + data; link.href='data:' + data;
link.download="clusters_" + projectName + "_" + columnName + "_" + (new Date()).toISOString() + ".json"; link.download="clusters_" + projectName + "_" + columnName + "_" + timeStamp + ".json";
link.click(); link.click();
}; };