Skip to content

Commit 2d49c7a

Browse files
authored
Merge pull request #319 from neuroglia-io/fix-correlations
Updated the Dashboard's correlation interface by enabling its reactive features, by adding a button to trigger correlations by posting cloud events in-app, and by adding a new view to create explicit correlations
2 parents 9a505cb + 42634b7 commit 2d49c7a

File tree

58 files changed

+5223
-2181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+5223
-2181
lines changed

src/apis/management/Synapse.Apis.Management.Core/Services/ISynapseManagementApi.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,27 @@ public interface ISynapseManagementApi
231231
[OperationContract]
232232
Task<List<V1Correlation>> GetCorrelationsAsync(string? query = null, CancellationToken cancellationToken = default);
233233

234+
/// <summary>
235+
/// Deletes the specified <see cref="V1CorrelationContext"/>
236+
/// </summary>
237+
/// <param name="correlationId">The id of the <see cref="V1Correlation"/> the <see cref="V1CorrelationContext"/> to delete belongs to</param>
238+
/// <param name="contextId">The id of the <see cref="V1CorrelationContext"/> to delete</param>
239+
/// <param name="cancellationToken">A <see cref="CancellationToken"/></param>
240+
/// <returns>A new awaitable <see cref="Task"/></returns>
241+
[OperationContract]
242+
Task DeleteCorrelationContextAsync(string correlationId, string contextId, CancellationToken cancellationToken = default);
243+
244+
/// <summary>
245+
/// Deletes the specified correlated <see cref="V1Event"/>
246+
/// </summary>
247+
/// <param name="correlationId">The id of the <see cref="V1Correlation"/> the correlated <see cref="V1Event"/> to delete belongs to</param>
248+
/// <param name="contextId">The id of the <see cref="V1CorrelationContext"/> the correlated <see cref="V1Event"/> to delete belongs to</param>
249+
/// <param name="eventId">The id of the correlated <see cref="V1Event"/> to delete</param>
250+
/// <param name="cancellationToken">A <see cref="CancellationToken"/></param>
251+
/// <returns>A new awaitable <see cref="Task"/></returns>
252+
[OperationContract]
253+
Task DeleteCorrelationContextEventAsync(string correlationId, string contextId, string eventId, CancellationToken cancellationToken = default);
254+
234255
/// <summary>
235256
/// Deletes the <see cref="V1Correlation"/> with the specified id
236257
/// </summary>

src/apis/management/Synapse.Apis.Management.Grpc.Client/Services/ISynapseGrpcManagementApi.cs

Lines changed: 452 additions & 437 deletions
Large diffs are not rendered by default.

src/apis/management/Synapse.Apis.Management.Grpc.Client/Services/SynapseGrpcManagementApiClient.cs

Lines changed: 28 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,14 @@ public virtual async Task<V1Workflow> UploadWorkflowAsync(V1UploadWorkflowComman
8888
}
8989

9090
/// <inheritdoc/>
91-
public virtual async Task<List<V1Workflow>> GetWorkflowsAsync(string query, CancellationToken cancellationToken = default)
91+
public virtual async Task<List<V1Workflow>> GetWorkflowsAsync(string? query = null, CancellationToken cancellationToken = default)
9292
{
9393
var result = await this.Adapter.GetWorkflowsAsync(query, cancellationToken);
9494
if (!result.Succeeded)
9595
throw new SynapseApiException(result);
9696
return result.Data!;
9797
}
9898

