Skip to content

Commit

Permalink
Merge pull request #105 from microsoft/staging
Browse files Browse the repository at this point in the history
Release - 1/25/24
  • Loading branch information
EricJohnson327 authored Jan 25, 2024
2 parents 8767bc8 + f6d5323 commit 928029b
Show file tree
Hide file tree
Showing 22 changed files with 172 additions and 243 deletions.
4 changes: 2 additions & 2 deletions ToolingVersions.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<TargetFramework>net6.0-windows10.0.22000.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19045.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19045.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
</PropertyGroup>
</Project>
37 changes: 19 additions & 18 deletions build/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ parameters:
- release

variables:
MSIXVersion: '0.400'
MSIXVersion: '0.500'
solution: '**/DevHomeAzureExtension.sln'
appxPackageDir: 'AppxPackages'
testOutputArtifactDir: 'TestResults'
Expand Down Expand Up @@ -58,7 +58,7 @@ extends:
steps:
- task: NuGetToolInstaller@1

- task: NuGetAuthenticate@0
- task: NuGetAuthenticate@1
inputs:
nuGetServiceConnections: 'DevHomeInternal'

Expand Down Expand Up @@ -189,22 +189,23 @@ extends:
MaxConcurrency: '50'
MaxRetryAttempts: '5'

- task: AzureKeyVault@1
inputs:
azureSubscription: 'DevHomeAzureServiceConnection'
KeyVaultName: 'DevHomeKeyVault'
SecretsFilter: 'ApiScanConnectionString'
RunAsPreJob: false

- task: APIScan@2
inputs:
softwareFolder: '$(Build.StagingDirectory)'
softwareName: 'Dev Home Azure Extension'
softwareVersionNum: '1.0'
softwareBuildNum: '$(Build.BuildId)'
symbolsFolder: 'SRV*http://symweb'
env:
AzureServicesAuthConnectionString: $(ApiScanConnectionString)
# Commented out until our implementation is fixed
# - task: AzureKeyVault@1
# inputs:
# azureSubscription: 'DevHomeAzureServiceConnection'
# KeyVaultName: 'DevHomeKeyVault'
# SecretsFilter: 'ApiScanConnectionString'
# RunAsPreJob: false

# - task: APIScan@2
# inputs:
# softwareFolder: '$(Build.StagingDirectory)'
# softwareName: 'Dev Home Azure Extension'
# softwareVersionNum: '1.0'
# softwareBuildNum: '$(Build.BuildId)'
# symbolsFolder: 'SRV*http://symweb'
# env:
# AzureServicesAuthConnectionString: $(ApiScanConnectionString)

- task: Windows Application Driver@0
condition: and(always(), eq('${{ platform}}', 'x64'))
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Try {
.\build\scripts\Create-AppxBundle.ps1 -InputPath (Join-Path $env:Build_RootDirectory "AppxPackages\$configuration") -ProjectName AzureExtension -BundleVersion ([version]$env:msix_version) -OutputPath (Join-Path $env:Build_RootDirectory ("AppxBundles\$configuration\AzureExtension_" + $env:msix_version + "_8wekyb3d8bbwe.msixbundle"))
if (-not($IsAzurePipelineBuild) -And $isAdmin) {
# This can fail if SignTool.exe is not found, which is part of the Windows SDK.
Invoke-SignPackage ("AppxBundles\$configuration\DevHomeAzureExtension_" + $env:msix_version + "_8wekyb3d8bbwe.msixbundle")
Invoke-SignPackage ("AppxBundles\$configuration\AzureExtension_" + $env:msix_version + "_8wekyb3d8bbwe.msixbundle")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/CreateBuildInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Param(
)

$Major = "0"
$Minor = "4"
$Minor = "5"
$Patch = "99" # default to 99 for local builds

$versionSplit = $Version.Split(".");
Expand Down
20 changes: 19 additions & 1 deletion src/AzureExtension/AzureExtension.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.123" />
<PackageReference Include="Dapper.Contrib" Version="2.0.78" />
<PackageReference Include="LibGit2Sharp" Version="0.26.2" />
<PackageReference Include="LibGit2Sharp" Version="0.29.0" />
<PackageReference Include="MessageFormat" Version="6.0.2" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.4" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.56.0" />
Expand Down Expand Up @@ -115,9 +115,27 @@
<Content Update="Widgets\Assets\PullRequestReviewNotStarted.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Widgets\Assets\PullRequestsScreenshotDark.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Widgets\Assets\PullRequestsScreenshotLight.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Widgets\Assets\PullRequestWaiting.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Widgets\Assets\QueryResultScreenshotDark.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Widgets\Assets\QueryResultScreenshotLight.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Widgets\Assets\QueryTilesScreenshotDark.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Widgets\Assets\QueryTilesScreenshotLight.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Widgets\Assets\Requirement.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down
2 changes: 1 addition & 1 deletion src/AzureExtension/Providers/RepositoryProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ public IAsyncOperation<ProviderOperationResult> CloneRepositoryAsync(IRepository
return new ProviderOperationResult(ProviderOperationStatus.Failure, e, $"Could not get the logged in developer. HResult: {e.HResult}", e.Message);
}

cloneOptions.CredentialsProvider = (url, user, cred) => new LibGit2Sharp.UsernamePasswordCredentials
cloneOptions.FetchOptions.CredentialsProvider = (url, user, cred) => new LibGit2Sharp.UsernamePasswordCredentials
{
// Password is a PAT unique to GitHub.
Username = authResult.AccessToken,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 16 additions & 16 deletions src/AzureExtension/Widgets/AzurePullRequestsWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,14 @@ private string GetIconForPullRequestStatus(string? prStatus)
};
}

// Action handler methods
protected override void HandleSubmit(WidgetActionInvokedArgs args)
protected override bool ValidateConfiguration(WidgetActionInvokedArgs args)
{
// Set loading page while we fetch data from ADO.
Page = WidgetPageState.Loading;
UpdateWidget();
CanPin = false;

// This is the action when the user clicks the submit button after entering some data on the widget while in
// the Configure state.
CanSave = false;

Page = WidgetPageState.Configure;
var data = args.Data;
var dataObject = JsonObject.Parse(data);
Expand All @@ -107,29 +105,31 @@ protected override void HandleSubmit(WidgetActionInvokedArgs args)
{
message = Resources.GetResource(@"Widget_Template/DevIDError");
UpdateActivityState();
return;
return false;
}

var repositoryInfo = AzureClientHelpers.GetRepositoryInfo(selectedRepositoryUrl, developerId);
if (repositoryInfo.Result != ResultType.Success)
{
message = GetMessageForError(repositoryInfo.Error, repositoryInfo.ErrorMessage);
UpdateActivityState();
return;
return false;
}

CanPin = true;
message = Resources.GetResource(@"Widget_Template/CanBePinned");
CanSave = true;
Pinned = true;
Page = WidgetPageState.Content;
UpdateActivityState();
return true;
}

Page = WidgetPageState.Configure;
UpdateWidget();
return false;
}

public override void OnCustomizationRequested(WidgetCustomizationRequestedArgs customizationRequestedArgs)
{
// Set CanPin to false so user will have to Submit again before Saving.
CanPin = false;
// Set CanSave to false so user will have to Submit again before Saving.
CanSave = false;
SavedConfigurationData = ConfigurationData;
SetConfigure();
}
Expand Down Expand Up @@ -197,7 +197,7 @@ public override void RequestContentData()
}
}

private void ResetDataFromState(string data)
protected override void ResetDataFromState(string data)
{
var dataObject = JsonObject.Parse(data);

Expand All @@ -210,6 +210,7 @@ private void ResetDataFromState(string data)
DeveloperLoginId = dataObject["account"]?.GetValue<string>() ?? string.Empty;
selectedRepositoryUrl = dataObject["query"]?.GetValue<string>() ?? string.Empty;
selectedView = dataObject["view"]?.GetValue<string>() ?? string.Empty;
message = null;

var developerId = GetDevId(DeveloperLoginId);
if (developerId == null)
Expand Down Expand Up @@ -245,7 +246,6 @@ public override string GetConfiguration(string data)
configurationData.Add("message", message);
configurationData.Add("widgetTitle", widgetTitle);

configurationData.Add("configuring", !CanPin);
configurationData.Add("pinned", Pinned);
configurationData.Add("arrow", IconLoader.GetIconAsBase64("arrow.png"));

Expand Down Expand Up @@ -344,7 +344,7 @@ public override string GetData(WidgetPageState page)
WidgetPageState.SignIn => GetSignIn(),
WidgetPageState.Configure => GetConfiguration(string.Empty),
WidgetPageState.Content => ContentData,
WidgetPageState.Loading => new JsonObject { { "configuring", true } }.ToJsonString(),
WidgetPageState.Loading => EmptyJson,
_ => throw new NotImplementedException(Page.GetType().Name),
};
}
Expand Down
34 changes: 19 additions & 15 deletions src/AzureExtension/Widgets/AzureQueryListWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,22 @@ private string GetIconForStatusState(string? statusState)
};
}

