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) {
354354 const profiles = document.getElementById('connection_profiles');
355355 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+
357364 profiles.addEventListener('change', async function () {
358365 const selectedProfile = profiles.selectedOptions[0];
359366 if (!selectedProfile) {
@@ -367,6 +374,8 @@ async function renderDetailsContent(detailsContent) {
367374 saveSettingsDebounced();
368375 await renderDetailsContent(detailsContent);
369376
377+ toggleProfileSpecificButtons();
378+
370379 // None option selected
371380 if (!profileId) {
372381 await eventSource.emit(event_types.CONNECTION_PROFILE_LOADED, NONE);