mirror of https://github.com/jumpserver/jumpserver
Merge pull request #3359 from jumpserver/dev_fav
[Update] 优化收藏资产功能,不刷新页面的情况下,可以在收藏资产列表取消收藏pull/3358/head
commit
1bc6492064
|
@ -104,6 +104,7 @@ $(document).ready(function () {
|
|||
body: JSON.stringify({asset: assetId}),
|
||||
flash_message: false,
|
||||
success: function (data) {
|
||||
favoriteAssets.push(assetId);
|
||||
var btn = disfavorBtnTmpl.replace("ID", assetId);
|
||||
$this.replaceWith(btn)
|
||||
}
|
||||
|
@ -117,6 +118,10 @@ $(document).ready(function () {
|
|||
method: "DELETE",
|
||||
flash_message: false,
|
||||
success: function (data) {
|
||||
var index = favoriteAssets.indexOf(assetId);
|
||||
if (index !== '-1'){
|
||||
favoriteAssets.splice(index, 1);
|
||||
}
|
||||
var btn = favorBtnTmpl.replace("ID", assetId);
|
||||
$this.replaceWith(btn)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue