reassign_master_routes.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. module.exports = Em.Route.extend({
  19. route: '/services/reassign',
  20. enter: function (router) {
  21. console.log('in /service/reassign:enter');
  22. Em.run.next(function () {
  23. var reassignMasterController = router.get('reassignMasterController');
  24. App.router.get('updateController').set('isWorking', false);
  25. App.ModalPopup.show({
  26. classNames: ['full-width-modal'],
  27. header:Em.I18n.t('services.reassign.header'),
  28. bodyClass: App.ReassignMasterView.extend({
  29. controller: reassignMasterController
  30. }),
  31. primary:Em.I18n.t('form.cancel'),
  32. showFooter: false,
  33. secondary: null,
  34. onPrimary:function () {
  35. this.hide();
  36. App.router.get('updateController').set('isWorking', true);
  37. App.router.transitionTo('main.services');
  38. },
  39. onClose: function() {
  40. this.hide();
  41. App.router.get('updateController').set('isWorking', true);
  42. App.router.transitionTo('main.services')
  43. },
  44. didInsertElement: function(){
  45. this.fitHeight();
  46. }
  47. });
  48. router.transitionTo('step' + reassignMasterController.get('currentStep'));
  49. });
  50. },
  51. step1: Em.Route.extend({
  52. route: '/step1',
  53. connectOutlets: function (router) {
  54. console.log('in reassignMaster.step1:connectOutlets');
  55. var controller = router.get('reassignMasterController');
  56. controller.setCurrentStep('1');
  57. controller.dataLoading().done(function () {
  58. controller.loadAllPriorSteps();
  59. controller.connectOutlet('wizardStep11');
  60. })
  61. },
  62. next: function (router) {
  63. App.db.setMasterComponentHosts(undefined);
  64. router.transitionTo('step2');
  65. }
  66. }),
  67. step2: Em.Route.extend({
  68. route: '/step2',
  69. connectOutlets: function (router) {
  70. console.log('in reassignMaster.step2:connectOutlets');
  71. var controller = router.get('reassignMasterController');
  72. controller.setCurrentStep('2');
  73. controller.dataLoading().done(function () {
  74. controller.loadAllPriorSteps();
  75. controller.connectOutlet('wizardStep5', controller.get('content'));
  76. })
  77. },
  78. back: Em.Router.transitionTo('step1'),
  79. next: function (router) {
  80. var controller = router.get('reassignMasterController');
  81. var wizardStep5Controller = router.get('wizardStep5Controller');
  82. controller.saveMasterComponentHosts(wizardStep5Controller);
  83. router.transitionTo('step3');
  84. }
  85. }),
  86. step3: Em.Route.extend({
  87. route: '/step3',
  88. connectOutlets: function (router) {
  89. console.log('in reassignMaster.step3:connectOutlets');
  90. var controller = router.get('reassignMasterController');
  91. controller.setCurrentStep('3');
  92. controller.dataLoading().done(function () {
  93. controller.loadAllPriorSteps();
  94. controller.set('content.serviceName', controller.get('content.reassign.service_id'));
  95. controller.connectOutlet('wizardStep12', controller.get('content'));
  96. })
  97. },
  98. back: Em.Router.transitionTo('step2'),
  99. next: function (router) {
  100. var controller = router.get('reassignMasterController');
  101. var wizardStep12Controller = router.get('wizardStep12Controller');
  102. controller.set('content.modifiedConfigs', wizardStep12Controller.get('modifiedConfigs'));
  103. controller.saveServiceConfigProperties(wizardStep12Controller);
  104. router.transitionTo('step4');
  105. }
  106. }),
  107. step4: Em.Route.extend({
  108. route: '/step3',
  109. connectOutlets: function (router) {
  110. console.log('in reassignMaster.step4:connectOutlets');
  111. var controller = router.get('reassignMasterController');
  112. controller.setCurrentStep('4');
  113. controller.dataLoading().done(function () {
  114. controller.loadAllPriorSteps();
  115. controller.connectOutlet('wizardStep13', controller.get('content'));
  116. })
  117. },
  118. back: Em.Router.transitionTo('step3'),
  119. next: function (router) {
  120. }
  121. }),
  122. gotoStep1: Em.Router.transitionTo('step1'),
  123. gotoStep2: Em.Router.transitionTo('step2'),
  124. gotoStep3: Em.Router.transitionTo('step3'),
  125. gotoStep4: Em.Router.transitionTo('step4'),
  126. gotoStep5: Em.Router.transitionTo('step5'),
  127. gotoStep6: Em.Router.transitionTo('step6'),
  128. backToServices: function (router) {
  129. App.router.get('updateController').set('isWorking', true);
  130. router.transitionTo('services');
  131. }
  132. });