Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detecting configuration files #2459

Merged
merged 25 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
60ed7f9
WIP
dhoehna Feb 23, 2024
501649f
Merge branch 'main' into user/dhoehna/DetectingConfigurationFiles
dhoehna Feb 26, 2024
4f0f3d8
Builds and runs. no special UI though. :(
dhoehna Feb 28, 2024
19c1ffd
Works. Looks good. View File works.
dhoehna Mar 12, 2024
3b75e0d
Fixing some UI
dhoehna Mar 14, 2024
cf187af
Merging with Main
dhoehna Mar 15, 2024
c08cc92
Stretching the contents. Adding owning account name
dhoehna Mar 15, 2024
bec0cb9
Consolidating localized strings
dhoehna Mar 21, 2024
63c8311
Merge branch 'main' into user/dhoehna/DetectingConfigurationFiles
dhoehna Mar 21, 2024
9fd34d3
Adding back my changes
dhoehna Mar 21, 2024
8287e89
Finally. Expands the whole list view
dhoehna Mar 22, 2024
378338c
Now with proper padding
dhoehna Mar 22, 2024
301e6ed
Adding new borders to compensate for removing the top border from Nex…
dhoehna Mar 22, 2024
c91c13a
Making the code a bit better
dhoehna Mar 22, 2024
82c2f29
Merge branch 'main' into user/dhoehna/DetectingConfigurationFiles
dhoehna Mar 22, 2024
36d314c
Removing un-needed using statements
dhoehna Mar 22, 2024
7ae4a14
Removing un-used code. Adding some syntactical sugar.
dhoehna Mar 25, 2024
af7b2ae
Adding another catch. Removing IHost
dhoehna Mar 26, 2024
06c3a6f
Fixing merge
dhoehna Mar 26, 2024
1d9b87b
Merge branch 'main' into user/dhoehna/DetectingConfigurationFiles
dhoehna Mar 27, 2024
1998f8d
Fixing log and spacing issues
dhoehna Mar 27, 2024
7224ad5
Merge branch 'main' into user/dhoehna/DetectingConfigurationFiles
dhoehna Mar 27, 2024
a2f2b2e
Removing extra white-space
dhoehna Mar 27, 2024
a8006a1
Pulling main
dhoehna Mar 29, 2024
ff73717
Addressing comments. Consolidating exception code
dhoehna Mar 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tools/SetupFlow/DevHome.SetupFlow/Models/CloneRepoTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace DevHome.SetupFlow.Models;
/// </summary>
public partial class CloneRepoTask : ObservableObject, ISetupTask
{

dhoehna marked this conversation as resolved.
Show resolved Hide resolved
private const string _configurationFolderName = ".configurations";

private const string _configurationFileYamlExtension = ".dsc.yaml";
Expand All @@ -39,6 +40,8 @@ public partial class CloneRepoTask : ObservableObject, ISetupTask

private readonly IHost _host;

private readonly ILogger _log = Log.ForContext("SourceContext", nameof(CloneRepoTask));

private readonly Guid _activityId;

/// <summary>
Expand Down
38 changes: 19 additions & 19 deletions tools/SetupFlow/DevHome.SetupFlow/Models/ConfigureTargetTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
using DevHome.Common.Environments.Services;
using DevHome.Common.Views;
using DevHome.Contracts.Services;
using DevHome.Logging;
using DevHome.SetupFlow.Common.Exceptions;
using DevHome.SetupFlow.Common.Helpers;
using DevHome.SetupFlow.Exceptions;
using DevHome.SetupFlow.Models.WingetConfigure;
using DevHome.SetupFlow.Services;
using DevHome.SetupFlow.ViewModels;
using Microsoft.UI.Xaml;
using Microsoft.Windows.DevHome.SDK;
using Projection::DevHome.SetupFlow.ElevatedComponent;
using Serilog;
using Windows.Foundation;
using Windows.Storage;
using SDK = Microsoft.Windows.DevHome.SDK;

namespace DevHome.SetupFlow.Models;

public class ConfigureTargetTask : ISetupTask

Check failure on line 30 in tools/SetupFlow/DevHome.SetupFlow/Models/ConfigureTargetTask.cs

View workflow job for this annotation

GitHub Actions / build-and-test (Release, x64, windows-latest, 8.0.x)

'ConfigureTargetTask' does not implement interface member 'ISetupTask.SummaryScreenInformation'. 'ConfigureTargetTask.SummaryScreenInformation' cannot implement 'ISetupTask.SummaryScreenInformation' because it does not have the matching return type of 'ISummaryInformationViewModel'.

Check failure on line 30 in tools/SetupFlow/DevHome.SetupFlow/Models/ConfigureTargetTask.cs

View workflow job for this annotation

GitHub Actions / build-and-test (Release, arm64, windows-latest, 8.0.x)

'ConfigureTargetTask' does not implement interface member 'ISetupTask.SummaryScreenInformation'. 'ConfigureTargetTask.SummaryScreenInformation' cannot implement 'ISetupTask.SummaryScreenInformation' because it does not have the matching return type of 'ISummaryInformationViewModel'.

Check failure on line 30 in tools/SetupFlow/DevHome.SetupFlow/Models/ConfigureTargetTask.cs

View workflow job for this annotation

GitHub Actions / build-and-test (Release, arm64, windows-latest, 8.0.x)

'ConfigureTargetTask' does not implement interface member 'ISetupTask.SummaryScreenInformation'. 'ConfigureTargetTask.SummaryScreenInformation' cannot implement 'ISetupTask.SummaryScreenInformation' because it does not have the matching return type of 'ISummaryInformationViewModel'.

Check failure on line 30 in tools/SetupFlow/DevHome.SetupFlow/Models/ConfigureTargetTask.cs

View workflow job for this annotation

GitHub Actions / build-and-test (Debug, x86, windows-latest, 8.0.x)

'ConfigureTargetTask' does not implement interface member 'ISetupTask.SummaryScreenInformation'. 'ConfigureTargetTask.SummaryScreenInformation' cannot implement 'ISetupTask.SummaryScreenInformation' because it does not have the matching return type of 'ISummaryInformationViewModel'.
{
private readonly ILogger _log = Log.ForContext("SourceContext", nameof(ConfigureTargetTask));

private readonly Microsoft.UI.Dispatching.DispatcherQueue _dispatcherQueue;

private readonly ISetupFlowStringResource _stringResource;
Expand Down Expand Up @@ -93,8 +93,8 @@
public SDKApplyConfigurationResult Result { get; private set; }

public IAsyncOperation<ApplyConfigurationResult> ApplyConfigurationAsyncOperation { get; private set; }

dhoehna marked this conversation as resolved.
Show resolved Hide resolved
public ISummaryInformationViewModel SummaryScreenInformation { get; }

Check failure on line 97 in tools/SetupFlow/DevHome.SetupFlow/Models/ConfigureTargetTask.cs

View workflow job for this annotation

GitHub Actions / build-and-test (Release, x64, windows-latest, 8.0.x)

The type or namespace name 'ISummaryInformationViewModel' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 97 in tools/SetupFlow/DevHome.SetupFlow/Models/ConfigureTargetTask.cs

View workflow job for this annotation

GitHub Actions / build-and-test (Release, arm64, windows-latest, 8.0.x)

The type or namespace name 'ISummaryInformationViewModel' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 97 in tools/SetupFlow/DevHome.SetupFlow/Models/ConfigureTargetTask.cs

View workflow job for this annotation

GitHub Actions / build-and-test (Release, arm64, windows-latest, 8.0.x)

The type or namespace name 'ISummaryInformationViewModel' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 97 in tools/SetupFlow/DevHome.SetupFlow/Models/ConfigureTargetTask.cs

View workflow job for this annotation

GitHub Actions / build-and-test (Debug, x86, windows-latest, 8.0.x)

The type or namespace name 'ISummaryInformationViewModel' could not be found (are you missing a using directive or an assembly reference?)

public ConfigureTargetTask(
ISetupFlowStringResource stringResource,
Expand All @@ -114,7 +114,7 @@

public void OnAdaptiveCardSessionStopped(IExtensionAdaptiveCardSession2 cardSession, SDK.ExtensionAdaptiveCardSessionStoppedEventArgs data)
{
Log.Logger?.ReportInfo(Log.Component.ConfigurationTarget, "Extension ending adaptive card session");
_log.Information("Extension ending adaptive card session");

// Now that the session has ended, we can remove the adaptive card panel from the UI.
cardSession.Stopped -= OnAdaptiveCardSessionStopped;
Expand All @@ -135,13 +135,13 @@
}

AddMessage(_stringResource.GetLocalized(StringResourceKey.ConfigureTargetApplyConfigurationActionFailureEnd), MessageSeverityKind.Error);
Log.Logger?.ReportError(Log.Component.ConfigurationTarget, "Error no more attempts to correct action");
_log.Error("Error no more attempts to correct action");
}
}

public void OnActionRequired(IApplyConfigurationOperation operation, SDK.ApplyConfigurationActionRequiredEventArgs actionRequiredEventArgs)
{
Log.Logger?.ReportInfo(Log.Component.ConfigurationTarget, $"adaptive card receieved from extension");
_log.Information($"adaptive card receieved from extension");
var correctiveCard = actionRequiredEventArgs?.CorrectiveActionCardSession;

if (correctiveCard != null)
Expand All @@ -162,7 +162,7 @@
}
else
{
Log.Logger?.ReportInfo(Log.Component.ConfigurationTarget, "A corrective action was sent from the extension but the adaptive card session was null.");
_log.Information("A corrective action was sent from the extension but the adaptive card session was null.");
}
}

Expand All @@ -174,7 +174,7 @@

if (progressData == null)
{
Log.Logger?.ReportError(Log.Component.ConfigurationTarget, "Unable to get progress of the configuration as the progress data was null");
_log.Error("Unable to get progress of the configuration as the progress data was null");
return;
}

Expand All @@ -195,7 +195,7 @@

if (wrapper.IsErrorMessagePresent)
{
Log.Logger?.ReportError(Log.Component.ConfigurationTarget, $"Target experienced an error while applying the configuration: {wrapper.GetErrorMessageForLogging()}");
_log.Error($"Target experienced an error while applying the configuration: {wrapper.GetErrorMessageForLogging()}");
severity = MessageSeverityKind.Error;
stringBuilder.AppendLine(GetSpacingForProgressMessage(startingLineNumber++) + wrapper.GetErrorMessagesForDisplay());
}
Expand All @@ -212,7 +212,7 @@
}
else
{
Log.Logger?.ReportInfo(Log.Component.ConfigurationTarget, "Extension sent progress but there was no configuration unit data sent.");
_log.Information("Extension sent progress but there was no configuration unit data sent.");
}

// Example of a message that will be displayed in the UI:
Expand All @@ -224,7 +224,7 @@
}
catch (Exception ex)
{
Log.Logger?.ReportError(Log.Component.ConfigurationTarget, $"Failed to process configuration progress data on target machine.'{ComputeSystemName}'", ex);
_log.Error($"Failed to process configuration progress data on target machine.'{ComputeSystemName}'", ex);
}
}

Expand Down Expand Up @@ -264,7 +264,7 @@

if (resultStatus == ProviderOperationStatus.Failure)
{
Log.Logger?.ReportError(Log.Component.ConfigurationTarget, $"Extension failed to configure config file with exception. Diagnostic text: {result.DiagnosticText}", result.ExtendedError);
_log.Error($"Extension failed to configure config file with exception. Diagnostic text: {result.DiagnosticText}", result.ExtendedError);
throw new SDKApplyConfigurationSetResultException(applyConfigurationResult.Result.DiagnosticText);
}

Expand All @@ -289,7 +289,7 @@
ConfigurationResults.Add(new ConfigurationUnitResult(Result.ApplyResult.Result.UnitResults[i]));
}

Log.Logger?.ReportInfo(Log.Component.ConfigurationTarget, "Configuration stopped");
_log.Information("Configuration stopped");
}
else
{
Expand All @@ -298,7 +298,7 @@
}
catch (Exception ex)
{
Log.Logger?.ReportError(Log.Component.ConfigurationTarget, $"Failed to apply configuration on target machine. '{ComputeSystemName}'", ex);
_log.Error($"Failed to apply configuration on target machine. '{ComputeSystemName}'", ex);
}

var tempResultInfo = !string.IsNullOrEmpty(resultInformation) ? resultInformation : string.Empty;
Expand Down Expand Up @@ -381,7 +381,7 @@
}
catch (Exception e)
{
Log.Logger?.ReportError(Log.Component.ConfigurationTarget, $"Failed to apply configuration on target machine.", e);
_log.Error($"Failed to apply configuration on target machine.", e);
return TaskFinishedState.Failure;
}
}).AsAsyncOperation();
Expand Down Expand Up @@ -434,7 +434,7 @@
}
catch (Exception ex)
{
GlobalLog.Logger?.ReportError($"Failure occurred while retrieving the HostConfig file", ex);
_log.Error($"Failure occurred while retrieving the HostConfig file", ex);
}
}

Expand Down Expand Up @@ -516,11 +516,11 @@
}
else
{
GlobalLog.Logger?.ReportInfo($"HostConfig file contents are null or empty - HostConfigFileContents: {hostConfigContents}");
_log.Information($"HostConfig file contents are null or empty - HostConfigFileContents: {hostConfigContents}");
}
});
}
}

private void OnThemeChanged(object sender, ElementTheme e) => UpdateHostConfig();
}
}
dhoehna marked this conversation as resolved.
Show resolved Hide resolved
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.