This is an automated email from the ASF dual-hosted git repository.

duncangrant pushed a commit to branch fix-ctrl-click
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git

commit 95de5402ef5ff9e51cf73af31e9fe0412ee69967
Author: Duncan Grant <duncan.gr...@cloudsoft.io>
AuthorDate: Tue May 21 10:00:17 2024 +0100

    Calculates href so ctrl click works
    
    Should be able to open the composer in a new tab.
    By calculating the href on the links then this works.
    This doesn't seem to happen anywhere else in Brooklyn.
---
 ui-modules/utils/quick-launch/quick-launch.html | 6 +++---
 ui-modules/utils/quick-launch/quick-launch.js   | 8 ++++++++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/ui-modules/utils/quick-launch/quick-launch.html 
b/ui-modules/utils/quick-launch/quick-launch.html
index ffa14b46..4733fbf0 100644
--- a/ui-modules/utils/quick-launch/quick-launch.html
+++ b/ui-modules/utils/quick-launch/quick-launch.html
@@ -152,7 +152,7 @@
         <em>Returning to the Form will revert any changes made here in the 
YAML Editor</em>
     </small>
     <div>
-        <span class="btn-group" uib-dropdown>
+        <span class="btn-group" uib-dropdown on-toggle="setComposerLink()">
             <button class="btn btn-lg btn-default " ng-if="!yamlViewDisplayed 
&& transitionsShown()" ng-disabled="deploying" ng-click="showEditor()">
                 Edit as YAML
             </button>
@@ -164,10 +164,10 @@
             </button>
             <ul ng-if="!args.noComposerButton" class="dropdown-menu" 
uib-dropdown-menu role="menu" aria-labelledby="composer-actions">
                 <li role="menuitem">
-                    <a ng-click="openComposer($event, false)" href="#"><i 
class="fa fa-link"></i> Open in Composer</a>
+                    <a ng-href="{{composerLink}}"><i class="fa fa-link"></i> 
Open in Composer</a>
                 </li>
                 <li ng-if="!yamlViewDisplayed && 
vm.isComposerOpenExpandPossible()" role="menuitem">
-                    <a ng-click="openComposer($event, true)" href="#"><i 
class="fa fa-link"></i> Open in Composer (expanded)</a>
+                    <a ng-href="{{composerLinkExpanded}}"><i class="fa 
fa-link"></i> Open in Composer (expanded)</a>
                 </li>
             </ul>
         </span>
diff --git a/ui-modules/utils/quick-launch/quick-launch.js 
b/ui-modules/utils/quick-launch/quick-launch.js
index 0659d444..71b717f8 100644
--- a/ui-modules/utils/quick-launch/quick-launch.js
+++ b/ui-modules/utils/quick-launch/quick-launch.js
@@ -108,6 +108,8 @@ export function quickLaunchDirective() {
         $scope.editorEnabled = !$scope.args.noEditButton;
         $scope.forceFormOnly = false;
         $scope.deploying = false;
+        $scope.composerLink = "#";
+        $scope.composerLinkExpanded = "#";
         $scope.model = {
             newConfigFormOpen: false,
             
@@ -125,6 +127,7 @@ export function quickLaunchDirective() {
         $scope.showEditor = showEditor;
         $scope.openComposer = openComposer;
         $scope.hideEditor = hideEditor;
+        $scope.setComposerLink = setComposerLink;
         $scope.clearError = () => { delete $scope.model.deployError; };
         $scope.transitionsShown = () => $scope.editorEnabled && 
$scope.formEnabled && !$scope.forceFormOnly;
 
@@ -374,6 +377,11 @@ export function quickLaunchDirective() {
             $scope.yamlViewDisplayed = false;
         }
 
+        function setComposerLink() {
+            $scope.composerLink = getComposerHref({ expanded:false , 
validateYaml: true });
+            $scope.composerLinkExpanded = getComposerHref({ expanded:true , 
validateYaml: true });
+        }
+
         function openComposer($event, expanded) {
             $event.preventDefault();
             if (!brBrandInfo.blueprintComposerBaseUrl) {

Reply via email to