|
@@ -20,6 +20,74 @@ var App = require('app');
|
|
App.MainServiceInfoSummaryController = Em.Controller.extend({
|
|
App.MainServiceInfoSummaryController = Em.Controller.extend({
|
|
name: 'mainServiceInfoSummaryController',
|
|
name: 'mainServiceInfoSummaryController',
|
|
|
|
|
|
|
|
+ selectedFlumeAgent: null,
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Send start command for selected Flume Agent
|
|
|
|
+ * @method startFlumeAgent
|
|
|
|
+ */
|
|
|
|
+ startFlumeAgent: function () {
|
|
|
|
+ var selectedFlumeAgent = this.get('selectedFlumeAgent');
|
|
|
|
+ if (selectedFlumeAgent && selectedFlumeAgent.get('status') === 'INSTALLED') {
|
|
|
|
+ var self = this;
|
|
|
|
+ App.showConfirmationPopup(function () {
|
|
|
|
+ var command = 'START';
|
|
|
|
+ var context = Em.I18n.t('services.service.summary.flume.start.context').format(selectedFlumeAgent.get('name'));
|
|
|
|
+ self.sendFlumeAgentCommandToServer(command, context, selectedFlumeAgent);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Send stop command for selected Flume Agent
|
|
|
|
+ * @method stopFlumeAgent
|
|
|
|
+ */
|
|
|
|
+ stopFlumeAgent: function () {
|
|
|
|
+ var selectedFlumeAgent = this.get('selectedFlumeAgent');
|
|
|
|
+ if (selectedFlumeAgent && selectedFlumeAgent.get('status') === 'STARTED') {
|
|
|
|
+ var self = this;
|
|
|
|
+ App.showConfirmationPopup(function () {
|
|
|
|
+ var command = 'STOP';
|
|
|
|
+ var context = Em.I18n.t('services.service.summary.flume.stop.context').format(selectedFlumeAgent.get('name'));
|
|
|
|
+ self.sendFlumeAgentCommandToServer(command, context, selectedFlumeAgent);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Send command for Flume Agent to server
|
|
|
|
+ * @param {string} command
|
|
|
|
+ * @param {string} context
|
|
|
|
+ * @param {Object} agent
|
|
|
|
+ * @method sendFlumeAgentCommandToServer
|
|
|
|
+ */
|
|
|
|
+ sendFlumeAgentCommandToServer: function (command, context, agent) {
|
|
|
|
+ App.ajax.send({
|
|
|
|
+ name: 'service.flume.agent.command',
|
|
|
|
+ sender: this,
|
|
|
|
+ data: {
|
|
|
|
+ command: command,
|
|
|
|
+ context: context,
|
|
|
|
+ agentName: agent.get('name'),
|
|
|
|
+ host: agent.get('host.hostName')
|
|
|
|
+ },
|
|
|
|
+ success: 'commandSuccessCallback'
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Callback, that shows Background operations popup if request was successful
|
|
|
|
+ */
|
|
|
|
+ commandSuccessCallback: function () {
|
|
|
|
+ console.log('Send request for refresh configs successfully');
|
|
|
|
+ // load data (if we need to show this background operations popup) from persist
|
|
|
|
+ App.router.get('applicationController').dataLoading().done(function (showPopup) {
|
|
|
|
+ if (showPopup) {
|
|
|
|
+ App.router.get('backgroundOperationsController').showPopup();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
nagiosUrl: function(){
|
|
nagiosUrl: function(){
|
|
return App.router.get('clusterController.nagiosUrl');
|
|
return App.router.get('clusterController.nagiosUrl');
|
|
}.property('App.router.clusterController.nagiosUrl'),
|
|
}.property('App.router.clusterController.nagiosUrl'),
|