mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Disable buttons on <None> option
This commit is contained in:
@ -354,6 +354,13 @@ async function renderDetailsContent(detailsContent) {
|
|||||||
const profiles = document.getElementById('connection_profiles');
|
const profiles = document.getElementById('connection_profiles');
|
||||||
renderConnectionProfiles(profiles);
|
renderConnectionProfiles(profiles);
|
||||||
|
|
||||||
|
function toggleProfileSpecificButtons() {
|
||||||
|
const profileId = extension_settings.connectionManager.selectedProfile;
|
||||||
|
const profileSpecificButtons = ['update_connection_profile', 'reload_connection_profile', 'delete_connection_profile'];
|
||||||
|
profileSpecificButtons.forEach(id => document.getElementById(id).classList.toggle('disabled', !profileId));
|
||||||
|
}
|
||||||
|
toggleProfileSpecificButtons();
|
||||||
|
|
||||||
profiles.addEventListener('change', async function () {
|
profiles.addEventListener('change', async function () {
|
||||||
const selectedProfile = profiles.selectedOptions[0];
|
const selectedProfile = profiles.selectedOptions[0];
|
||||||
if (!selectedProfile) {
|
if (!selectedProfile) {
|
||||||
@ -367,6 +374,8 @@ async function renderDetailsContent(detailsContent) {
|
|||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
await renderDetailsContent(detailsContent);
|
await renderDetailsContent(detailsContent);
|
||||||
|
|
||||||
|
toggleProfileSpecificButtons();
|
||||||
|
|
||||||
// None option selected
|
// None option selected
|
||||||
if (!profileId) {
|
if (!profileId) {
|
||||||
await eventSource.emit(event_types.CONNECTION_PROFILE_LOADED, NONE);
|
await eventSource.emit(event_types.CONNECTION_PROFILE_LOADED, NONE);
|
||||||
|
Reference in New Issue
Block a user