mirror of
https://github.com/valitydev/redash.git
synced 2024-11-08 01:48:54 +00:00
Fixes dashboard textbox editing
Combines mozilla/redash PR’s 86 and 95. There was a bug that saved textbox content on a dashboard when you tried to close without saving. This fixes it.
This commit is contained in:
parent
aae77a8b25
commit
a795f1463b
@ -17,6 +17,7 @@ const AddWidgetDialog = {
|
||||
this.query = {};
|
||||
this.selected_query = undefined;
|
||||
this.text = '';
|
||||
this.existing_text = '';
|
||||
this.widgetSizes = [{
|
||||
name: 'Regular',
|
||||
value: 1,
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" aria-label="Close" ng-click="$ctrl.close()"><span aria-hidden="true">×</span></button>
|
||||
<button type="button" class="close" aria-label="Close" ng-click="$ctrl.closeWithoutSave()"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">Edit TextBox</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@ -13,6 +13,6 @@
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" ng-disabled="$ctrl.saveInProgress" ng-click="$ctrl.close()">Close</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" ng-click="$ctrl.saveWidget()">Save</button>
|
||||
</div>
|
||||
|
@ -8,7 +8,7 @@ const EditTextBoxComponent = {
|
||||
close: '&',
|
||||
dismiss: '&',
|
||||
},
|
||||
controller(toastr) {
|
||||
controller($rootScope, $location, $http, toastr) {
|
||||
'ngInject';
|
||||
|
||||
this.saveInProgress = false;
|
||||
@ -23,6 +23,10 @@ const EditTextBoxComponent = {
|
||||
this.saveInProgress = false;
|
||||
});
|
||||
};
|
||||
this.closeWithoutSave = () => {
|
||||
this.widget.text = this.widget.existing_text;
|
||||
this.close();
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@ -30,11 +34,14 @@ function DashboardWidgetCtrl($location, $uibModal, $window, Events, currentUser)
|
||||
this.canViewQuery = currentUser.hasPermission('view_query');
|
||||
|
||||
this.editTextBox = () => {
|
||||
this.widget.existing_text = this.widget.text;
|
||||
$uibModal.open({
|
||||
component: 'editTextBox',
|
||||
resolve: {
|
||||
widget: this.widget,
|
||||
},
|
||||
backdrop: 'static',
|
||||
keyboard: false,
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user