|
42 | 42 | var groupedColumns = ViewBagHelper.ValueOrDefault(ViewBag.GroupedColumns, new List<ReportColumn> { ReportColumn.ProviderName }); |
43 | 43 | var sortedColumns = ViewBagHelper.ValueOrDefault(ViewBag.SortedColumns, new List<ReportColumn> { ReportColumn.PriorityName, ReportColumn.ProjectName, ReportColumn.FileDirectory, ReportColumn.FileName, ReportColumn.Line }); |
44 | 44 | FileLinkSettings fileLinkSettings = ViewBagHelper.ValueOrDefault(ViewBag.FileLinkSettings, new FileLinkSettings()); |
| 45 | + IdeIntegrationSettings ideIntegrationSettings = ViewBagHelper.ValueOrDefault<IdeIntegrationSettings>(ViewBag.IdeIntegrationSettings, null); |
45 | 46 | List<HtmlDxDataGridColumnDescription> additionalColumns = ViewBagHelper.ValueOrDefault(ViewBag.AdditionalColumns, new List<HtmlDxDataGridColumnDescription>()); |
46 | 47 | string jQueryLocation = ViewBagHelper.ValueOrDefault(ViewBag.JQueryLocation, "https://ajax.aspnetcdn.com/ajax/jquery/"); |
47 | 48 | string jQueryVersion = ViewBagHelper.ValueOrDefault(ViewBag.JQueryVersion, "3.1.0"); |
|
61 | 62 | addPriorityName: priorityNameVisible, |
62 | 63 | addProjectPath: projectPathVisible, |
63 | 64 | addProjectName: projectNameVisible, |
64 | | - addFilePath: filePathVisible, |
| 65 | + addFilePath: filePathVisible || ideIntegrationSettings != null, |
65 | 66 | addFileDirectory: fileDirectoryVisible, |
66 | 67 | addFileName: fileNameVisible, |
67 | 68 | addLine: lineVisible, |
|
94 | 95 | <link rel="stylesheet" type="text/css" href="@(devExtremeLocation)@(devExtremeVersion)/css/@(theme.GetCssFileName())" /> |
95 | 96 | @* DevExtreme library *@ |
96 | 97 | <script type="text/javascript" src="@(devExtremeLocation)@(devExtremeVersion)/js/dx.all.js"></script> |
| 98 | + @* Additional JavaScript for IDE integration *@ |
| 99 | + @if (ideIntegrationSettings != null && !string.IsNullOrWhiteSpace(ideIntegrationSettings.JavaScript)) |
| 100 | + { |
| 101 | + <script type="text/javascript"> |
| 102 | + @Raw(ideIntegrationSettings.JavaScript) |
| 103 | + </script> |
| 104 | + } |
| 105 | + |
| 106 | + <style> |
| 107 | + @* Styles for making sure drop down glyph is not shown for menu in file column in any theme *@ |
| 108 | + td[role=gridcell] .dx-menu-item-popout |
| 109 | + { |
| 110 | + display: none; |
| 111 | + } |
| 112 | + td[role=gridcell] .dx-icon |
| 113 | + { |
| 114 | + margin: 0px !important; |
| 115 | + } |
| 116 | + @* Style for making sure menu in file column in any theme is not too high *@ |
| 117 | + .dx-datagrid .dx-menu .dx-menu-item .dx-menu-item-content, .dx-datagrid-container .dx-menu .dx-menu-item .dx-menu-item-content |
| 118 | + { |
| 119 | + padding: 0px; |
| 120 | + } |
| 121 | + </style> |
97 | 122 | </head> |
98 | 123 | <body class="dx-viewport"> |
99 | 124 | @if (showHeader) |
|
110 | 135 | </script> |
111 | 136 |
|
112 | 137 | <script type="text/javascript"> |
113 | | - $(function(){ |
| 138 | + $(function () { |
| 139 | + @if (ideIntegrationSettings != null && !string.IsNullOrWhiteSpace(ideIntegrationSettings.OpenInIdeCall)) |
| 140 | + { |
| 141 | + <text> |
| 142 | + @* Creates the menu in the file column *@ |
| 143 | + function getFileCellMenuElement(filePath, line) { |
| 144 | + var element = |
| 145 | + $('<div>') |
| 146 | + .css("float", "right") |
| 147 | + .dxMenu({ |
| 148 | + items: [{ |
| 149 | + text: "", |
| 150 | + icon: "overflow", |
| 151 | + items: [ |
| 152 | + { |
| 153 | + text: "@ideIntegrationSettings.MenuEntryText", |
| 154 | + action: "openInIde" |
| 155 | + } |
| 156 | + ] |
| 157 | + }], |
| 158 | + onItemClick: function (e) { |
| 159 | + if (e.itemData.action === "openInIde") { |
| 160 | + @Raw(ideIntegrationSettings.GetOpenInIdeCall("filePath", "line")) |
| 161 | + } |
| 162 | + } |
| 163 | + }); |
| 164 | + return element; |
| 165 | + } |
| 166 | + </text> |
| 167 | + }; |
| 168 | +
|
114 | 169 | $("#gridContainer").dxDataGrid({ |
115 | 170 | dataSource: issues, |
116 | 171 | loadPanel: { |
|
259 | 314 | } |
260 | 315 | }, |
261 | 316 | </text> |
| 317 | + } else { |
| 318 | + <text> |
| 319 | + { |
| 320 | + dataField: "FilePath", |
| 321 | + visible: false |
| 322 | + }, |
| 323 | + </text> |
262 | 324 | } |
263 | 325 | @if (fileDirectoryVisible) |
264 | 326 | { |
|
295 | 357 | @:sortIndex: @sortedColumns.IndexOf(ReportColumn.FileName), |
296 | 358 | @:sortOrder: "@fileNameSortOrder.ToShortString()", |
297 | 359 | } |
298 | | - @if (fileLinkSettings != null && !string.IsNullOrWhiteSpace(fileLinkSettings.FileLinkPattern)) |
299 | | - { |
300 | | - <text> |
301 | | - cellTemplate: function (container, options) { |
302 | | - if (options.data["FileLink"]) { |
303 | | - $('<a>', { |
304 | | - text: options.value, |
305 | | - href: options.data["FileLink"], |
306 | | - target: "_blank" |
307 | | - }).appendTo(container); |
308 | | - } |
309 | | - else { |
310 | | - container.text(options.value); |
311 | | - } |
312 | | - } |
313 | | - </text> |
| 360 | + cellTemplate: function (container, options) { |
| 361 | + if (options.data["FileLink"]) { |
| 362 | + var $wrapper = |
| 363 | + $('<div>') |
| 364 | + .css("float", "left"); |
| 365 | + var $link = |
| 366 | + $('<a>', { |
| 367 | + text: options.value, |
| 368 | + href: options.data["FileLink"], |
| 369 | + target: "_blank" |
| 370 | + }); |
| 371 | + $wrapper.append($link); |
| 372 | + $wrapper.appendTo(container); |
| 373 | + } |
| 374 | + else { |
| 375 | + $('<div>') |
| 376 | + .text(options.value) |
| 377 | + .css("float", "left") |
| 378 | + .appendTo(container); |
| 379 | + } |
| 380 | + @if (ideIntegrationSettings != null && !string.IsNullOrWhiteSpace(ideIntegrationSettings.OpenInIdeCall)) |
| 381 | + { |
| 382 | + <text> |
| 383 | + getFileCellMenuElement(options.data["FilePath"], options.data["Line"]) |
| 384 | + .appendTo(container); |
| 385 | + </text> |
| 386 | + } |
314 | 387 | } |
315 | 388 | }, |
316 | 389 | </text> |
|
0 commit comments