From f02958cb0c3866d4d6e474f0a944f15b5d7b2e4b Mon Sep 17 00:00:00 2001 From: Charles d'Avernas Date: Tue, 22 Oct 2024 11:10:59 +0200 Subject: [PATCH] fix(Solution): Transformed the `CustomFunction` into a cluster resource Signed-off-by: Charles d'Avernas --- .../Synapse.Api.Application.csproj | 2 +- .../Services/ISynapseApiClient.cs | 2 +- .../Synapse.Api.Client.Core.csproj | 2 +- .../Services/SynapseHttpApiClient.cs | 2 +- .../Synapse.Api.Client.Http.csproj | 2 +- .../Controllers/CustomFunctionsController.cs | 4 +- .../Synapse.Api.Http/Synapse.Api.Http.csproj | 2 +- .../Synapse.Api.Server.csproj | 2 +- src/cli/Synapse.Cli/Synapse.Cli.csproj | 2 +- ...re.Infrastructure.Containers.Docker.csproj | 2 +- ...nfrastructure.Containers.Kubernetes.csproj | 2 +- .../Synapse.Core.Infrastructure.csproj | 2 +- .../Resources/CustomFunction.yaml | 2 +- src/core/Synapse.Core/Synapse.Core.csproj | 2 +- .../Synapse.Correlator.csproj | 2 +- ...espacedResourceManagementComponentStore.cs | 2 +- .../Extensions/DateTimeExtensions.cs | 2 +- .../Pages/Correlators/List/View.razor | 2 + .../Pages/Functions/Create/State.cs | 14 ---- .../Pages/Functions/Create/Store.cs | 83 +++---------------- .../Pages/Functions/Create/View.razor | 47 ++--------- .../Pages/Functions/List/State.cs | 27 ------ .../Pages/Functions/List/Store.cs | 2 +- .../Pages/Functions/List/View.razor | 24 ++---- .../Synapse.Operator/Synapse.Operator.csproj | 2 +- .../Executors/FunctionCallExecutor.cs | 12 +-- .../Interfaces/IWorkflowExecutionContext.cs | 2 +- .../Services/WorkflowExecutionContext.cs | 2 +- .../Synapse.Runner/Synapse.Runner.csproj | 2 +- .../Synapse.Runtime.Abstractions.csproj | 2 +- .../Synapse.Runtime.Docker.csproj | 2 +- .../Synapse.Runtime.Kubernetes.csproj | 2 +- .../Synapse.Runtime.Native.csproj | 2 +- .../Services/MockCloudFlowsApiClient.cs | 2 +- 34 files changed, 60 insertions(+), 205 deletions(-) delete mode 100644 src/dashboard/Synapse.Dashboard/Pages/Functions/List/State.cs diff --git a/src/api/Synapse.Api.Application/Synapse.Api.Application.csproj b/src/api/Synapse.Api.Application/Synapse.Api.Application.csproj index 8a4b4c1ae..edc091fe7 100644 --- a/src/api/Synapse.Api.Application/Synapse.Api.Application.csproj +++ b/src/api/Synapse.Api.Application/Synapse.Api.Application.csproj @@ -7,7 +7,7 @@ en True 1.0.0 - alpha4 + alpha4.1 $(VersionPrefix) $(VersionPrefix) The Synapse Authors diff --git a/src/api/Synapse.Api.Client.Core/Services/ISynapseApiClient.cs b/src/api/Synapse.Api.Client.Core/Services/ISynapseApiClient.cs index f63b04d38..0b53c509a 100644 --- a/src/api/Synapse.Api.Client.Core/Services/ISynapseApiClient.cs +++ b/src/api/Synapse.Api.Client.Core/Services/ISynapseApiClient.cs @@ -34,7 +34,7 @@ public interface ISynapseApiClient /// /// Gets the Synapse API used to manage s /// - INamespacedResourceApiClient CustomFunctions { get; } + IClusterResourceApiClient CustomFunctions { get; } /// /// Gets the Synapse API used to manage s diff --git a/src/api/Synapse.Api.Client.Core/Synapse.Api.Client.Core.csproj b/src/api/Synapse.Api.Client.Core/Synapse.Api.Client.Core.csproj index 6f5c81398..d580075e1 100644 --- a/src/api/Synapse.Api.Client.Core/Synapse.Api.Client.Core.csproj +++ b/src/api/Synapse.Api.Client.Core/Synapse.Api.Client.Core.csproj @@ -7,7 +7,7 @@ en True 1.0.0 - alpha4 + alpha4.1 $(VersionPrefix) $(VersionPrefix) The Synapse Authors diff --git a/src/api/Synapse.Api.Client.Http/Services/SynapseHttpApiClient.cs b/src/api/Synapse.Api.Client.Http/Services/SynapseHttpApiClient.cs index b7fe8cee1..1226a976b 100644 --- a/src/api/Synapse.Api.Client.Http/Services/SynapseHttpApiClient.cs +++ b/src/api/Synapse.Api.Client.Http/Services/SynapseHttpApiClient.cs @@ -75,7 +75,7 @@ public SynapseHttpApiClient(IServiceProvider serviceProvider, ILoggerFactory log public INamespacedResourceApiClient Correlators { get; private set; } = null!; /// - public INamespacedResourceApiClient CustomFunctions { get; private set; } = null!; + public IClusterResourceApiClient CustomFunctions { get; private set; } = null!; /// public IDocumentApiClient Documents { get; } diff --git a/src/api/Synapse.Api.Client.Http/Synapse.Api.Client.Http.csproj b/src/api/Synapse.Api.Client.Http/Synapse.Api.Client.Http.csproj index b22247211..1727c15eb 100644 --- a/src/api/Synapse.Api.Client.Http/Synapse.Api.Client.Http.csproj +++ b/src/api/Synapse.Api.Client.Http/Synapse.Api.Client.Http.csproj @@ -7,7 +7,7 @@ en True 1.0.0 - alpha4 + alpha4.1 $(VersionPrefix) $(VersionPrefix) The Synapse Authors diff --git a/src/api/Synapse.Api.Http/Controllers/CustomFunctionsController.cs b/src/api/Synapse.Api.Http/Controllers/CustomFunctionsController.cs index 8d0b9205a..42a2745f4 100644 --- a/src/api/Synapse.Api.Http/Controllers/CustomFunctionsController.cs +++ b/src/api/Synapse.Api.Http/Controllers/CustomFunctionsController.cs @@ -14,13 +14,13 @@ namespace Synapse.Api.Http.Controllers; /// -/// Represents the used to manage s +/// Represents the used to manage s /// /// The service used to mediate calls /// The service used to serialize/deserialize objects to/from JSON [Route("api/v1/custom-functions")] public class CustomFunctionsController(IMediator mediator, IJsonSerializer jsonSerializer) - : NamespacedResourceController(mediator, jsonSerializer) + : ClusterResourceController(mediator, jsonSerializer) { diff --git a/src/api/Synapse.Api.Http/Synapse.Api.Http.csproj b/src/api/Synapse.Api.Http/Synapse.Api.Http.csproj index 9d4129989..5747e5e48 100644 --- a/src/api/Synapse.Api.Http/Synapse.Api.Http.csproj +++ b/src/api/Synapse.Api.Http/Synapse.Api.Http.csproj @@ -8,7 +8,7 @@ Library True 1.0.0 - alpha4 + alpha4.1 $(VersionPrefix) $(VersionPrefix) The Synapse Authors diff --git a/src/api/Synapse.Api.Server/Synapse.Api.Server.csproj b/src/api/Synapse.Api.Server/Synapse.Api.Server.csproj index 99e443a8d..cea4ee914 100644 --- a/src/api/Synapse.Api.Server/Synapse.Api.Server.csproj +++ b/src/api/Synapse.Api.Server/Synapse.Api.Server.csproj @@ -7,7 +7,7 @@ en True 1.0.0 - alpha4 + alpha4.1 $(VersionPrefix) $(VersionPrefix) The Synapse Authors diff --git a/src/cli/Synapse.Cli/Synapse.Cli.csproj b/src/cli/Synapse.Cli/Synapse.Cli.csproj index b12db2220..5f6bfd610 100644 --- a/src/cli/Synapse.Cli/Synapse.Cli.csproj +++ b/src/cli/Synapse.Cli/Synapse.Cli.csproj @@ -8,7 +8,7 @@ en True 1.0.0 - alpha4 + alpha4.1 $(VersionPrefix) $(VersionPrefix) The Synapse Authors diff --git a/src/core/Synapse.Core.Infrastructure.Containers.Docker/Synapse.Core.Infrastructure.Containers.Docker.csproj b/src/core/Synapse.Core.Infrastructure.Containers.Docker/Synapse.Core.Infrastructure.Containers.Docker.csproj index 58c33bb4d..14055cede 100644 --- a/src/core/Synapse.Core.Infrastructure.Containers.Docker/Synapse.Core.Infrastructure.Containers.Docker.csproj +++ b/src/core/Synapse.Core.Infrastructure.Containers.Docker/Synapse.Core.Infrastructure.Containers.Docker.csproj @@ -7,7 +7,7 @@ en True 1.0.0 - alpha4 + alpha4.1 $(VersionPrefix) $(VersionPrefix) The Synapse Authors diff --git a/src/core/Synapse.Core.Infrastructure.Containers.Kubernetes/Synapse.Core.Infrastructure.Containers.Kubernetes.csproj b/src/core/Synapse.Core.Infrastructure.Containers.Kubernetes/Synapse.Core.Infrastructure.Containers.Kubernetes.csproj index 25949e7a6..d9b3f0180 100644 --- a/src/core/Synapse.Core.Infrastructure.Containers.Kubernetes/Synapse.Core.Infrastructure.Containers.Kubernetes.csproj +++ b/src/core/Synapse.Core.Infrastructure.Containers.Kubernetes/Synapse.Core.Infrastructure.Containers.Kubernetes.csproj @@ -7,7 +7,7 @@ en True 1.0.0 - alpha4 + alpha4.1 $(VersionPrefix) $(VersionPrefix) The Synapse Authors diff --git a/src/core/Synapse.Core.Infrastructure/Synapse.Core.Infrastructure.csproj b/src/core/Synapse.Core.Infrastructure/Synapse.Core.Infrastructure.csproj index 622e5c9ae..c39f4c0fe 100644 --- a/src/core/Synapse.Core.Infrastructure/Synapse.Core.Infrastructure.csproj +++ b/src/core/Synapse.Core.Infrastructure/Synapse.Core.Infrastructure.csproj @@ -7,7 +7,7 @@ en True 1.0.0 - alpha4 + alpha4.1 $(VersionPrefix) $(VersionPrefix) The Synapse Authors diff --git a/src/core/Synapse.Core/Resources/CustomFunction.yaml b/src/core/Synapse.Core/Resources/CustomFunction.yaml index e6f5dccf5..b9c2dc4b6 100644 --- a/src/core/Synapse.Core/Resources/CustomFunction.yaml +++ b/src/core/Synapse.Core/Resources/CustomFunction.yaml @@ -3,7 +3,7 @@ kind: CustomResourceDefinition metadata: name: custom-functions.synapse.io spec: - scope: Namespaced + scope: Cluster group: synapse.io names: plural: custom-functions diff --git a/src/core/Synapse.Core/Synapse.Core.csproj b/src/core/Synapse.Core/Synapse.Core.csproj index 324a1aab3..24847e69a 100644 --- a/src/core/Synapse.Core/Synapse.Core.csproj +++ b/src/core/Synapse.Core/Synapse.Core.csproj @@ -7,7 +7,7 @@ en True 1.0.0 - alpha4 + alpha4.1 $(VersionPrefix) $(VersionPrefix) The Synapse Authors diff --git a/src/correlator/Synapse.Correlator/Synapse.Correlator.csproj b/src/correlator/Synapse.Correlator/Synapse.Correlator.csproj index 2779a322c..116d0f94a 100644 --- a/src/correlator/Synapse.Correlator/Synapse.Correlator.csproj +++ b/src/correlator/Synapse.Correlator/Synapse.Correlator.csproj @@ -8,7 +8,7 @@ en True 1.0.0 - alpha4 + alpha4.1 $(VersionPrefix) $(VersionPrefix) The Synapse Authors diff --git a/src/dashboard/Synapse.Dashboard/Components/ResourceManagement/NamespacedResourceManagementComponentStore.cs b/src/dashboard/Synapse.Dashboard/Components/ResourceManagement/NamespacedResourceManagementComponentStore.cs index 976e6c972..1b251c5df 100644 --- a/src/dashboard/Synapse.Dashboard/Components/ResourceManagement/NamespacedResourceManagementComponentStore.cs +++ b/src/dashboard/Synapse.Dashboard/Components/ResourceManagement/NamespacedResourceManagementComponentStore.cs @@ -25,8 +25,8 @@ namespace Synapse.Dashboard.Components.ResourceManagement; /// The websocket service client public class NamespacedResourceManagementComponentStore(ILogger> logger, ISynapseApiClient apiClient, ResourceWatchEventHubClient resourceEventHub) : ResourceManagementComponentStoreBase(logger, apiClient, resourceEventHub) - where TResource : Resource, new() where TState : NamespacedResourceManagementComponentState, new() + where TResource : Resource, new() { /// diff --git a/src/dashboard/Synapse.Dashboard/Extensions/DateTimeExtensions.cs b/src/dashboard/Synapse.Dashboard/Extensions/DateTimeExtensions.cs index 23d0a733a..2d0d4da61 100644 --- a/src/dashboard/Synapse.Dashboard/Extensions/DateTimeExtensions.cs +++ b/src/dashboard/Synapse.Dashboard/Extensions/DateTimeExtensions.cs @@ -15,7 +15,7 @@ using moment.net.Models; using System.Globalization; -namespace Synapse.Dashboard.Extensions; +namespace Synapse.Dashboard; /// /// Provides extension methods for diff --git a/src/dashboard/Synapse.Dashboard/Pages/Correlators/List/View.razor b/src/dashboard/Synapse.Dashboard/Pages/Correlators/List/View.razor index e3ee63f77..a9fa880a9 100644 --- a/src/dashboard/Synapse.Dashboard/Pages/Correlators/List/View.razor +++ b/src/dashboard/Synapse.Dashboard/Pages/Correlators/List/View.razor @@ -98,10 +98,12 @@ @code { + /// protected override void OnInitialized() { base.OnInitialized(); BreadcrumbManager.Use(Breadcrumbs.Correlators); } + } \ No newline at end of file diff --git a/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/State.cs b/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/State.cs index 9cb13d7a1..4ebad1c0c 100644 --- a/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/State.cs +++ b/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/State.cs @@ -23,26 +23,12 @@ namespace Synapse.Dashboard.Pages.Functions.Create; [Feature] public record CreateFunctionViewState { - /// - /// Gets a that contains all s - /// - public EquatableList? Namespaces { get; set; } - - /// - /// Gets/sets the 's namespace - /// - public string? Namespace { get; set; } /// /// Gets/sets the 's name /// public string? Name { get; set; } - /// - /// Gets/sets the 's namespace, when the user is creating one - /// - public string? ChosenNamespace { get; set; } - /// /// Gets/sets the 's name, when the user is creating one /// diff --git a/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/Store.cs b/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/Store.cs index a2b7d9fd2..0540770cc 100644 --- a/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/Store.cs +++ b/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/Store.cs @@ -106,27 +106,13 @@ MonacoInterop monacoInterop /// public StandaloneCodeEditor? TextEditor { get; set; } - /// - /// Gets an used to observe s - /// - public IObservable?> Namespaces => this.Select(s => s.Namespaces).DistinctUntilChanged(); - #region Selectors - /// - /// Gets an used to observe changes - /// - public IObservable Namespace => this.Select(state => state.Namespace).DistinctUntilChanged(); /// /// Gets an used to observe changes /// public IObservable Name => this.Select(state => state.Name).DistinctUntilChanged(); - /// - /// Gets an used to observe changes - /// - public IObservable ChosenNamespace => this.Select(state => state.ChosenNamespace).DistinctUntilChanged(); - /// /// Gets an used to observe changes /// @@ -203,18 +189,6 @@ MonacoInterop monacoInterop #endregion #region Setters - /// - /// Sets the state's - /// - /// The new value - public void SetNamespace(string? ns) - { - this.Reduce(state => state with - { - Namespace = ns, - Loading = true - }); - } /// /// Sets the state's @@ -228,17 +202,6 @@ public void SetName(string? name) Loading = true }); } - /// - /// Sets the state's - /// - /// The new value - public void SetChosenNamespace(string? ns) - { - this.Reduce(state => state with - { - ChosenNamespace = ns - }); - } /// /// Sets the state's @@ -273,14 +236,12 @@ public void SetProblemDetails(ProblemDetails? problem) /// /// Gets the for the specified namespace and name /// - /// The namespace the to create a new version of belongs to /// The name of the to create a new version of /// A new awaitable - public async Task GetCustomFunctionAsync(string @namespace, string name) + public async Task GetCustomFunctionAsync(string name) { - ArgumentException.ThrowIfNullOrWhiteSpace(@namespace); ArgumentException.ThrowIfNullOrWhiteSpace(name); - var resources = await this.ApiClient.CustomFunctions.GetAsync(name, @namespace) ?? throw new NullReferenceException($"Failed to find the specified function '{name}.{@namespace}'"); + var resources = await this.ApiClient.CustomFunctions.GetAsync(name) ?? throw new NullReferenceException($"Failed to find the specified function '{name}'"); var version = resources.Spec.Versions.GetLatestVersion(); var function = resources.Spec.Versions.GetLatest(); var nextVersion = SemVersion.Parse(version, SemVersionStyles.Strict); @@ -429,15 +390,14 @@ public async Task SaveCustomFunctionAsync() var function = this.MonacoEditorHelper.PreferredLanguage == PreferredLanguage.JSON ? this.JsonSerializer.Deserialize(functionText)! : this.YamlSerializer.Deserialize(functionText)!; - var @namespace = this.Get(state => state.Namespace) ?? this.Get(state => state.ChosenNamespace); var name = this.Get(state => state.Name) ?? this.Get(state => state.ChosenName); var version = this.Get(state => state.Version).ToString(); - if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(@namespace)) + if (string.IsNullOrEmpty(name)) { this.Reduce(state => state with { ProblemTitle = "Invalid function", - ProblemDetail = "The name or namespace cannot be empty." + ProblemDetail = "The name cannot be empty." }); return; } @@ -448,7 +408,7 @@ public async Task SaveCustomFunctionAsync() CustomFunction? resource = null; try { - resource = await this.ApiClient.CustomFunctions.GetAsync(name, @namespace); + resource = await this.ApiClient.CustomFunctions.GetAsync(name); } catch { @@ -460,7 +420,6 @@ public async Task SaveCustomFunctionAsync() { Metadata = new() { - Namespace = @namespace, Name = name }, Spec = new() @@ -478,10 +437,10 @@ public async Task SaveCustomFunctionAsync() if (patch != null) { var resourcePatch = new Patch(PatchType.JsonPatch, jsonPatch); - await this.ApiClient.ManageNamespaced().PatchAsync(name, @namespace, resourcePatch, null, this.CancellationTokenSource.Token); + await this.ApiClient.ManageCluster().PatchAsync(name, resourcePatch, null, this.CancellationTokenSource.Token); } } - this.NavigationManager.NavigateTo($"/functions/{@namespace}/{name}"); + this.NavigationManager.NavigateTo($"/functions/{name}"); } catch (ProblemDetailsException ex) { @@ -531,9 +490,8 @@ public async Task SaveCustomFunctionAsync() /// public override async Task InitializeAsync() { - await this.ListNamespacesAsync().ConfigureAwait(false); this.Function.SubscribeAsync(async definition => { - string document = ""; + string document = string.Empty; if (definition != null) { document = this.MonacoEditorHelper.PreferredLanguage == PreferredLanguage.JSON ? @@ -546,14 +504,10 @@ public override async Task InitializeAsync() }); await this.OnTextBasedEditorInitAsync(); }, cancellationToken: this.CancellationTokenSource.Token); - Observable.CombineLatest( - this.Namespace.Where(ns => !string.IsNullOrWhiteSpace(ns)), - this.Name.Where(name => !string.IsNullOrWhiteSpace(name)), - (ns, name) => (ns!, name!) - ).SubscribeAsync(async ((string ns, string name) function) => - { - await this.GetCustomFunctionAsync(function.ns, function.name); - }, cancellationToken: this.CancellationTokenSource.Token); + this.Name.Where(name => !string.IsNullOrWhiteSpace(name)) + .SubscribeAsync(async name => + await this.GetCustomFunctionAsync(name!), + cancellationToken: this.CancellationTokenSource.Token); await this.SetValidationSchema(); await base.InitializeAsync(); } @@ -587,19 +541,6 @@ protected async Task SetValidationSchema(string? version = null) this._processingVersion = false; } - /// - /// Lists all available s - /// - /// A new awaitable - public virtual async Task ListNamespacesAsync() - { - var namespaceList = new EquatableList(await (await this.ApiClient.Namespaces.ListAsync().ConfigureAwait(false)).OrderBy(ns => ns.GetQualifiedName()).ToListAsync().ConfigureAwait(false)); - this.Reduce(s => s with - { - Namespaces = namespaceList - }); - } - /// /// Disposes of the store /// diff --git a/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/View.razor b/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/View.razor index f3c692d99..424d25ed8 100644 --- a/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/View.razor +++ b/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/View.razor @@ -15,7 +15,7 @@ *@ @page "/functions/new" -@page "/functions/new/{namespace}/{name}" +@page "/functions/new/{name}" @using ServerlessWorkflow.Sdk.Models @using Synapse.Api.Client.Services @inherits StatefulComponent @@ -24,7 +24,7 @@ New function -

