batch_scheduled_requests.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with this
  4. * work for additional information regarding copyright ownership. The ASF
  5. * licenses this file to you under the Apache License, Version 2.0 (the
  6. * "License"); you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. * License for the specific language governing permissions and limitations under
  15. * the License.
  16. */
  17. var App = require('app');
  18. /**
  19. * Default success callback for ajax-requests in this module
  20. * @type {Function}
  21. */
  22. var defaultSuccessCallback = function(data, ajaxOptions, params) {
  23. App.router.get('userSettingsController').dataLoading('show_bg').done(function(initValue) {
  24. params.query && params.query.set('status', 'SUCCESS');
  25. if (initValue) {
  26. App.router.get('backgroundOperationsController').showPopup();
  27. }
  28. });
  29. };
  30. /**
  31. * Default error callback for ajax-requests in this module
  32. * @param {Object} xhr
  33. * @param {String} textStatus
  34. * @param {String} error
  35. * @param {Object} opt
  36. * @param {Object} params
  37. * @type {Function}
  38. */
  39. var defaultErrorCallback = function(xhr, textStatus, error, opt, params) {
  40. params.query && params.query.set('status', 'FAIL');
  41. App.ajax.defaultErrorHandler(xhr, opt.url, 'POST', xhr.status);
  42. };
  43. /**
  44. * Contains helpful utilities for handling batch and scheduled requests.
  45. */
  46. module.exports = {
  47. /**
  48. * Some services have components which have a need for rolling restarts. This
  49. * method returns the name of the host-component which supports rolling
  50. * restarts for a service.
  51. * @param {String} serviceName
  52. */
  53. getRollingRestartComponentName: function(serviceName) {
  54. var rollingRestartComponents = {
  55. HDFS: 'DATANODE',
  56. YARN: 'NODEMANAGER',
  57. HBASE: 'HBASE_REGIONSERVER',
  58. STORM: 'SUPERVISOR'
  59. };
  60. return rollingRestartComponents[serviceName] ? rollingRestartComponents[serviceName] : null;
  61. },
  62. /**
  63. * Facade-function for restarting host components of specific service
  64. * @param {String} serviceDisplayName for which service hostComponents should be restarted
  65. * @param {String} serviceName for which service hostComponents should be restarted
  66. * @param {bool} staleConfigsOnly restart only hostComponents with <code>staleConfig</code> true
  67. * @param {Object} query
  68. * @param {bool} runMmOperation
  69. */
  70. restartAllServiceHostComponents: function(serviceDisplayName, serviceName, staleConfigsOnly, query, runMmOperation) {
  71. var self = this;
  72. var context = staleConfigsOnly ?
  73. Em.I18n.t('rollingrestart.context.allWithStaleConfigsForSelectedService').format(serviceDisplayName) :
  74. Em.I18n.t('rollingrestart.context.allForSelectedService').format(serviceDisplayName);
  75. if (runMmOperation) {
  76. this.turnOnOffPassiveRequest('ON', Em.I18n.t('passiveState.turnOnFor').format(serviceName), serviceName);
  77. }
  78. this.getComponentsFromServer({
  79. services: [serviceName],
  80. staleConfigs: staleConfigsOnly ? staleConfigsOnly : null,
  81. passiveState: 'OFF',
  82. displayParams: ['host_components/HostRoles/component_name']
  83. }, function (data) {
  84. var hostComponents = [];
  85. data.items.forEach(function (host) {
  86. host.host_components.forEach(function (hostComponent) {
  87. hostComponents.push(Em.Object.create({
  88. componentName: hostComponent.HostRoles.component_name,
  89. hostName: host.Hosts.host_name
  90. }))
  91. });
  92. });
  93. self.restartHostComponents(hostComponents, context, "SERVICE", query);
  94. });
  95. },
  96. /**
  97. * construct URL from parameters for request in <code>getComponentsFromServer()</code>
  98. * @param {object} options
  99. * @return {{fields: string, params: string}}
  100. */
  101. constructComponentsCallUrl: function (options) {
  102. var multipleValueParams = {
  103. 'services': 'host_components/HostRoles/service_name.in(<entity-names>)',
  104. 'hosts': 'Hosts/host_name.in(<entity-names>)',
  105. 'components': 'host_components/HostRoles/component_name.in(<entity-names>)'
  106. },
  107. singleValueParams = {
  108. staleConfigs: 'host_components/HostRoles/stale_configs=',
  109. passiveState: 'Hosts/maintenance_state=',
  110. workStatus: 'host_components/HostRoles/state='
  111. },
  112. displayParams = options.displayParams || [],
  113. urlParams = '',
  114. addAmpersand = false;
  115. for (var i in multipleValueParams) {
  116. var arrayParams = options[i];
  117. if (Array.isArray(arrayParams) && arrayParams.length > 0) {
  118. if (addAmpersand) {
  119. urlParams += '&';
  120. addAmpersand = false;
  121. }
  122. urlParams += multipleValueParams[i].replace('<entity-names>', arrayParams.join(','));
  123. addAmpersand = true;
  124. }
  125. }
  126. for (var j in singleValueParams) {
  127. var param = options[j];
  128. if (!Em.isNone(param)) {
  129. urlParams += (addAmpersand) ? '&' : '';
  130. urlParams += singleValueParams[j] + param.toString();
  131. addAmpersand = true;
  132. }
  133. }
  134. var params = urlParams,
  135. fields = '';
  136. displayParams.forEach(function (displayParam, index, array) {
  137. if (index === 0) {
  138. fields += (addAmpersand) ? '&' : '';
  139. fields += 'fields=';
  140. }
  141. fields += displayParam;
  142. fields += (array.length === (index + 1)) ? '' : ",";
  143. });
  144. fields += '&minimal_response=true';
  145. return {fields: fields.substring(1, fields.length), params: params};
  146. },
  147. /**
  148. * make GET call to server in order to obtain host-components
  149. * which correspond to filter params from <code>options</code>
  150. * @param options
  151. * @param callback
  152. */
  153. getComponentsFromServer: function (options, callback) {
  154. var request_parameters = this.constructComponentsCallUrl(options);
  155. return App.ajax.send({
  156. name: 'host.host_components.filtered',
  157. sender: this,
  158. data: {
  159. parameters: request_parameters.params,
  160. fields: request_parameters.fields,
  161. callback: callback
  162. },
  163. success: 'getComponentsFromServerSuccessCallback'
  164. });
  165. },
  166. /**
  167. * pass request outcome to <code>callback()<code>
  168. * @param data
  169. * @param opt
  170. * @param params
  171. */
  172. getComponentsFromServerSuccessCallback: function (data, opt, params) {
  173. params.callback(data);
  174. },
  175. /**
  176. * Restart list of host components
  177. * @param {Ember.Enumerable} hostComponentsList list of host components should be restarted
  178. * @param {String} context message to show in BG popup
  179. * @param {String} level - operation level, can be ("CLUSTER", "SERVICE", "HOST", "HOSTCOMPONENT")
  180. * @param {String} query
  181. */
  182. restartHostComponents: function (hostComponentsList, context, level, query) {
  183. context = context || Em.I18n.t('rollingrestart.context.default');
  184. /**
  185. * Format: {
  186. * 'DATANODE': ['host1', 'host2'],
  187. * 'NAMENODE': ['host1', 'host3']
  188. * ...
  189. * }
  190. */
  191. var componentToHostsMap = {};
  192. var hosts = [];
  193. var batches, refreshYARNQueues = false;
  194. hostComponentsList.forEach(function(hc) {
  195. var hostName = hc.get('hostName');
  196. var componentName = hc.get('componentName');
  197. if (componentName === 'HIVE_SERVER_INTERACTIVE') {
  198. refreshYARNQueues = true;
  199. }
  200. if (!componentToHostsMap[componentName]) {
  201. componentToHostsMap[componentName] = [];
  202. }
  203. componentToHostsMap[componentName].push(hostName);
  204. hosts.push(hostName);
  205. });
  206. var resource_filters = [];
  207. for (var componentName in componentToHostsMap) {
  208. if (componentToHostsMap.hasOwnProperty(componentName)) {
  209. resource_filters.push({
  210. service_name: App.StackServiceComponent.find(componentName).get('serviceName'),
  211. component_name: componentName,
  212. hosts: componentToHostsMap[componentName].join(",")
  213. });
  214. }
  215. }
  216. if (hostComponentsList.length > 0) {
  217. var serviceComponentName = hostComponentsList[0].get("componentName");
  218. var serviceName = App.StackServiceComponent.find(serviceComponentName).get('serviceName');
  219. var operation_level = this.getOperationLevelObject(level, serviceName,
  220. serviceComponentName);
  221. }
  222. if (resource_filters.length) {
  223. if (refreshYARNQueues) {
  224. batches = [
  225. {
  226. "order_id": 1,
  227. "type": "POST",
  228. "uri": App.apiPrefix + "/clusters/" + App.get('clusterName') + "/requests",
  229. "RequestBodyInfo": {
  230. "RequestInfo": {
  231. "context": "Refresh YARN Capacity Scheduler",
  232. "command": "REFRESHQUEUES",
  233. "parameters/forceRefreshConfigTags": "capacity-scheduler"
  234. },
  235. "Requests/resource_filters": [{
  236. "service_name": "YARN",
  237. "component_name": "RESOURCEMANAGER",
  238. "hosts": App.HostComponent.find().findProperty('componentName', 'RESOURCEMANAGER').get('hostName')
  239. }]
  240. }
  241. },
  242. {
  243. "order_id": 2,
  244. "type": "POST",
  245. "uri": App.apiPrefix + "/clusters/" + App.get('clusterName') + "/requests",
  246. "RequestBodyInfo": {
  247. "RequestInfo": {
  248. "context": context,
  249. "command": "RESTART",
  250. "operation_level": operation_level
  251. },
  252. "Requests/resource_filters": resource_filters
  253. }
  254. }
  255. ];
  256. App.ajax.send({
  257. name: 'common.batch.request_schedules',
  258. sender: {
  259. successCallback: defaultSuccessCallback,
  260. errorCallback: defaultErrorCallback
  261. },
  262. data: {
  263. intervalTimeSeconds: 1,
  264. tolerateSize: 0,
  265. batches: batches,
  266. query: query
  267. },
  268. success: 'successCallback',
  269. error: 'errorCallback'
  270. });
  271. } else {
  272. App.ajax.send({
  273. name: 'restart.hostComponents',
  274. sender: {
  275. successCallback: defaultSuccessCallback,
  276. errorCallback: defaultErrorCallback
  277. },
  278. data: {
  279. context: context,
  280. resource_filters: resource_filters,
  281. query: query,
  282. operation_level: operation_level
  283. },
  284. success: 'successCallback',
  285. error: 'errorCallback'
  286. });
  287. }
  288. }
  289. },
  290. /**
  291. * @param {String} level - operation level name, can be ("CLUSTER", "SERVICE", "HOST", "HOSTCOMPONENT")
  292. * @param {String} serviceName
  293. * @param {String} componentName
  294. * @returns {Object} {{level: *, cluster_name: *}} - operation level object
  295. * @method getOperationLevelObject - create operation level object to be included into ajax query
  296. */
  297. getOperationLevelObject: function(level, serviceName, componentName) {
  298. var operationLevel = {
  299. "level": level,
  300. "cluster_name": App.get("clusterName")
  301. };
  302. if (level === "SERVICE") {
  303. operationLevel["service_name"] = serviceName;
  304. }
  305. else {
  306. if (level !== "HOST") {
  307. operationLevel["service_name"] = serviceName;
  308. operationLevel["hostcomponent_name"] = componentName;
  309. }
  310. }
  311. return operationLevel;
  312. },
  313. turnOnOffPassiveRequest: function(state, message, serviceName, callback) {
  314. return App.ajax.send({
  315. 'name': 'common.service.passive',
  316. 'sender': {
  317. 'successCallback': callback || defaultSuccessCallback,
  318. 'errorCallback': defaultErrorCallback
  319. },
  320. 'data': {
  321. 'requestInfo': message,
  322. 'serviceName': serviceName,
  323. 'passive_state': state
  324. },
  325. 'success': 'successCallback'
  326. });
  327. },
  328. /**
  329. * Makes a REST call to the server requesting the rolling restart of the
  330. * provided host components.
  331. * @param {Array} restartHostComponents list of host components should be restarted
  332. * @param {Number} batchSize size of each batch
  333. * @param {Number} intervalTimeSeconds delay between two batches
  334. * @param {Number} tolerateSize task failure tolerance
  335. * @param {callback} [successCallback]
  336. * @param {callback} [errorCallback]
  337. */
  338. _doPostBatchRollingRestartRequest: function(restartHostComponents, batchSize, intervalTimeSeconds, tolerateSize, successCallback, errorCallback) {
  339. successCallback = successCallback || defaultSuccessCallback;
  340. errorCallback = errorCallback || defaultErrorCallback;
  341. if (!restartHostComponents.length) {
  342. return;
  343. }
  344. return App.ajax.send({
  345. name: 'common.batch.request_schedules',
  346. sender: {
  347. successCallback: successCallback,
  348. errorCallback: errorCallback
  349. },
  350. data: {
  351. intervalTimeSeconds: intervalTimeSeconds,
  352. tolerateSize: tolerateSize,
  353. batches: this.getBatchesForRollingRestartRequest(restartHostComponents, batchSize)
  354. },
  355. success: 'successCallback',
  356. error: 'errorCallback'
  357. });
  358. },
  359. /**
  360. * Create list of batches for rolling restart request
  361. * @param {Array} restartHostComponents list host components should be restarted
  362. * @param {Number} batchSize size of each batch
  363. * @returns {Array} list of batches
  364. */
  365. getBatchesForRollingRestartRequest: function(restartHostComponents, batchSize) {
  366. var hostIndex = 0,
  367. batches = [],
  368. batchCount = Math.ceil(restartHostComponents.length / batchSize),
  369. sampleHostComponent = restartHostComponents.objectAt(0),
  370. componentName = sampleHostComponent.get('componentName'),
  371. serviceName = sampleHostComponent.get('serviceName');
  372. for ( var count = 0; count < batchCount; count++) {
  373. var hostNames = [];
  374. for ( var hc = 0; hc < batchSize && hostIndex < restartHostComponents.length; hc++) {
  375. hostNames.push(restartHostComponents.objectAt(hostIndex++).get('hostName'));
  376. }
  377. if (hostNames.length) {
  378. batches.push({
  379. "order_id" : count + 1,
  380. "type" : "POST",
  381. "uri" : App.apiPrefix + "/clusters/" + App.get('clusterName') + "/requests",
  382. "RequestBodyInfo" : {
  383. "RequestInfo" : {
  384. "context" : "_PARSE_.ROLLING-RESTART." + componentName + "." + (count + 1) + "." + batchCount,
  385. "command" : "RESTART"
  386. },
  387. "Requests/resource_filters": [{
  388. "service_name" : serviceName,
  389. "component_name" : componentName,
  390. "hosts" : hostNames.join(",")
  391. }]
  392. }
  393. });
  394. }
  395. }
  396. return batches;
  397. },
  398. /**
  399. * Launches dialog to handle rolling restarts of host components.
  400. *
  401. * Rolling restart is supported only for components listed in <code>getRollingRestartComponentName</code>
  402. * @see getRollingRestartComponentName
  403. * @param {String} hostComponentName
  404. * Type of host-component to restart across cluster
  405. * (ex: DATANODE)
  406. * @param {bool} staleConfigsOnly
  407. * Pre-select host-components which have stale
  408. * configurations
  409. */
  410. launchHostComponentRollingRestart: function(hostComponentName, serviceName, isMaintenanceModeOn, staleConfigsOnly, skipMaintenance) {
  411. if (App.get('components.rollinRestartAllowed').contains(hostComponentName)) {
  412. return this.showRollingRestartPopup(hostComponentName, serviceName, isMaintenanceModeOn, staleConfigsOnly, null, skipMaintenance);
  413. }
  414. return this.showWarningRollingRestartPopup(hostComponentName);
  415. },
  416. /**
  417. * Show popup with rolling restart dialog
  418. * @param {String} hostComponentName name of the host components that should be restarted
  419. * @param {String} serviceName
  420. * @param {boolean} isMaintenanceModeOn
  421. * @param {bool} staleConfigsOnly restart only components with <code>staleConfigs</code> = true
  422. * @param {App.hostComponent[]} [hostComponents] list of hostComponents that should be restarted
  423. * @param {boolean} [skipMaintenance]
  424. * Using this parameter will reset hostComponentName
  425. */
  426. showRollingRestartPopup: function(hostComponentName, serviceName, isMaintenanceModeOn, staleConfigsOnly, hostComponents, skipMaintenance) {
  427. hostComponents = hostComponents || [];
  428. var componentDisplayName = App.format.role(hostComponentName, false);
  429. var self = this;
  430. if (!componentDisplayName) {
  431. componentDisplayName = hostComponentName;
  432. }
  433. var title = Em.I18n.t('rollingrestart.dialog.title').format(componentDisplayName);
  434. var viewExtend = {
  435. turnOnMmMsg: Em.I18n.t('passiveState.turnOnFor').format(serviceName),
  436. turnOnMm: false,
  437. staleConfigsOnly : staleConfigsOnly,
  438. hostComponentName : hostComponentName,
  439. skipMaintenance: skipMaintenance,
  440. serviceName: serviceName,
  441. isServiceInMM: isMaintenanceModeOn,
  442. didInsertElement: function () {
  443. var view = this;
  444. this.set('parentView.innerView', this);
  445. if (hostComponents.length) {
  446. view.initialize();
  447. return;
  448. }
  449. self.getComponentsFromServer({
  450. components: [hostComponentName],
  451. displayParams: ['host_components/HostRoles/stale_configs', 'Hosts/maintenance_state', 'host_components/HostRoles/maintenance_state'],
  452. staleConfigs: staleConfigsOnly ? staleConfigsOnly : null
  453. }, function (data) {
  454. var wrappedHostComponents = [];
  455. data.items.forEach(function (host) {
  456. host.host_components.forEach(function(hostComponent) {
  457. wrappedHostComponents.push(Em.Object.create({
  458. componentName: hostComponent.HostRoles.component_name,
  459. serviceName: App.StackServiceComponent.find(hostComponent.HostRoles.component_name).get('serviceName'),
  460. hostName: host.Hosts.host_name,
  461. staleConfigs: hostComponent.HostRoles.stale_configs,
  462. hostPassiveState: host.Hosts.maintenance_state,
  463. passiveState: hostComponent.HostRoles.maintenance_state
  464. }));
  465. });
  466. });
  467. view.set('allHostComponents', wrappedHostComponents);
  468. view.initialize();
  469. });
  470. }
  471. };
  472. if (hostComponents.length) {
  473. viewExtend.allHostComponents = hostComponents;
  474. }
  475. App.ModalPopup.show({
  476. header : title,
  477. hostComponentName : hostComponentName,
  478. serviceName: serviceName,
  479. isServiceInMM: isMaintenanceModeOn,
  480. staleConfigsOnly : staleConfigsOnly,
  481. skipMaintenance: skipMaintenance,
  482. innerView : null,
  483. bodyClass : App.RollingRestartView.extend(viewExtend),
  484. classNames : [ 'rolling-restart-popup' ],
  485. primary : Em.I18n.t('rollingrestart.dialog.primary'),
  486. onPrimary : function() {
  487. var dialog = this;
  488. var restartComponents = this.get('innerView.restartHostComponents');
  489. var batchSize = this.get('innerView.batchSize');
  490. var waitTime = this.get('innerView.interBatchWaitTimeSeconds');
  491. var tolerateSize = this.get('innerView.tolerateSize');
  492. if (this.get('innerView.turnOnMm')) {
  493. self.turnOnOffPassiveRequest('ON', Em.I18n.t('passiveState.turnOnFor').format(serviceName), serviceName.toUpperCase());
  494. }
  495. self._doPostBatchRollingRestartRequest(restartComponents, batchSize, waitTime, tolerateSize, function(data, ajaxOptions, params) {
  496. dialog.hide();
  497. defaultSuccessCallback(data, ajaxOptions, params);
  498. });
  499. },
  500. updateButtons : function() {
  501. var errors = this.get('innerView.errors');
  502. this.set('disablePrimary', (errors != null && errors.length > 0))
  503. }.observes('innerView.errors')
  504. });
  505. },
  506. /**
  507. * Show warning popup about not supported host components
  508. * @param {String} hostComponentName
  509. */
  510. showWarningRollingRestartPopup: function(hostComponentName) {
  511. var componentDisplayName = App.format.role(hostComponentName, false) || hostComponentName;
  512. var title = Em.I18n.t('rollingrestart.dialog.title').format(componentDisplayName);
  513. var msg = Em.I18n.t('rollingrestart.notsupported.hostComponent').format(componentDisplayName);
  514. return App.ModalPopup.show({
  515. header : title,
  516. secondary : false,
  517. msg : msg,
  518. bodyClass : Em.View.extend({
  519. template : Em.Handlebars.compile('<div class="alert alert-warning">{{msg}}</div>')
  520. })
  521. });
  522. },
  523. /**
  524. * Warn user that alerts will be updated in few minutes
  525. * @param {String} passiveState
  526. */
  527. infoPassiveState: function(passiveState) {
  528. var enabled = passiveState == 'OFF' ? 'enabled' : 'suppressed';
  529. App.ModalPopup.show({
  530. header: Em.I18n.t('common.information'),
  531. secondary: null,
  532. bodyClass: Em.View.extend({
  533. template: Em.Handlebars.compile('<p>{{view.message}}</p>'),
  534. message: Em.I18n.t('hostPopup.warning.alertsTimeOut').format(passiveState.toLowerCase(), enabled)
  535. })
  536. });
  537. },
  538. /**
  539. * Retrieves the latest information about a specific request schedule
  540. * identified by 'requestScheduleId'
  541. *
  542. * @param {Number} requestScheduleId ID of the request schedule to get
  543. * @param {Function} successCallback Called with request_schedule data from server. An
  544. * empty object returned for invalid ID.
  545. * @param {Function} errorCallback Optional error callback. Default behavior is to
  546. * popup default error dialog.
  547. */
  548. getRequestSchedule: function(requestScheduleId, successCallback, errorCallback) {
  549. if (requestScheduleId != null && !isNaN(requestScheduleId) && requestScheduleId > -1) {
  550. errorCallback = errorCallback || defaultErrorCallback;
  551. App.ajax.send({
  552. name : 'request_schedule.get',
  553. sender : {
  554. successCallbackFunction: successCallback,
  555. errorCallbackFunction: errorCallback
  556. },
  557. data : {
  558. request_schedule_id : requestScheduleId
  559. },
  560. success : 'successCallbackFunction',
  561. error : 'errorCallbackFunction'
  562. });
  563. } else {
  564. successCallback({});
  565. }
  566. },
  567. /**
  568. * Attempts to abort a specific request schedule identified by 'requestScheduleId'
  569. *
  570. * @param {Number} requestScheduleId ID of the request schedule to get
  571. * @param {Function} successCallback Called when request schedule successfully aborted
  572. * @param {Function} errorCallback Optional error callback. Default behavior is to
  573. * popup default error dialog.
  574. */
  575. doAbortRequestSchedule: function(requestScheduleId, successCallback, errorCallback) {
  576. if (requestScheduleId != null && !isNaN(requestScheduleId) && requestScheduleId > -1) {
  577. errorCallback = errorCallback || defaultErrorCallback;
  578. App.ajax.send({
  579. name : 'common.delete.request_schedule',
  580. sender : {
  581. successCallbackFunction: successCallback,
  582. errorCallbackFunction: errorCallback
  583. },
  584. data : {
  585. request_schedule_id : requestScheduleId
  586. },
  587. success : 'successCallbackFunction',
  588. error : 'errorCallbackFunction'
  589. });
  590. } else {
  591. successCallback({});
  592. }
  593. }
  594. };