-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add per-user configurable top-level tab hiding #238
base: master
Are you sure you want to change the base?
Conversation
src/WebAPI/BasicAPIFeatures.cs
Outdated
@@ -514,6 +515,22 @@ public static async Task<JObject> SetParamEdits(Session session, JObject rawData | |||
return new JObject() { ["success"] = true }; | |||
} | |||
|
|||
public static async Task<JObject> RegisterTabs(Session session, JObject rawData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the heck are clients registering tabs for? That's... backwards. Server should define them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of this:
SwarmUI/src/Pages/Text2Image.cshtml
Lines 27 to 31 in d611e91
<a class="nav-link active translate" data-bs-toggle="tab" href="#Text2Image" id="text2imagetabbutton" aria-selected="true" role="tab">Generate</a> | |
</li> | |
@WebServer.T2ITabHeader | |
<li class="nav-item" role="presentation"> | |
<a class="nav-link translate" data-bs-toggle="tab" href="#utilities_tab" id="utilitiestabbutton" aria-selected="false" tabindex="-1" role="tab">Utilities</a> |
unless i am mistaken extensions can add arbitrary extra <li>
elements (or any html actually) to the tab list via this, and there's no server side registry of what's added - that variable is just An String. Enforcing that extensions provide some kind of ExtensionTab record rather than An String would be an API break and I ain't about to go parsing arbitrary extension-provided HTML in server side code
if i am mistaken/didn't look hard enough and this html is generated somewhere from an object rather than being arbitrary shit provided by an estension that would be great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's entirely generated, WebServer#GatherExtensionPageAdditions
generates that, and knows exactly what titles/ids are in use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well that'll teach me to go modifying an unfamiliar codebase at 1:30am.
ok lemme just. go right ahead and make this less insane
62a6666
to
d627ccc
Compare
please don't force push |
d627ccc
to
7f2adbe
Compare
well, mostly. select2 isnt playing nice
7f2adbe
to
24d4237
Compare
@mcmonkey4eva ok, 2 more force-pushes to undo the first one sry about that 😅 |
OK, made that change and un-drafted this since it's not nearly as cursed now. [edit] ignore that tiny force push i was missing two spaces |
76d9384
to
edaa9b5
Compare
} | ||
|
||
/// <summary>Register a top-level nav tab from an extension.</summary> | ||
/// <param name="ID">The tab button's <a> element ID.</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this <a>
will yield a C# xml doc error?
per Discord discussion yesterday: should swap this down to just a CSV input for now. I posted an issue #258 to track the need to replace select2 with something that doesn't suck |
Still haven't gotten to this but will attempt to in the near future 😅 |
hi fren, it's your worst nightmare, I actually did the thing! and it even accounts for dynamic/extension-added tabs!
well okay it only sort of works. by which I mean it does not work.
the magicks for dropdown popovers appear to be broken with select2's multi-select (since nothing else seems to ever actually call
makeMultiselectInput()
?) and I am not enough of a JS person to work out how to fix that. So the multiselect shows up, but it's styled wrong, and changing the selected options doesn't mark the option as altered so it's not saveable.But the hiding does work if I manipulate things in the browser debugger to pretend like the server returned a list of tab IDs to hide.
what do, how fix?