Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/app/pages/dashboards/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ function DashboardCtrl($rootScope, $routeParams, $location, $timeout, $q, $uibMo
};

this.editDashboard = () => {
this.dashboard.existing_name = this.dashboard.name;
$uibModal.open({
component: 'editDashboardDialog',
resolve: {
Expand Down
12 changes: 8 additions & 4 deletions client/app/pages/dashboards/edit-dashboard-dialog.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<div class="modal-header">
<button type="button" class="close" ng-click="$ctrl.dismiss()" ng-disabled="$ctrl.saveInProgress" aria-hidden="true">&times;</button>
<button type="button" class="close" ng-click="$ctrl.closeWithoutSave()" ng-disabled="$ctrl.saveInProgress" aria-hidden="true">&times;</button>
<h4 class="modal-title">Edit: {{$ctrl.dashboard.name}}</h4>
</div>
<div class="modal-body">
<p>
<input type="text" class="form-control" placeholder="Dashboard Name" ng-model="$ctrl.dashboard.name" required>
<form name="myForm">
<input name="dashboardName" type="text" class="form-control" placeholder="Dashboard Name" ng-model="$ctrl.dashboard.name" required>
</form>
</p>
<p ng-if="myForm.dashboardName.$invalid" class="alert alert-warning">A name is required.</p>


<div gridster="$ctrl.gridsterOptions" ng-if="$ctrl.items | notEmpty">
<ul>
Expand All @@ -16,6 +20,6 @@ <h4 class="modal-title">Edit: {{$ctrl.dashboard.name}}</h4>
</div>
</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-default" ng-disabled="$ctrl.saveInProgress" ng-click="$ctrl.closeWithoutSave()">Close</button>
<button type="button" class="btn btn-primary" ng-disabled="$ctrl.saveInProgress || myForm.dashboardName.$invalid" ng-click="$ctrl.saveDashboard()">Save</button>
</div>
4 changes: 4 additions & 0 deletions client/app/pages/dashboards/edit-dashboard-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ const EditDashboardDialog = {
Events.record('create', 'dashboard');
}
};
this.closeWithoutSave = () => {
this.dashboard.name = this.dashboard.existing_name;
this.dismiss();
};
},
};

Expand Down