Merge pull request #1092 from amiaopensource/master

Add export button to "Cluster and Edit"
This commit is contained in:
Thad Guidry 2017-02-10 09:01:20 -06:00 committed by GitHub
commit 2800b26a77
9 changed files with 35 additions and 0 deletions

View File

@ -634,6 +634,7 @@
"pick-record": "Pick Record Elements",
"merge-cluster": "Merge Selected & Re-Cluster",
"merge-close": "Merge Selected & Close",
"export-cluster": "Export Clusters",
"close": "Close",
"reset-template": "Reset Template",
"export": "Export",

View File

@ -634,6 +634,7 @@
"pick-record": "Pick Record Elements",
"merge-cluster": "Merge Selected & Re-Cluster",
"merge-close": "Merge Selected & Close",
"export-cluster": "Export Clusters",
"close": "Close",
"reset-template": "Reset Template",
"export": "Export",

View File

@ -634,6 +634,7 @@
"pick-record": "Escojer elementos del registro",
"merge-cluster": "Unir seleccionados y reagrupar",
"merge-close": "Unir seleccionados y cerrar",
"export-cluster": "Exportar agrupaciones",
"close": "Cerrar",
"reset-template": "Restablecer la plantilla",
"export": "Exportar",

View File

@ -634,6 +634,7 @@
"pick-record": "Sélectionner les éléments des entrées",
"merge-cluster": "Fusionner la sélection & regrouper",
"merge-close": "Fusionner la sélection & fermer",
"export-cluster": "Exporter les groupes",
"close": "Fermer",
"reset-template": "Réinitialiser le modèle",
"export": "Exporter",

View File

@ -634,6 +634,7 @@
"pick-record": "Seleziona gli elementi del record",
"merge-cluster": "Unisci i selezionati & Ri-Cluster",
"merge-close": "Unisci i selezionati & Chiudi",
"export-cluster": "Esporta cluster",
"close": "Chiudi",
"reset-template": "Resetta Template",
"export": "Esporta",

View File

@ -634,6 +634,7 @@
"pick-record": "レコード要素を選択",
"merge-cluster": "Merge Selected & Re-Cluster",
"merge-close": "Merge Selected & Close",
"export-cluster": "クラスタを出力",
"close": "閉じる",
"reset-template": "テンプレートをリセット",
"export": "出力",

View File

@ -635,6 +635,7 @@
"pick-record": "选择记录",
"merge-cluster": "合并选中 & 重新簇集",
"merge-close": "合并选中 & 关闭",
"export-cluster": "导出簇",
"close": "关闭",
"reset-template": "重置模板",
"export": "导出",

View File

@ -56,6 +56,7 @@
<button class="button" bind="deselectAllButton"></button>
</td>
<td class="right" style="text-align: right">
<button class="button" bind="exportClusterButton"></button>
<button class="button button-primary" bind="applyReClusterButton"></button>
<button class="button" bind="applyCloseButton"></button>
<button class="button" bind="closeButton"></button>

View File

@ -69,6 +69,7 @@ ClusteringDialog.prototype._createDialog = function() {
this._elmts.or_dialog_blockChars.html($.i18n._('core-dialogs')["block-chars"]);
this._elmts.selectAllButton.html($.i18n._('core-buttons')["select-all"]);
this._elmts.deselectAllButton.html($.i18n._('core-buttons')["unselect-all"]);
this._elmts.exportClusterButton.html($.i18n._('core-buttons')["export-cluster"]);
this._elmts.applyReClusterButton.html($.i18n._('core-buttons')["merge-cluster"]);
this._elmts.applyCloseButton.html($.i18n._('core-buttons')["merge-close"]);
this._elmts.closeButton.html($.i18n._('core-buttons')["close"]);
@ -121,6 +122,7 @@ ClusteringDialog.prototype._createDialog = function() {
this._elmts.selectAllButton.click(function() { self._selectAll(); });
this._elmts.deselectAllButton.click(function() { self._deselectAll(); });
this._elmts.exportClusterButton.click(function() { self._onExportCluster(); });
this._elmts.applyReClusterButton.click(function() { self._onApplyReCluster(); });
this._elmts.applyCloseButton.click(function() { self._onApplyClose(); });
this._elmts.closeButton.click(function() { self._dismiss(); });
@ -333,6 +335,11 @@ ClusteringDialog.prototype._onApplyReCluster = function() {
});
};
ClusteringDialog.prototype._onExportCluster = function() {
var self = this;
self._export();
};
ClusteringDialog.prototype._apply = function(onDone) {
var clusters = this._getRestrictedClusters();
var edits = [];
@ -373,6 +380,26 @@ ClusteringDialog.prototype._apply = function(onDone) {
}
};
ClusteringDialog.prototype._export = function() {
var clusters = this._getRestrictedClusters();
var projectName = theProject.metadata.name;
var columnName = this._columnName;
var timeStamp = (new Date()).toISOString();
var obj = {
'projectName': projectName,
'columnName': columnName,
'timeStamp': timeStamp,
'clusterMethod': this._method,
'keyingFunction': this._function,
'clusters': clusters
};
var data = "text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(obj));
var link = document.createElement('a');
link.href = 'data:' + data;
link.download = "clusters_" + projectName + "_" + columnName + "_" + timeStamp + ".json";
link.click();
};
ClusteringDialog.prototype._dismiss = function() {
DialogSystem.dismissUntil(this._level - 1);
};