diff --git a/apollo-portal/src/main/resources/static/scripts/controller/config/ConfigBaseInfoController.js b/apollo-portal/src/main/resources/static/scripts/controller/config/ConfigBaseInfoController.js index 5b749bfe30741a92a8b275b63ed90b26de5d69f8..54333d7e1aa085f311046aacf9975fbe6fabf39c 100644 --- a/apollo-portal/src/main/resources/static/scripts/controller/config/ConfigBaseInfoController.js +++ b/apollo-portal/src/main/resources/static/scripts/controller/config/ConfigBaseInfoController.js @@ -15,6 +15,7 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr if (!appId) { $window.location.href = '/index.html'; + return; } initPage(); @@ -51,6 +52,7 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr } function loadAppInfo() { + $scope.notFoundApp = true; AppService.load($rootScope.pageContext.appId).then(function (result) { $scope.notFoundApp = false; @@ -60,40 +62,40 @@ function ConfigBaseInfoController($rootScope, $scope, $window, $location, toastr loadNavTree(); recordVisitApp(); + findMissEnvs(); $(".J_appFound").removeClass("hidden"); }, function (result) { $(".J_appNotFound").removeClass("hidden"); }); + } + + $scope.createAppInMissEnv = function () { + var count = 0; + $scope.missEnvs.forEach(function (env) { + AppService.create_remote(env, $scope.appBaseInfo).then(function (result) { + toastr.success(env, '创建成功'); + count++; + if (count == $scope.missEnvs.length) { + location.reload(true); + } + }, function (result) { + toastr.error(AppUtil.errorMsg(result), '创建失败:' + env); + count++; + if (count == $scope.missEnvs.length) { + location.reload(true); + } + }); + }); + }; - ////// 补缺失的环境 ////// + function findMissEnvs() { $scope.missEnvs = []; AppService.find_miss_envs($rootScope.pageContext.appId).then(function (result) { $scope.missEnvs = AppUtil.collectData(result); - }, function (result) { - }); - $scope.createAppInMissEnv = function () { - var count = 0; - $scope.missEnvs.forEach(function (env) { - AppService.create_remote(env, $scope.appBaseInfo).then(function (result) { - toastr.success(env, '创建成功'); - count++; - if (count == $scope.missEnvs.length) { - location.reload(true); - } - }, function (result) { - toastr.error(AppUtil.errorMsg(result), '创建失败:' + env); - count++; - if (count == $scope.missEnvs.length) { - location.reload(true); - } - }); - }); - }; } - function recordVisitApp() { //save user recent visited apps var VISITED_APPS_STORAGE_KEY = "VisitedAppsV2"; diff --git a/apollo-portal/src/main/resources/static/scripts/directive/item-modal-directive.js b/apollo-portal/src/main/resources/static/scripts/directive/item-modal-directive.js index eb6fc639c282dbd4b9c5b73e311d7733011af877..cc9a8611f71ac072a0c480582812da7562c4d856 100644 --- a/apollo-portal/src/main/resources/static/scripts/directive/item-modal-directive.js +++ b/apollo-portal/src/main/resources/static/scripts/directive/item-modal-directive.js @@ -1,6 +1,6 @@ directive_module.directive('itemmodal', itemModalDirective); -function itemModalDirective(toastr, AppUtil, EventManager, ConfigService) { +function itemModalDirective(toastr, $sce, AppUtil, EventManager, ConfigService) { return { restrict: 'E', templateUrl: '../../views/component/item-modal.html', @@ -15,7 +15,6 @@ function itemModalDirective(toastr, AppUtil, EventManager, ConfigService) { }, link: function (scope) { - var TABLE_VIEW_OPER_TYPE = { CREATE: 'create', UPDATE: 'update' @@ -23,6 +22,13 @@ function itemModalDirective(toastr, AppUtil, EventManager, ConfigService) { scope.doItem = doItem; scope.collectSelectedClusters = collectSelectedClusters; + scope.showHiddenChars = showHiddenChars; + + $('#itemModal').on('show.bs.modal', function (e) { + scope.showHiddenCharsContext = false; + scope.hiddenCharCounter = 0; + scope.valueWithHiddenChars = $sce.trustAsHtml(''); + }); function doItem() { @@ -61,7 +67,6 @@ function itemModalDirective(toastr, AppUtil, EventManager, ConfigService) { namespace: scope.toOperationNamespace }); - }, function (result) { toastr.error(AppUtil.errorMsg(result), "添加失败"); scope.item.addItemBtnDisabled = false; @@ -97,7 +102,6 @@ function itemModalDirective(toastr, AppUtil, EventManager, ConfigService) { }); } - } else { if (!scope.item.comment) { @@ -114,7 +118,7 @@ function itemModalDirective(toastr, AppUtil, EventManager, ConfigService) { { namespace: scope.toOperationNamespace }); - + AppUtil.hideModal('#itemModal'); toastr.success("更新成功, 如需生效请发布"); @@ -126,9 +130,48 @@ function itemModalDirective(toastr, AppUtil, EventManager, ConfigService) { } var selectedClusters = []; + function collectSelectedClusters(data) { selectedClusters = data; } + + function showHiddenChars() { + var value = scope.item.value; + if (!value) { + return; + } + + var hiddenCharCounter = 0, valueWithHiddenChars = value; + + for (var i = 0; i < valueWithHiddenChars.length; i++) { + var c = valueWithHiddenChars[i]; + if (isHiddenChar(c)) { + valueWithHiddenChars = valueWithHiddenChars.replace(c, viewHiddenChar); + hiddenCharCounter++; + } + } + + scope.showHiddenCharsContext = true; + scope.hiddenCharCounter = hiddenCharCounter; + scope.valueWithHiddenChars = $sce.trustAsHtml(valueWithHiddenChars); + + } + + function isHiddenChar(c) { + return c == '\t' || c == '\n' || c == ' '; + } + + function viewHiddenChar(c) { + + if (c == '\t') { + return '#制表符#'; + } else if (c == '\n') { + return '#换行符#'; + } else if (c == ' ') { + return '#空格#'; + } + + } } } } diff --git a/apollo-portal/src/main/resources/static/styles/common-style.css b/apollo-portal/src/main/resources/static/styles/common-style.css index 082af3692ba5093f67d78abaf8910985ad5e455e..e745bb0e386d76bc876a7c7063e15a73fb7a410e 100644 --- a/apollo-portal/src/main/resources/static/styles/common-style.css +++ b/apollo-portal/src/main/resources/static/styles/common-style.css @@ -62,6 +62,10 @@ p, td, span { border-top: 1px solid #ddd; } +.bg-info, .bg-primary, .bg-warning, .bg-danger, .bg-success { + padding: 10px; +} + .active { background: #f5f5f5; } @@ -503,7 +507,6 @@ table th { background: url(../img/add.png) no-repeat; } - .list-group-item .icon-text { background-size: 20px; background-position: 5% 50%; diff --git a/apollo-portal/src/main/resources/static/views/component/item-modal.html b/apollo-portal/src/main/resources/static/views/component/item-modal.html index a5188e614bd6bbe91d4f2ffb02d2d870ddda07be..d09d451e1062161a8ad2d90d9d3e7dbb96958296 100644 --- a/apollo-portal/src/main/resources/static/views/component/item-modal.html +++ b/apollo-portal/src/main/resources/static/views/component/item-modal.html @@ -6,7 +6,9 @@ @@ -33,7 +35,13 @@ ng-required="true" ng-model="item.value"> + 注意: 隐藏字符(空格、换行符、制表符Tab)容易导致配置出错,如果需要检测Value中隐藏字符请点击 检测隐藏字符 +
+
无隐藏字符
+
+ +
diff --git a/apollo-portal/src/main/resources/static/views/component/namespace-panel-master-tab.html b/apollo-portal/src/main/resources/static/views/component/namespace-panel-master-tab.html index c7dddcf31d6c82f25efac020a8c89cb1b64e9bda..26da0b5fc305eb4835dbf62aabeef4f50cd86591 100644 --- a/apollo-portal/src/main/resources/static/views/component/namespace-panel-master-tab.html +++ b/apollo-portal/src/main/resources/static/views/component/namespace-panel-master-tab.html @@ -233,7 +233,8 @@ + ng-if="config.item.key" + ng-class="{'warning': !config.item.value}">