item.js 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. var batchUtils = require('utils/batch_scheduled_requests');
  20. App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDownload, App.InstallComponent, {
  21. name: 'mainServiceItemController',
  22. /**
  23. * Callback functions for start and stop service have few differences
  24. *
  25. * Used with currentCallBack property
  26. */
  27. callBackConfig: {
  28. 'STARTED': {
  29. 'c': 'STARTING',
  30. 'f': 'starting',
  31. 'c2': 'live',
  32. 'hs': 'started',
  33. 's': 'start'
  34. },
  35. 'INSTALLED': {
  36. 'c': 'STOPPING',
  37. 'f': 'stopping',
  38. 'c2': 'dead',
  39. 'hs': 'stopped',
  40. 's': 'stop'
  41. }
  42. },
  43. /**
  44. * Map of service names and lists of sites they need to load
  45. */
  46. serviceConfigsMap: {
  47. 'OOZIE': ['oozie-env']
  48. },
  49. /**
  50. * Configs loaded to use for service actions menu
  51. *
  52. * format: {config-type: {property-name1: property-value1, property-name2: property-value2, ...}}
  53. */
  54. configs: {},
  55. /**
  56. * @type {boolean}
  57. * @default true
  58. */
  59. isPending: true,
  60. /**
  61. * @type {boolean}
  62. * @default false
  63. */
  64. isServicesInfoLoaded: false,
  65. /**
  66. * Define whether configs for service actions menu were loaded
  67. * @type {Boolean}
  68. */
  69. isServiceConfigsLoaded: false,
  70. /**
  71. * flag to control router switch between service summary and configs
  72. * @type {boolean}
  73. */
  74. routeToConfigs: false,
  75. isClientsOnlyService: function() {
  76. return App.get('services.clientOnly').contains(this.get('content.serviceName'));
  77. }.property('content.serviceName'),
  78. isConfigurable: function () {
  79. return !App.get('services.noConfigTypes').contains(this.get('content.serviceName'));
  80. }.property('App.services.noConfigTypes','content.serviceName'),
  81. clientComponents: function () {
  82. var clientNames = [];
  83. var clients = App.StackServiceComponent.find().filterProperty('serviceName', this.get('content.serviceName')).filterProperty('isClient');
  84. clients.forEach(function (item) {
  85. clientNames.push({
  86. action: 'downloadClientConfigs',
  87. context: {
  88. name: item.get('componentName'),
  89. label: item.get('displayName')
  90. }
  91. });
  92. });
  93. return clientNames;
  94. }.property('content.serviceName'),
  95. /**
  96. * Load all config tags for loading configs
  97. */
  98. loadConfigs: function(){
  99. if (this.get('serviceConfigsMap')[this.get('content.serviceName')]) {
  100. this.set('isServiceConfigsLoaded', false);
  101. App.ajax.send({
  102. name: 'config.tags',
  103. sender: this,
  104. success: 'onLoadConfigsTags',
  105. error: 'onTaskError'
  106. });
  107. } else {
  108. this.set('isServiceConfigsLoaded', true);
  109. }
  110. },
  111. /**
  112. * Load all configs for sites from <code>serviceConfigsMap</code> for current service
  113. * @param data
  114. */
  115. onLoadConfigsTags: function (data) {
  116. var self = this;
  117. var sitesToLoad = this.get('serviceConfigsMap')[this.get('content.serviceName')];
  118. var loadedSites = data.Clusters.desired_configs;
  119. var siteTagsToLoad = [];
  120. for (var site in loadedSites) {
  121. if (sitesToLoad.contains(site)) {
  122. siteTagsToLoad.push({
  123. siteName: site,
  124. tagName: loadedSites[site].tag
  125. });
  126. }
  127. }
  128. App.router.get('configurationController').getConfigsByTags(siteTagsToLoad).done(function (configs) {
  129. configs.forEach(function (site) {
  130. self.get('configs')[site.type] = site.properties;
  131. });
  132. self.set('isServiceConfigsLoaded', true);
  133. });
  134. },
  135. /**
  136. * Common method for ajax (start/stop service) responses
  137. * @param data
  138. * @param ajaxOptions
  139. * @param params
  140. */
  141. startStopPopupSuccessCallback: function (data, ajaxOptions, params) {
  142. if (data && data.Requests) {
  143. params.query.set('status', 'SUCCESS');
  144. var config = this.get('callBackConfig')[(JSON.parse(ajaxOptions.data)).Body.ServiceInfo.state];
  145. var self = this;
  146. if (App.get('testMode')) {
  147. self.set('content.workStatus', App.Service.Health[config.f]);
  148. self.get('content.hostComponents').setEach('workStatus', App.HostComponentStatus[config.f]);
  149. setTimeout(function () {
  150. self.set('content.workStatus', App.Service.Health[config.c2]);
  151. self.get('content.hostComponents').setEach('workStatus', App.HostComponentStatus[config.hs]);
  152. }, App.get('testModeDelayForActions'));
  153. }
  154. // load data (if we need to show this background operations popup) from persist
  155. App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
  156. if (initValue) {
  157. App.router.get('backgroundOperationsController').showPopup();
  158. }
  159. });
  160. } else {
  161. params.query.set('status', 'FAIL');
  162. }
  163. },
  164. startStopPopupErrorCallback: function(request, ajaxOptions, error, opt, params){
  165. params.query.set('status', 'FAIL');
  166. },
  167. /**
  168. * Confirmation popup for start/stop services
  169. * @param event
  170. * @param serviceHealth - 'STARTED' or 'INSTALLED'
  171. */
  172. startStopPopup: function(event, serviceHealth) {
  173. if ($(event.target).hasClass('disabled') || $(event.target.parentElement).hasClass('disabled')) {
  174. return;
  175. }
  176. var self = this;
  177. var serviceDisplayName = this.get('content.displayName');
  178. var isMaintenanceOFF = this.get('content.passiveState') === 'OFF';
  179. var msg = isMaintenanceOFF && serviceHealth == 'INSTALLED'? Em.I18n.t('services.service.stop.warningMsg.turnOnMM').format(serviceDisplayName) : null;
  180. msg = self.addAdditionalWarningMessage(serviceHealth, msg, serviceDisplayName);
  181. var bodyMessage = Em.Object.create({
  182. putInMaintenance: (serviceHealth == 'INSTALLED' && isMaintenanceOFF) || (serviceHealth == 'STARTED' && !isMaintenanceOFF),
  183. turnOnMmMsg: serviceHealth == 'INSTALLED' ? Em.I18n.t('passiveState.turnOnFor').format(serviceDisplayName) : Em.I18n.t('passiveState.turnOffFor').format(serviceDisplayName),
  184. confirmMsg: serviceHealth == 'INSTALLED'? Em.I18n.t('services.service.stop.confirmMsg').format(serviceDisplayName) : Em.I18n.t('services.service.start.confirmMsg').format(serviceDisplayName),
  185. confirmButton: serviceHealth == 'INSTALLED'? Em.I18n.t('services.service.stop.confirmButton') : Em.I18n.t('services.service.start.confirmButton'),
  186. additionalWarningMsg: msg
  187. });
  188. // check HDFS NameNode checkpoint before stop service
  189. if (this.get('content.serviceName') == 'HDFS' && serviceHealth == 'INSTALLED' &&
  190. this.get('content.hostComponents').filterProperty('componentName', 'NAMENODE').someProperty('workStatus', App.HostComponentStatus.started)) {
  191. this.checkNnLastCheckpointTime(function () {
  192. return App.showConfirmationFeedBackPopup(function(query, runMmOperation) {
  193. self.set('isPending', true);
  194. self.startStopWithMmode(serviceHealth, query, runMmOperation);
  195. }, bodyMessage);
  196. });
  197. } else {
  198. return App.showConfirmationFeedBackPopup(function(query, runMmOperation) {
  199. self.set('isPending', true);
  200. self.startStopWithMmode(serviceHealth, query, runMmOperation);
  201. }, bodyMessage);
  202. }
  203. },
  204. /**
  205. * this function will be called from :1) stop HDFS 2) restart all for HDFS 3) restart all affected for HDFS
  206. * @param callback - callback function to continue next operation
  207. */
  208. checkNnLastCheckpointTime: function(callback) {
  209. var self = this;
  210. this.pullNnCheckPointTime().complete(function () {
  211. var isNNCheckpointTooOld = self.get('isNNCheckpointTooOld');
  212. self.set('isNNCheckpointTooOld', null);
  213. if (isNNCheckpointTooOld) {
  214. // too old
  215. self.getHdfsUser().done(function() {
  216. var msg = Em.Object.create({
  217. confirmMsg: Em.I18n.t('services.service.stop.HDFS.warningMsg.checkPointTooOld').format(App.nnCheckpointAgeAlertThreshold) +
  218. Em.I18n.t('services.service.stop.HDFS.warningMsg.checkPointTooOld.instructions').format(isNNCheckpointTooOld, self.get('hdfsUser')),
  219. confirmButton: Em.I18n.t('common.next')
  220. });
  221. return App.showConfirmationFeedBackPopup(callback, msg);
  222. });
  223. } else if (isNNCheckpointTooOld == null) {
  224. // not available
  225. return App.showConfirmationPopup(
  226. callback, Em.I18n.t('services.service.stop.HDFS.warningMsg.checkPointNA'), null,
  227. Em.I18n.t('common.warning'), Em.I18n.t('common.proceedAnyway'), true
  228. );
  229. } else {
  230. // still young
  231. callback();
  232. }
  233. });
  234. },
  235. pullNnCheckPointTime: function () {
  236. return App.ajax.send({
  237. name: 'common.service.hdfs.getNnCheckPointTime',
  238. sender: this,
  239. success: 'parseNnCheckPointTime'
  240. });
  241. },
  242. parseNnCheckPointTime: function (data) {
  243. var nameNodesStatus = [];
  244. var lastCheckpointTime, hostName;
  245. if (data.host_components.length <= 1) {
  246. lastCheckpointTime = Em.get(data.host_components[0], 'metrics.dfs.FSNamesystem.LastCheckpointTime');
  247. hostName = Em.get(data.host_components[0], 'HostRoles.host_name');
  248. } else {
  249. // HA enabled
  250. data.host_components.forEach(function(namenode) {
  251. nameNodesStatus.pushObject( Em.Object.create({
  252. LastCheckpointTime: Em.get(namenode, 'metrics.dfs.FSNamesystem.LastCheckpointTime'),
  253. HAState: Em.get(namenode, 'metrics.dfs.FSNamesystem.HAState'),
  254. hostName: Em.get(namenode, 'HostRoles.host_name')
  255. }));
  256. });
  257. if (nameNodesStatus.someProperty('HAState', 'active')) {
  258. if (nameNodesStatus.findProperty('HAState', 'active').get('LastCheckpointTime')) {
  259. lastCheckpointTime = nameNodesStatus.findProperty('HAState', 'active').get('LastCheckpointTime');
  260. hostName = nameNodesStatus.findProperty('HAState', 'active').get('hostName');
  261. } else if (nameNodesStatus.someProperty('LastCheckpointTime')) {
  262. lastCheckpointTime = nameNodesStatus.findProperty('LastCheckpointTime').get('LastCheckpointTime');
  263. hostName = nameNodesStatus.findProperty('LastCheckpointTime').get('hostName');
  264. }
  265. } else if (nameNodesStatus.someProperty('HAState', 'standby')) {
  266. lastCheckpointTime = nameNodesStatus.findProperty('HAState', 'standby').get('LastCheckpointTime');
  267. hostName = nameNodesStatus.findProperty('HAState', 'standby').get('hostName')
  268. }
  269. }
  270. if (!lastCheckpointTime) {
  271. this.set("isNNCheckpointTooOld", null);
  272. } else {
  273. var time_criteria = App.nnCheckpointAgeAlertThreshold; // time in hours to define how many hours ago is too old
  274. var time_ago = (Math.round(App.dateTime() / 1000) - (time_criteria * 3600)) *1000;
  275. if (lastCheckpointTime <= time_ago) {
  276. // too old, set the effected hostName
  277. this.set("isNNCheckpointTooOld", hostName);
  278. } else {
  279. // still young
  280. this.set("isNNCheckpointTooOld", false);
  281. }
  282. }
  283. },
  284. /**
  285. * Return true if hdfs user data is loaded via App.MainServiceInfoConfigsController
  286. */
  287. getHdfsUser: function () {
  288. var self = this;
  289. var dfd = $.Deferred();
  290. var miscController = App.MainAdminServiceAccountsController.create();
  291. miscController.loadUsers();
  292. var interval = setInterval(function () {
  293. if (miscController.get('dataIsLoaded') && miscController.get('users')) {
  294. self.set('hdfsUser', miscController.get('users').findProperty('name', 'hdfs_user').get('value'));
  295. dfd.resolve();
  296. clearInterval(interval);
  297. }
  298. }, 10);
  299. return dfd.promise();
  300. },
  301. addAdditionalWarningMessage: function(serviceHealth, msg, serviceDisplayName){
  302. var servicesAffectedDisplayNames = [];
  303. var servicesAffected = [];
  304. if(serviceHealth == 'INSTALLED'){
  305. //To stop a service, display dependencies message...
  306. var currentService = this.get('content.serviceName');
  307. var stackServices = App.StackService.find();
  308. stackServices.forEach(function(service){
  309. if(service.get('isInstalled') || service.get('isSelected')){ //only care about services installed...
  310. var stackServiceDisplayName = service.get("displayName");
  311. var requiredServices = service.get('requiredServices'); //services required in order to have the current service be functional...
  312. if (!!requiredServices && requiredServices.length) { //only care about services with a non-empty requiredServices list.
  313. requiredServices.forEach(function(_requiredService){
  314. if (currentService === _requiredService) { //the service to be stopped is a required service by some other services...
  315. if(servicesAffected.indexOf(service) == -1 ) {
  316. servicesAffected.push(service);
  317. servicesAffectedDisplayNames.push(stackServiceDisplayName);
  318. }
  319. }
  320. },this);
  321. }
  322. }
  323. },this);
  324. var names = servicesAffectedDisplayNames.join();
  325. if(names){
  326. //only display this line with a non-empty dependency list
  327. var dependenciesMsg = Em.I18n.t('services.service.stop.warningMsg.dependent.services').format(serviceDisplayName,names);
  328. if(msg)
  329. msg = msg + " " + dependenciesMsg;
  330. else
  331. msg = dependenciesMsg;
  332. }
  333. }
  334. return msg;
  335. },
  336. startStopWithMmode: function(serviceHealth, query, runMmOperation) {
  337. var self = this;
  338. if (runMmOperation) {
  339. if (serviceHealth == "STARTED") {
  340. this.startStopPopupPrimary(serviceHealth, query).complete(function() {
  341. batchUtils.turnOnOffPassiveRequest("OFF", Em.I18n.t('passiveState.turnOff'), self.get('content.serviceName').toUpperCase());
  342. });
  343. } else {
  344. batchUtils.turnOnOffPassiveRequest("ON", Em.I18n.t('passiveState.turnOn'), this.get('content.serviceName').toUpperCase()).complete(function() {
  345. self.startStopPopupPrimary(serviceHealth, query);
  346. })
  347. }
  348. } else {
  349. this.startStopPopupPrimary(serviceHealth, query);
  350. }
  351. },
  352. startStopPopupPrimary: function (serviceHealth, query) {
  353. var requestInfo = (serviceHealth == "STARTED")
  354. ? App.BackgroundOperationsController.CommandContexts.START_SERVICE.format(this.get('content.serviceName'))
  355. : App.BackgroundOperationsController.CommandContexts.STOP_SERVICE.format(this.get('content.serviceName'));
  356. var data = {
  357. 'context': requestInfo,
  358. 'serviceName': this.get('content.serviceName').toUpperCase(),
  359. 'ServiceInfo': {
  360. 'state': serviceHealth
  361. },
  362. 'query': query
  363. };
  364. return App.ajax.send({
  365. 'name': 'common.service.update',
  366. 'sender': this,
  367. 'success': 'startStopPopupSuccessCallback',
  368. 'error': 'startStopPopupErrorCallback',
  369. 'data': data
  370. });
  371. },
  372. /**
  373. * On click callback for <code>start service</code> button
  374. * @param event
  375. */
  376. startService: function (event) {
  377. this.startStopPopup(event, App.HostComponentStatus.started);
  378. },
  379. /**
  380. * On click callback for <code>stop service</code> button
  381. * @param event
  382. */
  383. stopService: function (event) {
  384. this.startStopPopup(event, App.HostComponentStatus.stopped);
  385. },
  386. /**
  387. * On click callback for <code>run rebalancer</code> button
  388. * @param event
  389. */
  390. runRebalancer: function (event) {
  391. var self = this;
  392. return App.showConfirmationPopup(function() {
  393. self.set("content.runRebalancer", true);
  394. // load data (if we need to show this background operations popup) from persist
  395. App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
  396. if (initValue) {
  397. App.router.get('backgroundOperationsController').showPopup();
  398. }
  399. });
  400. });
  401. },
  402. /**
  403. * On click handler for Yarn Refresh Queues command from items menu
  404. * @param event
  405. */
  406. refreshYarnQueues : function (event) {
  407. var controller = this;
  408. var hosts = App.Service.find('YARN').get('hostComponents').filterProperty('componentName', 'RESOURCEMANAGER').mapProperty('hostName');
  409. return App.showConfirmationPopup(function() {
  410. App.ajax.send({
  411. name : 'service.item.refreshQueueYarnRequest',
  412. sender: controller,
  413. data : {
  414. command : "REFRESHQUEUES",
  415. context : Em.I18n.t('services.service.actions.run.yarnRefreshQueues.context') ,
  416. hosts : hosts.join(','),
  417. serviceName : "YARN",
  418. componentName : "RESOURCEMANAGER",
  419. forceRefreshConfigTags : "capacity-scheduler"
  420. },
  421. success : 'refreshYarnQueuesSuccessCallback',
  422. error : 'refreshYarnQueuesErrorCallback'
  423. });
  424. });
  425. },
  426. refreshYarnQueuesSuccessCallback : function(data, ajaxOptions, params) {
  427. if (data.Requests.id) {
  428. App.router.get('backgroundOperationsController').showPopup();
  429. }
  430. },
  431. refreshYarnQueuesErrorCallback : function(data) {
  432. var error = Em.I18n.t('services.service.actions.run.yarnRefreshQueues.error');
  433. if(data && data.responseText){
  434. try {
  435. var json = $.parseJSON(data.responseText);
  436. error += json.message;
  437. } catch (err) {}
  438. }
  439. App.showAlertPopup(Em.I18n.t('services.service.actions.run.yarnRefreshQueues.error'), error);
  440. },
  441. startLdapKnox: function(event) {
  442. var context = Em.I18n.t('services.service.actions.run.startLdapKnox.context');
  443. this.startStopLdapKnox('STARTDEMOLDAP',context);
  444. },
  445. stopLdapKnox: function(event) {
  446. var context = Em.I18n.t('services.service.actions.run.stopLdapKnox.context');
  447. this.startStopLdapKnox('STOPDEMOLDAP',context);
  448. },
  449. startStopLdapKnox: function(command,context) {
  450. var controller = this;
  451. var host = App.HostComponent.find().findProperty('componentName', 'KNOX_GATEWAY').get('hostName');
  452. return App.showConfirmationPopup(function() {
  453. App.ajax.send({
  454. name: 'service.item.startStopLdapKnox',
  455. sender: controller,
  456. data: {
  457. command: command,
  458. context: context,
  459. host: host,
  460. serviceName: "KNOX",
  461. componentName: "KNOX_GATEWAY"
  462. },
  463. success: 'startStopLdapKnoxSuccessCallback',
  464. error: 'startStopLdapKnoxErrorCallback'
  465. });
  466. });
  467. },
  468. startStopLdapKnoxSuccessCallback : function(data, ajaxOptions, params) {
  469. if (data.Requests.id) {
  470. App.router.get('backgroundOperationsController').showPopup();
  471. }
  472. },
  473. startStopLdapKnoxErrorCallback : function(data) {
  474. var error = Em.I18n.t('services.service.actions.run.startStopLdapKnox.error');
  475. if(data && data.responseText){
  476. try {
  477. var json = $.parseJSON(data.responseText);
  478. error += json.message;
  479. } catch (err) {}
  480. }
  481. App.showAlertPopup(Em.I18n.t('services.service.actions.run.yarnRefreshQueues.error'), error);
  482. },
  483. /**
  484. * On click handler for rebalance Hdfs command from items menu
  485. */
  486. rebalanceHdfsNodes: function () {
  487. var controller = this;
  488. App.ModalPopup.show({
  489. classNames: ['fourty-percent-width-modal'],
  490. header: Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.context'),
  491. primary: Em.I18n.t('common.start'),
  492. secondary: Em.I18n.t('common.cancel'),
  493. inputValue: 10,
  494. errorMessage: Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.promptError'),
  495. isInvalid: function () {
  496. var intValue = Number(this.get('inputValue'));
  497. return this.get('inputValue')!=='DEBUG' && (isNaN(intValue) || intValue < 1 || intValue > 100);
  498. }.property('inputValue'),
  499. disablePrimary: Em.computed.alias('isInvalid'),
  500. onPrimary: function () {
  501. if (this.get('isInvalid')) {
  502. return;
  503. }
  504. App.ajax.send({
  505. name : 'service.item.rebalanceHdfsNodes',
  506. sender: controller,
  507. data : {
  508. hosts : App.Service.find('HDFS').get('hostComponents').findProperty('componentName', 'NAMENODE').get('hostName'),
  509. threshold: this.get('inputValue')
  510. },
  511. success : 'rebalanceHdfsNodesSuccessCallback',
  512. error : 'rebalanceHdfsNodesErrorCallback'
  513. });
  514. this.hide();
  515. },
  516. bodyClass: Ember.View.extend({
  517. templateName: require('templates/common/modal_popups/prompt_popup'),
  518. text: Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.prompt'),
  519. didInsertElement: function () {
  520. App.tooltip(this.$(".prompt-input"), {
  521. placement: "bottom",
  522. title: Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.promptTooltip')
  523. });
  524. }
  525. })
  526. });
  527. },
  528. rebalanceHdfsNodesSuccessCallback: function (data) {
  529. if (data.Requests.id) {
  530. App.router.get('backgroundOperationsController').showPopup();
  531. }
  532. },
  533. rebalanceHdfsNodesErrorCallback : function(data) {
  534. var error = Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.error');
  535. if(data && data.responseText){
  536. try {
  537. var json = $.parseJSON(data.responseText);
  538. error += json.message;
  539. } catch (err) {
  540. }
  541. }
  542. App.showAlertPopup(Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.error'), error);
  543. },
  544. /**
  545. * On click callback for <code>run compaction</code> button
  546. * @param event
  547. */
  548. runCompaction: function (event) {
  549. var self = this;
  550. return App.showConfirmationPopup(function() {
  551. self.set("content.runCompaction", true);
  552. // load data (if we need to show this background operations popup) from persist
  553. App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
  554. if (initValue) {
  555. App.router.get('backgroundOperationsController').showPopup();
  556. }
  557. });
  558. });
  559. },
  560. /**
  561. * On click callback for <code>run smoke test</code> button
  562. * @param event
  563. */
  564. runSmokeTest: function (event) {
  565. var self = this;
  566. if (this.get('content.serviceName') === 'MAPREDUCE2' && !App.Service.find('YARN').get('isStarted')) {
  567. return App.showAlertPopup(Em.I18n.t('common.error'), Em.I18n.t('services.mapreduce2.smokeTest.requirement'));
  568. }
  569. return App.showConfirmationFeedBackPopup(function(query) {
  570. self.runSmokeTestPrimary(query);
  571. });
  572. },
  573. restartAllHostComponents : function(serviceName) {
  574. var serviceDisplayName = this.get('content.displayName');
  575. var bodyMessage = Em.Object.create({
  576. putInMaintenance: this.get('content.passiveState') === 'OFF',
  577. turnOnMmMsg: Em.I18n.t('passiveState.turnOnFor').format(serviceDisplayName),
  578. confirmMsg: Em.I18n.t('services.service.restartAll.confirmMsg').format(serviceDisplayName),
  579. confirmButton: Em.I18n.t('services.service.restartAll.confirmButton'),
  580. additionalWarningMsg: this.get('content.passiveState') === 'OFF' ? Em.I18n.t('services.service.restartAll.warningMsg.turnOnMM').format(serviceDisplayName): null
  581. });
  582. // check HDFS NameNode checkpoint before stop service
  583. if (this.get('content.serviceName') == 'HDFS' &&
  584. this.get('content.hostComponents').filterProperty('componentName', 'NAMENODE').someProperty('workStatus', App.HostComponentStatus.started)) {
  585. this.checkNnLastCheckpointTime(function () {
  586. return App.showConfirmationFeedBackPopup(function(query, runMmOperation) {
  587. batchUtils.restartAllServiceHostComponents(serviceDisplayName, serviceName, false, query, runMmOperation);
  588. }, bodyMessage);
  589. });
  590. } else {
  591. return App.showConfirmationFeedBackPopup(function(query, runMmOperation) {
  592. batchUtils.restartAllServiceHostComponents(serviceDisplayName, serviceName, false, query, runMmOperation);
  593. }, bodyMessage);
  594. }
  595. },
  596. turnOnOffPassive: function(label) {
  597. var self = this;
  598. var state = this.get('content.passiveState') == 'OFF' ? 'ON' : 'OFF';
  599. var onOff = state === 'ON' ? "On" : "Off";
  600. return App.showConfirmationPopup(function() {
  601. batchUtils.turnOnOffPassiveRequest(state, label, self.get('content.serviceName').toUpperCase(), function(data, opt, params) {
  602. self.set('content.passiveState', params.passive_state);
  603. batchUtils.infoPassiveState(params.passive_state);})
  604. },
  605. Em.I18n.t('hosts.passiveMode.popup').format(onOff,self.get('content.displayName'))
  606. );
  607. },
  608. rollingRestart: function(hostComponentName) {
  609. batchUtils.launchHostComponentRollingRestart(hostComponentName, this.get('content.displayName'), this.get('content.passiveState') === "ON", false, this.get('content.passiveState') === "ON");
  610. },
  611. runSmokeTestPrimary: function(query) {
  612. var clusterLevelRequired = ['KERBEROS'];
  613. var requestData = {
  614. 'serviceName': this.get('content.serviceName'),
  615. 'displayName': this.get('content.displayName'),
  616. 'actionName': this.get('content.serviceName') === 'ZOOKEEPER' ? 'ZOOKEEPER_QUORUM_SERVICE_CHECK' : this.get('content.serviceName') + '_SERVICE_CHECK',
  617. 'query': query
  618. };
  619. if (clusterLevelRequired.contains(this.get('content.serviceName'))) {
  620. requestData.operationLevel = {
  621. "level": "CLUSTER",
  622. "cluster_name": App.get('clusterName')
  623. };
  624. }
  625. App.ajax.send({
  626. 'name': 'service.item.smoke',
  627. 'sender': this,
  628. 'success':'runSmokeTestSuccessCallBack',
  629. 'error':'runSmokeTestErrorCallBack',
  630. 'data': requestData
  631. });
  632. },
  633. runSmokeTestSuccessCallBack: function (data, ajaxOptions, params) {
  634. if (data.Requests.id) {
  635. // load data (if we need to show this background operations popup) from persist
  636. App.router.get('userSettingsController').dataLoading('show_bg').done(function (initValue) {
  637. params.query.set('status', 'SUCCESS');
  638. if (initValue) {
  639. App.router.get('backgroundOperationsController').showPopup();
  640. }
  641. });
  642. }
  643. else {
  644. params.query.set('status', 'FAIL');
  645. }
  646. },
  647. runSmokeTestErrorCallBack: function (request, ajaxOptions, error, opt, params) {
  648. params.query.set('status', 'FAIL');
  649. },
  650. /**
  651. * On click callback for <code>Reassign <master component></code> button
  652. * @param hostComponent
  653. */
  654. reassignMaster: function (hostComponent) {
  655. var component = App.HostComponent.find().findProperty('componentName', hostComponent);
  656. if (component) {
  657. var reassignMasterController = App.router.get('reassignMasterController');
  658. reassignMasterController.saveComponentToReassign(component);
  659. reassignMasterController.setCurrentStep('1');
  660. App.router.transitionTo('reassign');
  661. }
  662. },
  663. /**
  664. * On click callback for <code>action</code> dropdown menu
  665. * Calls runSmokeTest, runRebalancer, runCompaction or reassignMaster depending on context
  666. * @param event
  667. */
  668. doAction: function (event) {
  669. if ($(event.target).hasClass('disabled') || $(event.target.parentElement).hasClass('disabled')) {
  670. return;
  671. }
  672. var methodName = event.context.action;
  673. var context = event.context.context;
  674. if (methodName) {
  675. this[methodName](context);
  676. }
  677. },
  678. /**
  679. * Restart clients host components to apply config changes
  680. */
  681. refreshConfigs: function () {
  682. var self = this;
  683. if (this.get('isClientsOnlyService') || this.get('content.serviceName') == "FLUME") {
  684. return App.showConfirmationFeedBackPopup(function (query) {
  685. batchUtils.getComponentsFromServer({
  686. services: [self.get('content.serviceName')]
  687. }, function (data) {
  688. var hostComponents = [];
  689. data.items.forEach(function (host) {
  690. host.host_components.forEach(function (hostComponent) {
  691. hostComponents.push(Em.Object.create({
  692. componentName: hostComponent.HostRoles.component_name,
  693. hostName: host.Hosts.host_name
  694. }))
  695. });
  696. });
  697. batchUtils.restartHostComponents(hostComponents, Em.I18n.t('rollingrestart.context.allForSelectedService').format(self.get('content.serviceName')), "SERVICE", query);
  698. })
  699. });
  700. }
  701. },
  702. /**
  703. * Send command to server to install client on selected host
  704. * @param componentName
  705. */
  706. addComponent: function (componentName) {
  707. var self = this;
  708. var component = App.StackServiceComponent.find().findProperty('componentName', componentName);
  709. var componentDisplayName = component.get('displayName');
  710. App.get('router.mainAdminKerberosController').getKDCSessionState(function () {
  711. return App.ModalPopup.show({
  712. primary: Em.computed.ifThenElse('anyHostsWithoutComponent', Em.I18n.t('hosts.host.addComponent.popup.confirm'), undefined),
  713. header: Em.I18n.t('popup.confirmation.commonHeader'),
  714. addComponentMsg: Em.I18n.t('hosts.host.addComponent.msg').format(componentDisplayName),
  715. selectHostMsg: Em.computed.i18nFormat('services.summary.selectHostForComponent', 'componentDisplayName'),
  716. thereIsNoHostsMsg: Em.computed.i18nFormat('services.summary.allHostsAlreadyRunComponent', 'componentDisplayName'),
  717. hostsWithoutComponent: function () {
  718. var hostsWithComponent = App.HostComponent.find().filterProperty('componentName', componentName).mapProperty('hostName');
  719. var result = App.get('allHostNames');
  720. hostsWithComponent.forEach(function (host) {
  721. result = result.without(host);
  722. });
  723. return result;
  724. }.property(),
  725. anyHostsWithoutComponent: Em.computed.gt('hostsWithoutComponent.length', 0),
  726. selectedHost: null,
  727. componentName: componentName,
  728. componentDisplayName: componentDisplayName,
  729. bodyClass: Em.View.extend({
  730. templateName: require('templates/main/service/add_host_popup')
  731. }),
  732. onPrimary: function () {
  733. var selectedHost = this.get('selectedHost');
  734. // Install
  735. if (['HIVE_METASTORE', 'RANGER_KMS_SERVER', 'NIMBUS'].contains(component.get('componentName')) && !!selectedHost) {
  736. App.router.get('mainHostDetailsController').addComponentWithCheck(
  737. {
  738. context: component,
  739. selectedHost: selectedHost
  740. }
  741. );
  742. } else {
  743. self.installHostComponentCall(selectedHost, component);
  744. }
  745. this.hide();
  746. }
  747. });
  748. });
  749. },
  750. /**
  751. * set property isPending (if this property is true - means that service has task in BGO)
  752. * and this makes start/stop button disabled
  753. */
  754. setStartStopState: function () {
  755. var serviceName = this.get('content.serviceName');
  756. var backgroundOperations = App.router.get('backgroundOperationsController.services');
  757. if (backgroundOperations && backgroundOperations.length > 0) {
  758. for (var i = 0; i < backgroundOperations.length; i++) {
  759. if (backgroundOperations[i].isRunning &&
  760. (backgroundOperations[i].dependentService === "ALL_SERVICES" ||
  761. backgroundOperations[i].dependentService === serviceName)) {
  762. this.set('isPending', true);
  763. return;
  764. }
  765. }
  766. this.set('isPending', false);
  767. } else {
  768. this.set('isPending', true);
  769. }
  770. }.observes('App.router.backgroundOperationsController.serviceTimestamp'),
  771. isStartDisabled: function () {
  772. if(this.get('isPending')) return true;
  773. return !(this.get('content.healthStatus') == 'red');
  774. }.property('content.healthStatus','isPending'),
  775. isStopDisabled: function () {
  776. if(this.get('isPending')) return true;
  777. if (App.get('isHaEnabled') && this.get('content.serviceName') == 'HDFS' && this.get('content.hostComponents').filterProperty('componentName', 'NAMENODE').someProperty('workStatus', App.HostComponentStatus.started)) {
  778. return false;
  779. }
  780. return (this.get('content.healthStatus') != 'green');
  781. }.property('content.healthStatus','isPending', 'App.isHaEnabled'),
  782. /**
  783. * Determine if service has than one service client components
  784. */
  785. isSeveralClients: function () {
  786. return App.StackServiceComponent.find().filterProperty('serviceName', this.get('content.serviceName')).filterProperty('isClient').length > 1;
  787. }.property('content.serviceName'),
  788. enableHighAvailability: function() {
  789. var highAvailabilityController = App.router.get('mainAdminHighAvailabilityController');
  790. highAvailabilityController.enableHighAvailability();
  791. },
  792. disableHighAvailability: function() {
  793. var highAvailabilityController = App.router.get('mainAdminHighAvailabilityController');
  794. highAvailabilityController.disableHighAvailability();
  795. },
  796. enableRMHighAvailability: function() {
  797. var highAvailabilityController = App.router.get('mainAdminHighAvailabilityController');
  798. highAvailabilityController.enableRMHighAvailability();
  799. },
  800. addHawqStandby: function() {
  801. var highAvailabilityController = App.router.get('mainAdminHighAvailabilityController');
  802. highAvailabilityController.addHawqStandby();
  803. },
  804. activateHawqStandby: function() {
  805. var highAvailabilityController = App.router.get('mainAdminHighAvailabilityController');
  806. highAvailabilityController.activateHawqStandby();
  807. },
  808. enableRAHighAvailability: function() {
  809. var highAvailabilityController = App.router.get('mainAdminHighAvailabilityController');
  810. highAvailabilityController.enableRAHighAvailability();
  811. },
  812. downloadClientConfigs: function (event) {
  813. var component = this.get('content.clientComponents').rejectProperty('totalCount', 0)[0];
  814. this.downloadClientConfigsCall({
  815. serviceName: this.get('content.serviceName'),
  816. componentName: (event && event.name) || component.get('componentName'),
  817. displayName: (event && event.label) || component.get('displayName')
  818. });
  819. },
  820. /**
  821. * On click handler for custom hawq command from items menu
  822. * @param context
  823. */
  824. executeHawqCustomCommand: function(context) {
  825. var controller = this;
  826. return App.showConfirmationPopup(function() {
  827. App.ajax.send({
  828. name : 'service.item.executeCustomCommand',
  829. sender: controller,
  830. data : {
  831. command : context.command,
  832. context : context.label,
  833. hosts : App.Service.find(context.service).get('hostComponents').findProperty('componentName', context.component).get('hostName'),
  834. serviceName : context.service,
  835. componentName : context.component
  836. },
  837. success : 'executeCustomCommandSuccessCallback',
  838. error : 'executeCustomCommandErrorCallback'
  839. });
  840. });
  841. },
  842. /**
  843. * On click handler for custom command from items menu
  844. * @param context
  845. */
  846. executeCustomCommand: function(context) {
  847. var controller = this;
  848. return App.showConfirmationPopup(function() {
  849. App.ajax.send({
  850. name : 'service.item.executeCustomCommand',
  851. sender: controller,
  852. data : {
  853. command : context.command,
  854. context : 'Execute ' + context.command,
  855. hosts : App.Service.find(context.service).get('hostComponents').findProperty('componentName', context.component).get('hostName'),
  856. serviceName : context.service,
  857. componentName : context.component,
  858. forceRefreshConfigTags : "capacity-scheduler"
  859. },
  860. success : 'executeCustomCommandSuccessCallback',
  861. error : 'executeCustomCommandErrorCallback'
  862. });
  863. });
  864. },
  865. executeCustomCommandSuccessCallback : function(data, ajaxOptions, params) {
  866. if (data.Requests.id) {
  867. App.router.get('backgroundOperationsController').showPopup();
  868. }
  869. },
  870. executeCustomCommandErrorCallback : function(data) {
  871. var error = Em.I18n.t('services.service.actions.run.executeCustomCommand.error');
  872. if(data && data.responseText){
  873. try {
  874. var json = $.parseJSON(data.responseText);
  875. error += json.message;
  876. } catch (err) {}
  877. }
  878. App.showAlertPopup(Em.I18n.t('services.service.actions.run.executeCustomCommand.error'), error);
  879. },
  880. /**
  881. * Returns interdependent services
  882. *
  883. * @param serviceName
  884. * @returns {string[]}
  885. */
  886. interDependentServices: function(serviceName) {
  887. var interDependentServices = [];
  888. App.StackService.find(serviceName).get('requiredServices').forEach(function(requiredService) {
  889. if (App.StackService.find(requiredService).get('requiredServices').contains(serviceName)) {
  890. interDependentServices.push(requiredService);
  891. }
  892. });
  893. return interDependentServices;
  894. },
  895. /**
  896. * find dependent services
  897. * @param {string[]} serviceNamesToDelete
  898. * @returns {Array}
  899. */
  900. findDependentServices: function (serviceNamesToDelete) {
  901. var dependentServices = [];
  902. App.Service.find().forEach(function (service) {
  903. if (!serviceNamesToDelete.contains(service.get('serviceName'))) {
  904. var requiredServices = App.StackService.find(service.get('serviceName')).get('requiredServices');
  905. serviceNamesToDelete.forEach(function (dependsOnService) {
  906. if (requiredServices.contains(dependsOnService)) {
  907. dependentServices.push(service.get('serviceName'));
  908. }
  909. });
  910. }
  911. }, this);
  912. return dependentServices;
  913. },
  914. /**
  915. * @param serviceNames
  916. * @returns {string}
  917. */
  918. servicesDisplayNames: function(serviceNames) {
  919. return serviceNames.map(function(serviceName) {
  920. return App.format.role(serviceName);
  921. }).join(',');
  922. },
  923. /**
  924. * Is services can be removed based on work status
  925. * @param serviceNames
  926. */
  927. allowUninstallServices: function(serviceNames) {
  928. return !App.Service.find().filter(function (service) {
  929. return serviceNames.contains(service.get('serviceName'));
  930. }).mapProperty('workStatus').some(function (workStatus) {
  931. return !App.Service.allowUninstallStates.contains(workStatus);
  932. });
  933. },
  934. /**
  935. * delete service action
  936. * @param {string} serviceName
  937. */
  938. deleteService: function(serviceName) {
  939. var self = this,
  940. interDependentServices = this.interDependentServices(serviceName),
  941. serviceNamesToDelete = interDependentServices.concat(serviceName),
  942. dependentServices = this.findDependentServices(serviceNamesToDelete),
  943. displayName = App.format.role(serviceName),
  944. popupHeader = Em.I18n.t('services.service.delete.popup.header'),
  945. dependentServicesToDeleteFmt = this.servicesDisplayNames(interDependentServices);
  946. if (App.Service.find().get('length') === 1) {
  947. //at least one service should be installed
  948. App.ModalPopup.show({
  949. secondary: null,
  950. header: popupHeader,
  951. encodeBody: false,
  952. body: Em.I18n.t('services.service.delete.lastService.popup.body').format(displayName)
  953. });
  954. } else if (dependentServices.length > 0) {
  955. this.dependentServicesWarning(serviceName, dependentServices);
  956. } else if (this.allowUninstallServices(serviceNamesToDelete)) {
  957. App.showConfirmationPopup(
  958. function() {self.confirmDeleteService(serviceName, interDependentServices, dependentServicesToDeleteFmt)},
  959. Em.I18n.t('services.service.delete.popup.warning').format(displayName) +
  960. (interDependentServices.length ? Em.I18n.t('services.service.delete.popup.warning.dependent').format(dependentServicesToDeleteFmt) : ''),
  961. null,
  962. popupHeader,
  963. Em.I18n.t('common.delete'),
  964. true
  965. );
  966. } else {
  967. var body = Em.I18n.t('services.service.delete.popup.mustBeStopped').format(displayName);
  968. if (interDependentServices.length) {
  969. body += Em.I18n.t('services.service.delete.popup.mustBeStopped.dependent').format(dependentServicesToDeleteFmt)
  970. }
  971. App.ModalPopup.show({
  972. secondary: null,
  973. header: popupHeader,
  974. encodeBody: false,
  975. body: body
  976. });
  977. }
  978. },
  979. /**
  980. * warning that show dependent services which must be deleted prior to chosen service deletion
  981. * @param {string} origin
  982. * @param {Array.<string>} dependent
  983. * @returns {App.ModalPopup}
  984. */
  985. dependentServicesWarning: function(origin, dependent) {
  986. var body = Em.I18n.t('services.service.delete.popup.dependentServices').format(App.format.role(origin));
  987. body += '<ul>';
  988. dependent.forEach(function(serviceName) {
  989. body += '<li>' + App.format.role(serviceName) + '</li>';
  990. });
  991. body += '</ul>';
  992. return App.ModalPopup.show({
  993. secondary: null,
  994. header: Em.I18n.t('services.service.delete.popup.header'),
  995. bodyClass: Em.View.extend({
  996. template: Em.Handlebars.compile(body)
  997. })
  998. });
  999. },
  1000. /**
  1001. * Confirmation popup of service deletion
  1002. * @param {string} serviceName
  1003. * @param {string[]} [dependentServiceNames]
  1004. * @param {string} [servicesToDeleteFmt]
  1005. */
  1006. confirmDeleteService: function (serviceName, dependentServiceNames, servicesToDeleteFmt) {
  1007. var message = dependentServiceNames && dependentServiceNames.length
  1008. ? Em.I18n.t('services.service.confirmDelete.popup.body.dependent').format(App.format.role(serviceName), servicesToDeleteFmt)
  1009. : Em.I18n.t('services.service.confirmDelete.popup.body').format(App.format.role(serviceName)),
  1010. confirmKey = 'yes',
  1011. self = this;
  1012. App.ModalPopup.show({
  1013. /**
  1014. * @function onPrimary
  1015. */
  1016. onPrimary: function() {
  1017. self.deleteServiceCall([serviceName].concat(dependentServiceNames));
  1018. this._super();
  1019. },
  1020. /**
  1021. * @type {string}
  1022. */
  1023. primary: Em.I18n.t('common.delete'),
  1024. /**
  1025. * @type {string}
  1026. */
  1027. primaryClass: 'btn-danger',
  1028. /**
  1029. * @type {string}
  1030. */
  1031. header: Em.I18n.t('services.service.confirmDelete.popup.header'),
  1032. /**
  1033. * @type {string}
  1034. */
  1035. confirmInput: '',
  1036. /**
  1037. * @type {boolean}
  1038. */
  1039. disablePrimary: Em.computed.notEqual('confirmInput', confirmKey),
  1040. /**
  1041. * @type {Em.View}
  1042. */
  1043. bodyClass: Em.View.extend({
  1044. confirmKey: confirmKey,
  1045. template: Em.Handlebars.compile(message +
  1046. '<div class="form-inline align-center"></br>' +
  1047. '<label><b>{{t common.enter}}&nbsp;{{view.confirmKey}}</b></label>&nbsp;' +
  1048. '{{view Ember.TextField valueBinding="view.parentView.confirmInput" class="input-small"}}</br>' +
  1049. '</div>')
  1050. }),
  1051. enterKeyPressed: function(e) {
  1052. if (this.get('disablePrimary')) return;
  1053. this.onPrimary();
  1054. }
  1055. });
  1056. },
  1057. /**
  1058. * Ajax call to delete service
  1059. * @param {string[]} serviceNames
  1060. * @returns {$.ajax}
  1061. */
  1062. deleteServiceCall: function(serviceNames) {
  1063. var serviceToDeleteNow = serviceNames[0];
  1064. if (serviceNames.length > 1) {
  1065. var servicesToDeleteNext = serviceNames.slice(1);
  1066. }
  1067. return App.ajax.send({
  1068. name : 'common.delete.service',
  1069. sender: this,
  1070. data : {
  1071. serviceName : serviceToDeleteNow,
  1072. servicesToDeleteNext: servicesToDeleteNext
  1073. },
  1074. success : 'deleteServiceCallSuccessCallback',
  1075. error: 'deleteServiceCallErrorCallback'
  1076. });
  1077. },
  1078. deleteServiceCallSuccessCallback: function(data, ajaxOptions, params) {
  1079. if (params.servicesToDeleteNext) {
  1080. this.deleteServiceCall(params.servicesToDeleteNext);
  1081. } else {
  1082. window.location.reload();
  1083. }
  1084. },
  1085. deleteServiceCallErrorCallback: function (jqXHR, ajaxOptions, error, opt) {
  1086. App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.method, jqXHR.status);
  1087. }
  1088. });