Skip to content

Commit

Permalink
Merge 9bf177d into d413cbc
Browse files Browse the repository at this point in the history
  • Loading branch information
hcmfys committed Jan 29, 2019
2 parents d413cbc + 9bf177d commit 668258f
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
56 changes: 56 additions & 0 deletions disconf-web/html/assets/js/mainList.js
Expand Up @@ -29,6 +29,7 @@
+ '</a></li>';
});
$("#applist").html(html);
doAutoComplete();
}
});
$("#applist").on('click', 'li a', function (e) {
Expand Down Expand Up @@ -408,4 +409,59 @@
fetchZkDeploy();
});

/*
添加自动完成查询功能
*/
function doAutoComplete() {

var txtList = [];
var relList = {};
lst = $("a[rel]");

var j = 0;
var myUi;
for (var i = 0; i < lst.length; i++) {

var ele = lst[i];
var rel = ele.rel;
var text = ele.text;
if (rel) {
var t = text.replace("APP: ", "");
txtList[j] = t;
relList[t] = rel;
j++;
}
}


$("#appAutoList").autocomplete({
minLength:0,
source: txtList,
select: function (event, ui) {
myUi = ui;
if (ui.item) {
var stext = ui.item.label;
//console.log("data=" + stext);
var relId = relList[stext];
if (relId) {
//console.log("relId=" + relId);
appId = relId;
$("#app_info").html(", " + stext);
$("#appDropdownMenuTitle").text(stext);
version = "#";
fetchVersion(appId, envId);
}
}

}
});

$("#appAutoList").dblclick(function () {
$("#appAutoList").val("");
});

}



})(jQuery);
3 changes: 3 additions & 0 deletions disconf-web/html/main.html
Expand Up @@ -94,6 +94,9 @@
<div class="row-fluid" style="min-height:400px;">
<div class="sidebar span2" style="float:left;overflow:visible;">

<label style="color: red"> 请输入查询:</label><br/>
<input type="text" id="appAutoList" style="width: 120px;height: 36px;" /> <br/>

<div class="dropdown" style="margin-top:20px;width:100%">
<button class="btn btn-default dropdown-toggle" type="button" id="appDropdownMenu" data-toggle="dropdown" style="width:100%;">
<span id="appDropdownMenuTitle">Apps</span>
Expand Down

0 comments on commit 668258f

Please sign in to comment.