Added importing of configurations exported from AI Studio (#1007)

Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
Peer HogeterpandThorsten Sommer authored and GitHub committed 2026-10-16 17:22:23 +02:00
1 parent f8c0232cfd
commit 22065783c2
49 files changed
+3257 -263

No files matched your search

@@ -185,6 +185,37 @@ public partial class DataSourceManagement : MSGComponentBase
await this.MessageBus.SendMessage<bool>(this, Event.CONFIGURATION_CHANGED);
}
private async Task ImportERIDataSource()
{
var import = await ConfigurationSnippetImportDialog.ShowAsync(this.DialogService, PluginConfigurationObjectType.DATA_SOURCE, T("Import Data Source"));
if (import?.ConfigurationObject is not DataSourceERI_V1 dataSource)
return;
var eriDialogParameters = new DialogParameters<DataSourceERI_V1Dialog>
{
{ x => x.IsEditing, false },
{ x => x.IsImport, true },
{ x => x.DataSource, dataSource },
{ x => x.ImportedSecret, import.Secret },
};
var eriDialogReference = await this.DialogService.ShowAsync<DataSourceERI_V1Dialog>(T("Add ERI v1 Data Source"), eriDialogParameters, DialogOptions.FULLSCREEN);
var eriDialogResult = await eriDialogReference.Result;
if (eriDialogResult is null || eriDialogResult.Canceled)
return;
//
// An organization can lock the import while the user is still filling in the form, e.g.,
// with a new version of its configuration plugin. Hence, the permission is checked once
// more before the imported data source is stored:
//
if (!this.SettingsManager.ConfigurationData.App.CanImportConfigurationSnippet(PluginConfigurationObjectType.DATA_SOURCE))
return;
var eriDataSource = (DataSourceERI_V1)eriDialogResult.Data!;
await this.StoreAddedDataSource(eriDataSource with { Num = this.SettingsManager.ConfigurationData.NextDataSourceNum++ });
}
private async Task AddDataSource(DataSourceType type)
{
IDataSource? addedDataSource = null;
@@ -244,6 +275,11 @@ public partial class DataSourceManagement : MSGComponentBase
if(addedDataSource is null)
return;
await this.StoreAddedDataSource(addedDataSource);
}
private async Task StoreAddedDataSource(IDataSource addedDataSource)
{
this.SettingsManager.ConfigurationData.DataSources.Add(addedDataSource);
await this.SettingsManager.StoreSettings();
await this.DataSourceEmbeddingService.QueueDataSourceAsync(addedDataSource);
@@ -616,4 +652,4 @@ public partial class DataSourceManagement : MSGComponentBase
break;
}
}
}
}