-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6291 from himdel/bz1744413
DialogUser - use DialogData.outputConversion before submit and refresh
- Loading branch information
Showing
5 changed files
with
41 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 16 additions & 12 deletions
28
app/assets/javascripts/services/dialog_field_refresh_service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
ManageIQ.angular.app.service('dialogFieldRefreshService', ['API', function(API) { | ||
this.refreshField = function(dialogData, dialogField, url, idList) { | ||
this.areFieldsBeingRefreshed = true; | ||
var data = angular.toJson({ | ||
ManageIQ.angular.app.service('dialogFieldRefreshService', ['API', 'DialogData', function(API, DialogData) { | ||
var self = this; | ||
|
||
self.refreshField = function(dialogData, dialogField, url, idList) { | ||
self.areFieldsBeingRefreshed = true; | ||
|
||
var data = { | ||
action: 'refresh_dialog_fields', | ||
resource: { | ||
dialog_fields: dialogData, | ||
dialog_fields: DialogData.outputConversion(dialogData), | ||
fields: dialogField, | ||
resource_action_id: idList.resourceActionId, | ||
target_id: idList.targetId, | ||
target_type: idList.targetType, | ||
real_target_type: idList.realTargetType, | ||
}, | ||
}); | ||
}; | ||
|
||
return new Promise(function(resolve) { | ||
API.post(url + idList.dialogId, data).then(function(response) { | ||
resolve(response.result[dialogField]); | ||
return API.post(url + idList.dialogId, angular.toJson(data)) | ||
.then(function(response) { | ||
// FIXME: API requests don't actually count towards $.active | ||
if ($.active < 1) { | ||
this.areFieldsBeingRefreshed = false; | ||
self.areFieldsBeingRefreshed = false; | ||
} | ||
}.bind(this)); | ||
}.bind(this)); | ||
|
||
return response.result[dialogField]; | ||
}); | ||
}; | ||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters