You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by iu...@apache.org on 2021/04/05 10:51:31 UTC
[brooklyn-ui] branch master updated: SMART-156 Trigger required
component by 'required' constraint instead of priority
This is an automated email from the ASF dual-hosted git repository.
iuliana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git
The following commit(s) were added to refs/heads/master by this push:
new 19c94ee SMART-156 Trigger required component by 'required' constraint instead of priority
new b39c235 Merge pull request #194 from algairim/smart-156
19c94ee is described below
commit 19c94ee2f7e0625ae47f30898ff09d0cad7ad626
Author: Mykola Mandra <my...@mykolas-mbp.home>
AuthorDate: Fri Apr 2 09:32:08 2021 +0100
SMART-156 Trigger required component by 'required' constraint instead of priority
Signed-off-by: Mykola Mandra <my...@cloudsoftcorp.com>
---
ui-modules/catalog/package.json | 2 +-
ui-modules/utils/quick-launch/quick-launch.html | 8 ++++----
ui-modules/utils/quick-launch/quick-launch.js | 7 ++++++-
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/ui-modules/catalog/package.json b/ui-modules/catalog/package.json
index 30d8177..0cc35a9 100644
--- a/ui-modules/catalog/package.json
+++ b/ui-modules/catalog/package.json
@@ -40,7 +40,6 @@
"appname": "Catalog"
},
"dependencies": {
- "brooklyn-ui-utils": "file:../utils",
"angular": "^1.6.1",
"angular-animate": "^1.6.1",
"angular-cookies": "^1.6.1",
@@ -48,6 +47,7 @@
"angular-ui-bootstrap": "^2.5.0",
"angular-ui-router": "^0.3.1",
"bootstrap": "^3.3.7",
+ "brooklyn-ui-utils": "file:../utils",
"es6-promise": "^4.0.5",
"font-awesome": "^4.6.3",
"isomorphic-fetch": "^2.2.1",
diff --git a/ui-modules/utils/quick-launch/quick-launch.html b/ui-modules/utils/quick-launch/quick-launch.html
index a2a6a4c..0fd2071 100644
--- a/ui-modules/utils/quick-launch/quick-launch.html
+++ b/ui-modules/utils/quick-launch/quick-launch.html
@@ -80,7 +80,7 @@
<select class="form-control" id="{{key}}" name="{{key}}"
ng-options="s.value as s.description for s in configMap[key].possibleValues"
ng-model="entityToDeploy['brooklyn.config'][key]"
- ng-required="configMap[key].priority > 0"
+ ng-required="isRequired(configMap[key])"
ng-disabled="deploying"
auto-focus="focus === key"></select>
<small class="help-block" ng-show="deploy.$submitted || deploy[key].$touched">
@@ -89,14 +89,14 @@
</div>
<div class="form-group" ng-class="{'has-error': deploy[key].$invalid && deploy[key].$touched}" ng-switch-when="java.lang.Integer">
<label for="{{key}}">{{key}} <i ng-click="deleteConfigField(key)" class="fa fa-trash form-delete"></i></label>
- <input type="number" id="{{key}}" name="{{key}}" class="form-control" ng-model="entityToDeploy['brooklyn.config'][key]" ng-required="configMap[key].priority > 0" ng-disabled="deploying" auto-focus="focus === key" />
+ <input type="number" id="{{key}}" name="{{key}}" class="form-control" ng-model="entityToDeploy['brooklyn.config'][key]" ng-required="isRequired(configMap[key])" ng-disabled="deploying" auto-focus="focus === key" />
<small class="help-block" ng-show="deploy.$submitted || deploy[key].$touched">
<span ng-if="deploy[key].$error.required">You must enter a value</span>
</small>
</div>
<div class="form-group" ng-class="{'has-error': deploy[key].$invalid && deploy[key].$touched}" ng-switch-default>
<label for="{{key}}">{{key}} <i ng-click="deleteConfigField(key)" class="fa fa-trash form-delete"></i></label>
- <input type="text" id="{{key}}" name="{{key}}" class="form-control" ng-model="entityToDeploy['brooklyn.config'][key]" ng-required="configMap[key].priority > 0" ng-disabled="deploying" auto-focus="focus === key" />
+ <input type="text" id="{{key}}" name="{{key}}" class="form-control" ng-model="entityToDeploy['brooklyn.config'][key]" ng-required="isRequired(configMap[key])" ng-disabled="deploying" auto-focus="focus === key" />
<small class="help-block" ng-show="deploy.$submitted || deploy[key].$touched">
<span ng-if="deploy[key].$error.required">You must enter a value</span>
</small>
@@ -106,7 +106,7 @@
</section>
</form>
- <section class="quick-launch-section quick-launch-add-configuration">
+ <section class="qu5ick-launch-section quick-launch-add-configuration">
<div class="quick-launch-section-content">
<button ng-click="toggleNewConfigForm()" class="spec-add-link">Add Config</button>
diff --git a/ui-modules/utils/quick-launch/quick-launch.js b/ui-modules/utils/quick-launch/quick-launch.js
index 7f32f2c..89ea39f 100644
--- a/ui-modules/utils/quick-launch/quick-launch.js
+++ b/ui-modules/utils/quick-launch/quick-launch.js
@@ -71,6 +71,7 @@ export function quickLaunchDirective() {
$scope.openComposer = openComposer;
$scope.hideEditor = hideEditor;
$scope.clearError = clearError;
+ $scope.isRequired = isRequired;
$scope.$watch('app', () => {
$scope.clearError();
@@ -91,7 +92,7 @@ export function quickLaunchDirective() {
result[config.name] = config;
let configValue = configInPlan(parsedPlan, config.name);
- if (configValue !== '' || config.pinned || (angular.isArray(config.contraints) && config.constraints.indexOf('required') > -1 && (!config.defaultValue === undefined || config.defaultValue === ''))) {
+ if (configValue !== '' || config.pinned || (isRequired(config) && (!config.defaultValue === undefined || config.defaultValue === ''))) {
if (!$scope.entityToDeploy.hasOwnProperty(BROOKLYN_CONFIG)) {
$scope.entityToDeploy[BROOKLYN_CONFIG] = {};
}
@@ -306,6 +307,10 @@ export function quickLaunchDirective() {
function clearError() {
delete $scope.model.deployError;
}
+
+ function isRequired(config) {
+ return angular.isArray(config.contraints) && config.constraints.indexOf('required') > -1;
+ }
}
function configInPlan(parsedPlan, configName) {