Add filter to link node

This commit is contained in:
Nick O'Leary
2020-06-03 15:54:51 +01:00
parent 2ce424b567
commit 139ae547c6
6 changed files with 41 additions and 7 deletions

View File

@@ -46,17 +46,19 @@
var editorRow = $("#dialog-form>div.node-input-target-list-row");
editorRow.css("height",height+"px");
};
$("#node-input-complete-target-filter").searchBox({
var search = $("#node-input-complete-target-filter").searchBox({
style: "compact",
delay: 300,
change: function() {
var val = $(this).val().trim();
if (val === "") {
dirList.treeList("filter", null);
search.searchBox("count","");
} else {
dirList.treeList("filter", function(item) {
var count = dirList.treeList("filter", function(item) {
return item.label.indexOf(val) > -1
});
search.searchBox("count",count+" / "+candidateNodes.length);
}
}
});

View File

@@ -61,17 +61,19 @@
var editorRow = $("#dialog-form>div.node-input-target-list-row");
editorRow.css("height",height+"px");
};
$("#node-input-catch-target-filter").searchBox({
var search = $("#node-input-catch-target-filter").searchBox({
style: "compact",
delay: 300,
change: function() {
var val = $(this).val().trim();
if (val === "") {
dirList.treeList("filter", null);
search.searchBox("count","");
} else {
dirList.treeList("filter", function(item) {
var count = dirList.treeList("filter", function(item) {
return item.label.indexOf(val) > -1
});
search.searchBox("count",count+" / "+candidateNodes.length);
}
}
});

View File

@@ -49,17 +49,19 @@
var editorRow = $("#dialog-form>div.node-input-target-list-row");
editorRow.css("height",height+"px");
};
$("#node-input-status-target-filter").searchBox({
var search = $("#node-input-status-target-filter").searchBox({
style: "compact",
delay: 300,
change: function() {
var val = $(this).val().trim();
if (val === "") {
dirList.treeList("filter", null);
search.searchBox("count","");
} else {
dirList.treeList("filter", function(item) {
var count = dirList.treeList("filter", function(item) {
return item.label.indexOf(val) > -1
});
search.searchBox("count",count+" / "+candidateNodes.length);
}
}
});

View File

@@ -4,6 +4,7 @@
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div>
<div style="position:relative; height: 30px; text-align: right;"><div style="display:inline-block"><input type="text" id="node-input-link-target-filter"></div></div>
<div class="form-row node-input-link-row"></div>
</script>
<script type="text/html" data-template-name="link out">
@@ -11,6 +12,7 @@
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div>
<div style="position:relative; height: 30px; text-align: right;"><div style="display:inline-block"><input type="text" id="node-input-link-target-filter"></div></div>
<div class="form-row node-input-link-row"></div>
</script>
@@ -47,6 +49,24 @@
});
var candidateNodes = RED.nodes.filterNodes({type:targetType});
var search = $("#node-input-link-target-filter").searchBox({
style: "compact",
delay: 300,
change: function() {
var val = $(this).val().trim();
if (val === "") {
treeList.treeList("filter", null);
search.searchBox("count","");
} else {
var count = treeList.treeList("filter", function(item) {
return item.label.indexOf(val) > -1
});
search.searchBox("count",count+" / "+candidateNodes.length);
}
}
});
var flows = [];
var flowMap = {};