Skip to content

Commit e5823d8

Browse files
authored
Show TFM badges in package search results (#9764)
* things are happening * added feature flag * nit * modified warning indicator placement to align better with badges * badges link to frameworks tab * use url helper method * explicit paramater names in tests * Aligned warning indicators and TFM badges, added borders * Fixed badges on small screens
1 parent c1115f8 commit e5823d8

42 files changed

Lines changed: 354 additions & 151 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/AccountDeleter/EmptyFeatureFlagService.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,13 @@ public bool IsDisplayPackageReadmeWarningEnabled(User user)
306306
throw new NotImplementedException();
307307
}
308308

309-
public bool IsFrameworkFilteringEnabled(User user) {
309+
public bool IsFrameworkFilteringEnabled(User user)
310+
{
311+
throw new NotImplementedException();
312+
}
313+
314+
public bool IsDisplayTfmBadgesEnabled(User user)
315+
{
310316
throw new NotImplementedException();
311317
}
312318
}

src/Bootstrap/dist/css/bootstrap-theme.css

Lines changed: 30 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Bootstrap/dist/css/bootstrap.css

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Bootstrap/dist/js/bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* Bootstrap v3.4.1 (https://getbootstrap.com/)
3-
* Copyright 2011-2023 Twitter, Inc.
3+
* Copyright 2011-2024 Twitter, Inc.
44
* Licensed under the MIT license
55
*/
66

src/Bootstrap/less/theme/base.less

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,39 @@ img.reserved-indicator-icon {
359359
}
360360
}
361361

362+
li.package-warning-indicators {
363+
display: block;
364+
overflow-y: visible;
365+
margin-bottom: 5px;
366+
font-size: 14px;
367+
}
368+
369+
li.package-tfm-badges {
370+
display: block;
371+
overflow-y: visible;
372+
373+
.framework-badges {
374+
margin-bottom: 2px;
375+
376+
span {
377+
margin-right: 1px;
378+
}
379+
380+
.framework-badge-computed {
381+
color: #000;
382+
border: 1px solid rgba(0,0,0,.15);
383+
}
384+
385+
@media (max-width: @screen-sm-min) {
386+
a + a {
387+
span {
388+
margin-bottom: 4px;
389+
}
390+
}
391+
}
392+
}
393+
}
394+
362395
@media (min-width: @screen-sm-min) {
363396
li {
364397
display: inline-block;

src/Bootstrap/less/theme/common-list-packages.less

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,16 @@
8282
@badge-border-radius: 2px;
8383

8484
.package-warning {
85-
padding-right: 8px;
86-
padding-left: 8px;
85+
padding: 1px 8px;
8786
border-radius: @badge-border-radius;
8887
margin-right: 5px;
89-
color: @package-warning-color
88+
color: @package-warning-color;
9089
}
9190

9291
.package-warning--vulnerable {
9392
.package-warning;
9493
background-color: @severe-warning-background-color;
94+
border: 1px solid darken(@severe-warning-background-color, 15%);
9595
i {
9696
color: @severe-warning-icon-color;
9797
}
@@ -100,4 +100,5 @@
100100
.package-warning--deprecated {
101101
.package-warning;
102102
background-color: @warning-background-color;
103+
border: 1px solid darken(@warning-background-color, 35%);
103104
}

src/GitHubVulnerabilities2Db/Fakes/FakeFeatureFlagService.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,13 @@ public bool IsNuGetAccountPasswordLoginEnabled()
305305
throw new NotImplementedException();
306306
}
307307

308-
public bool IsFrameworkFilteringEnabled(User user) {
308+
public bool IsFrameworkFilteringEnabled(User user)
309+
{
310+
throw new NotImplementedException();
311+
}
312+
313+
public bool IsDisplayTfmBadgesEnabled(User user)
314+
{
309315
throw new NotImplementedException();
310316
}
311317
}

src/NuGetGallery.Core/Frameworks/IPackageFrameworkCompatibilityFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ namespace NuGetGallery.Frameworks
88
{
99
public interface IPackageFrameworkCompatibilityFactory
1010
{
11-
PackageFrameworkCompatibility Create(ICollection<PackageFramework> packageFrameworks);
11+
PackageFrameworkCompatibility Create(ICollection<PackageFramework> packageFrameworks, string packageId, bool includeComputedBadges = false);
1212
}
1313
}

src/NuGetGallery.Core/Frameworks/PackageFrameworkCompatibility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public class PackageFrameworkCompatibility
2020
/// Key: Is the <see cref="FrameworkProductNames"/> if resolved on (<seealso cref="PackageFrameworkCompatibilityFactory.ResolveFrameworkProductName(NuGetFramework)"/>) or the <see cref="NuGetFramework.Framework"/>.<br></br>
2121
/// Value: Is an ordered collection containing all the compatible frameworks.
2222
/// </remarks>
23-
public IReadOnlyDictionary<string, IReadOnlyCollection<PackageFrameworkCompatibilityTableData>> Table { get; set; }
23+
public IReadOnlyDictionary<string, IReadOnlyCollection<PackageFrameworkCompatibilityData>> Table { get; set; }
2424
}
2525
}

src/NuGetGallery.Core/Frameworks/PackageFrameworkCompatibilityBadges.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ namespace NuGetGallery.Frameworks
1010
/// </summary>
1111
/// <remarks>
1212
/// All these properties are retrieved from the <see cref="PackageFrameworkCompatibility.Table"/>, one for each .NET product.<br></br>
13-
/// Only package asset frameworks are considered. i.e. <see cref="PackageFrameworkCompatibilityTableData.IsComputed"/> <c>= false</c>.<br></br>
13+
/// Only package asset frameworks are considered. i.e. <see cref="PackageFrameworkCompatibilityData.IsComputed"/> <c>= false</c>.<br></br>
1414
/// If there are no package asset frameworks for a particular .NET product, then the value will be <c>null</c>.
1515
/// </remarks>
1616
public class PackageFrameworkCompatibilityBadges
1717
{
18-
public NuGetFramework Net { get; set; }
19-
public NuGetFramework NetCore { get; set; }
20-
public NuGetFramework NetStandard { get; set; }
21-
public NuGetFramework NetFramework { get; set; }
18+
public string PackageId { get; set; }
19+
public PackageFrameworkCompatibilityData Net { get; set; }
20+
public PackageFrameworkCompatibilityData NetCore { get; set; }
21+
public PackageFrameworkCompatibilityData NetStandard { get; set; }
22+
public PackageFrameworkCompatibilityData NetFramework { get; set; }
2223
}
2324
}

0 commit comments

Comments
 (0)