Skip to content

Commit

Permalink
Merge pull request allegro#1800 from ar4s/ng-server-room-required
Browse files Browse the repository at this point in the history
Added required condition to server room in DC view
  • Loading branch information
xliiv committed Sep 18, 2015
2 parents 24dae11 + 79bc530 commit d64639d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/ralph/dc_view/static/js/app/data_center/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
rack.visualization_col = x;
rack.visualization_row = y;
rack.orientation = 'top';
rack.server_room = '';
rack.name = 'New rack';
rack.data_center = data_center.id;
rack.new = true;
data_center.rack_set.push(rack);
$scope.$emit('edit_rack', rack);
Expand All @@ -45,6 +45,7 @@
var rack_model = new RackModel(rack);
var rack_promise = null;
var success_msg = '';

if (typeof(rack.id) !== 'undefined') {
rack_promise = rack_model.$update();
success_msg = 'updated';
Expand Down Expand Up @@ -73,6 +74,7 @@
rack.active = false;
});
rack.active = true;
rack.server_room = rack.server_room && rack.server_room.toString();
$scope.rack = rack;
$scope.forms.edit_form.action = 'edit';
$scope.forms.edit_form.$error = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</div>
<div ng-show="rack">
<form name="forms.edit_form" class="form" ng-submit="addOrEdit(rack)">
<div data-alert class="alert-box error" ng-show="forms.edit_form.$error.all" ng-repeat="error in forms.edit_form.$error.all">
<div data-alert class="alert-box alert" ng-show="forms.edit_form.$error.all" ng-repeat="error in forms.edit_form.$error.all">
{{ error }}
</div>
<div class="row">
Expand All @@ -46,13 +46,15 @@
</div>
</div>
<div class="row">
<div class="large-12 columns">
<div class="large-12 columns" ng-class="{'error': forms.edit_form.server_room.$invalid}">
<label for="id_name">Server room
<select name="server_room" ng-model="rack.server_room" required>
<select name="server_room" ng-model="rack.server_room" required>
<option value="">----</option>
<option value="{{ room.id }}" ng-repeat="room in data_center.server_rooms">
{{ room.name }}
</option>
</select>
<span class="help-inline" ng-show="forms.edit_form.server_room.$error.required">Select server room.</span>
</label>
</div>
</div>
Expand Down

0 comments on commit d64639d

Please sign in to comment.