diff --git a/Relativity.Export.Samples.RelConsole/Helpers/OutputHelper.cs b/Relativity.Export.Samples.RelConsole/Helpers/OutputHelper.cs index c24e2b0..37fa397 100644 --- a/Relativity.Export.Samples.RelConsole/Helpers/OutputHelper.cs +++ b/Relativity.Export.Samples.RelConsole/Helpers/OutputHelper.cs @@ -1,10 +1,6 @@ using System.Reflection; -using System.Text.Json; using Relativity.Export.Samples.RelConsole.SampleCollection; -using Relativity.Export.V1.Model; -using Relativity.Export.V1.Model.ExportJobSettings; using Spectre.Console; -using Spectre.Console.Json; using Spectre.Console.Rendering; namespace Relativity.Export.Samples.RelConsole.Helpers; @@ -35,11 +31,11 @@ public static async Task StartAsync(string[] args, string relativityUrl, string var samplesPanel = GetSamplesPanel(samples); var metadataPanel = GetSampleMetadataPanel(samples.FirstOrDefault(s => s.ID == selectedSampleId)); - Columns[] dataColumns = new Columns[] - { + Columns[] dataColumns = + [ new Columns(samplesPanel), new Columns(metadataPanel) - }; + ]; PrintRelativityLogo(); AnsiConsole.Write(new Columns(dataColumns)); @@ -139,16 +135,28 @@ private static List GetSamples(int selectedSampleId) .Where(method => method.GetCustomAttributes(typeof(SampleMetadataAttribute), false).Length > 0) .ToArray(); - foreach (var method in sampleMethods) + var samplesMetadataAttribute = sampleMethods.Select(m => m.GetCustomAttribute()) + .OrderBy(x => x?.Name) + .ToArray(); + + for (int i = 0; i < samplesMetadataAttribute.Length; i++) { - var typeMeta = method.GetCustomAttribute(); + var data = samplesMetadataAttribute[i]; + + // Sample ID is 1-based + // Automatically assigned to the sample based on alphabetical order of samples names + var sampleID = i + 1; - if (typeMeta is null) + if (data is null) continue; - samples.Add(new SampleMetadata(typeMeta.ID, typeMeta.Name, typeMeta.Description ?? "No description", typeMeta.ID == selectedSampleId)); + var sampleMetadata = new SampleMetadata(ID: sampleID, + data.Name, + !string.IsNullOrEmpty(data.Description) ? data.Description : "No description", + sampleID == selectedSampleId); // is sample currently selected - _sampleRunner.Add(typeMeta.ID, method); + samples.Add(sampleMetadata); + _sampleRunner.Add(i + 1, sampleMethods[i]); } return samples; diff --git a/Relativity.Export.Samples.RelConsole/Helpers/SampleMetadata.cs b/Relativity.Export.Samples.RelConsole/Helpers/SampleMetadata.cs index 4012fa9..d7c6191 100644 --- a/Relativity.Export.Samples.RelConsole/Helpers/SampleMetadata.cs +++ b/Relativity.Export.Samples.RelConsole/Helpers/SampleMetadata.cs @@ -3,13 +3,11 @@ [System.AttributeUsage(System.AttributeTargets.Method)] public class SampleMetadataAttribute : System.Attribute { - public int ID { get; set; } public string Name { get; set; } = default!; public string? Description { get; set; } = default!; - public SampleMetadataAttribute(int id, string name, string description) + public SampleMetadataAttribute(string name, string description) { - ID = id; Name = name; Description = description; } diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_All.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_All.cs index 3a313b2..d748463 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_All.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_All.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(5, nameof(Export_FromFolder_All), "Exports native, fulltext, images and PDF files from folder")] + [SampleMetadata(nameof(Export_FromFolder_All), "Exports native, fulltext, images and PDF files from folder")] public async Task Export_FromFolder_All() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_All_With_DataSource_Name_In_Loadfile.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_All_With_DataSource_Name_In_Loadfile.cs index 1756644..73c38e1 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_All_With_DataSource_Name_In_Loadfile.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_All_With_DataSource_Name_In_Loadfile.cs @@ -6,8 +6,8 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(21, nameof(Export_Folder_All_With_DataSource_Name_In_Loadfile), "Exports native, fulltext, images and PDF files from folder. Exported laodfiles names contians DataSource name and date.")] - public async Task Export_Folder_All_With_DataSource_Name_In_Loadfile() + [SampleMetadata(nameof(Export_FromFolder_All_With_DataSource_Name_In_Loadfile), "Exports native, fulltext, images and PDF files from folder. Exported laodfiles names contians DataSource name and date.")] + public async Task Export_FromFolder_All_With_DataSource_Name_In_Loadfile() { // Your workspace ID. // This is where we point to the workspace where we want to export from. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_FullText.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_FullText.cs index 12a5c0f..b1407a9 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_FullText.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_FullText.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(4, nameof(Export_FromFolder_FullText), "Exports Fulltext from folder")] + [SampleMetadata(nameof(Export_FromFolder_FullText), "Exports Fulltext from folder")] public async Task Export_FromFolder_FullText() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_Images.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_Images.cs index 7e62428..6e93599 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_Images.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_Images.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(2, nameof(Export_FromFolder_Images), "Exports images from folder")] + [SampleMetadata(nameof(Export_FromFolder_Images), "Exports images from folder")] public async Task Export_FromFolder_Images() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_NativeFiles.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_NativeFiles.cs index d55e47d..a3da40f 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_NativeFiles.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_NativeFiles.cs @@ -1,4 +1,3 @@ -using System; using Relativity.Export.Samples.RelConsole.Helpers; using Relativity.Export.V1.Builders.ExportSettings; using Relativity.Export.V1.Model.ExportJobSettings; @@ -7,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(1, nameof(Export_FromFolder_NativeFiles), "Exports native files from folder")] + [SampleMetadata(nameof(Export_FromFolder_NativeFiles), "Exports native files from folder")] public async Task Export_FromFolder_NativeFiles() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_PDF.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_PDF.cs index 7e66bfa..0e20952 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_PDF.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Folder_PDF.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(3, nameof(Export_FromFolder_PDF), "Exports PDF files from folder")] + [SampleMetadata(nameof(Export_FromFolder_PDF), "Exports PDF files from folder")] public async Task Export_FromFolder_PDF() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_All.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_All.cs index 3aef206..ae0e51f 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_All.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_All.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(15, nameof(Export_FromProduction_All), "Exports native, fulltext, images and PDF files from production set")] + [SampleMetadata(nameof(Export_FromProduction_All), "Exports native, fulltext, images and PDF files from production set")] public async Task Export_FromProduction_All() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_FullText.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_FullText.cs index 3a88943..2b2ebb8 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_FullText.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_FullText.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(14, nameof(Export_FromProduction_Fulltext), "Exports fulltext from production")] + [SampleMetadata(nameof(Export_FromProduction_Fulltext), "Exports fulltext from production")] public async Task Export_FromProduction_Fulltext() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_Images.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_Images.cs index 1534ef6..9656bc1 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_Images.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_Images.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(12, nameof(Export_FromProduction_Images), "Exports images from folder")] + [SampleMetadata(nameof(Export_FromProduction_Images), "Exports images from folder")] public async Task Export_FromProduction_Images() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_NativeFiles.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_NativeFiles.cs index c47bafc..ce7041c 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_NativeFiles.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_NativeFiles.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(11, nameof(Export_FromProduction_NativeFiles), "Exports native files from production")] + [SampleMetadata(nameof(Export_FromProduction_NativeFiles), "Exports native files from production")] public async Task Export_FromProduction_NativeFiles() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_PDF.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_PDF.cs index c236742..6df1947 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_PDF.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_Production_PDF.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(13, nameof(Export_FromProduction_PDF), "Exports PDF files from a production")] + [SampleMetadata(nameof(Export_FromProduction_PDF), "Exports PDF files from a production")] public async Task Export_FromProduction_PDF() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_RDO.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_RDO.cs index 1d581f1..31c74e2 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_RDO.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_RDO.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(16, nameof(Export_RDO), "Exports RDO objects")] + [SampleMetadata(nameof(Export_RDO), "Exports RDO objects")] public async Task Export_RDO() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_All.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_All.cs index b3b7ffc..9b18d3e 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_All.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_All.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(10, nameof(Export_FromSavedSearch_All), "Exports native, fulltext, images and PDF files from saved search")] + [SampleMetadata(nameof(Export_FromSavedSearch_All), "Exports native, fulltext, images and PDF files from saved search")] public async Task Export_FromSavedSearch_All() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_FullText.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_FullText.cs index b14c123..af856d2 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_FullText.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_FullText.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(9, nameof(Export_FromSavedSearch_FullText), "Exports fulltext from saved search")] + [SampleMetadata(nameof(Export_FromSavedSearch_FullText), "Exports fulltext from saved search")] public async Task Export_FromSavedSearch_FullText() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_Images.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_Images.cs index 376ac38..32f323d 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_Images.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_Images.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(7, nameof(Export_FromSavedSearch_Images), "Exports images from saved search")] + [SampleMetadata(nameof(Export_FromSavedSearch_Images), "Exports images from saved search")] public async Task Export_FromSavedSearch_Images() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_NativeFiles.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_NativeFiles.cs index a783b8f..3ed96d8 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_NativeFiles.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_NativeFiles.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(6, nameof(Export_FromSavedSearch_NativeFiles), "Exports native files from saved search")] + [SampleMetadata(nameof(Export_FromSavedSearch_NativeFiles), "Exports native files from saved search")] public async Task Export_FromSavedSearch_NativeFiles() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_PDF.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_PDF.cs index 97dd961..3014c0c 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_PDF.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Export_SavedSearch_PDF.cs @@ -6,7 +6,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(8, nameof(Export_FromSavedSearch_PDF), "Exports PDF files from saved search")] + [SampleMetadata(nameof(Export_FromSavedSearch_PDF), "Exports PDF files from saved search")] public async Task Export_FromSavedSearch_PDF() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Job_Cancel.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Job_Cancel.cs index 7ec3925..2c2e21c 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Job_Cancel.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Job_Cancel.cs @@ -8,7 +8,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(20, nameof(Job_Cancel), "Cancels running export job")] + [SampleMetadata(nameof(Job_Cancel), "Cancels running export job")] public async Task Job_Cancel() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Job_Delete_Files.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Job_Delete_Files.cs index 4ae9e8b..4af1632 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Job_Delete_Files.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Job_Delete_Files.cs @@ -5,7 +5,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(22, nameof(Job_Delete_Files), "Deletes exported files of specified export job")] + [SampleMetadata(nameof(Job_Delete_Files), "Deletes exported files of specified export job")] public async Task Job_Delete_Files() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Job_GetSettings.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Job_GetSettings.cs index 159df60..de14175 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Job_GetSettings.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Job_GetSettings.cs @@ -1,14 +1,12 @@ -using System.Collections.Concurrent; using Relativity.Export.Samples.RelConsole.Helpers; using Relativity.Export.V1.Builders.ExportSettings; -using Relativity.Export.V1.Model; using Relativity.Export.V1.Model.ExportJobSettings; namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(19, nameof(Job_GetSettings), "Gets settings of a selected job")] + [SampleMetadata(nameof(Job_GetSettings), "Gets settings of a selected job")] public async Task Job_GetSettings() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Job_List.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Job_List.cs index a0deeaf..5e129b1 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Job_List.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Job_List.cs @@ -1,4 +1,3 @@ -using System.Collections.Concurrent; using Relativity.Export.Samples.RelConsole.Helpers; using Relativity.Export.V1.Builders.ExportSettings; using Relativity.Export.V1.Model; @@ -8,7 +7,7 @@ namespace Relativity.Export.Samples.RelConsole.SampleCollection; public partial class BaseExportService { - [SampleMetadata(17, nameof(Job_ListExportJobs), "Lists export jobs")] + [SampleMetadata(nameof(Job_ListExportJobs), "Lists export jobs")] public async Task Job_ListExportJobs() { // Your workspace ID. diff --git a/Relativity.Export.Samples.RelConsole/SampleCollection/Job_StartAllRunnableJobs.cs b/Relativity.Export.Samples.RelConsole/SampleCollection/Job_StartAllRunnableJobs.cs index 6aeb07e..97b8c98 100644 --- a/Relativity.Export.Samples.RelConsole/SampleCollection/Job_StartAllRunnableJobs.cs +++ b/Relativity.Export.Samples.RelConsole/SampleCollection/Job_StartAllRunnableJobs.cs @@ -10,7 +10,7 @@ public record class RunnableJobResult(string ResultMessage, ExportStatus? Result public partial class BaseExportService { - [SampleMetadata(18, nameof(Job_StartAllRunnableJobs), "Starts all runnable export jobs")] + [SampleMetadata(nameof(Job_StartAllRunnableJobs), "Starts all runnable export jobs")] public async Task Job_StartAllRunnableJobs() { // Your workspace ID.