Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
superrain51
apollo
提交
174a4c75
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,体验更适合开发者的 AI 搜索 >>
提交
174a4c75
编写于
10月 12, 2016
作者:
Z
zhangle
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bugfix:add illegal appId to visited app list
上级
4edcb169
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
42 deletion
+43
-42
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/FavoriteRepository.java
...ramework/apollo/portal/repository/FavoriteRepository.java
+1
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/FavoriteService.java
...trip/framework/apollo/portal/service/FavoriteService.java
+1
-1
apollo-portal/src/main/resources/static/scripts/controller/config/ConfigBaseInfoController.js
...tic/scripts/controller/config/ConfigBaseInfoController.js
+41
-40
未找到文件。
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/FavoriteRepository.java
浏览文件 @
174a4c75
...
...
@@ -13,7 +13,7 @@ public interface FavoriteRepository extends PagingAndSortingRepository<Favorite,
List
<
Favorite
>
findByAppIdOrderByPositionAscDataChangeCreatedTimeAsc
(
String
appId
,
Pageable
page
);
Favorite
findFirst
1
ByUserIdOrderByPositionAscDataChangeCreatedTimeAsc
(
String
userId
);
Favorite
findFirstByUserIdOrderByPositionAscDataChangeCreatedTimeAsc
(
String
userId
);
Favorite
findByUserIdAndAppId
(
String
userId
,
String
appId
);
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/FavoriteService.java
浏览文件 @
174a4c75
...
...
@@ -91,7 +91,7 @@ public class FavoriteService {
checkUserOperatePermission
(
favorite
);
String
userId
=
favorite
.
getUserId
();
Favorite
firstFavorite
=
favoriteRepository
.
findFirst
1
ByUserIdOrderByPositionAscDataChangeCreatedTimeAsc
(
userId
);
Favorite
firstFavorite
=
favoriteRepository
.
findFirstByUserIdOrderByPositionAscDataChangeCreatedTimeAsc
(
userId
);
long
minPosition
=
firstFavorite
.
getPosition
();
favorite
.
setPosition
(
minPosition
-
1
);
...
...
apollo-portal/src/main/resources/static/scripts/controller/config/ConfigBaseInfoController.js
浏览文件 @
174a4c75
...
...
@@ -25,50 +25,15 @@ function ConfigBaseInfoController($rootScope, $scope, $location, toastr, UserSer
UserService
.
load_user
().
then
(
function
(
result
)
{
$rootScope
.
pageContext
.
userId
=
result
.
userId
;
loadAppInfo
();
handleFavorite
();
recordVisitApp
();
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
"
获取用户登录信息失败
"
);
});
loadAppInfo
();
handlePermission
();
}
function
recordVisitApp
()
{
//save user recent visited apps
var
VISITED_APPS_STORAGE_KEY
=
"
VisitedAppsV2
"
;
var
visitedAppsObject
=
JSON
.
parse
(
localStorage
.
getItem
(
VISITED_APPS_STORAGE_KEY
));
var
hasSaved
=
false
;
if
(
visitedAppsObject
)
{
var
visitedApps
=
visitedAppsObject
[
$rootScope
.
pageContext
.
userId
];
if
(
visitedApps
&&
visitedApps
.
length
>
0
){
visitedApps
.
forEach
(
function
(
app
)
{
if
(
app
==
appId
)
{
hasSaved
=
true
;
return
;
}
});
}
}
else
{
visitedAppsObject
=
{};
visitedAppsObject
[
$rootScope
.
pageContext
.
userId
]
=
[];
}
var
currentUserVisitedApps
=
visitedAppsObject
[
$rootScope
.
pageContext
.
userId
];
if
(
!
hasSaved
)
{
//if queue's length bigger than 6 will remove oldest app
if
(
currentUserVisitedApps
.
length
>=
6
){
currentUserVisitedApps
.
splice
(
0
,
1
);
}
currentUserVisitedApps
.
push
(
$rootScope
.
pageContext
.
appId
);
localStorage
.
setItem
(
VISITED_APPS_STORAGE_KEY
,
JSON
.
stringify
(
visitedAppsObject
));
}
}
function
loadAppInfo
()
{
$scope
.
notFoundApp
=
true
;
AppService
.
load
(
$rootScope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
...
...
@@ -78,6 +43,7 @@ function ConfigBaseInfoController($rootScope, $scope, $location, toastr, UserSer
$scope
.
appBaseInfo
.
orgInfo
=
result
.
orgName
+
'
(
'
+
result
.
orgId
+
'
)
'
;
loadNavTree
();
recordVisitApp
();
$
(
"
.J_appFound
"
).
removeClass
(
"
hidden
"
);
},
function
(
result
)
{
...
...
@@ -112,6 +78,41 @@ function ConfigBaseInfoController($rootScope, $scope, $location, toastr, UserSer
};
}
function
recordVisitApp
()
{
//save user recent visited apps
var
VISITED_APPS_STORAGE_KEY
=
"
VisitedAppsV2
"
;
var
visitedAppsObject
=
JSON
.
parse
(
localStorage
.
getItem
(
VISITED_APPS_STORAGE_KEY
));
var
hasSaved
=
false
;
if
(
visitedAppsObject
)
{
var
visitedApps
=
visitedAppsObject
[
$rootScope
.
pageContext
.
userId
];
if
(
visitedApps
&&
visitedApps
.
length
>
0
)
{
visitedApps
.
forEach
(
function
(
app
)
{
if
(
app
==
appId
)
{
hasSaved
=
true
;
return
;
}
});
}
}
else
{
visitedAppsObject
=
{};
visitedAppsObject
[
$rootScope
.
pageContext
.
userId
]
=
[];
}
var
currentUserVisitedApps
=
visitedAppsObject
[
$rootScope
.
pageContext
.
userId
];
if
(
!
hasSaved
)
{
//if queue's length bigger than 6 will remove oldest app
if
(
currentUserVisitedApps
.
length
>=
6
)
{
currentUserVisitedApps
.
splice
(
0
,
1
);
}
currentUserVisitedApps
.
push
(
$rootScope
.
pageContext
.
appId
);
localStorage
.
setItem
(
VISITED_APPS_STORAGE_KEY
,
JSON
.
stringify
(
visitedAppsObject
));
}
}
function
loadNavTree
()
{
AppService
.
load_nav_tree
(
$rootScope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
var
navTree
=
[];
...
...
@@ -152,7 +153,7 @@ function ConfigBaseInfoController($rootScope, $scope, $location, toastr, UserSer
//default selection from session storage or first env & first cluster
if
(
$rootScope
.
pageContext
.
env
==
env
.
env
&&
$rootScope
.
pageContext
.
clusterName
==
cluster
.
name
)
{
==
cluster
.
name
)
{
clusterNode
.
state
=
{};
clusterNode
.
state
.
selected
=
true
;
}
...
...
@@ -227,7 +228,7 @@ function ConfigBaseInfoController($rootScope, $scope, $location, toastr, UserSer
function
handleFavorite
()
{
FavoriteService
.
findFavorites
(
$rootScope
.
pageContext
.
userId
,
$rootScope
.
pageContext
.
appId
)
$rootScope
.
pageContext
.
appId
)
.
then
(
function
(
result
)
{
if
(
result
&&
result
.
length
)
{
$scope
.
favoriteId
=
result
[
0
].
id
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录