Skip to content

Commit

Permalink
Added required condition to server room in DC view
Browse files Browse the repository at this point in the history
    Server room must be specify when user add rack from DC view.
  • Loading branch information
ar4s committed Sep 18, 2015
1 parent 24dae11 commit 79bc530
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 79bc530

Please sign in to comment.