function initialize()

in app/scripts/modules/amazon/pipeline/stages/bake/awsBakeStage.js [55:96]


    function initialize() {
      $q.all({
        regions: bakeryService.getRegions('aws'),
        baseOsOptions: bakeryService.getBaseOsOptions('aws'),
        baseLabelOptions: bakeryService.getBaseLabelOptions(),
        vmTypes: bakeryService.getVmTypes(),
        storeTypes: bakeryService.getStoreTypes(),
      }).then(function(results) {
        $scope.regions = results.regions;
        $scope.vmTypes = results.vmTypes;
        if (!$scope.stage.vmType && $scope.vmTypes && $scope.vmTypes.length) {
          $scope.stage.vmType = $scope.vmTypes[0];
        }
        $scope.storeTypes = results.storeTypes;
        if (!$scope.stage.storeType && $scope.storeTypes && $scope.storeTypes.length) {
          $scope.stage.storeType = $scope.storeTypes[0];
        }
        if ($scope.regions.length === 1) {
          $scope.stage.region = $scope.regions[0];
        } else if (!$scope.regions.includes($scope.stage.region)) {
          delete $scope.stage.region;
        }
        if (!$scope.stage.regions.length && $scope.application.defaultRegions.aws) {
          $scope.stage.regions.push($scope.application.defaultRegions.aws);
        }
        if (!$scope.stage.regions.length && $scope.application.defaultRegions.aws) {
          $scope.stage.regions.push($scope.application.defaultRegions.aws);
        }
        $scope.baseOsOptions = results.baseOsOptions.baseImages;
        $scope.baseLabelOptions = results.baseLabelOptions;

        if (!$scope.stage.baseOs && $scope.baseOsOptions && $scope.baseOsOptions.length) {
          $scope.stage.baseOs = $scope.baseOsOptions[0].id;
        }
        if (!$scope.stage.baseLabel && $scope.baseLabelOptions && $scope.baseLabelOptions.length) {
          $scope.stage.baseLabel = $scope.baseLabelOptions[0];
        }
        $scope.viewState.roscoMode = SETTINGS.feature.roscoMode;
        $scope.showAdvancedOptions = showAdvanced();
        $scope.viewState.loading = false;
      });
    }