This is an automated email from the ASF dual-hosted git repository.
heneveld 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 52da7d3b fix bugs where some errors don't show if value is set null at
some point
52da7d3b is described below
commit 52da7d3bcbcc15b7f66b93a304f2030d8faa4ba1
Author: Alex Heneveld <[email protected]>
AuthorDate: Mon Nov 7 18:43:22 2022 +0000
fix bugs where some errors don't show if value is set null at some point
probably shouldn't be getting set to null, and if it is set to null should
show up in ui as that explicitly,
but that is a fix for another day
---
.../app/components/providers/blueprint-service.provider.js | 9 +++++----
.../app/components/spec-editor/spec-editor.directive.js | 2 ++
.../app/views/main/graphical/graphical.state.js | 3 +++
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git
a/ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js
b/ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js
index 270176bd..60c560ff 100644
---
a/ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js
+++
b/ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js
@@ -466,8 +466,9 @@ function BlueprintService($log, $q, $sce, paletteApi,
iconGenerator, dslService,
$log.warn("Unknown constraint object", typeof constraintO,
constraintO, config);
key = constraintO;
}
- let val = (k) => entity.config.get(k || config.name);
- let isSet = (k) => entity.config.has(k || config.name) &&
angular.isDefined(val(k));
+ let valExplicit = (k) => entity.config.get(k || config.name);
+ let isSet = (k) => entity.config.has(k || config.name) &&
angular.isDefined(valExplicit(k));
+ let val = (k) => isSet(k) ? entity.config.get(k ||
config.name) : config.defaultValue;
let isAnySet = (k) => {
if (!k || !Array.isArray(k)) return false;
return k.some(isSet);
@@ -477,12 +478,12 @@ function BlueprintService($log, $q, $sce, paletteApi,
iconGenerator, dslService,
switch (key) {
case 'Predicates.notNull()':
case 'Predicates.notNull':
- if (!isSet() && !hasDefault) {
+ if ((!isSet() && !hasDefault) || val()==null) {
message = `<samp>${config.name}</samp> is
required`;
}
break;
case 'required':
- if (!isSet() && !hasDefault && val()!='') {
+ if ((!isSet() && !hasDefault) || val()==null ||
val()=='') {
message = `<samp>${config.name}</samp> is
required`;
}
break;
diff --git
a/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
b/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
index 81cfd310..adc97e2e 100644
---
a/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
+++
b/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
@@ -1097,6 +1097,8 @@ export function specEditorDirective($rootScope,
$templateCache, $injector, $sani
let result = {};
for (let keyRef in localConfig) {
if (angular.isUndefined(localConfig[keyRef]) ||
localConfig[keyRef] === null || localConfig[keyRef].length < 1) {
+ // TODO if we wanted to support explicit empty strings or
null, this would be the place to tweak it,
+ // plus a few other guards on null, and forcing code mode.
continue;
}
diff --git
a/ui-modules/blueprint-composer/app/views/main/graphical/graphical.state.js
b/ui-modules/blueprint-composer/app/views/main/graphical/graphical.state.js
index d3df3d45..8383c493 100644
--- a/ui-modules/blueprint-composer/app/views/main/graphical/graphical.state.js
+++ b/ui-modules/blueprint-composer/app/views/main/graphical/graphical.state.js
@@ -53,6 +53,9 @@ function graphicalController($scope, $state, $filter,
blueprintService, paletteS
$scope.blueprint = blueprintService.get();
$scope.$watch('blueprint', () => vm.computeIssues(), true);
+ // thought these might be needed to ensure errors are set, but seems not
to be the case, above seems sufficient
+ //blueprintService.refreshBlueprintMetadata().then(()=>
vm.computeIssues());
+ //$scope.$watch('blueprint.lastUpdated', () => vm.computeIssues(), true);
this.computeIssues = () => {
$scope.allIssues = computeQuickFixes(blueprintService);