implement apply style

This commit is contained in:
Vladimir Mandic
2023-10-12 11:00:27 -04:00
parent 59b51cddf2
commit e2e6648bdb
7 changed files with 14 additions and 7 deletions
+6 -1
View File
@@ -20,7 +20,10 @@ const getENActiveTab = () => gradioApp().getElementById('tab_txt2img').style.dis
const getENActivePage = () => {
const tabname = getENActiveTab();
const page = gradioApp().querySelector(`#${tabname}_extra_networks > .tabs > .tab-nav > .selected`);
return page ? page.innerText : '';
const pageName = page ? page.innerText : '';
const btnApply = gradioApp().getElementById(`${tabname}_extra_apply`);
if (btnApply) btnApply.style.display = pageName === 'Style' ? 'inline-flex' : 'none';
return pageName;
};
const setENState = (state) => {
@@ -193,10 +196,12 @@ function setupExtraNetworksForTab(tabname) {
const btnSave = gradioApp().getElementById(`${tabname}_extra_save`);
const btnClose = gradioApp().getElementById(`${tabname}_extra_close`);
const btnModel = gradioApp().getElementById(`${tabname}_extra_model`);
const btnApply = gradioApp().getElementById(`${tabname}_extra_apply`);
const buttons = document.createElement('span');
buttons.classList.add('buttons');
if (btnRefresh) buttons.appendChild(btnRefresh);
if (btnModel) buttons.appendChild(btnModel);
if (btnApply) buttons.appendChild(btnApply);
if (btnScan) buttons.appendChild(btnScan);
if (btnSave) buttons.appendChild(btnSave);
if (btnClose) buttons.appendChild(btnClose);
-2
View File
@@ -5,14 +5,12 @@ let nvmlTable = null;
async function updateNVML() {
try {
const res = await fetch('/sdapi/v1/nvml');
console.log('HERE1', res);
if (!res.ok) {
clearInterval(nvmlInterval);
nvmlEl.style.display = 'none';
return;
}
const data = await res.json();
console.log('HERE2', data);
if (!data) {
clearInterval(nvmlInterval);
nvmlEl.style.display = 'none';
+1
View File
@@ -181,6 +181,7 @@ table.settings-value-table td { padding: 0.4em; border: 1px solid #ccc; max-widt
.extra-networks .description { flex: 3; }
.extra-networks .tab-nav > button { margin-right: 0; height: 24px; padding: 2px 4px 2px 4px; }
.extra-networks .buttons { position: absolute; right: 0; margin: -4px; background: var(--background-color); }
.extra-networks .buttons>button { height: 1.2em; margin-top: var(--spacing-md); }
.extra-networks .custom-button { width: 120px; width: 100%; background: none; justify-content: left; text-align: left; padding: 2px 8px 2px 16px; text-indent: -8px; box-shadow: none; line-break: auto; }
.extra-networks .custom-button:hover { background: var(--button-primary-background-fill) }
.extra-networks-tab { padding: 0 !important; }