package components import ( "context" "fmt" "github.com/starfleetcptn/gomft/components/shared/toast" "github.com/starfleetcptn/gomft/internal/db" ) type StorageProvidersData struct { Providers []db.StorageProvider Error string Status string } // Main template for Storage Providers page templ StorageProviders(ctx context.Context, data StorageProvidersData) { @LayoutWithContext("Storage Providers", ctx) { @toast.Container() @toast.ShowToastJS() if data.Error != "" { } if data.Status != "" { }
if data.Error != "" { } //
if len(data.Providers) == 0 {

No storage providers

Get started by creating a new storage provider.

Create First Provider
} else { @StorageProviders_ProvidersList(data.Providers) }

Storage providers define connection details to different storage systems.

Your credentials are encrypted for security. You can test connections before using them in transfers.

Google Drive and Google Photos providers require authentication. Click the "Authenticate" button to complete setup.

Providers can be used in multiple transfer configurations. Deleting a provider will affect any transfer that uses it.

} } // Partial for just the providers-list div // Usage: @StorageProviders_ProvidersList(providers) templ StorageProviders_ProvidersList(providers []db.StorageProvider) {
} // Dialog component for confirmation dialogs for storage providers // Usage: @StorageProviderDialog(id, title, message, confirmClass, confirmText, action, providerID, providerName) templ StorageProviderDialog(id string, title string, message string, confirmClass string, confirmText string, action string, providerID uint, providerName string) { } script closeProviderModal(id string) { const modal = document.getElementById(id); const backdrop = document.getElementById(id + '-backdrop'); if (modal) { modal.classList.add('hidden'); modal.classList.remove('flex'); } if (backdrop) { backdrop.remove(); } document.body.style.overflow = ''; } script showProviderModal(id string) { const modal = document.getElementById(id); if (modal) { modal.classList.remove('hidden'); modal.classList.add('flex'); document.body.style.overflow = 'hidden'; } } script triggerProviderDelete(dialogId string, providerID uint, providerName string) { // Hide the dialog document.getElementById(dialogId).classList.add("hidden"); document.getElementById(dialogId).classList.remove("flex"); // Store data for event handlers window.lastDeletedProvider = { id: providerID, name: providerName }; window.currentlyDeletingProvider = true; }