Skip to content

Commit

Permalink
Fix model type select sorting.
Browse files Browse the repository at this point in the history
- Remove duplicate logic in url search.
  • Loading branch information
cdb-boop committed Sep 6, 2024
1 parent 92f8c63 commit eeb6391
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions web/model-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2036,10 +2036,11 @@ class ModelGrid {
}

let modelTypeOptions = [];
for (const [key, value] of Object.entries(models)) {
for (const key of Object.keys(models)) {
const el = $el("option", [key]);
modelTypeOptions.push(el);
}
modelTypeOptions.sort((a, b) => a.innerText.localeCompare(b.innerText, undefined, {sensitivity: 'base'}));
modelSelect.innerHTML = "";
modelTypeOptions.forEach(option => modelSelect.add(option));
modelSelect.value = modelType;
Expand Down Expand Up @@ -3280,9 +3281,6 @@ class DownloadView {
/** @type {HTMLButtonElement} */ clearSearchButton: null,
};

/** @type {DOMParser} */
#domParser = null;

/** @type {Object.<string, HTMLElement>} */
#settings = null;

Expand All @@ -3295,7 +3293,6 @@ class DownloadView {
* @param {() => Promise<void>} updateModels
*/
constructor(modelData, settings, updateModels) {
this.#domParser = new DOMParser();
this.#updateModels = updateModels;
const update = async() => { await this.#update(modelData, settings); };
const reset = () => {
Expand Down Expand Up @@ -3360,12 +3357,7 @@ class DownloadView {
onkeydown: async (e) => {
if (e.key === "Enter") {
e.stopPropagation();
if (this.elements.url.value === "") {
reset();
}
else {
await update();
}
searchButton.click();
e.target.blur();
}
},
Expand Down

0 comments on commit eeb6391

Please sign in to comment.