@@ -103,7 +103,7 @@ private void ShowInfoMessage(string messageString)
103
103
104
104
private void ClearTreeViews ( )
105
105
{
106
- tvSecrets . Items . Clear ( ) ;
106
+ tvSecrets . ItemsSource = null ;
107
107
tvCurrentBranch . ItemsSource = null ;
108
108
CurrentBranchExpander . IsExpanded = false ;
109
109
}
@@ -125,29 +125,7 @@ private async Task LoadDataAsync()
125
125
try
126
126
{
127
127
// get secrets
128
- var repoSecrets = await client . Repository ? . Actions ? . Secrets ? . GetAll ( _repoInfo . RepoOwner , _repoInfo . RepoName ) ;
129
- if ( repoSecrets . TotalCount > 0 )
130
- {
131
- foreach ( var secret in repoSecrets . Secrets )
132
- {
133
- var updatedOrCreatedAt = secret . UpdatedAt . GetValueOrDefault ( secret . CreatedAt ) ;
134
- var item = new TreeViewItem
135
- {
136
- Header = $ "{ secret . Name } ({ updatedOrCreatedAt : g} )",
137
- Tag = secret ,
138
- } ;
139
-
140
- tvSecrets . Items . Add ( item ) ;
141
- }
142
- }
143
- else
144
- {
145
- var noSecretItem = new TreeViewItem
146
- {
147
- Header = "No repository secrets defined"
148
- } ;
149
- tvSecrets . Items . Add ( noSecretItem ) ;
150
- }
128
+ await RefreshSecretsAsync ( client ) ;
151
129
152
130
// get current branch
153
131
var runs = await client . Actions ? . Workflows ? . Runs ? . List ( _repoInfo . RepoOwner , _repoInfo . RepoName , new WorkflowRunsRequest ( ) { Branch = _repoInfo . CurrentBranch } , new ApiOptions ( ) { PageCount = 1 , PageSize = maxRuns } ) ;
@@ -163,7 +141,7 @@ private async Task LoadDataAsync()
163
141
{
164
142
SimpleRun simpleRun = new ( )
165
143
{
166
- Conclusion = run . Conclusion . Value . StringValue ,
144
+ Conclusion = run . Conclusion is not null ? run . Conclusion . Value . StringValue : run . Status . StringValue ,
167
145
Name = run . Name ,
168
146
LogDate = run . UpdatedAt ,
169
147
Id = run . Id . ToString ( ) ,
@@ -183,14 +161,14 @@ private async Task LoadDataAsync()
183
161
{
184
162
steps . Add ( new SimpleJob ( )
185
163
{
186
- Conclusion = step . Conclusion . Value . StringValue ,
164
+ Conclusion = step . Conclusion is not null ? step . Conclusion . Value . StringValue : step . Status . StringValue ,
187
165
Name = step . Name ,
188
166
Url = $ "{ job . HtmlUrl } #step:{ step . Number . ToString ( ) } :1"
189
167
} ) ;
190
168
}
191
169
simpleJobs . Add ( new SimpleJob ( )
192
170
{
193
- Conclusion = job . Conclusion . Value . StringValue ,
171
+ Conclusion = job . Conclusion is not null ? job . Conclusion . Value . StringValue : job . Status . StringValue ,
194
172
Name = job . Name ,
195
173
Id = job . Id . ToString ( ) ,
196
174
Jobs = steps // add the steps to the job
@@ -228,12 +206,23 @@ private async Task LoadDataAsync()
228
206
refreshProgress . IsIndeterminate = false ;
229
207
}
230
208
231
- private UIElement CreateEmojiContent ( string emojiString )
209
+ private async Task RefreshSecretsAsync ( GitHubClient client )
232
210
{
233
- var emojiBlock = new Emoji . Wpf . TextBlock ( ) ;
234
- emojiBlock . Text = emojiString ;
235
-
236
- return emojiBlock ;
211
+ var repoSecrets = await client . Repository ? . Actions ? . Secrets ? . GetAll ( _repoInfo . RepoOwner , _repoInfo . RepoName ) ;
212
+ List < string > secretList = new ( ) ;
213
+ if ( repoSecrets . TotalCount > 0 )
214
+ {
215
+ foreach ( var secret in repoSecrets . Secrets )
216
+ {
217
+ var updatedOrCreatedAt = secret . UpdatedAt . GetValueOrDefault ( secret . CreatedAt ) ;
218
+ secretList . Add ( $ "{ secret . Name } ({ updatedOrCreatedAt : g} )") ;
219
+ }
220
+ }
221
+ else
222
+ {
223
+ secretList . Add ( "No repository secrets defined" ) ;
224
+ }
225
+ tvSecrets . ItemsSource = secretList ;
237
226
}
238
227
239
228
private static GitHubClient GetGitHubClient ( )
0 commit comments