wizard.js 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307
  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. require('models/host');
  20. App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingMixin, {
  21. isStepDisabled: null,
  22. previousStep: 0,
  23. /**
  24. * map of actions which load data required by which step
  25. * used by <code>loadAllPriorSteps</code>
  26. */
  27. loadMap: {},
  28. /**
  29. * Wizard properties in local storage, which should be cleaned right after wizard has been finished
  30. */
  31. dbPropertiesToClean: [
  32. 'service',
  33. 'hosts',
  34. 'masterComponentHosts',
  35. 'slaveComponentHosts',
  36. 'cluster',
  37. 'allHostNames',
  38. 'installOptions',
  39. 'allHostNamesPattern',
  40. 'serviceComponents'
  41. ],
  42. init: function () {
  43. this.clusters = App.Cluster.find();
  44. this.setIsStepDisabled();
  45. },
  46. /**
  47. * Set <code>isStepDisabled</code> with list of available steps (basing on <code>totalSteps</code>)
  48. * @method setIsStepDisabled
  49. */
  50. setIsStepDisabled: function () {
  51. this.set('isStepDisabled', []);
  52. this.get('isStepDisabled').pushObject(Em.Object.create({
  53. step: 1,
  54. value: false
  55. }));
  56. for (var i = 2; i <= this.get('totalSteps'); i++) {
  57. this.get('isStepDisabled').pushObject(Em.Object.create({
  58. step: i,
  59. value: true
  60. }));
  61. }
  62. },
  63. slaveComponents: function () {
  64. return App.StackServiceComponent.find().filterProperty('isSlave', true);
  65. }.property('App.router.clusterController.isLoaded'),
  66. allHosts: function () {
  67. var dbHosts = this.get('content.hosts');
  68. var hosts = [];
  69. var hostComponents = [];
  70. for (var hostName in dbHosts) {
  71. hostComponents = [];
  72. var disksOverallCapacity = 0;
  73. var diskFree = 0;
  74. dbHosts[hostName].hostComponents.forEach(function (componentName) {
  75. hostComponents.push(Em.Object.create({
  76. componentName: componentName,
  77. displayName: App.format.role(componentName)
  78. }));
  79. });
  80. dbHosts[hostName].disk_info.forEach(function (disk) {
  81. disksOverallCapacity += parseFloat(disk.size);
  82. diskFree += parseFloat(disk.available);
  83. });
  84. hosts.push(Em.Object.create({
  85. id: hostName,
  86. hostName: hostName,
  87. publicHostName: hostName,
  88. diskInfo: dbHosts[hostName].disk_info,
  89. diskTotal: disksOverallCapacity / (1024 * 1024),
  90. diskFree: diskFree / (1024 * 1024),
  91. disksMounted: dbHosts[hostName].disk_info.length,
  92. cpu: dbHosts[hostName].cpu,
  93. memory: dbHosts[hostName].memory,
  94. osType: dbHosts[hostName].osType ? dbHosts[hostName].osType: 0,
  95. osArch: dbHosts[hostName].osArch ? dbHosts[hostName].osArch : 0,
  96. ip: dbHosts[hostName].ip ? dbHosts[hostName].ip: 0,
  97. hostComponents: hostComponents
  98. }))
  99. }
  100. return hosts;
  101. }.property('content.hosts'),
  102. setStepsEnable: function () {
  103. for (var i = 1; i <= this.totalSteps; i++) {
  104. var step = this.get('isStepDisabled').findProperty('step', i);
  105. if (i <= this.get('currentStep')) {
  106. step.set('value', false);
  107. } else {
  108. step.set('value', true);
  109. }
  110. }
  111. }.observes('currentStep'),
  112. /**
  113. * Enable step link in left nav menu
  114. * @param step - step number
  115. */
  116. enableStep: function (step) {
  117. this.get('isStepDisabled').findProperty('step', step).set('value', false);
  118. },
  119. setLowerStepsDisable: function (stepNo) {
  120. for (var i = 1; i < stepNo; i++) {
  121. var step = this.get('isStepDisabled').findProperty('step', i);
  122. step.set('value', true);
  123. }
  124. },
  125. /**
  126. * Set current step to new value.
  127. * Method moved from App.router.setInstallerCurrentStep
  128. * @param currentStep
  129. * @param completed
  130. */
  131. currentStep: function () {
  132. return App.get('router').getWizardCurrentStep(this.get('name').substr(0, this.get('name').length - 10));
  133. }.property(),
  134. /**
  135. * Set current step to new value.
  136. * Method moved from App.router.setInstallerCurrentStep
  137. * @param currentStep
  138. * @param completed
  139. */
  140. setCurrentStep: function (currentStep, completed) {
  141. this.set('previousStep', this.get('currentStep'));
  142. App.db.setWizardCurrentStep(this.get('name').substr(0, this.get('name').length - 10), currentStep, completed);
  143. this.set('currentStep', currentStep);
  144. },
  145. clusters: null,
  146. isStep0: function () {
  147. return this.get('currentStep') == 0;
  148. }.property('currentStep'),
  149. isStep1: function () {
  150. return this.get('currentStep') == 1;
  151. }.property('currentStep'),
  152. isStep2: function () {
  153. return this.get('currentStep') == 2;
  154. }.property('currentStep'),
  155. isStep3: function () {
  156. return this.get('currentStep') == 3;
  157. }.property('currentStep'),
  158. isStep4: function () {
  159. return this.get('currentStep') == 4;
  160. }.property('currentStep'),
  161. isStep5: function () {
  162. return this.get('currentStep') == 5;
  163. }.property('currentStep'),
  164. isStep6: function () {
  165. return this.get('currentStep') == 6;
  166. }.property('currentStep'),
  167. isStep7: function () {
  168. return this.get('currentStep') == 7;
  169. }.property('currentStep'),
  170. isStep8: function () {
  171. return this.get('currentStep') == 8;
  172. }.property('currentStep'),
  173. isStep9: function () {
  174. return this.get('currentStep') == 9;
  175. }.property('currentStep'),
  176. isStep10: function () {
  177. return this.get('currentStep') == 10;
  178. }.property('currentStep'),
  179. gotoStep: function (step, disableNaviWarning) {
  180. if (this.get('isStepDisabled').findProperty('step', step).get('value') !== false) {
  181. return false;
  182. }
  183. // if going back from Step 9 in Install Wizard, delete the checkpoint so that the user is not redirected
  184. // to Step 9
  185. if (this.get('content.controllerName') == 'installerController' && this.get('currentStep') === '9' && step < 9) {
  186. App.clusterStatus.setClusterStatus({
  187. clusterName: this.get('clusterName'),
  188. clusterState: 'CLUSTER_NOT_CREATED_1',
  189. wizardControllerName: 'installerController',
  190. localdb: {}
  191. });
  192. }
  193. if ((this.get('currentStep') - step) > 1 && !disableNaviWarning) {
  194. App.ModalPopup.show({
  195. header: Em.I18n.t('installer.navigation.warning.header'),
  196. onPrimary: function () {
  197. App.router.send('gotoStep' + step);
  198. this.hide();
  199. },
  200. body: "If you proceed to go back to Step " + step + ", you will lose any changes you have made beyond this step"
  201. });
  202. } else {
  203. App.router.send('gotoStep' + step);
  204. }
  205. return true;
  206. },
  207. gotoStep0: function () {
  208. this.gotoStep(0);
  209. },
  210. gotoStep1: function () {
  211. this.gotoStep(1);
  212. },
  213. gotoStep2: function () {
  214. this.gotoStep(2);
  215. },
  216. gotoStep3: function () {
  217. this.gotoStep(3);
  218. },
  219. gotoStep4: function () {
  220. this.gotoStep(4);
  221. },
  222. gotoStep5: function () {
  223. this.gotoStep(5);
  224. },
  225. gotoStep6: function () {
  226. this.gotoStep(6);
  227. },
  228. gotoStep7: function () {
  229. this.gotoStep(7);
  230. },
  231. gotoStep8: function () {
  232. this.gotoStep(8);
  233. },
  234. gotoStep9: function () {
  235. this.gotoStep(9);
  236. },
  237. gotoStep10: function () {
  238. this.gotoStep(10);
  239. },
  240. /**
  241. * Initialize host status info for step9
  242. */
  243. setInfoForStep9: function () {
  244. var hostInfo = this.getDBProperty('hosts');
  245. for (var index in hostInfo) {
  246. hostInfo[index].status = "pending";
  247. hostInfo[index].message = 'Waiting';
  248. hostInfo[index].logTasks = [];
  249. hostInfo[index].tasks = [];
  250. hostInfo[index].progress = '0';
  251. }
  252. this.setDBProperty('hosts', hostInfo);
  253. },
  254. /**
  255. * Remove all data for installOptions step
  256. */
  257. clearInstallOptions: function () {
  258. var installOptions = this.getInstallOptions();
  259. this.set('content.installOptions', installOptions);
  260. this.setDBProperty('installOptions', installOptions);
  261. this.set('content.hosts', {});
  262. this.setDBProperty('hosts', {});
  263. },
  264. toObject: function (object) {
  265. var result = {};
  266. for (var i in object) {
  267. if (object.hasOwnProperty(i)) {
  268. result[i] = object[i];
  269. }
  270. }
  271. return result;
  272. },
  273. /**
  274. * Convert any object or array to pure JS instance without inherit properties
  275. * It is used to convert Ember.Object to pure JS Object and Ember.Array to pure JS Array
  276. * @param originalInstance
  277. * @returns {*}
  278. */
  279. toJSInstance: function (originalInstance) {
  280. var convertedInstance = originalInstance;
  281. if (Em.isArray(originalInstance)) {
  282. convertedInstance = [];
  283. originalInstance.forEach(function (element) {
  284. convertedInstance.push(this.toJSInstance(element));
  285. }, this)
  286. } else if (originalInstance && typeof originalInstance === 'object') {
  287. convertedInstance = {};
  288. for (var property in originalInstance) {
  289. if (originalInstance.hasOwnProperty(property)) {
  290. convertedInstance[property] = this.toJSInstance(originalInstance[property]);
  291. }
  292. }
  293. }
  294. return convertedInstance
  295. },
  296. /**
  297. * save status of the cluster. This is called from step8 and step9 to persist install and start requestId
  298. * @param clusterStatus object with status, isCompleted, requestId, isInstallError and isStartError field.
  299. */
  300. saveClusterStatus: function (clusterStatus) {
  301. var oldStatus = this.toObject(this.get('content.cluster'));
  302. clusterStatus = jQuery.extend(oldStatus, clusterStatus);
  303. if (clusterStatus.requestId &&
  304. clusterStatus.oldRequestsId.indexOf(clusterStatus.requestId) === -1) {
  305. clusterStatus.oldRequestsId.push(clusterStatus.requestId);
  306. }
  307. this.set('content.cluster', clusterStatus);
  308. this.setDBProperty('cluster', clusterStatus);
  309. },
  310. /**
  311. * Invoke installation of selected services to the server and saves the request id returned by the server.
  312. * @param isRetry
  313. */
  314. installServices: function (isRetry, callback) {
  315. // clear requests since we are installing services
  316. // and we don't want to get tasks for previous install attempts
  317. this.set('content.cluster.oldRequestsId', []);
  318. var data;
  319. callback = callback || Em.K;
  320. if (isRetry) {
  321. data = {
  322. context: Em.I18n.t('requestInfo.installComponents'),
  323. HostRoles: {"state": "INSTALLED"},
  324. urlParams: "HostRoles/desired_state=INSTALLED"
  325. };
  326. } else {
  327. data = {
  328. context: Em.I18n.t('requestInfo.installServices'),
  329. ServiceInfo: {"state": "INSTALLED"},
  330. urlParams: "ServiceInfo/state=INIT"
  331. };
  332. }
  333. var clusterStatus = {
  334. status: 'PENDING'
  335. };
  336. this.saveClusterStatus(clusterStatus);
  337. App.ajax.send({
  338. name: isRetry ? 'common.host_components.update' : 'common.services.update',
  339. sender: this,
  340. data: data,
  341. success: 'installServicesSuccessCallback',
  342. error: 'installServicesErrorCallback'
  343. }).then(callback, callback);
  344. },
  345. installServicesSuccessCallback: function (jsonData) {
  346. var installStartTime = App.dateTime();
  347. console.log("TRACE: In success function for the installService call");
  348. if (jsonData) {
  349. var requestId = jsonData.Requests.id;
  350. console.log('requestId is: ' + requestId);
  351. var clusterStatus = {
  352. status: 'PENDING',
  353. requestId: requestId,
  354. isInstallError: false,
  355. isCompleted: false,
  356. installStartTime: installStartTime
  357. };
  358. this.saveClusterStatus(clusterStatus);
  359. } else {
  360. console.log('ERROR: Error occurred in parsing JSON data');
  361. }
  362. },
  363. installServicesErrorCallback: function (request, ajaxOptions, error) {
  364. console.log("TRACE: In error function for the installService call");
  365. console.log("TRACE: error code status is: " + request.status);
  366. console.log('Error message is: ' + request.responseText);
  367. var clusterStatus = {
  368. status: 'PENDING',
  369. requestId: this.get('content.cluster.requestId'),
  370. isInstallError: true,
  371. isCompleted: false
  372. };
  373. this.saveClusterStatus(clusterStatus);
  374. App.showAlertPopup(Em.I18n.t('common.errorPopup.header'), request.responseText);
  375. },
  376. /**
  377. * show popup, that display status of bootstrap launching
  378. * @param callback
  379. * @return {Object}
  380. */
  381. showLaunchBootstrapPopup: function (callback) {
  382. return App.ModalPopup.show({
  383. header: Em.I18n.t('installer.step2.bootStrap.header'),
  384. isError: false,
  385. serverError: null,
  386. bodyClass: Em.View.extend({
  387. templateName: require('templates/wizard/bootstrap_call_popup')
  388. }),
  389. showFooter: false,
  390. showCloseButton: false,
  391. secondary: null,
  392. /**
  393. * handle requestId when call is completed,
  394. * if it's correct call callback and hide popup
  395. * otherwise notify error and enable buttons to close popup
  396. * @param requestId
  397. * @param serverError
  398. */
  399. finishLoading: function (requestId, serverError) {
  400. if (Em.isNone(requestId)) {
  401. this.set('isError', true);
  402. this.set('showFooter', true);
  403. this.set('showCloseButton', true);
  404. this.set('serverError', serverError);
  405. } else {
  406. callback(requestId);
  407. this.hide();
  408. }
  409. }
  410. });
  411. },
  412. /**
  413. * Bootstrap selected hosts.
  414. * @param bootStrapData
  415. * @param callback
  416. * @return {Object}
  417. */
  418. launchBootstrap: function (bootStrapData, callback) {
  419. var popup = this.showLaunchBootstrapPopup(callback);
  420. App.ajax.send({
  421. name: 'wizard.launch_bootstrap',
  422. sender: this,
  423. data: {
  424. bootStrapData: bootStrapData,
  425. popup: popup
  426. },
  427. success: 'launchBootstrapSuccessCallback',
  428. error: 'launchBootstrapErrorCallback'
  429. });
  430. return popup;
  431. },
  432. launchBootstrapSuccessCallback: function (data, opt, params) {
  433. console.log("TRACE: POST bootstrap succeeded");
  434. params.popup.finishLoading(data.requestId, null);
  435. },
  436. launchBootstrapErrorCallback: function (request, ajaxOptions, error, opt, params) {
  437. console.log("ERROR: POST bootstrap failed");
  438. params.popup.finishLoading(null, error);
  439. },
  440. /**
  441. * Load <code>content.<name></code> variable from localStorage, if wasn't loaded before.
  442. * If you specify <code>reload</code> to true - it will reload it.
  443. * @param name
  444. * @param reload
  445. * @return {Boolean}
  446. */
  447. load: function (name, reload) {
  448. if (this.get('content.' + name) && !reload) {
  449. return false;
  450. }
  451. var result = this.getDBProperty(name);
  452. if (!result) {
  453. if (this['get' + name.capitalize()]) {
  454. result = this['get' + name.capitalize()]();
  455. this.setDBProperty(name, result);
  456. console.log(this.get('name') + ": created " + name, result);
  457. }
  458. else {
  459. console.debug('get' + name.capitalize(), ' not defined in the ' + this.get('name'));
  460. }
  461. }
  462. this.set('content.' + name, result);
  463. console.log(this.get('name') + ": loaded " + name, result);
  464. },
  465. save: function (name) {
  466. var convertedValue = this.toJSInstance(this.get('content.' + name));
  467. this.setDBProperty(name, convertedValue);
  468. console.log(this.get('name') + ": saved " + name, convertedValue);
  469. },
  470. clear: function () {
  471. this.set('content', Ember.Object.create({
  472. 'controllerName': this.get('content.controllerName')
  473. }));
  474. this.set('currentStep', 0);
  475. this.clearStorageData();
  476. },
  477. clusterStatusTemplate: {
  478. name: "",
  479. status: "PENDING",
  480. isCompleted: false,
  481. requestId: null,
  482. installStartTime: null,
  483. installTime: null,
  484. isInstallError: false,
  485. isStartError: false,
  486. oldRequestsId: []
  487. },
  488. clearStorageData: function () {
  489. this.get('dbPropertiesToClean').forEach(function (key) {
  490. this.setDBProperty(key, undefined);
  491. }, this);
  492. },
  493. getInstallOptions: function() {
  494. return jQuery.extend({}, App.get('isHadoopWindowsStack') ? this.get('installWindowsOptionsTemplate') : this.get('installOptionsTemplate'));
  495. },
  496. installOptionsTemplate: {
  497. hostNames: "", //string
  498. manualInstall: false, //true, false
  499. useSsh: true, //bool
  500. javaHome: App.defaultJavaHome, //string
  501. localRepo: false, //true, false
  502. sshKey: "", //string
  503. bootRequestId: null, //string
  504. sshUser: "root", //string
  505. agentUser: "root" //string
  506. },
  507. installWindowsOptionsTemplate: {
  508. hostNames: "", //string
  509. manualInstall: false, //true, false
  510. useSsh: true, //bool
  511. javaHome: App.defaultJavaHome, //string
  512. localRepo: false, //true, false
  513. sshKey: "", //string
  514. bootRequestId: null, //string
  515. sshUser: "", //string
  516. agentUser: "" //string
  517. },
  518. loadedServiceComponents: null,
  519. /**
  520. * Generate serviceComponents as pr the stack definition and save it to localdata
  521. * called form stepController step4WizardController
  522. */
  523. loadServiceComponents: function () {
  524. return App.ajax.send({
  525. name: 'wizard.service_components',
  526. sender: this,
  527. data: {
  528. stackUrl: App.get('stackVersionURL'),
  529. stackVersion: App.get('currentStackVersionNumber')
  530. },
  531. success: 'loadServiceComponentsSuccessCallback',
  532. error: 'loadServiceComponentsErrorCallback'
  533. });
  534. },
  535. loadServiceComponentsSuccessCallback: function (jsonData) {
  536. var savedSelectedServices = this.getDBProperty('selectedServiceNames');
  537. var savedInstalledServices = this.getDBProperty('installedServiceNames');
  538. this.set('content.selectedServiceNames', savedSelectedServices);
  539. this.set('content.installedServiceNames', savedInstalledServices);
  540. if (!savedSelectedServices) {
  541. jsonData.items.forEach(function (service) {
  542. service.StackServices.is_selected = true;
  543. }, this);
  544. } else {
  545. jsonData.items.forEach(function (service) {
  546. if (savedSelectedServices.contains(service.StackServices.service_name))
  547. service.StackServices.is_selected = true;
  548. else
  549. service.StackServices.is_selected = false;
  550. }, this);
  551. }
  552. if (!savedInstalledServices) {
  553. jsonData.items.forEach(function (service) {
  554. service.StackServices.is_installed = false;
  555. }, this);
  556. } else {
  557. jsonData.items.forEach(function (service) {
  558. if (savedInstalledServices.contains(service.StackServices.service_name))
  559. service.StackServices.is_installed = true;
  560. else
  561. service.StackServices.is_installed = false;
  562. }, this);
  563. }
  564. App.stackServiceMapper.mapStackServices(jsonData);
  565. },
  566. loadServiceComponentsErrorCallback: function (request, ajaxOptions, error) {
  567. console.log("TRACE: STep5 -> In error function for the getServiceComponents call");
  568. console.log("TRACE: STep5 -> error code status is: " + request.status);
  569. console.log('Step8: Error message is: ' + request.responseText);
  570. },
  571. /**
  572. * Load config groups from local DB
  573. */
  574. loadServiceConfigGroups: function () {
  575. var serviceConfigGroups = this.getDBProperty('serviceConfigGroups'),
  576. hosts = this.getDBProperty('hosts'),
  577. host_names = Em.keys(hosts);
  578. if (Em.isNone(serviceConfigGroups)) {
  579. serviceConfigGroups = [];
  580. }
  581. else {
  582. serviceConfigGroups.forEach(function(group) {
  583. var hostNames = group.hosts.map(function(host_id) {
  584. for (var i = 0; i < host_names.length; i++) {
  585. if (hosts[host_names[i]].id === host_id) {
  586. return host_names[i];
  587. }
  588. }
  589. Em.assert('host is missing!!!!', false);
  590. });
  591. Em.set(group, 'hosts', hostNames);
  592. });
  593. }
  594. this.set('content.configGroups', serviceConfigGroups);
  595. console.log("InstallerController.configGroups: loaded config ", serviceConfigGroups);
  596. },
  597. registerErrPopup: function (header, message) {
  598. App.ModalPopup.show({
  599. header: header,
  600. secondary: false,
  601. bodyClass: Ember.View.extend({
  602. template: Ember.Handlebars.compile('<p>{{view.message}}</p>'),
  603. message: message
  604. })
  605. });
  606. },
  607. /**
  608. * Save hosts that the user confirmed to proceed with from step 3
  609. * @param stepController App.WizardStep3Controller
  610. */
  611. saveConfirmedHosts: function (stepController) {
  612. var hosts = this.get('content.hosts'),
  613. indx = 1;
  614. //add previously installed hosts
  615. for (var hostName in hosts) {
  616. if (!hosts[hostName].isInstalled) {
  617. delete hosts[hostName];
  618. }
  619. }
  620. stepController.get('confirmedHosts').forEach(function (_host) {
  621. if (_host.bootStatus == 'REGISTERED') {
  622. hosts[_host.name] = {
  623. name: _host.name,
  624. cpu: _host.cpu,
  625. memory: _host.memory,
  626. disk_info: _host.disk_info,
  627. os_type: _host.os_type,
  628. os_arch: _host.os_arch,
  629. ip: _host.ip,
  630. bootStatus: _host.bootStatus,
  631. isInstalled: false,
  632. id: indx++
  633. };
  634. }
  635. });
  636. console.log('wizardController:saveConfirmedHosts: save hosts ', hosts);
  637. this.setDBProperty('hosts', hosts);
  638. this.set('content.hosts', hosts);
  639. },
  640. /**
  641. * Save data after installation to main controller
  642. * @param stepController App.WizardStep9Controller
  643. */
  644. saveInstalledHosts: function (stepController) {
  645. var hosts = stepController.get('hosts');
  646. var hostInfo = this.getDBProperty('hosts');
  647. for (var index in hostInfo) {
  648. hostInfo[index].status = "pending";
  649. var host = hosts.findProperty('name', hostInfo[index].name);
  650. if (host) {
  651. hostInfo[index].status = host.status;
  652. hostInfo[index].message = host.message;
  653. hostInfo[index].progress = host.progress;
  654. }
  655. }
  656. this.set('content.hosts', hostInfo);
  657. this.setDBProperty('hosts', hostInfo);
  658. console.log('wizardController:saveInstalledHosts: save hosts ', hostInfo);
  659. },
  660. /**
  661. * Save slaveHostComponents to main controller
  662. * @param stepController
  663. */
  664. saveSlaveComponentHosts: function (stepController) {
  665. var hosts = stepController.get('hosts'),
  666. dbHosts = this.getDBProperty('hosts'),
  667. headers = stepController.get('headers');
  668. var formattedHosts = Ember.Object.create();
  669. headers.forEach(function (header) {
  670. formattedHosts.set(header.get('name'), []);
  671. });
  672. hosts.forEach(function (host) {
  673. var checkboxes = host.get('checkboxes');
  674. headers.forEach(function (header) {
  675. var cb = checkboxes.findProperty('title', header.get('label'));
  676. if (cb.get('checked')) {
  677. formattedHosts.get(header.get('name')).push({
  678. group: 'Default',
  679. isInstalled: cb.get('isInstalled'),
  680. host_id: dbHosts[host.hostName].id
  681. });
  682. }
  683. });
  684. });
  685. var slaveComponentHosts = [];
  686. headers.forEach(function (header) {
  687. slaveComponentHosts.push({
  688. componentName: header.get('name'),
  689. displayName: header.get('label').replace(/\s/g, ''),
  690. hosts: formattedHosts.get(header.get('name'))
  691. });
  692. });
  693. this.setDBProperty('slaveComponentHosts', slaveComponentHosts);
  694. console.log('wizardController.slaveComponentHosts: saved hosts', slaveComponentHosts);
  695. this.set('content.slaveComponentHosts', slaveComponentHosts);
  696. },
  697. /**
  698. * Return true if cluster data is loaded and false otherwise.
  699. * This is used for all wizard controllers except for installer wizard.
  700. */
  701. dataLoading: function () {
  702. var dfd = $.Deferred();
  703. this.connectOutlet('loading');
  704. if (App.router.get('clusterController.isLoaded')) {
  705. dfd.resolve();
  706. } else {
  707. var interval = setInterval(function () {
  708. if (App.router.get('clusterController.isLoaded')) {
  709. dfd.resolve();
  710. clearInterval(interval);
  711. }
  712. }, 50);
  713. }
  714. return dfd.promise();
  715. },
  716. /**
  717. * Return true if user data is loaded via App.MainServiceInfoConfigsController
  718. * This function is used in reassign master wizard right now.
  719. */
  720. usersLoading: function () {
  721. var self = this;
  722. var dfd = $.Deferred();
  723. var miscController = App.MainAdminServiceAccountsController.create({content: self.get('content')});
  724. miscController.loadUsers();
  725. var interval = setInterval(function () {
  726. if (miscController.get('dataIsLoaded')) {
  727. if (self.get("content.hdfsUser")) {
  728. self.set('content.hdfsUser', miscController.get('content.hdfsUser'));
  729. }
  730. dfd.resolve();
  731. clearInterval(interval);
  732. }
  733. }, 10);
  734. return dfd.promise();
  735. },
  736. /**
  737. * Save cluster status before going to deploy step
  738. * @param name cluster state. Unique for every wizard
  739. */
  740. saveClusterState: function (name) {
  741. App.clusterStatus.setClusterStatus({
  742. clusterName: this.get('content.cluster.name'),
  743. clusterState: name,
  744. wizardControllerName: this.get('content.controllerName'),
  745. localdb: App.db.data
  746. });
  747. },
  748. /**
  749. * Load serviceConfigProperties to model
  750. */
  751. loadServiceConfigProperties: function () {
  752. var serviceConfigProperties = this.getDBProperty('serviceConfigProperties');
  753. this.set('content.serviceConfigProperties', serviceConfigProperties);
  754. console.log("AddHostController.loadServiceConfigProperties: loaded config ", serviceConfigProperties);
  755. },
  756. /**
  757. * Save config properties
  758. * @param stepController Step7WizardController
  759. */
  760. saveServiceConfigProperties: function (stepController) {
  761. var serviceConfigProperties = [];
  762. var fileNamesToUpdate = [];
  763. stepController.get('stepConfigs').forEach(function (_content) {
  764. if (_content.serviceName === 'YARN') {
  765. _content.set('configs', App.config.textareaIntoFileConfigs(_content.get('configs'), 'capacity-scheduler.xml'));
  766. }
  767. _content.get('configs').forEach(function (_configProperties) {
  768. var configProperty = {
  769. id: _configProperties.get('id'),
  770. name: _configProperties.get('name'),
  771. displayName: _configProperties.get('displayName'),
  772. value: _configProperties.get('value'),
  773. savedValue: _configProperties.get('savedValue'),
  774. recommendedValue: _configProperties.get('recommendedValue'),
  775. description: _configProperties.get('description'),
  776. serviceName: _configProperties.get('serviceName'),
  777. domain: _configProperties.get('domain'),
  778. isVisible: _configProperties.get('isVisible'),
  779. isFinal: _configProperties.get('isFinal'),
  780. recommendedIsFinal: _configProperties.get('isFinal'),
  781. supportsFinal: _configProperties.get('supportsFinal'),
  782. filename: _configProperties.get('filename'),
  783. displayType: _configProperties.get('displayType'),
  784. isRequiredByAgent: _configProperties.get('isRequiredByAgent'),
  785. hasInitialValue: !!_configProperties.get('hasInitialValue'),
  786. isRequired: _configProperties.get('isRequired'), // flag that allow saving property with empty value
  787. group: !!_configProperties.get('group') ? _configProperties.get('group.name') : null,
  788. showLabel: _configProperties.get('showLabel'),
  789. category: _configProperties.get('category'),
  790. configId: App.config.configId(_configProperties.get('name'),_configProperties.get('filename'))
  791. };
  792. serviceConfigProperties.push(configProperty);
  793. }, this);
  794. // check for configs that need to update for installed services
  795. if (stepController.get('installedServiceNames') && stepController.get('installedServiceNames').contains(_content.get('serviceName'))) {
  796. // get only modified configs
  797. var configs = _content.get('configs').filter(function (config) {
  798. if (config.get('isNotDefaultValue') || (config.get('savedValue') === null)) {
  799. var notAllowed = ['masterHost', 'masterHosts', 'slaveHosts', 'slaveHost'];
  800. return !notAllowed.contains(config.get('displayType')) && !!config.filename;
  801. }
  802. return false;
  803. });
  804. // if modified configs detected push all service's configs for update
  805. if (configs.length) {
  806. fileNamesToUpdate = fileNamesToUpdate.concat(configs.mapProperty('filename').uniq());
  807. }
  808. }
  809. }, this);
  810. this.setDBProperty('serviceConfigProperties', serviceConfigProperties);
  811. this.set('content.serviceConfigProperties', serviceConfigProperties);
  812. this.setDBProperty('fileNamesToUpdate', fileNamesToUpdate);
  813. },
  814. /**
  815. * save Config groups
  816. * @param stepController
  817. * @param isAddService
  818. */
  819. saveServiceConfigGroups: function (stepController, isAddService) {
  820. var serviceConfigGroups = [],
  821. isForInstalledService = false,
  822. hosts = isAddService ? App.router.get('addServiceController').getDBProperty('hosts') : this.getDBProperty('hosts');
  823. stepController.get('stepConfigs').forEach(function (service) {
  824. // mark group of installed service
  825. if (service.get('selected') === false) isForInstalledService = true;
  826. service.get('configGroups').forEach(function (configGroup) {
  827. var properties = [];
  828. configGroup.get('properties').forEach(function (property) {
  829. properties.push({
  830. isRequiredByAgent: property.get('isRequiredByAgent'),
  831. name: property.get('name'),
  832. value: property.get('value'),
  833. isFinal: property.get('isFinal'),
  834. filename: property.get('filename')
  835. })
  836. });
  837. //configGroup copied into plain JS object to avoid Converting circular structure to JSON
  838. var hostNames = configGroup.get('hosts').map(function(host_name) {return hosts[host_name].id;});
  839. serviceConfigGroups.push({
  840. id: configGroup.get('id'),
  841. name: configGroup.get('name'),
  842. description: configGroup.get('description'),
  843. hosts: hostNames,
  844. properties: properties,
  845. isDefault: configGroup.get('isDefault'),
  846. isForInstalledService: isForInstalledService,
  847. isForUpdate: configGroup.isForUpdate || configGroup.get('hash') != this.getConfigGroupHash(configGroup, hostNames),
  848. service: {id: configGroup.get('service.id')}
  849. });
  850. }, this)
  851. }, this);
  852. this.setDBProperty('serviceConfigGroups', serviceConfigGroups);
  853. this.set('content.configGroups', serviceConfigGroups);
  854. },
  855. /**
  856. * generate string hash for config group
  857. * @param {Object} configGroup
  858. * @param {Array|undefined} hosts
  859. * @returns {String|null}
  860. * @method getConfigGroupHash
  861. */
  862. getConfigGroupHash: function(configGroup, hosts) {
  863. if (!Em.get(configGroup, 'properties.length') && !Em.get(configGroup, 'hosts.length') && !hosts) {
  864. return null;
  865. }
  866. var hash = {};
  867. Em.get(configGroup, 'properties').forEach(function (config) {
  868. hash[Em.get(config, 'name')] = {value: Em.get(config, 'value'), isFinal: Em.get(config, 'isFinal')};
  869. });
  870. hash['hosts'] = hosts || Em.get(configGroup, 'hosts');
  871. return JSON.stringify(hash);
  872. },
  873. /**
  874. * return slaveComponents bound to hosts
  875. * @return {Array}
  876. */
  877. getSlaveComponentHosts: function () {
  878. var components = this.get('slaveComponents');
  879. var result = [];
  880. var installedServices = App.Service.find().mapProperty('serviceName');
  881. var selectedServices = App.StackService.find().filterProperty('isSelected', true).mapProperty('serviceName');
  882. var installedComponentsMap = {};
  883. var uninstalledComponents = [];
  884. components.forEach(function (component) {
  885. if (installedServices.contains(component.get('serviceName'))) {
  886. installedComponentsMap[component.get('componentName')] = [];
  887. } else if (selectedServices.contains(component.get('serviceName'))) {
  888. uninstalledComponents.push(component);
  889. }
  890. }, this);
  891. installedComponentsMap['HDFS_CLIENT'] = [];
  892. App.HostComponent.find().forEach(function (hostComponent) {
  893. if (installedComponentsMap[hostComponent.get('componentName')]) {
  894. installedComponentsMap[hostComponent.get('componentName')].push(hostComponent.get('hostName'));
  895. }
  896. }, this);
  897. for (var componentName in installedComponentsMap) {
  898. var name = (componentName === 'HDFS_CLIENT') ? 'CLIENT' : componentName;
  899. var component = {
  900. componentName: name,
  901. displayName: App.format.role(name),
  902. hosts: [],
  903. isInstalled: true
  904. };
  905. installedComponentsMap[componentName].forEach(function (hostName) {
  906. component.hosts.push({
  907. group: "Default",
  908. hostName: hostName,
  909. isInstalled: true
  910. });
  911. }, this);
  912. result.push(component);
  913. }
  914. uninstalledComponents.forEach(function (component) {
  915. var hosts = jQuery.extend(true, [], result.findProperty('componentName', 'DATANODE').hosts);
  916. hosts.setEach('isInstalled', false);
  917. result.push({
  918. componentName: component.get('componentName'),
  919. displayName: App.format.role(component.get('componentName')),
  920. hosts: hosts,
  921. isInstalled: false
  922. })
  923. });
  924. return result;
  925. },
  926. /**
  927. * Load master component hosts data for using in required step controllers
  928. */
  929. loadMasterComponentHosts: function () {
  930. var masterComponentHosts = this.getDBProperty('masterComponentHosts');
  931. var stackMasterComponents = App.get('components.masters').uniq();
  932. if (!masterComponentHosts) {
  933. masterComponentHosts = [];
  934. App.HostComponent.find().filter(function(component) {
  935. return stackMasterComponents.contains(component.get('componentName'));
  936. }).forEach(function (item) {
  937. masterComponentHosts.push({
  938. component: item.get('componentName'),
  939. hostName: item.get('hostName'),
  940. isInstalled: true,
  941. serviceId: item.get('service.id'),
  942. display_name: item.get('displayName')
  943. })
  944. });
  945. this.setDBProperty('masterComponentHosts', masterComponentHosts);
  946. }
  947. this.set("content.masterComponentHosts", masterComponentHosts);
  948. },
  949. /**
  950. * Save Master Component Hosts data to Main Controller
  951. * @param stepController App.WizardStep5Controller
  952. */
  953. saveMasterComponentHosts: function (stepController) {
  954. var obj = stepController.get('selectedServicesMasters');
  955. var masterComponentHosts = [];
  956. obj.forEach(function (_component) {
  957. masterComponentHosts.push({
  958. display_name: _component.get('display_name'),
  959. component: _component.get('component_name'),
  960. hostName: _component.get('selectedHost'),
  961. serviceId: _component.get('serviceId'),
  962. isInstalled: _component.get('isInstalled')
  963. });
  964. });
  965. this.setDBProperty('masterComponentHosts', masterComponentHosts);
  966. this.set('content.masterComponentHosts', masterComponentHosts);
  967. },
  968. clearMasterComponentHosts: function() {
  969. this.set('content.masterComponentHosts', null);
  970. this.setDBProperty('masterComponentHosts', null);
  971. },
  972. /**
  973. * Load information about hosts with clients components
  974. */
  975. loadClients: function () {
  976. var clients = this.getDBProperty('clientInfo');
  977. this.set('content.clients', clients);
  978. console.log(this.get('content.controllerName') + ".loadClients: loaded list ", clients);
  979. },
  980. /**
  981. * load methods assigned to each step
  982. * methods executed in exact order as they described in map
  983. * @return {object}
  984. */
  985. loadAllPriorSteps: function () {
  986. var currentStep = this.get('currentStep');
  987. var loadMap = this.get('loadMap');
  988. var operationStack = [];
  989. var dfd = $.Deferred();
  990. for (var s in loadMap) {
  991. if (parseInt(s) <= parseInt(currentStep)) {
  992. operationStack.pushObjects(loadMap[s]);
  993. }
  994. }
  995. var sequence = App.actionSequence.create({context: this});
  996. sequence.setSequence(operationStack).onFinish(function () {
  997. dfd.resolve();
  998. }).start();
  999. return dfd.promise();
  1000. },
  1001. /**
  1002. * return new object extended from clusterStatusTemplate
  1003. * @return Object
  1004. */
  1005. getCluster: function () {
  1006. return jQuery.extend({}, this.get('clusterStatusTemplate'), {name: App.router.getClusterName()});
  1007. },
  1008. /**
  1009. * Load services data from server.
  1010. */
  1011. loadServicesFromServer: function () {
  1012. var services = this.getDBProperty('services');
  1013. if (!services) {
  1014. services = {
  1015. selectedServices: [],
  1016. installedServices: []
  1017. };
  1018. App.StackService.find().forEach(function(item){
  1019. var isInstalled = App.Service.find().someProperty('id', item.get('serviceName'));
  1020. item.set('isSelected', isInstalled);
  1021. item.set('isInstalled', isInstalled);
  1022. if (isInstalled) {
  1023. services.selectedServices.push(item.get('serviceName'));
  1024. services.installedServices.push(item.get('serviceName'));
  1025. }
  1026. },this);
  1027. this.setDBProperty('services',services);
  1028. } else {
  1029. App.StackService.find().forEach(function(item) {
  1030. var isSelected = services.selectedServices.contains(item.get('serviceName'));
  1031. var isInstalled = services.installedServices.contains(item.get('serviceName'));
  1032. item.set('isSelected', isSelected);
  1033. item.set('isInstalled', isInstalled);
  1034. },this);
  1035. }
  1036. this.set('content.services', App.StackService.find());
  1037. },
  1038. /**
  1039. * Load confirmed hosts.
  1040. * Will be used at <code>Assign Masters(step5)</code> step
  1041. */
  1042. loadConfirmedHosts: function () {
  1043. var hosts = App.db.getHosts();
  1044. if (hosts) {
  1045. this.set('content.hosts', hosts);
  1046. }
  1047. },
  1048. loadHosts: function () {
  1049. var dfd;
  1050. var hostsInDb = this.getDBProperty('hosts');
  1051. if (hostsInDb) {
  1052. this.set('content.hosts', hostsInDb);
  1053. dfd = $.Deferred();
  1054. dfd.resolve();
  1055. } else {
  1056. dfd = App.ajax.send({
  1057. name: 'hosts.confirmed',
  1058. sender: this,
  1059. data: {},
  1060. success: 'loadHostsSuccessCallback',
  1061. error: 'loadHostsErrorCallback'
  1062. });
  1063. }
  1064. return dfd.promise();
  1065. },
  1066. loadHostsSuccessCallback: function (response) {
  1067. var installedHosts = {};
  1068. response.items.forEach(function (item, indx) {
  1069. installedHosts[item.Hosts.host_name] = {
  1070. name: item.Hosts.host_name,
  1071. cpu: item.Hosts.cpu_count,
  1072. memory: item.Hosts.total_mem,
  1073. disk_info: item.Hosts.disk_info,
  1074. osType: item.Hosts.os_type,
  1075. osArch: item.Hosts.os_arch,
  1076. ip: item.Hosts.ip,
  1077. bootStatus: "REGISTERED",
  1078. isInstalled: true,
  1079. hostComponents: item.host_components,
  1080. id: indx++
  1081. };
  1082. });
  1083. this.setDBProperty('hosts', installedHosts);
  1084. this.set('content.hosts', installedHosts);
  1085. },
  1086. loadHostsErrorCallback: function (jqXHR, ajaxOptions, error, opt) {
  1087. App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.method, jqXHR.status);
  1088. console.log('Loading hosts failed');
  1089. },
  1090. /**
  1091. * Determine if <code>Assign Slaves and Clients</code> step should be skipped
  1092. * @method setSkipSlavesStep
  1093. * @param services
  1094. * @param step
  1095. */
  1096. setSkipSlavesStep: function (services, step) {
  1097. var hasServicesWithSlave = services.someProperty('hasSlave');
  1098. var hasServicesWithClient = services.someProperty('hasClient');
  1099. var hasServicesWithCustomAssignedNonMasters = services.someProperty('hasNonMastersWithCustomAssignment');
  1100. this.set('content.skipSlavesStep', !hasServicesWithSlave && !hasServicesWithClient || !hasServicesWithCustomAssignedNonMasters);
  1101. if (this.get('content.skipSlavesStep')) {
  1102. this.get('isStepDisabled').findProperty('step', step).set('value', this.get('content.skipSlavesStep'));
  1103. }
  1104. },
  1105. /**
  1106. * Load config themes for enhanced config layout.
  1107. *
  1108. * @method loadConfigThemes
  1109. * @return {$.Deferred}
  1110. */
  1111. loadConfigThemes: function () {
  1112. var self = this;
  1113. var dfd = $.Deferred();
  1114. if (App.get('isClusterSupportsEnhancedConfigs') && !this.get('stackConfigsLoaded')) {
  1115. var serviceNames = App.StackService.find().filter(function (s) {
  1116. return s.get('isSelected') || s.get('isInstalled');
  1117. }).mapProperty('serviceName');
  1118. // Load stack configs before loading themes
  1119. App.config.loadClusterConfigsFromStack().always(function() {
  1120. App.config.loadConfigsFromStack(serviceNames).done(function () {
  1121. self.loadConfigThemeForServices(serviceNames).always(function () {
  1122. self.set('stackConfigsLoaded', true);
  1123. App.themesMapper.generateAdvancedTabs(serviceNames);
  1124. dfd.resolve();
  1125. });
  1126. });
  1127. });
  1128. }
  1129. else {
  1130. dfd.resolve();
  1131. this.set('stackConfigsLoaded', true);
  1132. }
  1133. return dfd.promise();
  1134. },
  1135. /**
  1136. * Cache all step config to local storage in name value pairs
  1137. * @param stepController
  1138. */
  1139. cacheStepConfigValues: function(stepController) {
  1140. var stepConfigs = [];
  1141. stepController.get("stepConfigs").forEach(function (category) {
  1142. var configs = category.configs.map(function(config) {
  1143. return {
  1144. name: config.name,
  1145. value: config.value
  1146. };
  1147. });
  1148. stepConfigs = stepConfigs.concat(configs);
  1149. });
  1150. if (stepConfigs.length > 0 ) {
  1151. this.setDBProperty(stepController.name + "-sc", stepConfigs);
  1152. }
  1153. },
  1154. loadCachedStepConfigValues: function(stepController) {
  1155. return this.getDBProperty(stepController.name + "-sc");
  1156. },
  1157. clearCachedStepConfigValues: function(stepController) {
  1158. this.setDBProperty(stepController.name + "-sc", null);
  1159. },
  1160. saveTasksStatuses: function (tasksStatuses) {
  1161. this.set('content.tasksStatuses', tasksStatuses);
  1162. this.setDBProperty('tasksStatuses', tasksStatuses);
  1163. },
  1164. loadTasksStatuses: function() {
  1165. var tasksStatuses = this.getDBProperty('tasksStatuses');
  1166. this.set('content.tasksStatuses', tasksStatuses);
  1167. },
  1168. saveTasksRequestIds: function (tasksRequestIds) {
  1169. this.set('content.tasksRequestIds', tasksRequestIds);
  1170. this.setDBProperty('tasksRequestIds', tasksRequestIds);
  1171. },
  1172. loadTasksRequestIds: function() {
  1173. var tasksRequestIds = this.getDBProperty('tasksRequestIds');
  1174. this.set('content.tasksRequestIds', tasksRequestIds);
  1175. },
  1176. saveRequestIds: function (requestIds) {
  1177. this.set('content.requestIds', requestIds);
  1178. this.setDBProperty('requestIds', requestIds);
  1179. },
  1180. loadRequestIds: function() {
  1181. var requestIds = this.getDBProperty('requestIds');
  1182. this.set('content.requestIds', requestIds);
  1183. }
  1184. });