-
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 #3050 from skateman/inline-methods-tree
Display only the inline methods in the embedded methods tree (cherry picked from commit 2c1ff87) https://bugzilla.redhat.com/show_bug.cgi?id=1526585
- Loading branch information
Showing
12 changed files
with
215 additions
and
80 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
app/assets/javascripts/angular_modules/module_automate_selector.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* global miqHttpInject */ | ||
miqHttpInject( | ||
angular.module('ManageIQ.automateSelector', [ | ||
'miqStaticAssets.treeSelector', | ||
'miqStaticAssets.treeView', | ||
'ui.bootstrap', | ||
'frapontillo.bootstrap-switch', | ||
]) | ||
); |
62 changes: 62 additions & 0 deletions
62
app/assets/javascripts/controllers/miq_ae_class/ae_inline_method_selection_controller.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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* global miqJqueryRequest, miqPassFields */ | ||
(function() { | ||
var CONTROLLER_NAME = 'aeInlineMethodSelectionController'; | ||
|
||
var AeInlineMethodSelectionController = function($http, $uibModal) { | ||
var vm = this; | ||
vm.$http = $http; | ||
vm.$uibModal = $uibModal; | ||
|
||
vm.includeDomain = false; | ||
vm.selectable = {key: '^aem-'}; | ||
|
||
vm.$http.get('/tree/automate_inline_methods').then(function(response) { | ||
vm.data = response.data; | ||
}); | ||
}; | ||
|
||
AeInlineMethodSelectionController.prototype.lazyLoad = function(node) { | ||
return this.$http.get('/tree/automate_inline_methods?id=' + encodeURIComponent(node.key)) | ||
.then(function(response) { | ||
return response.data; | ||
}); | ||
}; | ||
|
||
AeInlineMethodSelectionController.prototype.openModal = function() { | ||
this.modal = this.$uibModal.open({ | ||
templateUrl: '/static/automate-selection-modal.html', | ||
keyboard: false, | ||
backdrop: 'static', | ||
size: 'lg', | ||
controllerAs: '$ctrl', | ||
controller: ['parent', function(parent) { this.parent = parent; }], | ||
resolve: { | ||
parent: function() { | ||
return this; | ||
}.bind(this), | ||
}, | ||
}); | ||
}; | ||
|
||
AeInlineMethodSelectionController.prototype.onSelect = function(node) { | ||
var fqname = node.fqname; | ||
// Chop the first part of the fqname if includeDomain is set to false | ||
if (this.includeDomain === false) { | ||
fqname = fqname.split('/'); | ||
fqname.splice(1, 1); | ||
fqname = fqname.join('/'); | ||
} | ||
|
||
var url = '/' + ManageIQ.controller + '/embedded_methods_add'; | ||
miqJqueryRequest(miqPassFields(url, {fqname: fqname})); | ||
|
||
this.modal.close(); | ||
}; | ||
|
||
AeInlineMethodSelectionController.prototype.closeModal = function() { | ||
this.modal.close(); | ||
}; | ||
|
||
AeInlineMethodSelectionController.$inject = ['$http', '$uibModal']; | ||
window.miqHttpInject(angular.module('ManageIQ.automateSelector')).controller(CONTROLLER_NAME, AeInlineMethodSelectionController); | ||
})(); |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class TreeBuilderAutomateInlineMethod < TreeBuilderAutomateEntrypoint | ||
def x_get_tree_class_kids(object, count_only, _type) | ||
count_only_or_objects(count_only, object.ae_methods.where(:location => 'inline'), [:display_name, :name]) | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div class="modal-header"> | ||
<h4 class="modal-title" translate>Select Item</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<div class="pull-left"> | ||
<miq-tree-selector | ||
name="entrypoint_selection" | ||
selected="$ctrl.parent.selected" | ||
selectable="$ctrl.parent.selectable" | ||
data="$ctrl.parent.data" | ||
lazy-load="$ctrl.parent.lazyLoad(node)" | ||
on-select="$ctrl.parent.onSelect(node)" | ||
></miq-tree-selector> | ||
</div> | ||
<div class="form-group pull-right"> | ||
<label class="control-label" translate>Include domain prefix in the path:</label> | ||
<input bs-switch type="checkbox" ng-model="$ctrl.parent.includeDomain" ng-show="$ctrl.parent.showInclude"/> | ||
</div> | ||
<div class="clearfix"></div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button class="btn btn-default" ng-click="$ctrl.parent.closeModal(false);" translate>Close</button> | ||
</div> |
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
Oops, something went wrong.