You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2021/09/16 18:26:26 UTC
[brooklyn-ui] 05/05: tidies following PR 290
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
commit ed9096273120f3d17f260b24c86fceb1f125a83c
Author: Alex Heneveld <al...@cloudsoftcorp.com>
AuthorDate: Thu Sep 16 19:25:49 2021 +0100
tidies following PR 290
guard against null value, pass fn rather than map, and tidy names of fields
---
.../config-sensor-table/config-sensor-table.directive.js | 6 +++---
.../config-sensor-table/config-sensor-table.template.html | 2 +-
.../app/views/main/inspect/summary/summary.controller.js | 8 ++++----
.../app/views/main/inspect/summary/summary.template.html | 2 +-
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/ui-modules/app-inspector/app/components/config-sensor-table/config-sensor-table.directive.js b/ui-modules/app-inspector/app/components/config-sensor-table/config-sensor-table.directive.js
index 31948eb..fbec7c3 100644
--- a/ui-modules/app-inspector/app/components/config-sensor-table/config-sensor-table.directive.js
+++ b/ui-modules/app-inspector/app/components/config-sensor-table/config-sensor-table.directive.js
@@ -37,7 +37,7 @@ export function configSensorTableDirective(brSnackbar) {
scope: {
data: '=',
info: '=',
- configitemsunsafemap: '=',
+ checkPlaintextSensitiveKeyValue: '<',
},
link,
};
@@ -50,13 +50,13 @@ export function configSensorTableDirective(brSnackbar) {
'external provider should be used to store this value with a DSL expression supplied in the blueprint to ' +
'retrieve the value.';
- scope.$watchGroup(['data','configitemsunsafemap'], (changes)=> {
+ scope.$watchGroup(['data'], (changes)=> {
if (angular.isObject(scope.data)) {
scope.items = Object.entries(scope.data)
.map(([key, value]) => ({
key,
value,
- isUnsafe: (scope.configitemsunsafemap || {})[key],
+ isPlaintextSensitiveValue: scope.checkPlaintextSensitiveKeyValue && scope.checkPlaintextSensitiveKeyValue(key, value),
}));
}
});
diff --git a/ui-modules/app-inspector/app/components/config-sensor-table/config-sensor-table.template.html b/ui-modules/app-inspector/app/components/config-sensor-table/config-sensor-table.template.html
index 549a30b..e236bb8 100644
--- a/ui-modules/app-inspector/app/components/config-sensor-table/config-sensor-table.template.html
+++ b/ui-modules/app-inspector/app/components/config-sensor-table/config-sensor-table.template.html
@@ -42,7 +42,7 @@
<span ng-if="item.value !== null" ng-bind-html="item.value | brLinky:mapInfo[item.key]"></span>
</span>
<span class="extras">
- <i class="fa fa-exclamation-triangle warning-icon" ng-class="{invisible: !item.isUnsafe}"
+ <i class="fa fa-exclamation-triangle warning-icon" ng-class="{invisible: !item.isPlaintextSensitiveValue}"
uib-popover={{WARNING_TEXT}} popover-trigger="'mouseenter'" popover-animation="true"
popover-placement="left"
></i>
diff --git a/ui-modules/app-inspector/app/views/main/inspect/summary/summary.controller.js b/ui-modules/app-inspector/app/views/main/inspect/summary/summary.controller.js
index 643f49d..501347e 100644
--- a/ui-modules/app-inspector/app/views/main/inspect/summary/summary.controller.js
+++ b/ui-modules/app-inspector/app/views/main/inspect/summary/summary.controller.js
@@ -17,7 +17,7 @@
* under the License.
*/
import angular from "angular";
-import { map, mapValues } from "lodash";
+import map from "lodash";
import {HIDE_INTERSTITIAL_SPINNER_EVENT} from 'brooklyn-ui-utils/interstitial-spinner/interstitial-spinner';
import template from "./summary.template.html";
import { isSensitiveFieldName } from 'brooklyn-ui-utils/sensitive-field/sensitive-field';
@@ -87,6 +87,9 @@ export function summaryController($scope, $state, $stateParams, $q, $http, $http
return entityApi.entityConfigInfo(applicationId, entityId);
}
+ vm.checkPlaintextSensitiveKeyValue = (key,value) =>
+ key && vm.config && vm.config[key] && isSensitiveFieldName(key) && !vm.config[key].toString().startsWith('$brooklyn:');
+
// no return
vm.refreshConfig = () => {
const handleError = (message) => {
@@ -102,9 +105,6 @@ export function summaryController($scope, $state, $stateParams, $q, $http, $http
// TODO: ideally move this to a $watch block
if (vm.config && vm.configResolved && vm.configInfo) {
vm.configItems = vm.showResolvedConfig ? vm.configResolved : vm.config;
- vm.configItemsUnsafeMap = mapValues(vm.configItems, (value, key) =>
- isSensitiveFieldName(key.trim()) && !vm.config[key].toString().startsWith('$brooklyn:')
- );
}
}
diff --git a/ui-modules/app-inspector/app/views/main/inspect/summary/summary.template.html b/ui-modules/app-inspector/app/views/main/inspect/summary/summary.template.html
index 9427117..3f218f7 100644
--- a/ui-modules/app-inspector/app/views/main/inspect/summary/summary.template.html
+++ b/ui-modules/app-inspector/app/views/main/inspect/summary/summary.template.html
@@ -189,7 +189,7 @@
<loading-state error="vm.error.configItems" ng-if="!vm.configItems"></loading-state>
<config-sensor-table ng-if="vm.configItems"
data="vm.configItems" info="vm.configInfo"
- configitemsunsafemap="vm.configItemsUnsafeMap"
+ check-plaintext-sensitive-key-value="vm.checkPlaintextSensitiveKeyValue"
></config-sensor-table>
</div>
<div class="table-option-footer">