Dropdown optional model type virtual directory
This commit is contained in:
@@ -155,10 +155,10 @@ class DirectoryDropdown {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {DirectoryItem[]} directories
|
* @param {DirectoryItem[]} directories
|
||||||
* @param {string} modelType
|
|
||||||
* @param {string} sep
|
* @param {string} sep
|
||||||
|
* @param {string} [modelType = ""]
|
||||||
*/
|
*/
|
||||||
update(directories, modelType, sep) {
|
update(directories, sep, modelType = "") {
|
||||||
const dropdown = this.element;
|
const dropdown = this.element;
|
||||||
const input = this.#input;
|
const input = this.#input;
|
||||||
const submitSearch = this.#submitSearch;
|
const submitSearch = this.#submitSearch;
|
||||||
@@ -169,15 +169,18 @@ class DirectoryDropdown {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let cwd = null;
|
let cwd = 0;
|
||||||
const root = directories[0];
|
if (modelType !== "") {
|
||||||
const rootChildIndex = root["childIndex"];
|
const root = directories[0];
|
||||||
const rootChildCount = root["childCount"];
|
const rootChildIndex = root["childIndex"];
|
||||||
for (let i = rootChildIndex; i < rootChildIndex + rootChildCount; i++) {
|
const rootChildCount = root["childCount"];
|
||||||
const modelDir = directories[i];
|
cwd = null;
|
||||||
if (modelDir["name"] === modelType) {
|
for (let i = rootChildIndex; i < rootChildIndex + rootChildCount; i++) {
|
||||||
cwd = i;
|
const modelDir = directories[i];
|
||||||
break;
|
if (modelDir["name"] === modelType) {
|
||||||
|
cwd = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1220,8 +1223,8 @@ class ModelManager extends ComfyDialog {
|
|||||||
const modelType = this.#el.modelTypeSelect.value;
|
const modelType = this.#el.modelTypeSelect.value;
|
||||||
this.#modelContentFilterDirectoryDropdown.update(
|
this.#modelContentFilterDirectoryDropdown.update(
|
||||||
this.#data.modelDirectories,
|
this.#data.modelDirectories,
|
||||||
modelType,
|
|
||||||
this.#sep,
|
this.#sep,
|
||||||
|
modelType,
|
||||||
);
|
);
|
||||||
const value = this.#el.modelContentFilter.value;
|
const value = this.#el.modelContentFilter.value;
|
||||||
this.#data.previousModelFilters[modelType] = value;
|
this.#data.previousModelFilters[modelType] = value;
|
||||||
|
|||||||
Reference in New Issue
Block a user