From 6b24119b2d703e1bfa891ce6138c6793571976bd Mon Sep 17 00:00:00 2001 From: Roman Blanco Date: Thu, 9 Nov 2017 14:50:00 +0100 Subject: [PATCH 1/4] Corrected fqname spliting the whole 'fqname' was incorrectly assigned as 'ae_namespace' attribute, while 'ae_instance' and 'ae_class' stayed set as 'nil' --- .../controllers/dialog_editor/dialog_editor_controller.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/controllers/dialog_editor/dialog_editor_controller.js b/app/assets/javascripts/controllers/dialog_editor/dialog_editor_controller.js index 59d45a5e352..3a8dadd5ac9 100644 --- a/app/assets/javascripts/controllers/dialog_editor/dialog_editor_controller.js +++ b/app/assets/javascripts/controllers/dialog_editor/dialog_editor_controller.js @@ -105,7 +105,9 @@ ManageIQ.angular.app.controller('dialogEditorController', ['$window', '$http', ' if (vm.treeSelectorIncludeDomain === false) { fqname.splice(1, 1); } - elementData.resource_action.ae_namespace = fqname.join('/'); + elementData.resource_action.ae_instance = fqname.pop(); + elementData.resource_action.ae_class = fqname.pop(); + elementData.resource_action.ae_namespace = fqname.filter(String).join('/'); vm.treeSelectorShow = false; } From 6ea3fff57ff41d90145e6dbd1b57be3ed9a3b598 Mon Sep 17 00:00:00 2001 From: Roman Blanco Date: Tue, 14 Nov 2017 10:22:35 +0100 Subject: [PATCH 2/4] Added method for displaying full fqname --- .../dialog_editor/dialog_editor_controller.js | 13 +++++++++++++ app/views/miq_ae_customization/editor.html.haml | 1 + 2 files changed, 14 insertions(+) diff --git a/app/assets/javascripts/controllers/dialog_editor/dialog_editor_controller.js b/app/assets/javascripts/controllers/dialog_editor/dialog_editor_controller.js index 3a8dadd5ac9..d871ca6c0ac 100644 --- a/app/assets/javascripts/controllers/dialog_editor/dialog_editor_controller.js +++ b/app/assets/javascripts/controllers/dialog_editor/dialog_editor_controller.js @@ -11,6 +11,7 @@ ManageIQ.angular.app.controller('dialogEditorController', ['$window', '$http', ' // treeSelector related vm.lazyLoad = lazyLoad; vm.onSelect = onSelect; + vm.showFullyQualifiedName = showFullyQualifiedName; vm.node = {}; vm.treeSelectorToggle = treeSelectorToggle; vm.treeSelectorIncludeDomain = false; @@ -111,6 +112,18 @@ ManageIQ.angular.app.controller('dialogEditorController', ['$window', '$http', ' vm.treeSelectorShow = false; } + function showFullyQualifiedName(resourceAction) { + if (typeof resourceAction.ae_namespace == 'undefined' || + typeof resourceAction.ae_class == 'undefined' || + typeof resourceAction.ae_instance == 'undefined') { + return ''; + } + var fqname = resourceAction.ae_namespace + + '/' + resourceAction.ae_class + + '/' + resourceAction.ae_instance; + return fqname; + } + function treeSelectorToggle() { vm.treeSelectorShow = ! vm.treeSelectorShow; } diff --git a/app/views/miq_ae_customization/editor.html.haml b/app/views/miq_ae_customization/editor.html.haml index f1764fa1fd3..996fc33e15f 100644 --- a/app/views/miq_ae_customization/editor.html.haml +++ b/app/views/miq_ae_customization/editor.html.haml @@ -21,6 +21,7 @@ "element-info" => "vm.elementInfo", "lazy-load" => "vm.lazyLoad", "on-select" => "vm.onSelect", + "show-fully-qualified-name" => "vm.showFullyQuallifiedName", "tree-selector-data" => "vm.treeSelectorData", "tree-selector-include-domain" => "vm.treeSelectorIncludeDomain", "tree-selector-show" => "vm.treeSelectorShow", From 871c9546f2752621ca77af4b3ae91972e7748c5f Mon Sep 17 00:00:00 2001 From: Roman Blanco Date: Thu, 16 Nov 2017 14:54:07 +0100 Subject: [PATCH 3/4] Corrected typo --- app/views/miq_ae_customization/editor.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/miq_ae_customization/editor.html.haml b/app/views/miq_ae_customization/editor.html.haml index 996fc33e15f..6b7c7ded626 100644 --- a/app/views/miq_ae_customization/editor.html.haml +++ b/app/views/miq_ae_customization/editor.html.haml @@ -21,7 +21,7 @@ "element-info" => "vm.elementInfo", "lazy-load" => "vm.lazyLoad", "on-select" => "vm.onSelect", - "show-fully-qualified-name" => "vm.showFullyQuallifiedName", + "show-fully-qualified-name" => "vm.showFullyQualifiedName", "tree-selector-data" => "vm.treeSelectorData", "tree-selector-include-domain" => "vm.treeSelectorIncludeDomain", "tree-selector-show" => "vm.treeSelectorShow", From 71f5fad06785f24d1414c2c8684b7b9a37bc6d7f Mon Sep 17 00:00:00 2001 From: Roman Blanco Date: Tue, 21 Nov 2017 16:19:02 +0100 Subject: [PATCH 4/4] Review response: Using tripple check for checking 'undefined' type --- .../controllers/dialog_editor/dialog_editor_controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/controllers/dialog_editor/dialog_editor_controller.js b/app/assets/javascripts/controllers/dialog_editor/dialog_editor_controller.js index d871ca6c0ac..52e9538c24a 100644 --- a/app/assets/javascripts/controllers/dialog_editor/dialog_editor_controller.js +++ b/app/assets/javascripts/controllers/dialog_editor/dialog_editor_controller.js @@ -113,9 +113,9 @@ ManageIQ.angular.app.controller('dialogEditorController', ['$window', '$http', ' } function showFullyQualifiedName(resourceAction) { - if (typeof resourceAction.ae_namespace == 'undefined' || - typeof resourceAction.ae_class == 'undefined' || - typeof resourceAction.ae_instance == 'undefined') { + if (typeof resourceAction.ae_namespace === 'undefined' || + typeof resourceAction.ae_class === 'undefined' || + typeof resourceAction.ae_instance === 'undefined') { return ''; } var fqname = resourceAction.ae_namespace