// Action handler methods
protected override void HandleSubmit(WidgetActionInvokedArgs args)
protected override bool ValidateConfiguration(WidgetActionInvokedArgs args)
{
// Set loading page while we fetch data from ADO.
Page = WidgetPageState.Loading;
UpdateWidget();

// This is the action when the user clicks the submit button after entering some data on the widget while in
// the Configure state.
CanSave = false;

Page = WidgetPageState.Configure;
var data = args.Data;
var dataObject = JsonObject.Parse(data);
message = null;

if (dataObject != null && dataObject["account"] != null && dataObject["query"] != null)
{
CanPin = false;
CanSave = false;
widgetTitle = dataObject["widgetTitle"]?.GetValue<string>() ?? string.Empty;
selectedQueryUrl = dataObject["query"]?.GetValue<string>() ?? string.Empty;
DeveloperLoginId = dataObject["account"]?.GetValue<string>() ?? string.Empty;
Expand All @@ -103,34 +102,39 @@ protected override void HandleSubmit(WidgetActionInvokedArgs args)
{
message = Resources.GetResource(@"Widget_Template/DevIDError");
UpdateActivityState();
return;
return false;
}

var queryInfo = AzureClientHelpers.GetQueryInfo(selectedQueryUrl, developerId);
selectedQueryId = queryInfo.AzureUri.Query; // This will be empty string if invalid query.
if (queryInfo.Result != ResultType.Success)
{
message = GetMessageForError(queryInfo.Error, queryInfo.ErrorMessage);
UpdateActivityState();
return false;
}
else
{
CanPin = true;
message = Resources.GetResource(@"Widget_Template/CanBePinned");
CanSave = true;
Pinned = true;
if (string.IsNullOrEmpty(widgetTitle))
{
widgetTitle = queryInfo.Name;
}

Page = WidgetPageState.Content;
UpdateActivityState();
return true;
}
}

Page = WidgetPageState.Configure;
UpdateWidget();
return false;
}

public override void OnCustomizationRequested(WidgetCustomizationRequestedArgs customizationRequestedArgs)
{
// Set CanPin to false so user will have to Submit again before Saving.
CanPin = false;
// Set CanSave to false so user will have to Submit again before Saving.
CanSave = false;
SavedConfigurationData = ConfigurationData;
SetConfigure();
}
Expand Down Expand Up @@ -200,7 +204,7 @@ public override void RequestContentData()
}
}

private void ResetDataFromState(string data)
protected override void ResetDataFromState(string data)
{
var dataObject = JsonObject.Parse(data);

Expand All @@ -212,6 +216,7 @@ private void ResetDataFromState(string data)
widgetTitle = dataObject["widgetTitle"]?.GetValue<string>() ?? string.Empty;
DeveloperLoginId = dataObject["account"]?.GetValue<string>() ?? string.Empty;
selectedQueryUrl = dataObject["query"]?.GetValue<string>() ?? string.Empty;
message = null;

var developerId = GetDevId(DeveloperLoginId);
if (developerId == null)
Expand Down Expand Up @@ -250,7 +255,6 @@ public override string GetConfiguration(string data)
configurationData.Add("message", message);
configurationData.Add("widgetTitle", widgetTitle);

configurationData.Add("configuring", !CanPin);
configurationData.Add("pinned", Pinned);
configurationData.Add("arrow", IconLoader.GetIconAsBase64("arrow.png"));

Expand Down Expand Up @@ -353,7 +357,7 @@ public override string GetData(WidgetPageState page)
WidgetPageState.SignIn => GetSignIn(),
WidgetPageState.Configure => GetConfiguration(string.Empty),
WidgetPageState.Content => ContentData,
WidgetPageState.Loading => new JsonObject { { "configuring", true } }.ToJsonString(),
WidgetPageState.Loading => EmptyJson,
_ => throw new NotImplementedException(Page.GetType().Name),
};
}
Expand Down
Loading

0 comments on commit 928029b

Please sign in to comment.