Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fr 5075 #567

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions terminalAtlassian/Activities/Get_Jira_Issue_v1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ public Get_Jira_Issue_v1(ICrateManager crateManager, AtlassianService atlassianS
_atlassianService = atlassianService;
}

protected override async Task Validate()
{
var issueKey = ActivityUI.IssueNumber.TextValue;
if (string.IsNullOrEmpty(issueKey))
{
ValidationManager.SetError("Issue number must be specified", ActivityUI.IssueNumber);
}
else
{
try
{
var curJiraIssue = await _atlassianService.GetJiraIssue(issueKey, AuthorizationToken);
}
catch (Exception e)
{
var m = "Response Content:";
var message = e.Message.Substring(e.Message.IndexOf(m) + m.Length, e.Message.Length - m.Length);
var j = Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(message, new { errorMessages = new string[1], errors = new { } });

ValidationManager.SetError(j.errorMessages[0], ActivityUI.IssueNumber);
}
}
}

public override async Task Initialize()
{
CrateSignaller.MarkAvailableAtRuntime<StandardPayloadDataCM>(RunTimeCrateLabel);
Expand Down
25 changes: 25 additions & 0 deletions terminalAtlassian/Activities/Save_Jira_Issue_v1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Fr8.TerminalBase.Services;
using Newtonsoft.Json;
using terminalAtlassian.Interfaces;
using Fr8.TerminalBase.Infrastructure;

namespace terminalAtlassian.Actions
{
Expand Down Expand Up @@ -250,6 +251,30 @@ public Save_Jira_Issue_v1(ICrateManager crateManager, IAtlassianService atlassia
_pushNotificationService = pushNotificationService;
}

protected override Task Validate()
{
if (string.IsNullOrEmpty(ActivityUI.AvailableProjects.Value))
{
ValidationManager.SetError("Project is not specified", ActivityUI.AvailableProjects);
}

if (string.IsNullOrEmpty(ActivityUI.AvailableIssueTypes.Value) && ActivityUI.AvailableIssueTypes.IsHidden != true)
{
ValidationManager.SetError("Issue Type is not specified", ActivityUI.AvailableIssueTypes);
}

if (string.IsNullOrEmpty(ActivityUI.AvailablePriorities.Value) && ActivityUI.AvailablePriorities.IsHidden != true)
{
ValidationManager.SetError("Issue Priority is not specified", ActivityUI.AvailablePriorities);
}
if(ActivityUI.Summary.IsHidden != true)
{
ValidationManager.ValidateTextSourceNotEmpty(ActivityUI.Summary, "Issue Summary is not specified");
}

return Task.FromResult(0);
}

#region Configuration

public override async Task Initialize()
Expand Down