wizard.js 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312
  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 advanced configs from server
  750. */
  751. loadAdvancedConfigs: function (dependentController) {
  752. var self = this;
  753. var loadServiceConfigsFn = function (clusterProperties) {
  754. var stackServices = self.get('content.services').filter(function (service) {
  755. return service.get('isInstalled') || service.get('isSelected');
  756. });
  757. var loadAdvancedConfigResult = [];
  758. dependentController.set('isAdvancedConfigLoaded', false);
  759. App.config.loadAdvancedConfigAll(stackServices.mapProperty('serviceName'), function (configMap) {
  760. stackServices.forEach(function (service) {
  761. var serviceName = service.get('serviceName');
  762. var properties = configMap[serviceName];
  763. var supportsFinal = App.config.getConfigTypesInfoFromService(service).supportsFinal;
  764. properties.forEach(function (property) {
  765. property.supportsFinal = Boolean(supportsFinal.find(function (configType) {
  766. return property.filename.startsWith(configType);
  767. }));
  768. if (property.serviceName == 'MISC' && property.name == 'yarn_user') {
  769. property.supportsFinal = false;
  770. }
  771. });
  772. loadAdvancedConfigResult.pushObjects(properties);
  773. });
  774. loadAdvancedConfigResult.pushObjects(clusterProperties);
  775. self.set('content.advancedServiceConfig', loadAdvancedConfigResult);
  776. dependentController.set('isAdvancedConfigLoaded', true);
  777. });
  778. };
  779. App.config.loadClusterConfig(loadServiceConfigsFn);
  780. },
  781. /**
  782. * Load serviceConfigProperties to model
  783. */
  784. loadServiceConfigProperties: function () {
  785. var serviceConfigProperties = this.getDBProperty('serviceConfigProperties');
  786. this.set('content.serviceConfigProperties', serviceConfigProperties);
  787. console.log("AddHostController.loadServiceConfigProperties: loaded config ", serviceConfigProperties);
  788. },
  789. /**
  790. * Save config properties
  791. * @param stepController Step7WizardController
  792. */
  793. saveServiceConfigProperties: function (stepController) {
  794. var serviceConfigProperties = [];
  795. var fileNamesToUpdate = [];
  796. stepController.get('stepConfigs').forEach(function (_content) {
  797. if (_content.serviceName === 'YARN') {
  798. _content.set('configs', App.config.textareaIntoFileConfigs(_content.get('configs'), 'capacity-scheduler.xml'));
  799. }
  800. _content.get('configs').forEach(function (_configProperties) {
  801. var configProperty = {
  802. id: _configProperties.get('id'),
  803. name: _configProperties.get('name'),
  804. displayName: _configProperties.get('displayName'),
  805. value: _configProperties.get('value'),
  806. savedValue: _configProperties.get('savedValue'),
  807. recommendedValue: _configProperties.get('recommendedValue'),
  808. description: _configProperties.get('description'),
  809. serviceName: _configProperties.get('serviceName'),
  810. domain: _configProperties.get('domain'),
  811. isVisible: _configProperties.get('isVisible'),
  812. isFinal: _configProperties.get('isFinal'),
  813. recommendedIsFinal: _configProperties.get('isFinal'),
  814. supportsFinal: _configProperties.get('supportsFinal'),
  815. filename: _configProperties.get('filename'),
  816. displayType: _configProperties.get('displayType'),
  817. isRequiredByAgent: _configProperties.get('isRequiredByAgent'),
  818. hasInitialValue: !!_configProperties.get('hasInitialValue'),
  819. isRequired: _configProperties.get('isRequired'), // flag that allow saving property with empty value
  820. group: !!_configProperties.get('group') ? _configProperties.get('group.name') : null,
  821. showLabel: _configProperties.get('showLabel'),
  822. category: _configProperties.get('category')
  823. };
  824. serviceConfigProperties.push(configProperty);
  825. }, this);
  826. // check for configs that need to update for installed services
  827. if (stepController.get('installedServiceNames') && stepController.get('installedServiceNames').contains(_content.get('serviceName'))) {
  828. // get only modified configs
  829. var configs = _content.get('configs').filter(function (config) {
  830. if (config.get('isNotDefaultValue') || (config.get('savedValue') === null)) {
  831. var notAllowed = ['masterHost', 'masterHosts', 'slaveHosts', 'slaveHost'];
  832. return !notAllowed.contains(config.get('displayType')) && !!config.filename;
  833. }
  834. return false;
  835. });
  836. // if modified configs detected push all service's configs for update
  837. if (configs.length) {
  838. fileNamesToUpdate = fileNamesToUpdate.concat(configs.mapProperty('filename').uniq());
  839. }
  840. }
  841. }, this);
  842. this.setDBProperty('serviceConfigProperties', serviceConfigProperties);
  843. this.set('content.serviceConfigProperties', serviceConfigProperties);
  844. this.setDBProperty('fileNamesToUpdate', fileNamesToUpdate);
  845. },
  846. /**
  847. * save Config groups
  848. * @param stepController
  849. * @param isAddService
  850. */
  851. saveServiceConfigGroups: function (stepController, isAddService) {
  852. var serviceConfigGroups = [],
  853. isForInstalledService = false,
  854. hosts = isAddService ? App.router.get('addServiceController').getDBProperty('hosts') : this.getDBProperty('hosts');
  855. stepController.get('stepConfigs').forEach(function (service) {
  856. // mark group of installed service
  857. if (service.get('selected') === false) isForInstalledService = true;
  858. service.get('configGroups').forEach(function (configGroup) {
  859. var properties = [];
  860. configGroup.get('properties').forEach(function (property) {
  861. properties.push({
  862. isRequiredByAgent: property.get('isRequiredByAgent'),
  863. name: property.get('name'),
  864. value: property.get('value'),
  865. isFinal: property.get('isFinal'),
  866. filename: property.get('filename')
  867. })
  868. });
  869. //configGroup copied into plain JS object to avoid Converting circular structure to JSON
  870. var hostNames = configGroup.get('hosts').map(function(host_name) {return hosts[host_name].id;});
  871. serviceConfigGroups.push({
  872. id: configGroup.get('id'),
  873. name: configGroup.get('name'),
  874. description: configGroup.get('description'),
  875. hosts: hostNames,
  876. properties: properties,
  877. isDefault: configGroup.get('isDefault'),
  878. isForInstalledService: isForInstalledService,
  879. isForUpdate: configGroup.isForUpdate || configGroup.get('hash') != this.getConfigGroupHash(configGroup, hostNames),
  880. service: {id: configGroup.get('service.id')}
  881. });
  882. }, this)
  883. }, this);
  884. this.setDBProperty('serviceConfigGroups', serviceConfigGroups);
  885. this.set('content.configGroups', serviceConfigGroups);
  886. },
  887. /**
  888. * generate string hash for config group
  889. * @param {Object} configGroup
  890. * @param {Array|undefined} hosts
  891. * @returns {String|null}
  892. * @method getConfigGroupHash
  893. */
  894. getConfigGroupHash: function(configGroup, hosts) {
  895. if (!Em.get(configGroup, 'properties.length') && !Em.get(configGroup, 'hosts.length') && !hosts) {
  896. return null;
  897. }
  898. var hash = {};
  899. Em.get(configGroup, 'properties').forEach(function (config) {
  900. hash[Em.get(config, 'name')] = {value: Em.get(config, 'value'), isFinal: Em.get(config, 'isFinal')};
  901. });
  902. hash['hosts'] = hosts || Em.get(configGroup, 'hosts');
  903. return JSON.stringify(hash);
  904. },
  905. /**
  906. * return slaveComponents bound to hosts
  907. * @return {Array}
  908. */
  909. getSlaveComponentHosts: function () {
  910. var components = this.get('slaveComponents');
  911. var result = [];
  912. var installedServices = App.Service.find().mapProperty('serviceName');
  913. var selectedServices = App.StackService.find().filterProperty('isSelected', true).mapProperty('serviceName');
  914. var installedComponentsMap = {};
  915. var uninstalledComponents = [];
  916. components.forEach(function (component) {
  917. if (installedServices.contains(component.get('serviceName'))) {
  918. installedComponentsMap[component.get('componentName')] = [];
  919. } else if (selectedServices.contains(component.get('serviceName'))) {
  920. uninstalledComponents.push(component);
  921. }
  922. }, this);
  923. installedComponentsMap['HDFS_CLIENT'] = [];
  924. App.HostComponent.find().forEach(function (hostComponent) {
  925. if (installedComponentsMap[hostComponent.get('componentName')]) {
  926. installedComponentsMap[hostComponent.get('componentName')].push(hostComponent.get('hostName'));
  927. }
  928. }, this);
  929. for (var componentName in installedComponentsMap) {
  930. var name = (componentName === 'HDFS_CLIENT') ? 'CLIENT' : componentName;
  931. var component = {
  932. componentName: name,
  933. displayName: App.format.role(name),
  934. hosts: [],
  935. isInstalled: true
  936. };
  937. installedComponentsMap[componentName].forEach(function (hostName) {
  938. component.hosts.push({
  939. group: "Default",
  940. hostName: hostName,
  941. isInstalled: true
  942. });
  943. }, this);
  944. result.push(component);
  945. }
  946. uninstalledComponents.forEach(function (component) {
  947. var hosts = jQuery.extend(true, [], result.findProperty('componentName', 'DATANODE').hosts);
  948. hosts.setEach('isInstalled', false);
  949. result.push({
  950. componentName: component.get('componentName'),
  951. displayName: App.format.role(component.get('componentName')),
  952. hosts: hosts,
  953. isInstalled: false
  954. })
  955. });
  956. return result;
  957. },
  958. /**
  959. * Load master component hosts data for using in required step controllers
  960. */
  961. loadMasterComponentHosts: function () {
  962. var masterComponentHosts = this.getDBProperty('masterComponentHosts');
  963. var stackMasterComponents = App.get('components.masters').uniq();
  964. if (!masterComponentHosts) {
  965. masterComponentHosts = [];
  966. App.HostComponent.find().filter(function(component) {
  967. return stackMasterComponents.contains(component.get('componentName'));
  968. }).forEach(function (item) {
  969. masterComponentHosts.push({
  970. component: item.get('componentName'),
  971. hostName: item.get('hostName'),
  972. isInstalled: true,
  973. serviceId: item.get('service.id'),
  974. display_name: item.get('displayName')
  975. })
  976. });
  977. this.setDBProperty('masterComponentHosts', masterComponentHosts);
  978. }
  979. this.set("content.masterComponentHosts", masterComponentHosts);
  980. },
  981. /**
  982. * Save Master Component Hosts data to Main Controller
  983. * @param stepController App.WizardStep5Controller
  984. */
  985. saveMasterComponentHosts: function (stepController) {
  986. var obj = stepController.get('selectedServicesMasters');
  987. var masterComponentHosts = [];
  988. obj.forEach(function (_component) {
  989. masterComponentHosts.push({
  990. display_name: _component.get('display_name'),
  991. component: _component.get('component_name'),
  992. hostName: _component.get('selectedHost'),
  993. serviceId: _component.get('serviceId'),
  994. isInstalled: _component.get('isInstalled')
  995. });
  996. });
  997. this.setDBProperty('masterComponentHosts', masterComponentHosts);
  998. this.set('content.masterComponentHosts', masterComponentHosts);
  999. },
  1000. clearMasterComponentHosts: function() {
  1001. this.set('content.masterComponentHosts', null);
  1002. this.setDBProperty('masterComponentHosts', null);
  1003. },
  1004. /**
  1005. * Load information about hosts with clients components
  1006. */
  1007. loadClients: function () {
  1008. var clients = this.getDBProperty('clientInfo');
  1009. this.set('content.clients', clients);
  1010. console.log(this.get('content.controllerName') + ".loadClients: loaded list ", clients);
  1011. },
  1012. /**
  1013. * load methods assigned to each step
  1014. * methods executed in exact order as they described in map
  1015. * @return {object}
  1016. */
  1017. loadAllPriorSteps: function () {
  1018. var currentStep = this.get('currentStep');
  1019. var loadMap = this.get('loadMap');
  1020. var operationStack = [];
  1021. var dfd = $.Deferred();
  1022. for (var s in loadMap) {
  1023. if (parseInt(s) <= parseInt(currentStep)) {
  1024. operationStack.pushObjects(loadMap[s]);
  1025. }
  1026. }
  1027. var sequence = App.actionSequence.create({context: this});
  1028. sequence.setSequence(operationStack).onFinish(function () {
  1029. dfd.resolve();
  1030. }).start();
  1031. return dfd.promise();
  1032. },
  1033. /**
  1034. * return new object extended from clusterStatusTemplate
  1035. * @return Object
  1036. */
  1037. getCluster: function () {
  1038. return jQuery.extend({}, this.get('clusterStatusTemplate'), {name: App.router.getClusterName()});
  1039. },
  1040. /**
  1041. * Load services data from server.
  1042. */
  1043. loadServicesFromServer: function () {
  1044. var services = this.getDBProperty('services');
  1045. if (!services) {
  1046. services = {
  1047. selectedServices: [],
  1048. installedServices: []
  1049. };
  1050. App.StackService.find().forEach(function(item){
  1051. var isInstalled = App.Service.find().someProperty('id', item.get('serviceName'));
  1052. item.set('isSelected', isInstalled);
  1053. item.set('isInstalled', isInstalled);
  1054. if (isInstalled) {
  1055. services.selectedServices.push(item.get('serviceName'));
  1056. services.installedServices.push(item.get('serviceName'));
  1057. }
  1058. },this);
  1059. this.setDBProperty('services',services);
  1060. } else {
  1061. App.StackService.find().forEach(function(item) {
  1062. var isSelected = services.selectedServices.contains(item.get('serviceName'));
  1063. var isInstalled = services.installedServices.contains(item.get('serviceName'));
  1064. item.set('isSelected', isSelected);
  1065. item.set('isInstalled', isInstalled);
  1066. },this);
  1067. }
  1068. this.set('content.services', App.StackService.find());
  1069. },
  1070. /**
  1071. * Load confirmed hosts.
  1072. * Will be used at <code>Assign Masters(step5)</code> step
  1073. */
  1074. loadConfirmedHosts: function () {
  1075. var hosts = App.db.getHosts();
  1076. if (hosts) {
  1077. this.set('content.hosts', hosts);
  1078. }
  1079. },
  1080. loadHosts: function () {
  1081. var dfd;
  1082. var hostsInDb = this.getDBProperty('hosts');
  1083. if (hostsInDb) {
  1084. this.set('content.hosts', hostsInDb);
  1085. dfd = $.Deferred();
  1086. dfd.resolve();
  1087. } else {
  1088. dfd = App.ajax.send({
  1089. name: 'hosts.confirmed',
  1090. sender: this,
  1091. data: {},
  1092. success: 'loadHostsSuccessCallback',
  1093. error: 'loadHostsErrorCallback'
  1094. });
  1095. }
  1096. return dfd.promise();
  1097. },
  1098. loadHostsSuccessCallback: function (response) {
  1099. var installedHosts = {};
  1100. response.items.forEach(function (item, indx) {
  1101. installedHosts[item.Hosts.host_name] = {
  1102. name: item.Hosts.host_name,
  1103. cpu: item.Hosts.cpu_count,
  1104. memory: item.Hosts.total_mem,
  1105. disk_info: item.Hosts.disk_info,
  1106. osType: item.Hosts.os_type,
  1107. osArch: item.Hosts.os_arch,
  1108. ip: item.Hosts.ip,
  1109. bootStatus: "REGISTERED",
  1110. isInstalled: true,
  1111. hostComponents: item.host_components,
  1112. id: indx++
  1113. };
  1114. });
  1115. this.setDBProperty('hosts', installedHosts);
  1116. this.set('content.hosts', installedHosts);
  1117. },
  1118. loadHostsErrorCallback: function (jqXHR, ajaxOptions, error, opt) {
  1119. App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.method, jqXHR.status);
  1120. console.log('Loading hosts failed');
  1121. },
  1122. /**
  1123. * Determine if <code>Assign Slaves and Clients</code> step should be skipped
  1124. * @method setSkipSlavesStep
  1125. * @param services
  1126. * @param step
  1127. */
  1128. setSkipSlavesStep: function (services, step) {
  1129. var hasServicesWithSlave = services.someProperty('hasSlave');
  1130. var hasServicesWithClient = services.someProperty('hasClient');
  1131. var hasServicesWithCustomAssignedNonMasters = services.someProperty('hasNonMastersWithCustomAssignment');
  1132. this.set('content.skipSlavesStep', !hasServicesWithSlave && !hasServicesWithClient || !hasServicesWithCustomAssignedNonMasters);
  1133. if (this.get('content.skipSlavesStep')) {
  1134. this.get('isStepDisabled').findProperty('step', step).set('value', this.get('content.skipSlavesStep'));
  1135. }
  1136. },
  1137. /**
  1138. * Load config themes for enhanced config layout.
  1139. *
  1140. * @method loadConfigThemes
  1141. * @return {$.Deferred}
  1142. */
  1143. loadConfigThemes: function () {
  1144. var self = this;
  1145. var dfd = $.Deferred();
  1146. if (App.get('isClusterSupportsEnhancedConfigs') && !this.get('stackConfigsLoaded')) {
  1147. var serviceNames = App.StackService.find().filter(function (s) {
  1148. return s.get('isSelected') || s.get('isInstalled');
  1149. }).mapProperty('serviceName');
  1150. // Load stack configs before loading themes
  1151. App.config.loadConfigsFromStack(serviceNames).done(function () {
  1152. self.loadConfigThemeForServices(serviceNames).always(function () {
  1153. self.set('stackConfigsLoaded', true);
  1154. App.themesMapper.generateAdvancedTabs(serviceNames);
  1155. dfd.resolve();
  1156. });
  1157. });
  1158. }
  1159. else {
  1160. dfd.resolve();
  1161. this.set('stackConfigsLoaded', true);
  1162. }
  1163. return dfd.promise();
  1164. },
  1165. saveTasksStatuses: function (tasksStatuses) {
  1166. this.set('content.tasksStatuses', tasksStatuses);
  1167. this.setDBProperty('tasksStatuses', tasksStatuses);
  1168. },
  1169. loadTasksStatuses: function() {
  1170. var tasksStatuses = this.getDBProperty('tasksStatuses');
  1171. this.set('content.tasksStatuses', tasksStatuses);
  1172. },
  1173. saveTasksRequestIds: function (tasksRequestIds) {
  1174. this.set('content.tasksRequestIds', tasksRequestIds);
  1175. this.setDBProperty('tasksRequestIds', tasksRequestIds);
  1176. },
  1177. loadTasksRequestIds: function() {
  1178. var tasksRequestIds = this.getDBProperty('tasksRequestIds');
  1179. this.set('content.tasksRequestIds', tasksRequestIds);
  1180. },
  1181. saveRequestIds: function (requestIds) {
  1182. this.set('content.requestIds', requestIds);
  1183. this.setDBProperty('requestIds', requestIds);
  1184. },
  1185. loadRequestIds: function() {
  1186. var requestIds = this.getDBProperty('requestIds');
  1187. this.set('content.requestIds', requestIds);
  1188. }
  1189. });