Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2024-05-13 06:18:16 +00:00
parent 7ec4725142
commit adeba64772
25 changed files with 103 additions and 37 deletions

View File

@ -1,6 +1,6 @@
<script>
import { GlChart } from '@gitlab/ui/dist/charts';
import { DATA_VIZ_BLUE_500 } from '@gitlab/ui/dist/tokens/js/tokens';
import { DATA_VIZ_BLUE_500 } from '@gitlab/ui/src/tokens/build/js/tokens';
import { hexToRgba } from '@gitlab/ui/dist/utils/utils';
import { isNumber } from 'lodash';
import { formatDate } from '~/lib/utils/datetime/date_format_utility';

View File

@ -1,4 +1,4 @@
@import '@gitlab/ui/dist/tokens/scss/tokens';
@import '@gitlab/ui/src/tokens/build/scss/tokens';
/*
* Layout

View File

@ -1,4 +1,4 @@
@import '@gitlab/ui/dist/tokens/scss/tokens.dark';
@import '@gitlab/ui/src/tokens/build/scss/tokens.dark';
$gray-lightest: lighten($gray-10, 1);
$gray-light: lighten($gray-10, 2);

View File

@ -1,5 +1,5 @@
@import './themes/dark';
@import '@gitlab/ui/dist/tokens/css/tokens.dark';
@import '@gitlab/ui/src/tokens/build/css/tokens.dark';
@import 'page_bundles/mixins_and_variables_and_functions';
:root {
@ -170,7 +170,7 @@ aside.right-sidebar:not(.right-sidebar-merge-requests) {
}
.gl-dark {
.gl-filtered-search-token-type,
.gl-filtered-search-token-type,
.gl-filtered-search-token-operator,
.gl-filtered-search-token-data,
.gl-filtered-search-suggestion-active {
@ -181,7 +181,7 @@ aside.right-sidebar:not(.right-sidebar-merge-requests) {
.gl-filtered-search-suggestion-active {
.dropdown-item:hover {
background-color: $gray-200;
}
}
}
.filtered-search-token {
@ -198,7 +198,7 @@ aside.right-sidebar:not(.right-sidebar-merge-requests) {
.filtered-search-wrapper li.droplab-item-active button {
background-color: $gray-100;
&:hover {
background-color: $gray-200;
}

View File

@ -1,5 +1,5 @@
.row-content-block.second-block.content-component-block.gl-px-0.gl-py-3
.gl-w-20
.gl-w-max-content.gl-max-w-full
#js-graph-ref-switcher{ data: { project_id: @project.id, ref: @ref, network_path: project_network_path(@project) } }
.oneline

View File

@ -213,7 +213,10 @@ let shouldExcludeFromCompliling = (modulePath) =>
// between Vue.js 2 and Vue.js 3 while using built gitlab-ui by default
if (EXPLICIT_VUE_VERSION) {
Object.assign(alias, {
'@gitlab/ui/dist/tokens/js': path.join(ROOT_PATH, 'node_modules/@gitlab/ui/dist/tokens/js'),
'@gitlab/ui/src/tokens/build/js': path.join(
ROOT_PATH,
'node_modules/@gitlab/ui/src/tokens/build/js',
),
'@gitlab/ui/dist': '@gitlab/ui/src',
'@gitlab/ui': '@gitlab/ui/src',
});

View File

@ -1588,6 +1588,8 @@ GET /groups/:id/hooks/:hook_id
{
"id": 1,
"url": "http://example.com/hook",
"name": "Hook name",
"description": "Hook description",
"group_id": 3,
"push_events": true,
"push_events_branch_filter": "",
@ -1627,8 +1629,10 @@ POST /groups/:id/hooks
| -----------------------------| -------------- |----------| ----------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the group](rest/index.md#namespaced-path-encoding) |
| `url` | string | yes | The hook URL |
| `name` | string | no | Name of the hook ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/460887) in GitLab 17.0) |
| `description` | string | no | Description of the hook ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/460887) in GitLab 17.0) |
| `push_events` | boolean | no | Trigger hook on push events |
| `push_events_branch_filter` | string | No | Trigger hook on push events for matching branches only. |
| `push_events_branch_filter` | string | no | Trigger hook on push events for matching branches only |
| `issues_events` | boolean | no | Trigger hook on issues events |
| `confidential_issues_events` | boolean | no | Trigger hook on confidential issues events |
| `merge_requests_events` | boolean | no | Trigger hook on merge requests events |
@ -1644,8 +1648,8 @@ POST /groups/:id/hooks
| `member_events` | boolean | no | Trigger hook on member events |
| `enable_ssl_verification` | boolean | no | Do SSL verification when triggering the hook |
| `token` | string | no | Secret token to validate received payloads; not returned in the response |
| `resource_access_token_events` | boolean | no | Trigger hook on project access token expiry events. |
| `custom_webhook_template` | string | No | Custom webhook template for the hook. |
| `resource_access_token_events` | boolean | no | Trigger hook on project access token expiry events |
| `custom_webhook_template` | string | no | Custom webhook template for the hook |
### Edit group hook
@ -1660,8 +1664,10 @@ PUT /groups/:id/hooks/:hook_id
| `id` | integer or string | yes | The ID or [URL-encoded path of the group](rest/index.md#namespaced-path-encoding). |
| `hook_id` | integer | yes | The ID of the group hook. |
| `url` | string | yes | The hook URL. |
| `name` | string | no | Name of the hook ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/460887) in GitLab 17.0). |
| `description` | string | no | Description of the hook ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/460887) in GitLab 17.0). |
| `push_events` | boolean | no | Trigger hook on push events. |
| `push_events_branch_filter` | string | No | Trigger hook on push events for matching branches only. |
| `push_events_branch_filter` | string | no | Trigger hook on push events for matching branches only. |
| `issues_events` | boolean | no | Trigger hook on issues events. |
| `confidential_issues_events` | boolean | no | Trigger hook on confidential issues events. |
| `merge_requests_events` | boolean | no | Trigger hook on merge requests events. |
@ -1679,7 +1685,7 @@ PUT /groups/:id/hooks/:hook_id
| `service_access_tokens_expiration_enforced` | boolean | no | Require service account access tokens to have an expiration date. |
| `token` | string | no | Secret token to validate received payloads. Not returned in the response. When you change the webhook URL, the secret token is reset and not retained. |
| `resource_access_token_events` | boolean | no | Trigger hook on project access token expiry events. |
| `custom_webhook_template` | string | No | Custom webhook template for the hook. |
| `custom_webhook_template` | string | no | Custom webhook template for the hook. |
### Delete group hook

View File

@ -2769,6 +2769,8 @@ GET /projects/:id/hooks/:hook_id
{
"id": 1,
"url": "http://example.com/hook",
"name": "Hook name",
"description": "Hook description",
"project_id": 3,
"push_events": true,
"push_events_branch_filter": "",
@ -2806,6 +2808,8 @@ POST /projects/:id/hooks
|------------------------------|-------------------|----------|-------------|
| `id` | integer or string | Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding). |
| `url` | string | Yes | The hook URL. |
| `name` | string | No | Name of the hook ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/460887) in GitLab 17.0). |
| `description` | string | No | Description of the hook ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/460887) in GitLab 17.0). |
| `confidential_issues_events` | boolean | No | Trigger hook on confidential issues events. |
| `confidential_note_events` | boolean | No | Trigger hook on confidential note events. |
| `deployment_events` | boolean | No | Trigger hook on deployment events. |
@ -2837,6 +2841,8 @@ PUT /projects/:id/hooks/:hook_id
| `hook_id` | integer | Yes | The ID of the project hook. |
| `id` | integer or string | Yes | The ID or [URL-encoded path of the project](rest/index.md#namespaced-path-encoding). |
| `url` | string | Yes | The hook URL. |
| `name` | string | No | Name of the hook ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/460887) in GitLab 17.0). |
| `description` | string | No | Description of the hook ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/460887) in GitLab 17.0). |
| `confidential_issues_events` | boolean | No | Trigger hook on confidential issues events. |
| `confidential_note_events` | boolean | No | Trigger hook on confidential note events. |
| `deployment_events` | boolean | No | Trigger hook on deployment events. |

View File

@ -40,6 +40,8 @@ Example response:
{
"id":1,
"url":"https://gitlab.example.com/hook",
"name": "Hook name",
"description": "Hook description",
"created_at":"2016-10-31T12:32:15.192Z",
"push_events":true,
"tag_push_events":false,
@ -75,6 +77,8 @@ Example response:
{
"id": 1,
"url": "https://gitlab.example.com/hook",
"name": "Hook name",
"description": "Hook description",
"created_at": "2016-10-31T12:32:15.192Z",
"push_events": true,
"tag_push_events": false,
@ -96,6 +100,8 @@ POST /hooks
| Attribute | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `url` | string | yes | The hook URL |
| `name` | string | no | Name of the hook ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/460887) in GitLab 17.0) |
| `description` | string | no | Description of the hook ([introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/460887) in GitLab 17.0) |
| `token` | string | no | Secret token to validate received payloads; this isn't returned in the response |
| `push_events` | boolean | no | When true, the hook fires on push events |
| `tag_push_events` | boolean | no | When true, the hook fires on new tags being pushed |
@ -116,6 +122,8 @@ Example response:
{
"id":1,
"url":"https://gitlab.example.com/hook",
"name": "Hook name",
"description": "Hook description",
"created_at":"2016-10-31T12:32:15.192Z",
"push_events":true,
"tag_push_events":false,

View File

@ -22,6 +22,8 @@ triggers a scan on all projects where either Container Scanning, Dependency Scan
enabled. If a new advisory affects an application or operating system dependency, it creates a
vulnerability in the project with the scanner value set to `GitLab SBoM Vulnerability Scanner`.
In contrast to the CI-based [Container Scanning](../container_scanning/index.md) and [Dependency Scanning](../dependency_scanning/index.md) security scans, Continuous Vulnerability Scanning is executed through background jobs (Sidekiq) rather than CI pipelines and no Security report artifacts are generated.
NOTE:
If a new operating system package is added to either the GitLab Advisory Database or Trivy
Database, and an advisory for it already exists, a vulnerability is **not** created. Support for

View File

@ -5,6 +5,8 @@ module API
class Hook < Grape::Entity
expose :id, documentation: { type: 'string', example: 1 }
expose :url, documentation: { type: 'string', example: 'https://webhook.site' }
expose :name, documentation: { type: 'string', example: 'Hook name' }
expose :description, documentation: { type: 'string', example: 'Hook description' }
expose :created_at, documentation: { type: 'dateTime', example: '2012-05-28T04:42:42-07:00' }
expose :push_events, documentation: { type: 'boolean' }
expose :tag_push_events, documentation: { type: 'boolean' }

View File

@ -22,6 +22,8 @@ module API
end
params :common_hook_parameters do
optional :name, type: String, desc: 'Name of the hook'
optional :description, type: String, desc: 'Description of the hook'
optional :push_events, type: Boolean, desc: "Trigger hook on push events"
optional :issues_events, type: Boolean, desc: "Trigger hook on issues events"
optional :confidential_issues_events, type: Boolean, desc: "Trigger hook on confidential issues events"

View File

@ -22,6 +22,8 @@ module API
end
params :hook_parameters do
optional :name, type: String, desc: 'Name of the hook'
optional :description, type: String, desc: 'Description of the hook'
optional :token, type: String,
desc: "Secret token to validate received payloads; this isn't returned in the response"
optional :push_events, type: Boolean, desc: 'When true, the hook fires on push events'

View File

@ -62,7 +62,7 @@
"@gitlab/favicon-overlay": "2.0.0",
"@gitlab/fonts": "^1.3.0",
"@gitlab/svgs": "3.99.0",
"@gitlab/ui": "80.1.0",
"@gitlab/ui": "80.6.0",
"@gitlab/web-ide": "^0.0.1-dev-20240508140740",
"@mattiasbuelens/web-streams-adapter": "^0.1.0",
"@rails/actioncable": "7.0.8-1",

View File

@ -151,14 +151,14 @@ export function getColorTokens(tokens) {
* from our gray scale
*/
const { text, ...lightModeTokensRaw } = JSON.parse(
fs.readFileSync(path.join(GITLAB_UI_DIR, 'dist/tokens/json/tokens.json'), 'utf-8'),
fs.readFileSync(path.join(GITLAB_UI_DIR, 'src/tokens/build/json/tokens.json'), 'utf-8'),
);
const lightModeHexToToken = Object.fromEntries(getColorTokens(lightModeTokensRaw));
export const darkModeTokenToHex = Object.fromEntries(
getColorTokens(
JSON.parse(
fs.readFileSync(path.join(GITLAB_UI_DIR, 'dist/tokens/json/tokens.dark.json'), 'utf-8'),
fs.readFileSync(path.join(GITLAB_UI_DIR, 'src/tokens/build/json/tokens.dark.json'), 'utf-8'),
),
).map(([color, key]) => [key.startsWith('text-') ? `gl-${key}` : key, color]),
);

