Skip to content

Commit 61a85ce

Browse files
committed
Merged in JDCMT-216_process_hidden_fields (pull request #50)
JDCMT-216 - do not show hidden fields * JDCMT-216 - do not show hidden fields - do not show priority on issue details card if fields is hidden - process assignee field if it is hidden on issue card and edit issue screen (make it readonly and show default value) Approved-by: Zakhar Listiev
1 parent 91024fd commit 61a85ce

File tree

2 files changed

+89
-74
lines changed

2 files changed

+89
-74
lines changed

src/MicrosoftTeamsIntegration.Jira/ClientApp/src/app/components/issues/edit-issue-dialog/edit-issue-dialog.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export class EditIssueDialogComponent implements OnInit {
254254
return this.currentUser.groups.items.some(x => x.name === UserGroup.JiraServicedeskUsers) &&
255255
this.permissions.ASSIGN_ISSUES.havePermission;
256256
}
257-
return this.permissions.ASSIGN_ISSUES.havePermission;
257+
return this.permissions.ASSIGN_ISSUES.havePermission && this.issue.assignee !== undefined;
258258
}
259259

260260
public get allowEditStatus(): boolean {
@@ -450,7 +450,7 @@ export class EditIssueDialogComponent implements OnInit {
450450
this.assigneesFilteredOptions = this.assigneesOptions;
451451

452452
const assignee = this.issue.assignee;
453-
if (assignee === null) {
453+
if (assignee === null || assignee === undefined) {
454454
this.selectedAssigneeOption = this.assigneeService.unassignedOption;
455455
}
456456

src/MicrosoftTeamsIntegration.Jira/TypeConverters/JiraIssueToAdaptiveCardTypeConverter.cs

Lines changed: 87 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public AdaptiveCard Convert(BotAndMessagingExtensionJiraIssue model, AdaptiveCar
5454

5555
var watchOrUnwatchActionColumn = GetWatchOrUnwatchAdaptiveColumn(model);
5656
var assignActionColumn = GetAssignAdaptiveColumn(model);
57+
var priorityColumn = GetPriorityColumn(model);
5758

5859
card.Body = new List<AdaptiveElement>
5960
{
@@ -173,78 +174,7 @@ public AdaptiveCard Convert(BotAndMessagingExtensionJiraIssue model, AdaptiveCar
173174
}
174175
}
175176
},
176-
new AdaptiveColumn
177-
{
178-
Width = "3",
179-
Spacing = AdaptiveSpacing.Small,
180-
VerticalContentAlignment = AdaptiveVerticalContentAlignment.Top,
181-
Items = new List<AdaptiveElement>
182-
{
183-
new AdaptiveColumnSet
184-
{
185-
Spacing = AdaptiveSpacing.Small,
186-
Columns = new List<AdaptiveColumn>
187-
{
188-
new AdaptiveColumn
189-
{
190-
Width = "4",
191-
Spacing = AdaptiveSpacing.Small,
192-
VerticalContentAlignment = AdaptiveVerticalContentAlignment.Top,
193-
Items = new List<AdaptiveElement>
194-
{
195-
new AdaptiveTextBlock
196-
{
197-
Text = "Priority",
198-
Wrap = true,
199-
Spacing = AdaptiveSpacing.None,
200-
Size = AdaptiveTextSize.Small
201-
},
202-
new AdaptiveColumnSet
203-
{
204-
Spacing = AdaptiveSpacing.Small,
205-
Columns = new List<AdaptiveColumn>
206-
{
207-
new AdaptiveColumn
208-
{
209-
Width = "16px",
210-
VerticalContentAlignment = AdaptiveVerticalContentAlignment.Top,
211-
Items = new List<AdaptiveElement>
212-
{
213-
new AdaptiveImage
214-
{
215-
UrlString = PrepareIconUrl(model.JiraIssue?.Fields?.Priority?.IconUrl),
216-
Size = AdaptiveImageSize.Small,
217-
PixelWidth = 16,
218-
PixelHeight = 16,
219-
Spacing = AdaptiveSpacing.None
220-
}
221-
}
222-
},
223-
new AdaptiveColumn
224-
{
225-
VerticalContentAlignment = AdaptiveVerticalContentAlignment.Top,
226-
Width = "6",
227-
Spacing = AdaptiveSpacing.Small,
228-
Items = new List<AdaptiveElement>
229-
{
230-
new AdaptiveTextBlock
231-
{
232-
Text = model.JiraIssue?.Fields?.Priority?.Name,
233-
Spacing = AdaptiveSpacing.None,
234-
Wrap = true,
235-
HorizontalAlignment = AdaptiveHorizontalAlignment.Left,
236-
Weight = AdaptiveTextWeight.Bolder
237-
}
238-
}
239-
}
240-
}
241-
}
242-
}
243-
}
244-
}
245-
}
246-
}
247-
},
177+
priorityColumn,
248178
new AdaptiveColumn
249179
{
250180
Width = "3",
@@ -425,6 +355,91 @@ public AdaptiveCard Convert(BotAndMessagingExtensionJiraIssue model, AdaptiveCar
425355
return card;
426356
}
427357

358+
private static AdaptiveColumn GetPriorityColumn(BotAndMessagingExtensionJiraIssue model)
359+
{
360+
if (model.JiraIssue?.Fields?.Priority == null)
361+
{
362+
return new AdaptiveColumn()
363+
{
364+
Width = "3",
365+
};
366+
}
367+
368+
return new AdaptiveColumn
369+
{
370+
Width = "3",
371+
Spacing = AdaptiveSpacing.Small,
372+
VerticalContentAlignment = AdaptiveVerticalContentAlignment.Top,
373+
Items = new List<AdaptiveElement>
374+
{
375+
new AdaptiveColumnSet
376+
{
377+
Spacing = AdaptiveSpacing.Small,
378+
Columns = new List<AdaptiveColumn>
379+
{
380+
new AdaptiveColumn
381+
{
382+
Width = "4",
383+
Spacing = AdaptiveSpacing.Small,
384+
VerticalContentAlignment = AdaptiveVerticalContentAlignment.Top,
385+
Items = new List<AdaptiveElement>
386+
{
387+
new AdaptiveTextBlock
388+
{
389+
Text = "Priority",
390+
Wrap = true,
391+
Spacing = AdaptiveSpacing.None,
392+
Size = AdaptiveTextSize.Small
393+
},
394+
new AdaptiveColumnSet
395+
{
396+
Spacing = AdaptiveSpacing.Small,
397+
Columns = new List<AdaptiveColumn>
398+
{
399+
new AdaptiveColumn
400+
{
401+
Width = "16px",
402+
VerticalContentAlignment = AdaptiveVerticalContentAlignment.Top,
403+
Items = new List<AdaptiveElement>
404+
{
405+
new AdaptiveImage
406+
{
407+
UrlString = PrepareIconUrl(model.JiraIssue?.Fields?.Priority
408+
?.IconUrl),
409+
Size = AdaptiveImageSize.Small,
410+
PixelWidth = 16,
411+
PixelHeight = 16,
412+
Spacing = AdaptiveSpacing.None
413+
}
414+
}
415+
},
416+
new AdaptiveColumn
417+
{
418+
VerticalContentAlignment = AdaptiveVerticalContentAlignment.Top,
419+
Width = "6",
420+
Spacing = AdaptiveSpacing.Small,
421+
Items = new List<AdaptiveElement>
422+
{
423+
new AdaptiveTextBlock
424+
{
425+
Text = model.JiraIssue?.Fields?.Priority?.Name,
426+
Spacing = AdaptiveSpacing.None,
427+
Wrap = true,
428+
HorizontalAlignment = AdaptiveHorizontalAlignment.Left,
429+
Weight = AdaptiveTextWeight.Bolder
430+
}
431+
}
432+
}
433+
}
434+
}
435+
}
436+
}
437+
}
438+
}
439+
}
440+
};
441+
}
442+
428443
private static string PrepareIconUrl(string iconUrl)
429444
{
430445
return !string.IsNullOrEmpty(iconUrl) && Uri.IsWellFormedUriString(iconUrl, UriKind.Absolute) ? iconUrl

0 commit comments

Comments
 (0)