private async Task <int> GetOrCreateClubhouseEpic(Octokit.Issue issue) { if (issue.Milestone == null) { return(0); } if (!_fetchedEpics) { _epics = (await _client.Epics.List()).ToList(); } var directHit = _epics.FirstOrDefault(x => x.Name.Equals(issue.Milestone.Title)); if (directHit != null) { return(directHit.Id); } //else, we don't have an epic with this details.... var newEpic = new Epic { Name = issue.Milestone.Title, CreatedAt = issue.Milestone.CreatedAt.DateTime, //deadline Description = issue.Milestone.Description, }; if (issue.Milestone.DueOn.HasValue) { newEpic.Deadline = issue.Milestone.DueOn.Value.DateTime; } await _client.Epics.Create(newEpic); return(newEpic.Id); }
internal FeedbackItemViewModel(Octokit.Issue issue, Action gotoAction) { Title = issue.Title; ImageUrl = issue.User.AvatarUrl; Created = issue.CreatedAt; GoToCommand = ReactiveCommand.Create().WithSubscription(_ => gotoAction()); }
public async Task LoadIssue() { _issue = await _storage.GetIssue(_issueNumber); IssueTitleLabel.Text = _issue.Title; IssueStatusLabel.Text = _issue.State.ToString().ApplyCase(LetterCasing.Title); IssueDateLabel.Text = _issue.CreatedAt.Humanize(); LabelsView.Delegate = this; LabelsView.ShowsVerticalScrollIndicator = false; int x = 0; foreach (var label in _issue.Labels) { var lbl = new UILabel { Text = label.Name }; //new UIView(new CoreGraphics.CGRect(x,0, 100,50)); var c = Storage.LabelColors[label.Name]; var color = UIColor.FromRGB(c[0], c[1], c[2]); lbl.BackgroundColor = color; lbl.TextColor = color.ContrastingColor(); x += (int)lbl.Frame.Size.Width; } IssueBodyLabel.AttributedText = _issue.Body.FromMarkdown(); System.Diagnostics.Debug.WriteLine(_issue.Body); LabelsView.ContentSize = new CoreGraphics.CGSize(x, LabelsView.Frame.Size.Height); }
public async Task <(Story story, int epicId)> ConvertToStory(Octokit.Issue issue, GitHubIssueListProvider ghProvider) { var story = new Story { CreatedAt = issue.CreatedAt.DateTime, Name = issue.Title, Description = issue.Body, ProjectId = Project.Id, }; story.RequestedById = GitHubUser2ClubHouseUser(issue.User); story.OwnerIds = issue.Assignees.Select(GitHubUser2ClubHouseUser).ToList(); var clubHouseEpicId = await GetOrCreateClubhouseEpic(issue); if (clubHouseEpicId > 0) { story.EpicId = clubHouseEpicId; } if (issue.Comments > 0) { foreach (var comment in await ghProvider.GetIssueComments(issue.Number)) { story.Comments.Add(new Comment { AuthorId = GitHubUser2ClubHouseUser(comment.User), CreatedAt = comment.CreatedAt.DateTime, Text = comment.Body }); } } _stories.Add(story); return(story, clubHouseEpicId); }
public IssueViewModel Init(string repositoryOwner, string repositoryName, int id, Octokit.Issue issue = null) { RepositoryOwner = repositoryOwner; RepositoryName = repositoryName; Id = id; Issue = issue; return(this); }
public static DiscordEmbedBuilder AsEmbed(this Octokit.Issue issueInfo) { var state = issueInfo.GetState(); var stateLabel = state.state == null ? null : $"[{state.state}] "; var title = $"{stateLabel}Issue #{issueInfo.Number} from {issueInfo.User?.Login ?? "???"}"; return(new DiscordEmbedBuilder { Title = title, Url = issueInfo.HtmlUrl, Description = issueInfo.Title, Color = state.color }); }
public async Task LoadIssue() { _issue = await _storage.GetIssue(_issueNumber); IssueNameLabel.Text = _issue.Title; IssueStatusView.BackgroundColor = _issue.State == Octokit.ItemState.Closed ? ClosedIssueColor : OpenIssueColor; IssueStatusLabel.Text = _issue.State.ToString().ApplyCase(LetterCasing.Title); IssueCreationDateLabel.Text = _issue.CreatedAt.Humanize(); //LabelsView.Delegate = this; LabelsView.ShowsVerticalScrollIndicator = false; int x = 0; foreach (var label in _issue.Labels) { var lbl = new UILabel { Font = UIFont.PreferredTitle3, Text = label.Name, TextAlignment = UITextAlignment.Center }; lbl.SizeToFit(); lbl.Frame = new CoreGraphics.CGRect(x, lbl.Frame.Y, lbl.Frame.Width + 14, LabelsView.Frame.Size.Height); var c = Storage.LabelColors[label.Name]; var color = UIColor.FromRGB(c[0], c[1], c[2]); lbl.BackgroundColor = color; lbl.TextColor = color.ContrastingColor(); LabelsView.AddSubview(lbl); System.Diagnostics.Debug.WriteLine($"{label.Name} : {x}"); x += (int)lbl.Frame.Size.Width; } if (_issue.Milestone != null) { IssueMilestoneCell.Hidden = false; if (_issue.Milestone.DueOn.HasValue) { IssueMilestoneDateLabel.Text = $"{_issue.Milestone.DueOn.GetValueOrDefault().DateTime:dd MMM}"; } else { IssueMilestoneDateLabel.Text = "--"; } IssueMilestoneLabel.Text = $"{_issue.Milestone.Title}"; } else { IssueMilestoneCell.Hidden = true; } IssueBodyLabel.AttributedText = _issue.Body.FromMarkdown(); System.Diagnostics.Debug.WriteLine(_issue.Body); LabelsView.ContentSize = new CoreGraphics.CGSize(x, LabelsView.Frame.Size.Height); }
public async Task LoadIssue() { _issue = await _storage.GetIssue(_issueNumber); if (String.IsNullOrEmpty(_issue.Body)) { _issueBodyTextView.Visibility = ViewStates.Gone; } else { _issueBodyTextView.Visibility = ViewStates.Visible; _issueBodyTextView.LoadMarkdown(_issue.Body, "file:///android_asset/github-markdown.css"); } _issueTitleTextView.Text = _issue.Title; _issueStatusTextView.Text = _issue.State.ToString(); if (_issue.Milestone != null) { if (_issue.Milestone.DueOn.HasValue) { _issueMilestoneDate.Text = $"{_issue.Milestone.DueOn.GetValueOrDefault().DateTime:dd MMM}"; } else { _issueMilestoneDate.Text = "--"; } _issueMilestoneDate.Visibility = ViewStates.Visible; _issueMilestoneInfo.Visibility = ViewStates.Visible; _issueMilestoneInfo.Text = $"{_issue.Milestone.Title}"; } else { _issueMilestoneDate.Visibility = ViewStates.Gone; _issueMilestoneInfo.Visibility = ViewStates.Gone; } _issueStatusTextView.SetBackgroundColor(_issue.State == Octokit.ItemState.Closed ? Resources.GetColor(Resource.Color.closed_issue) : Resources.GetColor(Resource.Color.open_issue)); _issueCreatedAtTextView.Text = _issue.CreatedAt.Humanize(DateTimeOffset.Now); var _layoutManager = new LinearLayoutManager(this.Context, LinearLayoutManager.Horizontal, false); _labelsRecyclerView.SetLayoutManager(_layoutManager); var adapter = new LabelsAdapter(_issue.Labels.ToList()); _labelsRecyclerView.SetAdapter(adapter); System.Diagnostics.Debug.WriteLine("Comments : " + _issue.CommentsUrl); }
public Issue(Octokit.Issue issue, DateTimeOffset oneDayAgo) { CreatedAt = issue.CreatedAt; UpdatedAt = issue.UpdatedAt ?? issue.CreatedAt; Link = issue.HtmlUrl; Title = issue.Title; Labels = issue.Labels.Select(x => x.Name).ToArray(); Recent = CreatedAt > oneDayAgo; HelpWanted = Labels .Select(l => new string(l.Where(c => char.IsLetterOrDigit(c)).ToArray())) .Any(l => HelpWantedLabels.Contains(l, StringComparer.OrdinalIgnoreCase)); }
public SelectableIssue(Octokit.Issue _issue) { InitializeComponent(); Issue = _issue; if (Issue == null) { throw new ArgumentNullException("_issue"); } IssueNumber.Text = Issue.Number.ToString(); IssueTitle.Text = Issue.Title; }
public static (string?state, DiscordColor color) GetState(this Octokit.Issue issueInfo) { if (issueInfo.State == Octokit.ItemState.Open) { return("Open", Config.Colors.PrOpen); } if (issueInfo.State == Octokit.ItemState.Closed) { return("Closed", Config.Colors.PrClosed); } return(null, Config.Colors.DownloadLinks); }
public static MyIssues.Models.Issue Map(this Octokit.Issue issue) { var i = new Models.Issue { Assignee = issue.Assignee?.Login, Author = issue.User.Login, Body = issue.Body, ClosedAt = issue.ClosedAt, CreatedAt = issue.CreatedAt, HtmlUrl = issue.HtmlUrl, Id = issue.Id, IsOpen = issue.State == Octokit.ItemState.Open, Locked = issue.Locked, Number = issue.Number, Milestone = issue.Milestone?.Title, MilestoneDueDate = issue.Milestone?.DueOn, Title = issue.Title, Labels = issue.Labels.Select(m => m.Map()).ToList() }; i.FillReactions(issue.Reactions); return(i); }
internal FeedbackItemViewModel(string repositoryOwner, string repositoryName, Octokit.Issue issue) { RepositoryOwner = repositoryOwner; RepositoryName = repositoryName; IssueId = issue.Number; Title = issue.Title; ImageUrl = issue.User.AvatarUrl; Created = issue.CreatedAt; CreatedString = Created.Humanize(); }