View File

@ -3,6 +3,8 @@
FactoryBot.define do
factory :project_hook do
url { generate(:url) }
name { generate(:name) }
description { "Description of #{name}" }
enable_ssl_verification { false }
project

View File

@ -3,5 +3,7 @@
FactoryBot.define do
factory :system_hook do
url { generate(:url) }
name { generate(:name) }
description { "Description of #{name}" }
end
end

View File

@ -85,7 +85,6 @@ RSpec.describe 'Recent searches', :js, feature_category: :team_planning do
expect_recent_searches_history_item_count 1
click_button 'Clear recent searches'
click_button 'Toggle history'
expect(page).to have_text "You don't have any recent searches"
expect_recent_searches_history_item_count 0

View File

@ -27,7 +27,9 @@
"resource_access_token_events"
],
"optional": [
"url_variables"
"url_variables",
"name",
"description"
],
"properties": {
"id": {
@ -39,6 +41,18 @@
"url": {
"type": "string"
},
"name": {
"type": [
"string",
"null"
]
},
"description": {
"type": [
"string",
"null"
]
},
"created_at": {
"type": "string",
"format": "date-time"

View File

@ -21,6 +21,18 @@
"url": {
"type": "string"
},
"name": {
"type": [
"string",
"null"
]
},
"description": {
"type": [
"string",
"null"
]
},
"created_at": {
"type": "string"
},

View File

@ -1,4 +1,11 @@
import { GlTable, GlAlert, GlLoadingIcon, GlDropdown, GlAvatar, GlLink } from '@gitlab/ui';
import {
GlTable,
GlAlert,
GlLoadingIcon,
GlDisclosureDropdown,
GlAvatar,
GlLink,
} from '@gitlab/ui';
import { mount } from '@vue/test-utils';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
@ -26,7 +33,7 @@ describe('AlertManagementTable', () => {
const findAlerts = () => wrapper.findAll('table tbody tr');
const findAlert = () => wrapper.findComponent(GlAlert);
const findLoader = () => wrapper.findComponent(GlLoadingIcon);
const findStatusDropdown = () => wrapper.findComponent(GlDropdown);
const findStatusDropdown = () => wrapper.findComponent(GlDisclosureDropdown);
const findDateFields = () => wrapper.findAllComponents(TimeAgo);
const findSearch = () => wrapper.findComponent(FilteredSearchBar);
const findSeverityColumnHeader = () => wrapper.findByTestId('alert-management-severity-sort');

View File

@ -1,4 +1,4 @@
import { GlDropdownItem, GlSorting, GlFilteredSearch, GlFormCheckbox } from '@gitlab/ui';
import { GlDisclosureDropdownItem, GlSorting, GlFilteredSearch, GlFormCheckbox } from '@gitlab/ui';
import { shallowMount, mount } from '@vue/test-utils';
import { nextTick } from 'vue';
import { useLocalStorageSpy } from 'helpers/local_storage_helper';
@ -60,7 +60,8 @@ describe('FilteredSearchBarRoot', () => {
const findGlSorting = () => wrapper.findComponent(GlSorting);
const findGlFilteredSearch = () => wrapper.findComponent(GlFilteredSearch);
const findGlFormCheckbox = () => wrapper.findComponent(GlFormCheckbox);
const findGlDropdownItem = () => wrapper.findComponent(GlDropdownItem);
const findGlDisclosureDropdownItems = () => wrapper.findAllComponents(GlDisclosureDropdownItem);
const findGlDisclosureDropdownItem = () => wrapper.findComponent(GlDisclosureDropdownItem);
afterEach(() => {
localStorage.clear();
@ -425,11 +426,7 @@ describe('FilteredSearchBarRoot', () => {
wrapper.vm.recentSearchesStore.addRecentSearch(mockHistoryItems[0]);
await nextTick();
const searchHistoryItemsEl = wrapper.findAll(
'.gl-search-box-by-click-menu .gl-search-box-by-click-history-item',
);
expect(searchHistoryItemsEl.at(0).text()).toBe(
expect(findGlDisclosureDropdownItems().at(0).text()).toBe(
'Author := @rootLabel := ~bugMilestone := %v1.0"duo"',
);
});
@ -446,7 +443,7 @@ describe('FilteredSearchBarRoot', () => {
wrapper.vm.recentSearchesStore.addRecentSearch([tokenValueMembership]);
await nextTick();
expect(findGlDropdownItem().text()).toBe('Membership := Direct');
expect(findGlDisclosureDropdownItem().text()).toBe('Membership := Direct');
});
});
@ -461,7 +458,7 @@ describe('FilteredSearchBarRoot', () => {
});
wrapper.vm.recentSearchesStore.addRecentSearch([tokenValueMembership]);
await nextTick();
expect(findGlDropdownItem().text()).toBe('Membership := exclude');
expect(findGlDisclosureDropdownItem().text()).toBe('Membership := exclude');
});
});

View File

@ -10,9 +10,9 @@ RSpec.describe API::Entities::Hook, feature_category: :webhooks do
subject(:json) { entity.as_json }
it 'exposes correct attributes' do
expect(json.keys).to contain_exactly(:alert_status, :created_at, :disabled_until, :enable_ssl_verification, :id,
:merge_requests_events, :push_events, :repository_update_events, :tag_push_events, :url, :url_variables,
:custom_webhook_template
expect(json.keys).to contain_exactly(
:id, :name, :description, :alert_status, :created_at, :disabled_until, :enable_ssl_verification, :tag_push_events,
:merge_requests_events, :push_events, :repository_update_events, :url, :url_variables, :custom_webhook_template
)
end

View File

@ -50,6 +50,8 @@ RSpec.shared_examples 'web-hook API endpoints' do |prefix|
let(:update_params) do
{
name: 'Updated name',
description: 'Updated description',
push_events: false,
job_events: true,
push_events_branch_filter: 'updated-branch-filter'

View File

@ -1331,10 +1331,10 @@
resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-3.99.0.tgz#85d2752787c3a87d40d5468a797e67c1e736a9fc"
integrity sha512-N1y2W8ti0Pw7N8UYUdcl7DQuIZfOcL0R85EzJlSgXLt+I0NdmX4s3CCqBV1g62ZDxLgfDqBfiLKLCcYz8JkJ8w==
"@gitlab/ui@80.1.0":
version "80.1.0"
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-80.1.0.tgz#5f2a3cf5691435ffe55e31e7aee3484eae5d91e5"
integrity sha512-lUs22yy9uTJ0v8HzbULnJlMu5504bsRR8JFzhPPRbDX7QAXc/XNmHgHCw2Aa8y9gxBfsf5EwBcnWl1o5BsV+Gw==
"@gitlab/ui@80.6.0":
version "80.6.0"
resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-80.6.0.tgz#7963bd2c7a2f6faca56c1607a9161e3f5af62242"
integrity sha512-+tP+9XLJD18Q5xUJ7yHvqV5SjkWUSeE98sEatl/4+awBDfob0OJWIjnnS0HHcBINo7F+7lTJh/e6HDgzgigfnA==
dependencies:
"@floating-ui/dom" "1.4.3"
bootstrap-vue "2.23.1"