mirror of
https://github.com/valitydev/redash.git
synced 2024-11-08 09:53:59 +00:00
Merge pull request #1896 from StantonVentures/textbox_editing_fix
Textbox editing fix
This commit is contained in:
commit
e76efc9cdf
@ -17,6 +17,8 @@ const AddWidgetDialog = {
|
||||
this.query = {};
|
||||
this.selected_query = undefined;
|
||||
this.text = '';
|
||||
this.existing_text = '';
|
||||
this.new_text = '';
|
||||
this.widgetSizes = [{
|
||||
name: 'Regular',
|
||||
value: 1,
|
||||
|
@ -4,11 +4,11 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" ng-model="$ctrl.widget.text" rows="3"></textarea>
|
||||
<textarea class="form-control" ng-model="$ctrl.widget.new_text" rows="3"></textarea>
|
||||
</div>
|
||||
<div ng-show="$ctrl.widget.text">
|
||||
<div ng-show="$ctrl.widget.new_text">
|
||||
<strong>Preview:</strong>
|
||||
<p ng-bind-html="$ctrl.widget.text | markdown"></p>
|
||||
<p ng-bind-html="$ctrl.widget.new_text | markdown"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -15,13 +15,18 @@ const EditTextBoxComponent = {
|
||||
this.widget = this.resolve.widget;
|
||||
this.saveWidget = () => {
|
||||
this.saveInProgress = true;
|
||||
this.widget.$save().then(() => {
|
||||
if (this.widget.new_text !== this.widget.existing_text) {
|
||||
this.widget.text = this.widget.new_text;
|
||||
this.widget.$save().then(() => {
|
||||
this.close();
|
||||
}).catch(() => {
|
||||
toastr.error('Widget can not be updated');
|
||||
}).finally(() => {
|
||||
this.saveInProgress = false;
|
||||
});
|
||||
} else {
|
||||
this.close();
|
||||
}).catch(() => {
|
||||
toastr.error('Widget can not be updated');
|
||||
}).finally(() => {
|
||||
this.saveInProgress = false;
|
||||
});
|
||||
}
|
||||
};
|
||||
},
|
||||
};
|
||||
@ -30,6 +35,8 @@ function DashboardWidgetCtrl($location, $uibModal, $window, Events, currentUser)
|
||||
this.canViewQuery = currentUser.hasPermission('view_query');
|
||||
|
||||
this.editTextBox = () => {
|
||||
this.widget.existing_text = this.widget.text;
|
||||
this.widget.new_text = this.widget.text;
|
||||
$uibModal.open({
|
||||
component: 'editTextBox',
|
||||
resolve: {
|
||||
|
Loading…
Reference in New Issue
Block a user