New Function @((!string.IsNullOrEmpty(ns) || !string.IsNullOrEmpty(name) || !string.IsNullOrEmpty(chosenName) || !string.IsNullOrEmpty(chosenNamespace)) ? $"({name??chosenName}.{ns??chosenNamespace}:{version})" : "")

+

New Function @((!string.IsNullOrEmpty(name) || !string.IsNullOrEmpty(chosenName)) ? $"({name??chosenName}:{version})" : "")

@if (loading) { @@ -32,21 +32,11 @@ } -else if (string.IsNullOrEmpty(ns) && string.IsNullOrEmpty(name) && string.IsNullOrEmpty(chosenName) && string.IsNullOrEmpty(chosenNamespace)) +else if (string.IsNullOrEmpty(name) && string.IsNullOrEmpty(chosenName)) {
- -
@@ -97,10 +87,8 @@ else @code { - string? ns; string? name; string? version; - string? chosenNamespace; string? chosenName; string? nameInputValue; string? namespaceSelectValue; @@ -108,22 +96,17 @@ else bool saving; ProblemDetails? problemDetails = null; - [Parameter] public string? Namespace { get; set; } [Parameter] public string? Name { get; set; } - public EquatableList? Namespaces { get; set; } /// protected override async Task OnInitializedAsync() { await base.OnInitializedAsync(); BreadcrumbManager.Use(Breadcrumbs.Functions); - BreadcrumbManager.Add(new($"New", $"/functions/new")); - Store.Namespace.Subscribe(value => OnStateChanged(_ => ns = value), token: CancellationTokenSource.Token); + BreadcrumbManager.Add(new("New", "/functions/new")); Store.Name.Subscribe(value => OnStateChanged(_ => name = value), token: CancellationTokenSource.Token); - Store.ChosenNamespace.Subscribe(value => OnStateChanged(_ => chosenNamespace = value), token: CancellationTokenSource.Token); Store.ChosenName.Subscribe(value => OnStateChanged(_ => chosenName = value), token: CancellationTokenSource.Token); - Store.Version.Subscribe(value => OnStateChanged(_ => version = value.ToString()), token: CancellationTokenSource.Token); - Store.Namespaces.Subscribe(value => this.OnStateChanged(_ => Namespaces = value), token: this.CancellationTokenSource.Token); + Store.Version.Subscribe(value => OnStateChanged(_ => version = value?.ToString()), token: CancellationTokenSource.Token); Store.Loading.Subscribe(value => OnStateChanged(_ => loading = value), token: CancellationTokenSource.Token); Store.Saving.Subscribe(value => OnStateChanged(_ => saving = value), token: CancellationTokenSource.Token); Store.ProblemDetails.Subscribe(problemDetails => OnStateChanged(cmp => cmp.problemDetails = problemDetails), token: CancellationTokenSource.Token); @@ -132,24 +115,12 @@ else /// protected override void OnParametersSet() { - if (Namespace != ns) - { - Store.SetNamespace(Namespace); - loading = true; - } - if (Name != name) - { - Store.SetName(Name); - } + if (Name != name) Store.SetName(Name); } - protected void SetNameAndNamespace() + protected void SetName() { - if (string.IsNullOrEmpty(nameInputValue) || string.IsNullOrEmpty(namespaceSelectValue)) - { - return; - } - Store.SetChosenNamespace(namespaceSelectValue); + if (string.IsNullOrEmpty(nameInputValue)) return; Store.SetChosenName(nameInputValue); } diff --git a/src/dashboard/Synapse.Dashboard/Pages/Functions/List/State.cs b/src/dashboard/Synapse.Dashboard/Pages/Functions/List/State.cs deleted file mode 100644 index c2e1fdbff..000000000 --- a/src/dashboard/Synapse.Dashboard/Pages/Functions/List/State.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright © 2024-Present The Synapse Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"), -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -using Synapse.Resources; - -namespace Synapse.Dashboard.Pages.Functions.List; - -/// -/// Represents the 's state -/// -public record FunctionListState - : NamespacedResourceManagementComponentState -{ - - - -} \ No newline at end of file diff --git a/src/dashboard/Synapse.Dashboard/Pages/Functions/List/Store.cs b/src/dashboard/Synapse.Dashboard/Pages/Functions/List/Store.cs index 44108b507..e0f4a8f86 100644 --- a/src/dashboard/Synapse.Dashboard/Pages/Functions/List/Store.cs +++ b/src/dashboard/Synapse.Dashboard/Pages/Functions/List/Store.cs @@ -23,7 +23,7 @@ namespace Synapse.Dashboard.Pages.Functions.List; /// The service used to interact with the Synapse API /// The hub used to watch resource events public class FunctionListComponentStore(ILogger logger, ISynapseApiClient apiClient, ResourceWatchEventHubClient resourceEventHub) - : NamespacedResourceManagementComponentStore(logger, apiClient, resourceEventHub) + : ClusterResourceManagementComponentStore(logger, apiClient, resourceEventHub) { diff --git a/src/dashboard/Synapse.Dashboard/Pages/Functions/List/View.razor b/src/dashboard/Synapse.Dashboard/Pages/Functions/List/View.razor index 05aa462ec..b9abc066e 100644 --- a/src/dashboard/Synapse.Dashboard/Pages/Functions/List/View.razor +++ b/src/dashboard/Synapse.Dashboard/Pages/Functions/List/View.razor @@ -14,11 +14,11 @@ limitations under the License. *@ -@page "/functions/{namespace?}/{name?}" +@page "/functions/{name?}" @attribute [Authorize] @namespace Synapse.Dashboard.Pages.Functions.List @using BlazorBootstrap -@inherits NamespacedResourceManagementComponent +@inherits ClusterResourceManagementComponent @inject IBreadcrumbManager BreadcrumbManager @inject NavigationManager NavigationManager @@ -33,16 +33,6 @@

Custom Functions

@(Resources?.Count ?? 0) items
-