-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 13364-validation-issues-when-creating-a-new-…
…model
- Loading branch information
Showing
194 changed files
with
3,990 additions
and
1,292 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
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 |
---|---|---|
|
@@ -51,6 +51,7 @@ jobs: | |
resource-adm | ||
resource-registry | ||
settings | ||
studio-root | ||
subform | ||
testing | ||
text | ||
|
584 changes: 292 additions & 292 deletions
584
.yarn/releases/yarn-4.5.1.cjs → .yarn/releases/yarn-4.5.2.cjs
Large diffs are not rendered by default.
Oops, something went wrong.
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
23 changes: 23 additions & 0 deletions
23
backend/src/Designer/Configuration/FeedbackFormSettings.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,23 @@ | ||
using Altinn.Studio.Designer.Configuration.Marker; | ||
|
||
namespace Altinn.Studio.Designer.Configuration | ||
{ | ||
/// <summary> | ||
/// Class representation for basic FeedbackForm configuration | ||
/// </summary> | ||
public class FeedbackFormSettings : ISettingsMarker | ||
{ | ||
/// <summary> | ||
/// Gets or sets the Slack settings | ||
/// </summary> | ||
public SlackSettings SlackSettings { get; set; } | ||
} | ||
|
||
public class SlackSettings | ||
{ | ||
/// <summary> | ||
/// Gets or sets the WebhookUrl | ||
/// </summary> | ||
public string WebhookUrl { get; set; } | ||
} | ||
} |
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,10 @@ | ||
using Altinn.Studio.Designer.Configuration.Marker; | ||
|
||
namespace Altinn.Studio.Designer.Configuration; | ||
|
||
public class RedisCacheSettings : ISettingsMarker | ||
{ | ||
public bool UseRedisCache { get; set; } = false; | ||
public string ConnectionString { get; set; } | ||
public string InstanceName { get; set; } | ||
} |
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
75 changes: 75 additions & 0 deletions
75
backend/src/Designer/Controllers/FeedbackFormController.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,75 @@ | ||
using System.Text.Json; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Altinn.Studio.Designer.Configuration; | ||
using Altinn.Studio.Designer.Models.Dto; | ||
using Altinn.Studio.Designer.TypedHttpClients.Slack; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Routing; | ||
|
||
namespace Altinn.Studio.Designer.Controllers; | ||
|
||
/// <summary> | ||
/// Controller containing actions related to feedback form | ||
/// </summary> | ||
[Authorize] | ||
[ApiController] | ||
[ValidateAntiForgeryToken] | ||
[Route("designer/api/{org}/{app:regex(^(?!datamodels$)[[a-z]][[a-z0-9-]]{{1,28}}[[a-z0-9]]$)}/feedbackform")] | ||
public class FeedbackFormController : ControllerBase | ||
{ | ||
private readonly ISlackClient _slackClient; | ||
private readonly GeneralSettings _generalSettings; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="FeedbackFormController"/> class. | ||
/// </summary> | ||
/// <param name="slackClient">A http client to send messages to slack</param> | ||
/// <param name="generalSettings">the general settings</param> | ||
public FeedbackFormController(ISlackClient slackClient, GeneralSettings generalSettings) | ||
{ | ||
_slackClient = slackClient; | ||
_generalSettings = generalSettings; | ||
} | ||
|
||
/// <summary> | ||
/// Endpoint for submitting feedback | ||
/// </summary> | ||
[HttpPost] | ||
[Route("submit")] | ||
public async Task<IActionResult> SubmitFeedback([FromRoute] string org, [FromRoute] string app, [FromBody] FeedbackForm feedback, CancellationToken cancellationToken) | ||
{ | ||
if (feedback == null) | ||
{ | ||
return BadRequest("Feedback object is null"); | ||
} | ||
|
||
if (feedback.Answers == null || feedback.Answers.Count == 0) | ||
{ | ||
return BadRequest("Feedback answers are null or empty"); | ||
} | ||
|
||
if (!feedback.Answers.ContainsKey("org")) | ||
{ | ||
feedback.Answers.Add("org", org); | ||
} | ||
|
||
if (!feedback.Answers.ContainsKey("app")) | ||
{ | ||
feedback.Answers.Add("app", app); | ||
} | ||
|
||
if (!feedback.Answers.ContainsKey("env")) | ||
{ | ||
feedback.Answers.Add("env", _generalSettings.HostName); | ||
} | ||
|
||
await _slackClient.SendMessage(new SlackRequest | ||
{ | ||
Text = JsonSerializer.Serialize(feedback.Answers, new JsonSerializerOptions { WriteIndented = true }) | ||
}, cancellationToken); | ||
|
||
return Ok(); | ||
} | ||
} |
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
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
Oops, something went wrong.