Skip to content

Commit

Permalink
fix(bakery/oracle): use read-only text field for bake region (#5846)
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyongzhang authored and Scott committed Oct 11, 2018
1 parent ca853c2 commit 977605c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 24 deletions.
14 changes: 4 additions & 10 deletions app/scripts/modules/oracle/src/pipeline/stages/bake/bakeStage.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@
</stage-config-field>

<stage-config-field label="Region" help-key="oracle.pipeline.config.bake.regions">
<region-select-field component="stage"
field="region"
account="stage.accountName"
regions="regions"
provider="'oracle'">
</region-select-field>
<input type="text" class="form-control input-sm" ng-readonly="true"
ng-model="stage.region"/>
</stage-config-field>

<stage-config-field label="Base Image" , help-key="oracle.pipeline.config.bake.baseOsOption">
Expand All @@ -45,8 +41,7 @@
<stage-config-field label="Rebake" help-key="execution.forceRebake">
<div class="checkbox" style="margin-bottom: 0">
<label>
<input type="checkbox" ng-model="stage.rebake">
</input>
<input type="checkbox" ng-model="stage.rebake"/>
Rebake image without regard to the status of any existing bake
</label>
</div>
Expand All @@ -55,7 +50,7 @@
<div class="col-md-9 col-md-offset-1">
<div class="checkbox">
<label>
<input type="checkbox" ng-model="stage.showAdvancedOptions">
<input type="checkbox" ng-model="stage.showAdvancedOptions"/>
<strong>Show Advanced Options</strong>
</label>
</div>
Expand All @@ -78,4 +73,3 @@
</stage-config-field>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@

const angular = require('angular');

import _ from 'lodash';

import {
AccountService,
AuthenticationService,
BakeryReader,
NetworkReader,
Registry,
SubnetReader,
} from '@spinnaker/core';
import { AccountService, AuthenticationService, BakeryReader, Registry } from '@spinnaker/core';

module.exports = angular
.module('spinnaker.oracle.pipeline.stage.bakeStage', [require('./bakeExecutionDetails.controller.js').name])
Expand Down Expand Up @@ -79,8 +70,10 @@ module.exports = angular

if ($scope.stage.accountName) {
AccountService.getRegionsForAccount($scope.stage.accountName).then(function(regions) {
$scope.regions = regions;
$scope.stage.region = $scope.regions[0].name;
if (Array.isArray(regions) && regions.length != 0) {
// there is exactly one region per account
$scope.stage.region = regions[0].name;
}
});
}

Expand All @@ -94,8 +87,10 @@ module.exports = angular

this.accountUpdated = function() {
AccountService.getRegionsForAccount($scope.stage.accountName).then(function(regions) {
$scope.regions = regions;
$scope.stage.region = $scope.regions[0].name;
if (Array.isArray(regions) && regions.length != 0) {
// there is exactly one region per account
$scope.stage.region = regions[0].name;
}
});
};

Expand Down

0 comments on commit 977605c

Please sign in to comment.