Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
d20d8a85
Commit
d20d8a85
authored
Mar 06, 2017
by
lepdou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check item value hidden chars
parent
6015c757
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
30 deletions
+87
-30
ConfigBaseInfoController.js
...tic/scripts/controller/config/ConfigBaseInfoController.js
+24
-22
item-modal-directive.js
...esources/static/scripts/directive/item-modal-directive.js
+48
-5
common-style.css
...-portal/src/main/resources/static/styles/common-style.css
+4
-1
item-modal.html
...src/main/resources/static/views/component/item-modal.html
+9
-1
namespace-panel-master-tab.html
...es/static/views/component/namespace-panel-master-tab.html
+2
-1
No files found.
apollo-portal/src/main/resources/static/scripts/controller/config/ConfigBaseInfoController.js
View file @
d20d8a85
...
...
@@ -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"
;
...
...
apollo-portal/src/main/resources/static/scripts/directive/item-modal-directive.js
View file @
d20d8a85
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
'<mark>#制表符#</mark>'
;
}
else
if
(
c
==
'
\
n'
)
{
return
'<mark>#换行符#</mark>'
;
}
else
if
(
c
==
' '
)
{
return
'<mark>#空格#</mark>'
;
}
}
}
}
}
...
...
apollo-portal/src/main/resources/static/styles/common-style.css
View file @
d20d8a85
...
...
@@ -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%
;
...
...
apollo-portal/src/main/resources/static/views/component/item-modal.html
View file @
d20d8a85
...
...
@@ -6,7 +6,9 @@
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<h4
class=
"modal-title"
>
<span
ng-show=
"item.tableViewOperType == 'create' && !toOperationNamespace.isBranch"
>
添加配置项
</span>
<span
ng-show=
"item.tableViewOperType == 'create' && !toOperationNamespace.isBranch"
>
添加配置项
<small
class=
"text-info"
>
(温馨提示: 可以通过文本模式批量添加配置)
</small>
</span>
<span
ng-show=
"item.tableViewOperType == 'create' && toOperationNamespace.isBranch"
>
添加灰度配置项
</span>
<span
ng-show=
"item.tableViewOperType == 'update'"
>
修改配置项
</span>
</h4>
...
...
@@ -33,7 +35,13 @@
ng-required=
"true"
ng-model=
"item.value"
>
</textarea>
注意: 隐藏字符(空格、换行符、制表符Tab)容易导致配置出错,如果需要检测Value中隐藏字符请点击
<a
ng-click=
"showHiddenChars()"
>
检测隐藏字符
</a>
<br>
<div
class=
"bg-info"
ng-show=
"showHiddenCharsContext && hiddenCharCounter == 0"
>
无隐藏字符
</div>
<div
class=
"bg-info"
ng-bind-html=
"valueWithHiddenChars"
ng-show=
"showHiddenCharsContext && hiddenCharCounter > 0"
></div>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
Comment
</label>
...
...
apollo-portal/src/main/resources/static/views/component/namespace-panel-master-tab.html
View file @
d20d8a85
...
...
@@ -233,7 +233,8 @@
</thead>
<tbody>
<tr
ng-repeat=
"config in namespace.viewItems |orderBy:col:desc"
ng-if=
"config.item.key"
>
ng-if=
"config.item.key"
ng-class=
"{'warning': !config.item.value}"
>
<td
width=
"8%"
class=
"text-center"
>
<span
class=
"label label-warning no-radius cursor-pointer"
ng-if=
"config.isModified"
data-tooltip=
"tooltip"
data-placement=
"bottom"
title=
"点击查看已发布的值"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment