-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create abstract BackendComponentBase and refactor Backend to BackendP…
…rovider Introduced an abstract BackendComponentBase to consolidate backend functionality for reuse and maintainability. Also, Backend has been renamed to BackendProvider for better clarity and consistency, and it now inherits from BackendComponentBase. This promotes better separation of concerns and a more structured approach to component hierarchy.
- Loading branch information
1 parent
fd1bacd
commit 928cb25
Showing
7 changed files
with
38 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
src/hosts/Elsa.Studio.Host.CustomElements/Components/Backend.razor
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
src/hosts/Elsa.Studio.Host.CustomElements/Components/BackendComponentBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Elsa.Studio.Components; | ||
using Elsa.Studio.Host.CustomElements.Services; | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace Elsa.Studio.Host.CustomElements.Components; | ||
|
||
public abstract class BackendComponentBase : StudioComponentBase | ||
{ | ||
[Parameter] public string? RemoteEndpoint { get; set; } | ||
[Parameter] public string? ApiKey { get; set; } | ||
[Parameter] public string? AccessToken { get; set; } | ||
[Inject] private BackendService BackendService { get; set; } = default!; | ||
|
||
protected override void OnInitialized() | ||
{ | ||
if (!string.IsNullOrWhiteSpace(RemoteEndpoint)) | ||
BackendService.RemoteEndpoint = RemoteEndpoint; | ||
|
||
if (!string.IsNullOrWhiteSpace(ApiKey)) | ||
BackendService.ApiKey = ApiKey; | ||
|
||
if (!string.IsNullOrWhiteSpace(AccessToken)) | ||
BackendService.AccessToken = AccessToken; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/hosts/Elsa.Studio.Host.CustomElements/Components/BackendProvider.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@using Elsa.Studio.Host.CustomElements.Services | ||
@using Elsa.Studio.Contracts | ||
@using Elsa.Studio.Options | ||
@using Microsoft.Extensions.Options | ||
@inherits BackendComponentBase | ||
|
||
@code { | ||
} |
2 changes: 1 addition & 1 deletion
2
src/hosts/Elsa.Studio.Host.CustomElements/Components/WorkflowDefinitionEditorWrapper.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
@page "/" | ||
@rendermode InteractiveServer | ||
<Backend RemoteEndpoint="https://localhost:5001/elsa/api" ApiKey="48587230567A646D394B435A6277734A-4802fa49-e91e-45e8-b00f-b5492377e20b"> | ||
<WorkflowDefinitionEditorWrapper DefinitionId="57305c33e237893b"></WorkflowDefinitionEditorWrapper> | ||
</Backend> | ||
<BackendProvider RemoteEndpoint="https://localhost:5001/elsa/api" ApiKey="48587230567A646D394B435A6277734A-4802fa49-e91e-45e8-b00f-b5492377e20b"/> | ||
<WorkflowDefinitionEditorWrapper DefinitionId="57305c33e237893b"></WorkflowDefinitionEditorWrapper> |