Inheritance: BindableBase
Esempio n. 1
0
 public MergeRequestViewModel(BranchViewModel branch, MergeRequest mergeRequest)
 {
     Branch = branch;
     MergeRequest = mergeRequest;
     Changes = branch.GetMergeRequestChanges(mergeRequest).Select(x => new MergeRequestFileDataViewModel(x)).ToList();
     Commits = branch.GetCommits(mergeRequest)
         .Select(commit => new CommitViewModel(commit, sha => branch.GetBuilds(mergeRequest, sha), x => branch.DownloadArtifacts(mergeRequest, x), x => branch.DownloadTrace(mergeRequest, x)))
         .ToList();
     Title = MergeRequest.Title;
     SourceBranch = MergeRequest.SourceBranch;
     TargetBranch = MergeRequest.TargetBranch;
     Author = MergeRequest.Author.Username;
     Assignee = MergeRequest.Assignee?.Username;
     AssigneeId = MergeRequest?.Assignee?.Id;
 }
Esempio n. 2
0
 void ShowMergeRequestNotification(BranchViewModel branchViewModel, MergeRequestHookClient hook) {
     var mergeStatus = hook.Attributes.State;
     if (mergeStatus == MergerRequestState.merged) {
         string message = $"Merge request {hook.Attributes.Title} for branch {hook.Attributes.SourceBranch} was merged.";
         var notification = NotificationService.CreatePredefinedNotification(message, null, null, null);
         var task = notification.ShowAsync();
         task.ContinueWith(x => PerformClick(x.Result));
         return;
     }
     if (mergeStatus == MergerRequestState.closed) {
         string message = $"Merge request {hook.Attributes.Title} for branch {hook.Attributes.SourceBranch} was closed.";
         var notification = NotificationService.CreatePredefinedNotification(message, null, null, null);
         var task = notification.ShowAsync();
         task.ContinueWith(x => PerformClick(x.Result));
         return;
     }
     if (branchViewModel.MergeRequest.AssigneeId != hook.Attributes.AssigneeId) {
         string message = $"Assignee for merge request {hook.Attributes.Title} for branch {hook.Attributes.SourceBranch} was changed.";
         var notification = NotificationService.CreatePredefinedNotification(message, null, null, null);
         var task = notification.ShowAsync();
         task.ContinueWith(x => PerformClick(x.Result));
         return;
     }
 }
 void RefreshSelectedBranch()
 {
     Branch = Repositories?.SelectedBranch;
     var mergeRequest = Branch?.MergeRequest;
     if (mergeRequest == null) {
         comment = null;
         assignedToService = false;
         performTesting = false;
         IsModified = false;
     }
     else {
         if (Branch.SupportsTesting) {
             var syncOptions = Branch.GetSyncOptions(mergeRequest.MergeRequest);
             performTesting = syncOptions?.PerformTesting ?? false;
             assignedToService = (syncOptions?.AssignToSyncService ?? false) && IsTestUser(mergeRequest.Assignee);
         }
         else {
             assignedToService = mergeRequest.Assignee == Branch.SyncServiceName;
             performTesting = false;
         }
         comment = mergeRequest.Title;
         IsModified = false;
     }
     SupportsTesting = Branch?.SupportsTesting ?? false;
     RaisePropertyChanged(null);
 }
        void PerformAbortTest(CommitViewModel commit)
        {
            var actualCommit = commit ?? BranchViewModel.MergeRequest.Commits.FirstOrDefault();

            BranchViewModel.AbortBuild(BranchViewModel.MergeRequest.MergeRequest, actualCommit?.Build.Build);
        }
 void UseCommitDescription(CommitViewModel commit)
 {
     BranchViewModel.UpdateMergeRequest(commit.Title, BranchViewModel.MergeRequest.MergeRequest.Description, BranchViewModel.MergeRequest.Assignee);
     RepositoriesViewModel.RaiseRefreshSelectedBranch();
 }
Esempio n. 6
0
 protected bool Equals(BranchViewModel other)
 {
     return(this.Repository.Equals(other.Repository) && Name == other.Name);
 }
Esempio n. 7
0
 protected bool Equals(BranchViewModel other)
 {
     return this.Repository.Equals(other.Repository) && Name == other.Name;
 }
 void RefreshSelectedBranch()
 {
     BranchViewModel = RepositoriesViewModel.SelectedBranch;
     if (BranchViewModel?.MergeRequest == null) {
         Commits = Enumerable.Empty<CommitViewModel>();
         return;
     }
     var mergeRequest = BranchViewModel.MergeRequest;
     Commits = mergeRequest.Commits;
     Commits.ForEach(x => x.UpdateBuilds());
 }