Skip to content

Commit 205228b

Browse files
Formatting code
Signed-off-by: Jaliya Udagedara <jaliya.udagedara@hotmail.com>
1 parent 3f24237 commit 205228b

File tree

2 files changed

+67
-52
lines changed

2 files changed

+67
-52
lines changed

src/apps/Synapse.Worker/Services/Processors/FunctionProcessor.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,15 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
9696
};
9797
}
9898
this.Authentication = auth;
99-
if (this.Authentication != null) this.Authorization = await AuthorizationInfo.CreateAsync(this.ServiceProvider, this.Authentication, cancellationToken);
99+
if (this.Authentication != null)
100+
{
101+
this.Authorization = await AuthorizationInfo.CreateAsync(this.ServiceProvider, this.Authentication, cancellationToken);
102+
}
100103
}
101104
else
105+
{
102106
throw new NullReferenceException($"Failed to find the authentication definition with name '{this.Function.AuthRef}'");
107+
}
103108
}
104109
}
105110

@@ -109,7 +114,10 @@ protected override async Task OnNextAsync(IV1WorkflowActivityIntegrationEvent e,
109114
if (e is V1WorkflowActivityCompletedIntegrationEvent completedEvent)
110115
{
111116
var output = completedEvent.Output.ToObject();
112-
if (this.Action.ActionDataFilter != null) output = await this.Context.FilterOutputAsync(this.Action, output!, this.Authorization, cancellationToken);
117+
if (this.Action.ActionDataFilter != null)
118+
{
119+
output = await this.Context.FilterOutputAsync(this.Action, output!, this.Authorization, cancellationToken);
120+
}
113121
await base.OnNextAsync(new V1WorkflowActivityCompletedIntegrationEvent(this.Activity.Id, output), cancellationToken);
114122
}
115123
else

src/dashboard/Synapse.Dashboard/Features/Workflows/WorkflowEditor/AuthenticationEditor.razor

Lines changed: 57 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@*
1+
@*
22
Copyright © 2022-Present The Synapse Authors
33
44
Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,21 +16,23 @@
1616

1717
@namespace Synapse.Dashboard
1818

19-
@if(authentication != null)
19+
@if (authentication != null)
2020
{
2121
<table class="table table-striped">
2222
<tbody>
2323
<tr>
2424
<td>Name</td>
25-
<td><input type="text" value="@authentication.Name" required placeholder="Name" title="The authentication name" class="form-control"
26-
@onchange="async e => await OnPropertyChangedAsync(nameof(authentication.Name), a => a.Name = (string)e.Value!)"/></td>
25+
<td>
26+
<input type="text" value="@authentication.Name" required placeholder="Name" title="The authentication name" class="form-control"
27+
@onchange="async e => await OnPropertyChangedAsync(nameof(authentication.Name), a => a.Name = (string)e.Value!)" />
28+
</td>
2729
</tr>
2830
<tr>
2931
<td>Scheme</td>
3032
<td>
3133
<select class="form-select bg-secondary text-white"
32-
@onchange="async e => await OnAuthenticationSchemeChangedAsync(EnumHelper.Parse<AuthenticationScheme>((string)e.Value!))">
33-
@foreach(var scheme in Enum.GetValues<AuthenticationScheme>())
34+
@onchange="async e => await OnAuthenticationSchemeChangedAsync(EnumHelper.Parse<AuthenticationScheme>((string)e.Value!))">
35+
@foreach (var scheme in Enum.GetValues<AuthenticationScheme>())
3436
{
3537
var schemeStr = @EnumHelper.Stringify(scheme);
3638
<option value="@schemeStr" selected="@(authentication.Scheme == scheme)">@schemeStr</option>
@@ -40,79 +42,84 @@
4042
</tr>
4143
<ExpandableDataRow IsExpanded="true">
4244
<Header>
43-
<td>Properties</td>
44-
<td>
45-
<div class="input-group">
46-
<div class="input-group-text">
47-
<input class="form-check-input mt-0 me-2" type="checkbox" value="@useSecretBasedProperties" checked="@useSecretBasedProperties"
48-
@onclick="OnUseSecretBasedPropertiesChanged">
49-
<label title="Indicates whether or not to load the authentication properties from a secret">Load properties from secret</label>
50-
</div>
45+
<td>Properties</td>
46+
<td>
47+
<div class="input-group">
48+
<div class="input-group-text">
49+
<input class="form-check-input mt-0 me-2" type="checkbox" value="@useSecretBasedProperties" checked="@useSecretBasedProperties"
50+
@onclick="OnUseSecretBasedPropertiesChanged">
51+
<label title="Indicates whether or not to load the authentication properties from a secret">Load properties from secret</label>
52+
</div>
5153
@if (useSecretBasedProperties)
5254
{
53-
<SecretSelector
54-
Secrets="Workflow.Secrets"
55+
<SecretSelector Secrets="Workflow.Secrets"
5556
Selected="@(((SecretBasedAuthenticationProperties)authentication.Properties).Secret)"
56-
OnChange="async secret => await OnPropertyChangedAsync(nameof(authentication.Properties), a => a.SecretRef = secret)"/>
57+
OnChange="async secret => await OnPropertyChangedAsync(nameof(authentication.Properties), a => a.SecretRef = secret)" />
5758
}
58-
</div>
59-
</td>
59+
</div>
60+
</td>
6061
</Header>
6162
<Body>
62-
@if(!useSecretBasedProperties)
63+
@if (!useSecretBasedProperties)
6364
{
64-
<td colspan="3">
65+
<td colspan="3">
6566
@switch (authentication.Scheme)
6667
{
6768
case AuthenticationScheme.Basic:
68-
if(authentication.Properties is not BasicAuthenticationProperties basic)
69+
if (authentication.Properties is not BasicAuthenticationProperties basic)
6970
{
7071
basic = new();
7172
authentication.Properties = basic;
7273
}
73-
<table class="table table-striped">
74-
<tbody>
75-
<tr>
76-
<td>Username</td>
77-
<td><input type="text" value="@basic.Username" required placeholder="Username" title="The username to use to authenticate" class="form-control"
78-
@onchange="async e => await OnAuthenticationPropertiesChangedAsync<BasicAuthenticationProperties>(p => p.Username = (string)e.Value!)"/></td>
79-
</tr>
80-
<tr>
81-
<td>Password</td>
82-
<td><input type="text" value="@basic.Password" required placeholder="Password" title="The password to use to authenticate" class="form-control"
83-
@onchange="async e => await OnAuthenticationPropertiesChangedAsync<BasicAuthenticationProperties>(p => p.Password = (string)e.Value!)"/></td>
84-
</tr>
85-
</tbody>
86-
</table>
74+
<table class="table table-striped">
75+
<tbody>
76+
<tr>
77+
<td>Username</td>
78+
<td>
79+
<input type="text" value="@basic.Username" required placeholder="Username" title="The username to use to authenticate" class="form-control"
80+
@onchange="async e => await OnAuthenticationPropertiesChangedAsync<BasicAuthenticationProperties>(p => p.Username = (string)e.Value!)" />
81+
</td>
82+
</tr>
83+
<tr>
84+
<td>Password</td>
85+
<td>
86+
<input type="text" value="@basic.Password" required placeholder="Password" title="The password to use to authenticate" class="form-control"
87+
@onchange="async e => await OnAuthenticationPropertiesChangedAsync<BasicAuthenticationProperties>(p => p.Password = (string)e.Value!)" />
88+
</td>
89+
</tr>
90+
</tbody>
91+
</table>
8792
break;
8893
case AuthenticationScheme.Bearer:
89-
if(authentication.Properties is not BearerAuthenticationProperties bearer)
94+
if (authentication.Properties is not BearerAuthenticationProperties bearer)
9095
{
9196
bearer = new();
9297
authentication.Properties = bearer;
9398
}
94-
<table class="table table-striped">
95-
<tbody>
96-
<tr>
97-
<td>Token</td>
98-
<td><textarea placeholder="Token" title="The token to use to authenticate" class="form-control"
99-
@onchange="async e => await OnPropertyChangedAsync(nameof(authentication.Properties), a => ((BearerAuthenticationProperties)a.Properties).Token = (string)e.Value!)">@bearer.Token</textarea></td>
100-
</tr>
101-
</tbody>
102-
</table>
99+
<table class="table table-striped">
100+
<tbody>
101+
<tr>
102+
<td>Token</td>
103+
<td>
104+
<textarea placeholder="Token" title="The token to use to authenticate" class="form-control"
105+
@onchange="async e => await OnPropertyChangedAsync(nameof(authentication.Properties), a => ((BearerAuthenticationProperties)a.Properties).Token = (string)e.Value!)">@bearer.Token</textarea>
106+
</td>
107+
</tr>
108+
</tbody>
109+
</table>
103110
break;
104111
case AuthenticationScheme.OAuth2:
105-
if(authentication.Properties is not OAuth2AuthenticationProperties oauth2)
112+
if (authentication.Properties is not OAuth2AuthenticationProperties oauth2)
106113
{
107114
oauth2 = new();
108115
authentication.Properties = oauth2;
109116
}
110117
break;
111118
default:
112-
<span class="text-danger">The specified authentication scheme '@(EnumHelper.Stringify(authentication.Scheme))' is not supported</span>
119+
<span class="text-danger">The specified authentication scheme '@(EnumHelper.Stringify(authentication.Scheme))' is not supported</span>
113120
break;
114121
}
115-
</td>
122+
</td>
116123
}
117124
</Body>
118125
</ExpandableDataRow>
@@ -147,7 +154,7 @@
147154
if (Authentication == null)
148155
return;
149156
this.useSecretBasedProperties = !useSecretBasedProperties;
150-
if(!this.useSecretBasedProperties)
157+
if (!this.useSecretBasedProperties)
151158
return;
152159
this.Authentication.SecretRef = "undefined";
153160
await this.OnChange.InvokeAsync(this.Authentication);

0 commit comments

Comments
 (0)