Disable buttons on <None> option

c7650576845dca33ee3e4ef2beb44e0ad635f6c0

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +9 -0Showing whitespace changes
public/scripts/extensions/connection-manager/index.js+9 -0
@@ -354,6 +354,13 @@ async function renderDetailsContent(detailsContent) {
354 const profiles = document.getElementById('connection_profiles');354 const profiles = document.getElementById('connection_profiles');
355 renderConnectionProfiles(profiles);355 renderConnectionProfiles(profiles);
356356
357 function toggleProfileSpecificButtons() {
358 const profileId = extension_settings.connectionManager.selectedProfile;
359 const profileSpecificButtons = ['update_connection_profile', 'reload_connection_profile', 'delete_connection_profile'];
360 profileSpecificButtons.forEach(id => document.getElementById(id).classList.toggle('disabled', !profileId));
361 }
362 toggleProfileSpecificButtons();
363
357 profiles.addEventListener('change', async function () {364 profiles.addEventListener('change', async function () {
358 const selectedProfile = profiles.selectedOptions[0];365 const selectedProfile = profiles.selectedOptions[0];
359 if (!selectedProfile) {366 if (!selectedProfile) {
@@ -367,6 +374,8 @@ async function renderDetailsContent(detailsContent) {
367 saveSettingsDebounced();374 saveSettingsDebounced();
368 await renderDetailsContent(detailsContent);375 await renderDetailsContent(detailsContent);
369376
377 toggleProfileSpecificButtons();
378
370 // None option selected379 // None option selected
371 if (!profileId) {380 if (!profileId) {
372 await eventSource.emit(event_types.CONNECTION_PROFILE_LOADED, NONE);381 await eventSource.emit(event_types.CONNECTION_PROFILE_LOADED, NONE);