|
25 | 25 | color: var(--neutral-foreground-hint) !important;
|
26 | 26 | font-style: italic;
|
27 | 27 | }
|
| 28 | +
|
| 29 | + .commitSha { |
| 30 | + border: none; |
| 31 | + color: #888; |
| 32 | + font-family: monospace; |
| 33 | + font-size: 0.8em; |
| 34 | + top: -4px; |
| 35 | + position: relative; |
| 36 | + margin-left: 5px; |
| 37 | + margin-right: 7px; |
| 38 | + } |
| 39 | +
|
| 40 | + .commitSha a { |
| 41 | + height: 23px; |
| 42 | + padding: 2px 6px 0px 6px; |
| 43 | + } |
| 44 | +
|
28 | 45 | </style>
|
29 | 46 |
|
30 | 47 | <PageTitle>Codeflows – Maestro++</PageTitle>
|
|
66 | 83 | <TemplateColumn Title="Backflow"
|
67 | 84 | Sortable="true"
|
68 | 85 | SortBy="@SortBy(sub => sub.BackflowSubscription != null && sub.BackflowSubscription.LastAppliedBuild != null ? sub.BackflowSubscription.LastAppliedBuild.DateProduced.ToString("o") : "1900")"
|
69 |
| - Align="Align.Center"> |
| 86 | + Align="Align.Start"> |
70 | 87 | <FluentLabel Title="@(context.BackflowSubscription?.LastAppliedBuild?.DateProduced.ToString("f"))">
|
71 |
| - @(GetLastAppliedBuildTimeAgo(context.BackflowSubscription)) |
| 88 | + @if (context.BackflowSubscription?.LastAppliedBuild != null) |
| 89 | + { |
| 90 | + @(GetLastAppliedBuildTimeAgo(context.BackflowSubscription)) |
| 91 | + <FluentAnchor Href="@context.BackflowSubscription.LastAppliedBuild.GetCommitLink()" Target="_blank" class="commitSha" title="@context.BackflowSubscription.LastAppliedBuild.Commit"> |
| 92 | + @@GetShortSha(context.BackflowSubscription.LastAppliedBuild.Commit) |
| 93 | + </FluentAnchor> |
| 94 | + } |
| 95 | + else |
| 96 | + { |
| 97 | + <span>—</span> |
| 98 | + } |
| 99 | + |
72 | 100 | @if (context.BackflowPr != null)
|
73 | 101 | {
|
74 |
| - <span> / </span> |
75 | 102 | <FluentAnchor Href="@context.BackflowPr" Target="_blank" Appearance="Appearance.Hypertext">Active PR</FluentAnchor>
|
76 | 103 | }
|
77 | 104 | </FluentLabel>
|
78 | 105 | </TemplateColumn>
|
79 | 106 | <TemplateColumn Title="Forward flow"
|
80 | 107 | Sortable="true"
|
81 | 108 | SortBy="@SortBy(sub => sub.ForwardflowSubscription != null && sub.ForwardflowSubscription.LastAppliedBuild != null ? sub.ForwardflowSubscription.LastAppliedBuild.DateProduced.ToString("o") : "1900")"
|
82 |
| - Align="Align.Center"> |
| 109 | + Align="Align.Start"> |
83 | 110 | <FluentLabel Title="@(context.ForwardflowSubscription?.LastAppliedBuild?.DateProduced.ToString("f"))">
|
84 |
| - @(GetLastAppliedBuildTimeAgo(context.ForwardflowSubscription)) |
| 111 | + @if (context.ForwardflowSubscription?.LastAppliedBuild != null) |
| 112 | + { |
| 113 | + @(GetLastAppliedBuildTimeAgo(context.ForwardflowSubscription)) |
| 114 | + <FluentAnchor Href="@context.ForwardflowSubscription.LastAppliedBuild.GetCommitLink()" Target="_blank" class="commitSha" title="@context.ForwardflowSubscription.LastAppliedBuild.Commit"> |
| 115 | + @@GetShortSha(context.ForwardflowSubscription.LastAppliedBuild.Commit) |
| 116 | + </FluentAnchor> |
| 117 | + } |
| 118 | + else |
| 119 | + { |
| 120 | + <span>—</span> |
| 121 | + } |
| 122 | + |
85 | 123 | @if (context.ForwardflowPr != null)
|
86 | 124 | {
|
87 |
| - <span> / </span> |
88 | 125 | <FluentAnchor Href="@context.ForwardflowPr" Target="_blank" Appearance="Appearance.Hypertext">Active PR</FluentAnchor>
|
89 | 126 | }
|
90 | 127 | </FluentLabel>
|
91 | 128 | </TemplateColumn>
|
92 |
| - <TemplateColumn Style="width:60px"> |
| 129 | + <TemplateColumn Width="60px"> |
93 | 130 | <CodeflowContextMenu Codeflow="@context" ShowDetails="@ShowDetails" />
|
94 | 131 | </TemplateColumn>
|
95 | 132 | </ChildContent>
|
|
144 | 181 | // Get all unique mappings
|
145 | 182 | var allMappings = subscriptions
|
146 | 183 | .Select(s => s.SourceDirectory ?? s.TargetDirectory)
|
147 |
| - .Distinct(); |
| 184 | + .Where(s => !string.IsNullOrEmpty(s)) |
| 185 | + .Distinct() |
| 186 | + .ToList(); |
148 | 187 |
|
149 |
| - List<CodeflowSubscription> codeflows = new List<CodeflowSubscription>(allMappings.Count()); |
| 188 | + List<CodeflowSubscription> codeflows = new List<CodeflowSubscription>(allMappings.Count); |
150 | 189 | foreach (var mapping in allMappings)
|
151 | 190 | {
|
152 |
| - var backflowSubscription = Subscriptions!.FirstOrDefault(s => s.SourceDirectory == mapping); |
153 |
| - var forwardflowSubscription = Subscriptions!.FirstOrDefault(s => s.TargetDirectory == mapping); |
| 191 | + var backflowSubscription = subscriptions!.FirstOrDefault(s => s.SourceDirectory == mapping); |
| 192 | + var forwardflowSubscription = subscriptions!.FirstOrDefault(s => s.TargetDirectory == mapping); |
154 | 193 | PullRequests.TryGetValue(backflowSubscription?.Id ?? default, out var backflowPr);
|
155 | 194 | PullRequests.TryGetValue(forwardflowSubscription?.Id ?? default, out var forwardflowPr);
|
156 | 195 | codeflows.Add(new CodeflowSubscription(
|
157 |
| - RepositoryUrl: backflowSubscription?.TargetRepository ?? forwardflowSubscription?.SourceRepository |
158 |
| - ?? throw new InvalidOperationException(), |
| 196 | + RepositoryUrl: backflowSubscription?.TargetRepository ?? forwardflowSubscription?.SourceRepository!, |
159 | 197 | RepositoryBranch: backflowSubscription?.TargetBranch,
|
160 | 198 | MappingName: mapping,
|
161 |
| - Enabled: backflowSubscription?.Enabled ?? forwardflowSubscription?.Enabled ?? false, // TODO |
| 199 | + Enabled: backflowSubscription?.Enabled ?? forwardflowSubscription?.Enabled ?? false, |
162 | 200 | BackflowSubscription: backflowSubscription,
|
163 | 201 | ForwardflowSubscription: forwardflowSubscription,
|
164 | 202 | BackflowPr: backflowPr,
|
|
235 | 273 | }
|
236 | 274 | ];
|
237 | 275 | }
|
| 276 | + |
| 277 | + static string GetShortSha(string sha) => sha.Substring(0, 7); |
238 | 278 | }
|
0 commit comments