fixed issue with config
This commit is contained in:
@@ -54,7 +54,7 @@
|
|||||||
<button id="copyRawBtn" class="ghost" type="button">Copy Markdown</button>
|
<button id="copyRawBtn" class="ghost" type="button">Copy Markdown</button>
|
||||||
<button id="clearOutputBtn" class="ghost" type="button">Clear</button>
|
<button id="clearOutputBtn" class="ghost" type="button">Clear</button>
|
||||||
</div>
|
</div>
|
||||||
<button id="settingsBtn" class="link">Open Settings</button>
|
<button id="settingsBtn" class="link">Settings</button>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="popup.js"></script>
|
<script src="popup.js"></script>
|
||||||
|
|||||||
@@ -609,7 +609,9 @@ function updateApiConfigKeyOptions() {
|
|||||||
const keys = collectApiKeys();
|
const keys = collectApiKeys();
|
||||||
const selects = apiConfigsContainer.querySelectorAll(".api-config-key-select");
|
const selects = apiConfigsContainer.querySelectorAll(".api-config-key-select");
|
||||||
selects.forEach((select) => {
|
selects.forEach((select) => {
|
||||||
const preferred = select.dataset.preferred || select.value;
|
const preferred = select.dataset.preferred || "";
|
||||||
|
const currentValue = select.value || "";
|
||||||
|
const candidate = preferred || currentValue;
|
||||||
select.innerHTML = "";
|
select.innerHTML = "";
|
||||||
if (!keys.length) {
|
if (!keys.length) {
|
||||||
const option = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
@@ -628,13 +630,15 @@ function updateApiConfigKeyOptions() {
|
|||||||
select.appendChild(option);
|
select.appendChild(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preferred && keys.some((key) => key.id === preferred)) {
|
if (candidate && keys.some((key) => key.id === candidate)) {
|
||||||
select.value = preferred;
|
select.value = candidate;
|
||||||
|
select.dataset.preferred = candidate;
|
||||||
} else {
|
} else {
|
||||||
select.value = keys[0].id;
|
select.value = keys[0].id;
|
||||||
}
|
if (!preferred) {
|
||||||
|
|
||||||
select.dataset.preferred = select.value;
|
select.dataset.preferred = select.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -803,7 +807,9 @@ function updateTaskEnvOptions() {
|
|||||||
const envs = collectEnvConfigs();
|
const envs = collectEnvConfigs();
|
||||||
const selects = tasksContainer.querySelectorAll(".task-env-select");
|
const selects = tasksContainer.querySelectorAll(".task-env-select");
|
||||||
selects.forEach((select) => {
|
selects.forEach((select) => {
|
||||||
const preferred = select.dataset.preferred || select.value;
|
const preferred = select.dataset.preferred || "";
|
||||||
|
const currentValue = select.value || "";
|
||||||
|
const candidate = preferred || currentValue;
|
||||||
select.innerHTML = "";
|
select.innerHTML = "";
|
||||||
if (!envs.length) {
|
if (!envs.length) {
|
||||||
const option = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
@@ -822,13 +828,15 @@ function updateTaskEnvOptions() {
|
|||||||
select.appendChild(option);
|
select.appendChild(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preferred && envs.some((env) => env.id === preferred)) {
|
if (candidate && envs.some((env) => env.id === candidate)) {
|
||||||
select.value = preferred;
|
select.value = candidate;
|
||||||
|
select.dataset.preferred = candidate;
|
||||||
} else {
|
} else {
|
||||||
select.value = envs[0].id;
|
select.value = envs[0].id;
|
||||||
}
|
if (!preferred) {
|
||||||
|
|
||||||
select.dataset.preferred = select.value;
|
select.dataset.preferred = select.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
scheduleSidebarErrors();
|
scheduleSidebarErrors();
|
||||||
}
|
}
|
||||||
@@ -1034,7 +1042,9 @@ function updateTaskProfileOptions() {
|
|||||||
const profiles = collectProfiles();
|
const profiles = collectProfiles();
|
||||||
const selects = tasksContainer.querySelectorAll(".task-profile-select");
|
const selects = tasksContainer.querySelectorAll(".task-profile-select");
|
||||||
selects.forEach((select) => {
|
selects.forEach((select) => {
|
||||||
const preferred = select.dataset.preferred || select.value;
|
const preferred = select.dataset.preferred || "";
|
||||||
|
const currentValue = select.value || "";
|
||||||
|
const candidate = preferred || currentValue;
|
||||||
select.innerHTML = "";
|
select.innerHTML = "";
|
||||||
if (!profiles.length) {
|
if (!profiles.length) {
|
||||||
const option = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
@@ -1053,13 +1063,15 @@ function updateTaskProfileOptions() {
|
|||||||
select.appendChild(option);
|
select.appendChild(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preferred && profiles.some((profile) => profile.id === preferred)) {
|
if (candidate && profiles.some((profile) => profile.id === candidate)) {
|
||||||
select.value = preferred;
|
select.value = candidate;
|
||||||
|
select.dataset.preferred = candidate;
|
||||||
} else {
|
} else {
|
||||||
select.value = profiles[0].id;
|
select.value = profiles[0].id;
|
||||||
}
|
if (!preferred) {
|
||||||
|
|
||||||
select.dataset.preferred = select.value;
|
select.dataset.preferred = select.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
scheduleSidebarErrors();
|
scheduleSidebarErrors();
|
||||||
}
|
}
|
||||||
@@ -1068,7 +1080,9 @@ function updateEnvApiOptions() {
|
|||||||
const apiConfigs = collectApiConfigs();
|
const apiConfigs = collectApiConfigs();
|
||||||
const selects = envConfigsContainer.querySelectorAll(".env-config-api-select");
|
const selects = envConfigsContainer.querySelectorAll(".env-config-api-select");
|
||||||
selects.forEach((select) => {
|
selects.forEach((select) => {
|
||||||
const preferred = select.dataset.preferred || select.value;
|
const preferred = select.dataset.preferred || "";
|
||||||
|
const currentValue = select.value || "";
|
||||||
|
const candidate = preferred || currentValue;
|
||||||
select.innerHTML = "";
|
select.innerHTML = "";
|
||||||
if (!apiConfigs.length) {
|
if (!apiConfigs.length) {
|
||||||
const option = document.createElement("option");
|
const option = document.createElement("option");
|
||||||
@@ -1087,13 +1101,15 @@ function updateEnvApiOptions() {
|
|||||||
select.appendChild(option);
|
select.appendChild(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preferred && apiConfigs.some((config) => config.id === preferred)) {
|
if (candidate && apiConfigs.some((config) => config.id === candidate)) {
|
||||||
select.value = preferred;
|
select.value = candidate;
|
||||||
|
select.dataset.preferred = candidate;
|
||||||
} else {
|
} else {
|
||||||
select.value = apiConfigs[0].id;
|
select.value = apiConfigs[0].id;
|
||||||
}
|
if (!preferred) {
|
||||||
|
|
||||||
select.dataset.preferred = select.value;
|
select.dataset.preferred = select.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
updateTaskEnvOptions();
|
updateTaskEnvOptions();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user