Skip to main content
Component Name: AdminSettings.razor
Version: 1.0.0
Admin Settings Screenshot

Dependencies

Services:
AdminSettingsService, UserService, SermonCollectionService, Snackbar

Variables

Variable NameTypeDescription
_appLogoSrcstring?Relative URL of the app’s logo
_appNamestring?Custom name for the app
_deploymentNamestring?Name of deployed model in Azure Open AI; used app-wide for generative AI queries
_missionStatementstring?Mission statement branding for the AI workspace
_uploadPermissionsGroupIdstring?Guid of the general upload permissions group
_openingPromptsList<string>?List of opening prompts displayed on Sermon Search start screen
_openingPromptIdsList<string>?List of sermon collection identifiers associated with _openingPrompts
_publicSermonCollectionsIEnumerable<SermonCollection>List of publicly accessible sermon collections (selectable for opening prompts)

Lifecycle Methods

protected override async Task OnInitializedAsync()
{
    if ( AdminSettingsService.CurrentAdminSettings != null )
    {
        _appLogoSrc = AdminSettingsService.CurrentAdminSettings.AppLogoSrc;
        _appName = AdminSettingsService.CurrentAdminSettings.AppName;
        _deploymentName = AdminSettingsService.CurrentAdminSettings.DeploymentName;
        _missionStatement = AdminSettingsService.CurrentAdminSettings.MissionStatement;
        _uploadPermissionsGroupId = AdminSettingsService.CurrentAdminSettings.UploadPermissionsGroupId;
        _openingPrompts = AdminSettingsService.CurrentAdminSettings.OpeningPrompts;
        _openingPromptIds = AdminSettingsService.CurrentAdminSettings.OpeningPromptIds;
        await UserService.InitializeCurrentUserAsync();

        if ( UserService.CurrentUser != null )
        {
            _publicSermonCollections = await SermonCollectionService.GetAllPublicSermonCollectionsAsync();
        }
    }
    else
    {
        await AdminSettingsService.InitializeCurrentAdminSettingsAsync();
        await OnInitializedAsync();
    }
}

Runtime Methods

UploadAppLogo(IBrowserFile)

Handles file picking, uploading, & storing the relative URL of a new app logo.
private async Task UploadAppLogo( IBrowserFile file )

RemoveOpeningPrompt(int)

Removes a Sermon Search opening prompt at a specified index in _openingPrompts
private void RemoveOpeningPrompt( int index )

AddOpeningPrompt()

Adds a Sermon Search opening prompt at the end of _openingPrompts
private void AddOpeningPrompt()

SaveSettings()

Uses AdminSettingsService to save all admin settings in Azure Cosmos DB, as they are currently set.
private async void SaveSettings()