Added plugin reload

This commit is contained in:
Leon Mika 2026-09-07 22:57:44 +00:00
parent ac437b7409
commit 18604ec5a6
5 changed files with 247 additions and 36 deletions

View file

@ -12,15 +12,33 @@ export class CommandsController extends Controller {
async connect() {
this._lastCommand = null;
this._options = [];
await this._loadProcessors();
window.runtime.EventsOn("processors-changed", () => {
this._loadProcessors();
});
}
async _loadProcessors() {
let processors = await ListProcessors();
processors.forEach((processor) => {
let options = processors.map((processor) => {
let option = document.createElement("option");
option.value = processor.name;
option.text = processor.label;
this.commandSelectTarget.appendChild(option);
return option;
});
this._options = Array.from(this.commandSelectTarget.options);
this._options = options;
this.commandSelectTarget.replaceChildren(...options);
if (this._lastCommand !== null && !options.some(opt => opt.value === this._lastCommand)) {
this._lastCommand = null;
}
if (this.element.open) {
this._filterOptions(this.commandInputTarget.value);
}
}
showCommands(ev) {