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.
diff --git a/ui-modules/utils/quick-launch/quick-launch.html b/ui-modules/utils/quick-launch/quick-launch.html
index ffa14b4..4733fbf 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 0659d44..3db4b0d 100644
--- a/ui-modules/utils/quick-launch/quick-launch.js
+++ b/ui-modules/utils/quick-launch/quick-launch.js
@@ -108,6 +108,8 @@
$scope.editorEnabled = !$scope.args.noEditButton;
$scope.forceFormOnly = false;
$scope.deploying = false;
+ $scope.composerLink = "#";
+ $scope.composerLinkExpanded = "#";
$scope.model = {
newConfigFormOpen: false,
@@ -123,8 +125,8 @@
$scope.deleteConfigField = deleteConfigField;
$scope.deployApp = deployApp;
$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,29 +376,9 @@
$scope.yamlViewDisplayed = false;
}
- function openComposer($event, expanded) {
- $event.preventDefault();
- if (!brBrandInfo.blueprintComposerBaseUrl) {
- console.warn("Composer unavailable in this build");
- return;
- }
- Promise.resolve(quickLaunch.getComposerHref({ expanded, validateYaml: true }))
- .then(href => {
- window.location.href = href;
- })
- .catch((error) => {
- console.warn("Opening composer in YAML text editor mode because we cannot generate a model for this configuration:", error);
- Promise.resolve(quickLaunch.getComposerHref({
- expanded, yamlEditor: true, validateYaml: false,
- yamlPrefix:
- "# This plan may have items which require attention so is being opened in YAML text editor mode.\n"+
- "# The YAML was autogenerated by merging the plan with any values provided in UI, but issues were\n"+
- "# detected that mean it might not be correct. Please check the blueprint below carefully.\n"+
- "\n" }))
- .then(query => {
- window.location.href = href;
- })
- })
+ function setComposerLink() {
+ $scope.composerLink = getComposerHref({ expanded:false , validateYaml: true });
+ $scope.composerLinkExpanded = getComposerHref({ expanded:true , validateYaml: true });
}
function getPlanObject({expanded, validateYaml=true}) {