Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Nullable>enable</Nullable>

<AspireMajorVersion>9</AspireMajorVersion>
<AspireVersion>$(AspireMajorVersion).1.0</AspireVersion>
<AspireVersion>$(AspireMajorVersion).2.0</AspireVersion>
<AspireAppHostSdkVersion>$(AspireVersion)</AspireAppHostSdkVersion>
<AspNetCoreVersion>9.0.0</AspNetCoreVersion>
<DotNetExtensionsVersion>9.0.3</DotNetExtensionsVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,18 @@ public static IResourceBuilder<JavaAppExecutableResource> WithMavenBuild(
await BuildWithMaven(builder.Resource, context.ServiceProvider, context.CancellationToken, false).ConfigureAwait(false) ?
new ExecuteCommandResult { Success = true } :
new ExecuteCommandResult { Success = false, ErrorMessage = "Failed to build with Maven" },
(context) => context.ResourceSnapshot.State switch
new CommandOptions()
{
{ Text: "Stopped" } or
{ Text: "Exited" } or
{ Text: "Finished" } or
{ Text: "FailedToStart" } => ResourceCommandState.Enabled,
_ => ResourceCommandState.Disabled
},
iconName: "build"
);
IconName = "build",
UpdateState = (context) => context.ResourceSnapshot.State switch
{
{ Text: "Stopped" } or
{ Text: "Exited" } or
{ Text: "Finished" } or
{ Text: "FailedToStart" } => ResourceCommandState.Enabled,
_ => ResourceCommandState.Disabled
},
});

return builder;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,6 @@ private static IResourceBuilder<OllamaModelResource> AddModelResourceCommand(
builder.WithCommand(
name: name,
displayName: displayName,
updateState: context =>
context.ResourceSnapshot.State?.Text == KnownResourceStates.Running ?
ResourceCommandState.Enabled :
ResourceCommandState.Disabled,
executeCommand: async context =>
{
var modelResource = builder.Resource;
Expand All @@ -165,13 +161,15 @@ private static IResourceBuilder<OllamaModelResource> AddModelResourceCommand(

return await executeCommand(modelResource, ollamaClient, logger, notificationService, context.CancellationToken);
},
displayDescription: displayDescription,
parameter: parameter,
confirmationMessage: confirmationMessage,
iconName: iconName,
iconVariant: iconVariant,
isHighlighted: isHighlighted
);
commandOptions: new()
{
Description = displayDescription,
Parameter = parameter,
ConfirmationMessage = confirmationMessage,
IconName = iconName,
IconVariant = iconVariant,
IsHighlighted = isHighlighted
});

private static IResourceBuilder<OllamaModelResource> WithModelDownload(this IResourceBuilder<OllamaModelResource> builder)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,14 @@ internal static IResourceBuilder<TResource> InternalWithReference<TResource>(thi
var service = context.ServiceProvider.GetRequiredService<SqlProjectPublishService>();
await service.PublishSqlProject(builder.Resource, target.Resource, targetDatabaseName, context.CancellationToken);
return new ExecuteCommandResult { Success = true };
}, updateState: (context) => context.ResourceSnapshot?.State?.Text == KnownResourceStates.Finished ? ResourceCommandState.Enabled : ResourceCommandState.Disabled,
displayDescription: "Redeploys the SQL Server Database Project to the target database.",
iconName: "ArrowReset",
iconVariant: IconVariant.Filled,
isHighlighted: true);
}, new CommandOptions()
{
Description = "Redeploys the SQL Server Database Project to the target database.",
IconName = "ArrowReset",
IconVariant = IconVariant.Filled,
IsHighlighted = true,
UpdateState = (context) => context.ResourceSnapshot?.State?.Text == KnownResourceStates.Finished ? ResourceCommandState.Enabled : ResourceCommandState.Disabled,
});

return builder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ public void AddBunNullNameThrows()
public void AddBunEmptyNameThrows()
{
var builder = DistributedApplication.CreateBuilder();
var name = "";

Assert.Throws<ArgumentException>(() => builder.AddBunApp(""));
Assert.Throws<ArgumentException>(() => builder.AddBunApp(name));
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public void AddNgrokEmptyNameThrows()
{
var builder = DistributedApplication.CreateBuilder();

Assert.Throws<ArgumentException>(() => builder.AddNgrok(""));
var name = "";
Assert.Throws<ArgumentException>(() => builder.AddNgrok(name));
}

[Fact]
Expand All @@ -64,16 +65,18 @@ public void AddNgrokWhitespaceConfigurationFolderThrows()
public void AddNgrokEmptyEndpointNameFolderThrows()
{
var builder = DistributedApplication.CreateBuilder();
var endpointName = "";

Assert.Throws<ArgumentException>(() => builder.AddNgrok("ngrok", endpointName: ""));
Assert.Throws<ArgumentException>(() => builder.AddNgrok("ngrok", endpointName));
}

[Fact]
public void AddNgrokWhitespaceEndpointNameFolderThrows()
{
var builder = DistributedApplication.CreateBuilder();
var endpointName = " ";

Assert.Throws<ArgumentException>(() => builder.AddNgrok("ngrok", endpointName: " "));
Assert.Throws<ArgumentException>(() => builder.AddNgrok("ngrok", endpointName));
}

[Fact]
Expand Down
Loading