Skip to content

Commit

Permalink
Merge pull request #9483 from NuGet/dev
Browse files Browse the repository at this point in the history
[ReleasePrep][2023.04.25]RI of dev into main
  • Loading branch information
joelverhagen committed Apr 27, 2023
2 parents 0931f8b + 3ebfdea commit e32d1c2
Show file tree
Hide file tree
Showing 32 changed files with 793 additions and 104 deletions.
37 changes: 36 additions & 1 deletion src/Bootstrap/dist/css/bootstrap-theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 16 additions & 5 deletions src/Bootstrap/dist/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,8 @@ if (typeof jQuery === 'undefined') {
toggle: true
}

Collapse.ARIA_EXPANDED_ALLOWED_ROLES = ['application', 'button', 'checkbox', 'combobox', 'gridcell', 'link', 'listbox', 'menuitem', 'row', 'rowheader', 'tab', 'treeitem']

Collapse.prototype.dimension = function () {
var hasWidth = this.$element.hasClass('width')
return hasWidth ? 'width' : 'height'
Expand Down Expand Up @@ -615,7 +617,11 @@ if (typeof jQuery === 'undefined') {
this.$element
.removeClass('collapse')
.addClass('collapsing')[dimension](0)
.attr('aria-expanded', true)

// the aria-expanded attribute is only allowed when the element has an allowed role
if (Collapse.ARIA_EXPANDED_ALLOWED_ROLES.includes(this.$element.attr('role'))) {
this.$element.attr('aria-expanded', true)
}

this.$trigger
.removeClass('collapsed')
Expand Down Expand Up @@ -655,7 +661,11 @@ if (typeof jQuery === 'undefined') {
this.$element
.addClass('collapsing')
.removeClass('collapse in')
.attr('aria-expanded', false)

// the aria-expanded attribute is only allowed when the element has an allowed role
if (Collapse.ARIA_EXPANDED_ALLOWED_ROLES.includes(this.$element.attr('role'))) {
this.$element.attr('aria-expanded', false)
}

this.$trigger
.addClass('collapsed')
Expand Down Expand Up @@ -696,7 +706,10 @@ if (typeof jQuery === 'undefined') {
Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
var isOpen = $element.hasClass('in')

$element.attr('aria-expanded', isOpen)
if (Collapse.ARIA_EXPANDED_ALLOWED_ROLES.includes(this.$element.attr('role'))) {
$element.attr('aria-expanded', isOpen)
}

$trigger
.toggleClass('collapsed', !isOpen)
.attr('aria-expanded', isOpen)
Expand Down Expand Up @@ -2345,14 +2358,12 @@ if (typeof jQuery === 'undefined') {
.end()
.find('[data-toggle="tab"]')
.attr('tabindex', "-1")
.attr('aria-expanded', false)
.attr('aria-selected', false)

element
.addClass('active')
.find('[data-toggle="tab"]')
.attr('tabindex', "0")
.attr('aria-expanded', true)
.attr('aria-selected', true)

if (transition) {
Expand Down
19 changes: 16 additions & 3 deletions src/Bootstrap/js/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
toggle: true
}

Collapse.ARIA_EXPANDED_ALLOWED_ROLES = ['application', 'button', 'checkbox', 'combobox', 'gridcell', 'link', 'listbox', 'menuitem', 'row', 'rowheader', 'tab', 'treeitem']

Collapse.prototype.dimension = function () {
var hasWidth = this.$element.hasClass('width')
return hasWidth ? 'width' : 'height'
Expand Down Expand Up @@ -68,7 +70,11 @@
this.$element
.removeClass('collapse')
.addClass('collapsing')[dimension](0)
.attr('aria-expanded', true)

// the aria-expanded attribute is only allowed when the element has an allowed role
if (Collapse.ARIA_EXPANDED_ALLOWED_ROLES.includes(this.$element.attr('role'))) {
this.$element.attr('aria-expanded', true)
}

this.$trigger
.removeClass('collapsed')
Expand Down Expand Up @@ -108,7 +114,11 @@
this.$element
.addClass('collapsing')
.removeClass('collapse in')
.attr('aria-expanded', false)

// the aria-expanded attribute is only allowed when the element has an allowed role
if (Collapse.ARIA_EXPANDED_ALLOWED_ROLES.includes(this.$element.attr('role'))) {
this.$element.attr('aria-expanded', false)
}

this.$trigger
.addClass('collapsed')
Expand Down Expand Up @@ -149,7 +159,10 @@
Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
var isOpen = $element.hasClass('in')

$element.attr('aria-expanded', isOpen)
if (Collapse.ARIA_EXPANDED_ALLOWED_ROLES.includes(this.$element.attr('role'))) {
$element.attr('aria-expanded', isOpen)
}

$trigger
.toggleClass('collapsed', !isOpen)
.attr('aria-expanded', isOpen)
Expand Down
2 changes: 0 additions & 2 deletions src/Bootstrap/js/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,12 @@
.end()
.find('[data-toggle="tab"]')
.attr('tabindex', "-1")
.attr('aria-expanded', false)
.attr('aria-selected', false)

element
.addClass('active')
.find('[data-toggle="tab"]')
.attr('tabindex', "0")
.attr('aria-expanded', true)
.attr('aria-selected', true)

if (transition) {
Expand Down
27 changes: 27 additions & 0 deletions src/Bootstrap/less/theme/common-list-packages.less
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,30 @@
margin-top: 75px;
margin-bottom: 0px;
}

@severe-warning-background-color: rgb(254, 217, 204);
@severe-warning-icon-color: rgb(216, 59, 1);
@warning-background-color: rgb(255, 244, 206);
@package-warning-color: rgb(50, 49, 48);
@badge-border-radius: 2px;

.package-warning {
padding-right: 8px;
padding-left: 8px;
border-radius: @badge-border-radius;
margin-right: 5px;
color: @package-warning-color
}

.package-warning--vulnerable {
.package-warning;
background-color: @severe-warning-background-color;
i {
color: @severe-warning-icon-color;
}
}

.package-warning--deprecated {
.package-warning;
background-color: @warning-background-color;
}
5 changes: 5 additions & 0 deletions src/Bootstrap/less/theme/page-api-keys.less
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@
border-left: 1px solid @gray-lighter;
}
}
.package-list {
li {
overflow-y: visible;
}
}
}

.api-key-details:not(:first-child)
Expand Down
10 changes: 9 additions & 1 deletion src/Bootstrap/less/theme/page-display-package.less
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,19 @@
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;

.profile-icon {
margin: 1.5px;
}

.username{
margin-left: 6.5px;
}
}

img {
margin-right: 8px;
border-radius: 5px;
margin: 2px;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/NuGetGallery/App_Code/ViewHelpers.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ var hlp = new AccordionHelper(name, formModelStatePrefix, expanded, page);
</div>
if (!disabled)
{
<div aria-controls="panel-body" class="panel panel-default panel-collapse collapse @(expanded ? "in" : string.Empty)"
<div class="panel panel-default panel-collapse collapse @(expanded ? "in" : string.Empty)"
id="@id-container">
<div class="panel-body">
@content(MvcHtmlString.Empty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"sonarcloud.io",
"travis-ci.com",
"travis-ci.org",
"wakatime.com",
"avatars.githubusercontent.com",
"raw.github.com",
"raw.githubusercontent.com",
Expand Down
86 changes: 86 additions & 0 deletions src/NuGetGallery/Helpers/SearchResponseHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json.Linq;
using NuGet.Services.Entities;

namespace NuGetGallery.Helpers
{
public static class SearchResponseHelper
{
public static ICollection<PackageDeprecation> GetDeprecationsOrNull(JToken docDeprecation)
{
PackageDeprecation deprecation = null;
if (docDeprecation != null)
{
var docReasons = docDeprecation.Value<JArray>("Reasons");
if (docReasons != null && docReasons.HasValues)
{
PackageDeprecationStatus status = PackageDeprecationStatus.NotDeprecated;
foreach (var reason in docReasons)
{
if (Enum.TryParse<PackageDeprecationStatus>(reason.Value<string>(), out var pdStatus))
{
status |= pdStatus;
}
}

var docAlternatePackage = docDeprecation["AlternatePackage"];
Package alternatePackage = null;
if (docAlternatePackage != null)
{
var range = docAlternatePackage.Value<string>("Range");
var id = docAlternatePackage.Value<string>("Id");
if (!string.IsNullOrEmpty(range) && !string.IsNullOrEmpty(id))
{
var version = string.Empty;
var commaIndex = range.IndexOf(",");
if (range.StartsWith("[") && commaIndex > 0)
{
var startIndex = 1;
version = range.Substring(startIndex, commaIndex - startIndex);
}

alternatePackage = new Package()
{
Id = id,
Version = version
};
}
}

deprecation = new PackageDeprecation()
{
CustomMessage = docDeprecation.Value<string>("Message"),
Status = status,
AlternatePackage = alternatePackage
};
}
}

return deprecation == null ? null : new List<PackageDeprecation>() { deprecation };
}

public static ICollection<VulnerablePackageVersionRange> GetVulnerabilities(JArray docVulnerabilities)
{
var vulnerabilities = new List<VulnerablePackageVersionRange>();
if (docVulnerabilities != null)
{
vulnerabilities = docVulnerabilities.Select(v => new VulnerablePackageVersionRange()
{
Vulnerability = new PackageVulnerability()
{
AdvisoryUrl = v.Value<string>("AdvisoryUrl"),
Severity = (PackageVulnerabilitySeverity)v.Value<int>("Severity")
}
})
.ToList();
}

return vulnerabilities;
}
}
}

0 comments on commit e32d1c2

Please sign in to comment.