Skip to content

Commit

Permalink
Don't allow saving dashboard with empty name
Browse files Browse the repository at this point in the history
  • Loading branch information
arikfr committed Jun 28, 2017
1 parent 92f93f8 commit e543e0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/app/pages/dashboards/edit-dashboard-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ <h4 class="modal-title">Edit: {{$ctrl.dashboard.name}}</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-disabled="$ctrl.saveInProgress" ng-click="$ctrl.dismiss()">Close</button>
<button type="button" class="btn btn-primary" ng-disabled="$ctrl.saveInProgress" ng-click="$ctrl.saveDashboard()">Save</button>
<button type="button" class="btn btn-primary" ng-disabled="$ctrl.saveInProgress || !$ctrl.isFormValid()" ng-click="$ctrl.saveDashboard()">Save</button>
</div>
4 changes: 3 additions & 1 deletion client/app/pages/dashboards/edit-dashboard-dialog.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sortBy } from 'underscore';
import { isEmpty, sortBy } from 'underscore';
import template from './edit-dashboard-dialog.html';

const EditDashboardDialog = {
Expand Down Expand Up @@ -45,6 +45,8 @@ const EditDashboardDialog = {
});
}

this.isFormValid = () => !isEmpty(this.dashboard.name);

this.saveDashboard = () => {
this.saveInProgress = true;

Expand Down

0 comments on commit e543e0c

Please sign in to comment.