Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
superrain51
apollo
提交
71c4ec27
apollo
项目概览
superrain51
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
71c4ec27
编写于
5月 27, 2016
作者:
L
lepdou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
文本模式下value包含\n处理
上级
ea3563c5
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
25 addition
and
6 deletion
+25
-6
apollo-portal/src/main/resources/static/config.html
apollo-portal/src/main/resources/static/config.html
+8
-1
apollo-portal/src/main/resources/static/scripts/controller/app/ConfigNamespaceController.js
...tatic/scripts/controller/app/ConfigNamespaceController.js
+17
-5
未找到文件。
apollo-portal/src/main/resources/static/config.html
浏览文件 @
71c4ec27
...
...
@@ -213,11 +213,18 @@
</header>
<!--text view-->
<!--只读模式下的文本内容,不替换换行符-->
<textarea
class=
"form-control"
rows=
"{{namespace.itemCnt}}"
style=
"border-radius: 0px"
ng-show=
"namespace.viewType == 'text'"
ng-show=
"namespace.viewType == 'text'
&& !namespace.isTextEditing
"
ng-disabled=
"!namespace.isTextEditing"
ng-model=
"namespace.text"
ng-bind=
"namespace.text"
>
</textarea>
<!--编辑状态下的文本内容,会过滤掉换行符-->
<textarea
class=
"form-control"
rows=
"{{namespace.itemCnt}}"
style=
"border-radius: 0px"
ng-show=
"namespace.viewType == 'text' && namespace.isTextEditing"
ng-disabled=
"!namespace.isTextEditing"
ng-model=
"namespace.editText"
ng-bind=
"namespace.editText"
>
</textarea>
<!--table view-->
<div
class=
"namespace-view-table"
>
...
...
apollo-portal/src/main/resources/static/scripts/controller/app/ConfigNamespaceController.js
浏览文件 @
71c4ec27
...
...
@@ -63,7 +63,7 @@ application_module.controller("ConfigNamespaceController",
var
MAX_ROW_SIZE
=
30
;
var
APPEND_ROW_SIZE
=
8
;
//把表格内容解析成文本
function
parseModel2Text
(
namespace
)
{
function
parseModel2Text
(
namespace
,
modeType
)
{
if
(
!
namespace
.
items
)
{
return
"
无配置信息
"
;
...
...
@@ -72,8 +72,18 @@ application_module.controller("ConfigNamespaceController",
var
itemCnt
=
0
;
namespace
.
items
.
forEach
(
function
(
item
)
{
if
(
item
.
item
.
key
)
{
var
itemValue
=
item
.
item
.
value
;
if
(
modeType
==
'
edit
'
)
{
//编辑状态下替换value的换行符
if
(
item
.
item
.
value
&&
(
item
.
item
.
value
.
indexOf
(
"
\n
"
)
>
-
1
))
{
alert
(
"
警告:[
"
+
item
.
item
.
key
+
"
]的值包含换行符
\\
n,文本编辑会过滤掉换行符.
"
);
while
(
itemValue
.
indexOf
(
"
\n
"
)
>
-
1
)
{
itemValue
=
itemValue
.
replace
(
"
\n
"
,
""
);
}
}
}
result
+=
item
.
item
.
key
+
"
=
"
+
item
.
item
.
v
alue
+
"
\n
"
;
item
.
item
.
key
+
"
=
"
+
item
V
alue
+
"
\n
"
;
}
else
{
result
+=
item
.
item
.
comment
+
"
\n
"
;
}
...
...
@@ -97,7 +107,7 @@ application_module.controller("ConfigNamespaceController",
ConfigService
.
modify_items
(
$scope
.
pageContext
.
appId
,
$scope
.
pageContext
.
env
,
$scope
.
pageContext
.
clusterName
,
$scope
.
toCommitNamespace
.
namespace
.
namespaceName
,
$scope
.
toCommitNamespace
.
t
ext
,
$scope
.
toCommitNamespace
.
editT
ext
,
$scope
.
toCommitNamespace
.
namespace
.
id
,
$scope
.
commitComment
).
then
(
function
(
result
)
{
...
...
@@ -120,6 +130,8 @@ application_module.controller("ConfigNamespaceController",
if
(
namespace
.
isTextEditing
)
{
//切换为编辑状态
$scope
.
toCommitNamespace
.
commited
=
false
;
namespace
.
backupText
=
namespace
.
text
;
namespace
.
editText
=
parseModel2Text
(
namespace
,
'
edit
'
);
}
else
{
if
(
!
$scope
.
toCommitNamespace
.
commited
)
{
//取消编辑,则复原
namespace
.
text
=
namespace
.
backupText
;
...
...
@@ -234,7 +246,7 @@ application_module.controller("ConfigNamespaceController",
itemModal
.
modal
(
'
hide
'
);
$rootScope
.
refreshNamespaces
(
namespace_view_type
.
TABLE
);
},
function
(
result
)
{
AppUtil
.
errorMsg
(
result
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"
添加失败
"
);
});
}
else
if
(
$scope
.
tableViewOperType
==
TABLE_VIEW_OPER_TYPE
.
UPDATE
)
{
...
...
@@ -250,7 +262,7 @@ application_module.controller("ConfigNamespaceController",
itemModal
.
modal
(
'
hide
'
);
$rootScope
.
refreshNamespaces
(
namespace_view_type
.
TABLE
);
},
function
(
result
)
{
AppUtil
.
errorMsg
(
result
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"
更新失败
"
);
});
}
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录