99-
/// <inheritdoc/>
100-
public virtual async Task<List<V1Workflow>> GetWorkflowsAsync(CancellationToken cancellationToken = default)
101-
{
102-
return await this.GetWorkflowsAsync(null!, cancellationToken);
103-
}
104-
10599
/// <inheritdoc/>
106100
public virtual async Task<V1Workflow> GetWorkflowByIdAsync(string id, CancellationToken cancellationToken = default)
107101
{
@@ -158,20 +152,14 @@ public virtual async Task<V1WorkflowInstance> GetWorkflowInstanceByIdAsync(strin
158152
}
159153

160154
/// <inheritdoc/>
161-
public virtual async Task<List<V1WorkflowInstance>> GetWorkflowInstancesAsync(string query, CancellationToken cancellationToken = default)
155+
public virtual async Task<List<V1WorkflowInstance>> GetWorkflowInstancesAsync(string? query = null, CancellationToken cancellationToken = default)
162156
{
163157
var result = await this.Adapter.GetWorkflowInstancesAsync(query, cancellationToken);
164158
if (!result.Succeeded)
165159
throw new SynapseApiException(result);
166160
return result.Data!;
167161
}
168162

169-
/// <inheritdoc/>
170-
public virtual async Task<List<V1WorkflowInstance>> GetWorkflowInstancesAsync(CancellationToken cancellationToken = default)
171-
{
172-
return await this.GetWorkflowInstancesAsync(null!, cancellationToken);
173-
}
174-
175163
/// <inheritdoc/>
176164
public virtual async Task SuspendWorkflowInstanceAsync(string id, CancellationToken cancellationToken = default)
177165
{
@@ -236,7 +224,7 @@ public virtual async Task<V1Correlation> CreateCorrelationAsync(V1CreateCorrelat
236224
}
237225

238226
/// <inheritdoc/>
239-
public virtual async Task<List<V1Correlation>> GetCorrelationsAsync(string query, CancellationToken cancellationToken = default)
227+
public virtual async Task<List<V1Correlation>> GetCorrelationsAsync(string? query = null, CancellationToken cancellationToken = default)
240228
{
241229
var result = await this.Adapter.GetCorrelationsAsync(query, cancellationToken);
242230
if (!result.Succeeded)
@@ -245,18 +233,34 @@ public virtual async Task<List<V1Correlation>> GetCorrelationsAsync(string query
245233
}
246234

247235
/// <inheritdoc/>
248-
public virtual async Task<List<V1Correlation>> GetCorrelationsAsync(CancellationToken cancellationToken = default)
236+
public virtual async Task<V1Correlation> GetCorrelationByIdAsync(string id, CancellationToken cancellationToken = default)
249237
{
250-
return await this.GetCorrelationsAsync(null!, cancellationToken);
238+
if (string.IsNullOrWhiteSpace(id)) throw new ArgumentNullException(nameof(id));
239+
var result = await this.Adapter.GetCorrelationByIdAsync(id, cancellationToken);
240+
if (!result.Succeeded)
241+
throw new SynapseApiException(result);
242+
return result.Data!;
251243
}
252244

253245
/// <inheritdoc/>
254-
public virtual async Task<V1Correlation> GetCorrelationByIdAsync(string id, CancellationToken cancellationToken = default)
246+
public virtual async Task DeleteCorrelationContextAsync(string correlationId, string contextId, CancellationToken cancellationToken = default)
255247
{
256-
var result = await this.Adapter.GetCorrelationByIdAsync(id, cancellationToken);
248+
if (string.IsNullOrWhiteSpace(correlationId)) throw new ArgumentNullException(nameof(correlationId));
249+
if (string.IsNullOrWhiteSpace(contextId)) throw new ArgumentNullException(nameof(contextId));
250+
var result = await this.Adapter.DeleteCorrelationContextAsync(new() { CorrelationId = correlationId, ContextId = contextId }, cancellationToken);
251+
if (!result.Succeeded)
252+
throw new SynapseApiException(result);
253+
}
254+
255+
/// <inheritdoc/>
256+
public virtual async Task DeleteCorrelationContextEventAsync(string correlationId, string contextId, string eventId, CancellationToken cancellationToken = default)
257+
{
258+
if (string.IsNullOrWhiteSpace(correlationId)) throw new ArgumentNullException(nameof(correlationId));
259+
if (string.IsNullOrWhiteSpace(contextId)) throw new ArgumentNullException(nameof(contextId));
260+
if (string.IsNullOrWhiteSpace(eventId)) throw new ArgumentNullException(nameof(eventId));
261+
var result = await this.Adapter.DeleteCorrelationContextEventAsync(new() { CorrelationId = correlationId, ContextId = contextId, EventId = eventId }, cancellationToken);
257262
if (!result.Succeeded)
258263
throw new SynapseApiException(result);
259-
return result.Data!;
260264
}
261265

262266
/// <inheritdoc/>
@@ -288,14 +292,9 @@ public virtual async Task<V1AuthenticationDefinitionCollection> GetAuthenticatio
288292
return result.Data!;
289293
}
290294

291-
/// <inheritdoc/>
292-
public virtual async Task<List<V1AuthenticationDefinitionCollection>> GetAuthenticationDefinitionCollectionsAsync(CancellationToken cancellationToken = default)
293-
{
294-
return await this.GetAuthenticationDefinitionCollectionsAsync(null!, cancellationToken);
295-
}
296295

297296
/// <inheritdoc/>
298-
public virtual async Task<List<V1AuthenticationDefinitionCollection>> GetAuthenticationDefinitionCollectionsAsync(string? query, CancellationToken cancellationToken = default)
297+
public virtual async Task<List<V1AuthenticationDefinitionCollection>> GetAuthenticationDefinitionCollectionsAsync(string? query = null, CancellationToken cancellationToken = default)
299298
{
300299
var result = await this.Adapter.GetAuthenticationDefinitionCollectionsAsync(query, cancellationToken);
301300
if (!result.Succeeded)
@@ -334,13 +333,7 @@ public virtual async Task<V1EventDefinitionCollection> GetEventDefinitionCollect
334333
}
335334

336335
/// <inheritdoc/>
337-
public virtual async Task<List<V1EventDefinitionCollection>> GetEventDefinitionCollectionsAsync(CancellationToken cancellationToken = default)
338-
{
339-
return await this.GetEventDefinitionCollectionsAsync(null!, cancellationToken);
340-
}
341-
342-
/// <inheritdoc/>
343-
public virtual async Task<List<V1EventDefinitionCollection>> GetEventDefinitionCollectionsAsync(string? query, CancellationToken cancellationToken = default)
336+
public virtual async Task<List<V1EventDefinitionCollection>> GetEventDefinitionCollectionsAsync(string? query = null, CancellationToken cancellationToken = default)
344337
{
345338
var result = await this.Adapter.GetEventDefinitionCollectionsAsync(query, cancellationToken);
346339
if (!result.Succeeded)
@@ -379,13 +372,7 @@ public virtual async Task<V1FunctionDefinitionCollection> GetFunctionDefinitionC
379372
}
380373

381374
/// <inheritdoc/>
382-
public virtual async Task<List<V1FunctionDefinitionCollection>> GetFunctionDefinitionCollectionsAsync(CancellationToken cancellationToken = default)
383-
{
384-
return await this.GetFunctionDefinitionCollectionsAsync(null!, cancellationToken);
385-
}
386-
387-
/// <inheritdoc/>
388-
public virtual async Task<List<V1FunctionDefinitionCollection>> GetFunctionDefinitionCollectionsAsync(string query, CancellationToken cancellationToken = default)
375+
public virtual async Task<List<V1FunctionDefinitionCollection>> GetFunctionDefinitionCollectionsAsync(string? query = null, CancellationToken cancellationToken = default)
389376
{
390377
var result = await this.Adapter.GetFunctionDefinitionCollectionsAsync(query, cancellationToken);
391378
if (!result.Succeeded)
@@ -437,10 +424,7 @@ public virtual async Task<V1Schedule> GetScheduleByIdAsync(string id, Cancellati
437424
}
438425

439426
/// <inheritdoc/>
440-
public virtual async Task<List<V1Schedule>> GetSchedulesAsync(CancellationToken cancellationToken = default) => await this.GetSchedulesAsync(null!, cancellationToken);
441-
442-
/// <inheritdoc/>
443-
public virtual async Task<List<V1Schedule>> GetSchedulesAsync(string query, CancellationToken cancellationToken = default)
427+
public virtual async Task<List<V1Schedule>> GetSchedulesAsync(string? query = null, CancellationToken cancellationToken = default)
444428
{
445429
var result = await this.Adapter.GetSchedulesAsync(query, cancellationToken);
446430
if (!result.Succeeded) throw new SynapseApiException(result);

0 commit comments

Comments
 (0)