|
3124 | 3124 | }.bind(this) |
3125 | 3125 | }).open(); |
3126 | 3126 | }, |
| 3127 | + _forceMergeIndex_handler: function(index) { |
| 3128 | + var fields = new app.ux.FieldCollection({ |
| 3129 | + fields: [ |
| 3130 | + new ui.TextField({ label: i18n.text("ForceMergeForm.MaxSegments"), name: "max_num_segments", value: "1", require: true }), |
| 3131 | + new ui.CheckField({ label: i18n.text("ForceMergeForm.ExpungeDeletes"), name: "only_expunge_deletes", value: false }), |
| 3132 | + new ui.CheckField({ label: i18n.text("ForceMergeForm.FlushAfter"), name: "flush", value: true }) |
| 3133 | + ] |
| 3134 | + }); |
| 3135 | + var dialog = new ui.DialogPanel({ |
| 3136 | + title: i18n.text("ForceMergeForm.ForceMergeIndex", index.name), |
| 3137 | + body: new ui.PanelForm({ fields: fields }), |
| 3138 | + onCommit: function( panel, args ) { |
| 3139 | + if(fields.validate()) { |
| 3140 | + |
| 3141 | + this.cluster.post(encodeURIComponent( index.name ) + "/_forcemerge?"+jQuery.param(fields.getData()), null, function(r) { |
| 3142 | + alert(JSON.stringify(r)); |
| 3143 | + }); |
| 3144 | + dialog.close(); |
| 3145 | + } |
| 3146 | + }.bind(this) |
| 3147 | + }).open(); |
| 3148 | + }, |
3127 | 3149 | _testAnalyser_handler: function(index) { |
3128 | 3150 | this.cluster.get(encodeURIComponent( index.name ) + "/_analyze?text=" + encodeURIComponent( prompt( i18n.text("IndexCommand.TextToAnalyze") ) ), function(r) { |
3129 | 3151 | alert(JSON.stringify(r, true, " ")); |
|
3251 | 3273 | { text: i18n.text("IndexActionsMenu.NewAlias"), onclick: function() { this._newAliasAction_handler(index); }.bind(this) }, |
3252 | 3274 | { text: i18n.text("IndexActionsMenu.Refresh"), onclick: function() { this._postIndexAction_handler("_refresh", index, false); }.bind(this) }, |
3253 | 3275 | { text: i18n.text("IndexActionsMenu.Flush"), onclick: function() { this._postIndexAction_handler("_flush", index, false); }.bind(this) }, |
3254 | | - { text: i18n.text("IndexActionsMenu.Optimize"), onclick: function () { this._optimizeIndex_handler(index); }.bind(this) }, |
| 3276 | + { text: this.cluster.versionAtLeast("5.0.0.") ? i18n.text("IndexActionsMenu.ForceMerge") : i18n.text("IndexActionsMenu.Optimize"), onclick: this.cluster.versionAtLeast("5.0.0.") ? function () { this._forceMergeIndex_handler(index); }.bind(this) : function () { this._optimizeIndex_handler(index); }.bind(this) }, |
3255 | 3277 | { text: i18n.text("IndexActionsMenu.Snapshot"), disabled: closed, onclick: function() { this._postIndexAction_handler("_gateway/snapshot", index, false); }.bind(this) }, |
3256 | 3278 | { text: i18n.text("IndexActionsMenu.Analyser"), onclick: function() { this._testAnalyser_handler(index); }.bind(this) }, |
3257 | 3279 | { text: (index.state === "close") ? i18n.text("IndexActionsMenu.Open") : i18n.text("IndexActionsMenu.Close"), onclick: function() { this._postIndexAction_handler((index.state === "close") ? "_open" : "_close", index, true); }.bind(this) }, |
|
3751 | 3773 | _node_handler: function(data) { |
3752 | 3774 | if(data) { |
3753 | 3775 | this.prefs.set("app-base_uri", this.cluster.base_uri); |
| 3776 | + if(data.version && data.version.number) |
| 3777 | + this.cluster.setVersion(data.version.number); |
3754 | 3778 | } |
3755 | 3779 | }, |
3756 | 3780 |
|
|
0 commit comments