Read about our upcoming Code of Conduct on this issue

Commit a5a5eb92 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 6bc29b406ba3
import { shallowMount } from '@vue/test-utils';
import Popover from '~/blob/suggest_gitlab_ci_yml/components/popover.vue';
import { mockTracking, unmockTracking, triggerEvent } from 'helpers/tracking_helper';
import * as utils from '~/lib/utils/common_utils';
import { GlButton } from '@gitlab/ui';
jest.mock('~/lib/utils/common_utils', () => ({
...jest.requireActual('~/lib/utils/common_utils'),
scrollToElement: jest.fn(),
}));
const target = 'gitlab-ci-yml-selector';
const dismissKey = '99';
const defaultTrackLabel = 'suggest_gitlab_ci_yml';
const commitTrackLabel = 'suggest_commit_first_project_gitlab_ci_yml';
const dismissCookie = 'suggest_gitlab_ci_yml_99';
const humanAccess = 'owner';
describe('Suggest gitlab-ci.yml Popover', () => {
let wrapper;
function createWrapper(trackLabel) {
wrapper = shallowMount(Popover, {
propsData: {
target,
trackLabel,
dismissKey,
humanAccess,
},
stubs: {
GlButton,
GlIcon
}
slots: {
title: '<gl-button><gl-icon /> </gl-button>',
}
});
}
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
describe('when no dismiss cookie is set', () => {
beforeEach(() => {
createWrapper(defaultTrackLabel);
});
it('sets popoverDismissed to false', () => {
expect(wrapper.vm.popoverDismissed).toEqual(false);
});
});
describe('when the dismiss cookie is set', () => {
beforeEach(() => {
utils.setCookie(dismissCookie, true);
createWrapper(defaultTrackLabel);
});
it('sets popoverDismissed to true', () => {
expect(wrapper.vm.popoverDismissed).toEqual(true);
});
afterEach(() => {
utils.removeCookie(dismissCookie);
});
});
describe('tracking', () => {
let trackingSpy;
beforeEach(() => {
createWrapper(commitTrackLabel);
trackingSpy = mockTracking('_category_', wrapper.element, jest.spyOn);
});
afterEach(() => {
unmockTracking();
});
it('sends a tracking event with the expected properties for the popover being viewed', () => {
const expectedCategory = undefined;
const expectedAction = undefined;
const expectedLabel = 'suggest_commit_first_project_gitlab_ci_yml';
const expectedProperty = 'owner';
document.body.dataset.page = 'projects:blob:new';
wrapper.vm.trackOnShow();
expect(trackingSpy).toHaveBeenCalledWith(expectedCategory, expectedAction, {
label: expectedLabel,
property: expectedProperty,
});
});
it('sends a tracking event when the popover is dismissed', () => {
const expectedLabel = commitTrackLabel;
const expectedProperty = 'owner';
const expectedValue = '10';
const dismissButton = wrapper.find(GlButton);
console.log(wrapper.html());
triggerEvent(dismissButton.element);
expect(trackingSpy).toHaveBeenCalledWith('_category_', 'click_button', {
label: expectedLabel,
property: expectedProperty,
value: expectedValue,
});
});
});
describe('when the popover is mounted with the trackLabel of the Confirm button popover at the bottom of the page', () => {
it('calls scrollToElement so that the Confirm button and popover will be in sight', () => {
const scrollToElementSpy = jest.spyOn(utils, 'scrollToElement');
createWrapper(commitTrackLabel);
expect(scrollToElementSpy).toHaveBeenCalled();
});
});
});
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-9.6-graphicsmagick-1.3.34"
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.26-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-9.6-graphicsmagick-1.3.34"
stages:
- sync
......
......@@ -15,7 +15,7 @@
- .default-retry
- .default-before_script
- .assets-compile-cache
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-graphicsmagick-1.3.34-docker-19.03.1
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-git-2.26-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-graphicsmagick-1.3.34-docker-19.03.1
stage: prepare
services:
- docker:19.03.0-dind
......
......@@ -38,7 +38,7 @@
POSTGRES_HOST_AUTH_METHOD: trust
.use-pg10:
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-10-graphicsmagick-1.3.34"
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.26-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-10-graphicsmagick-1.3.34"
services:
- name: postgres:10.12
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
......@@ -47,7 +47,7 @@
POSTGRES_HOST_AUTH_METHOD: trust
.use-pg11:
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-11-graphicsmagick-1.3.34"
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.26-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-11-graphicsmagick-1.3.34"
services:
- name: postgres:11.6
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
......@@ -65,7 +65,7 @@
POSTGRES_HOST_AUTH_METHOD: trust
.use-pg10-ee:
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-10-graphicsmagick-1.3.34"
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.26-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-10-graphicsmagick-1.3.34"
services:
- name: postgres:10.12
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
......@@ -75,7 +75,7 @@
POSTGRES_HOST_AUTH_METHOD: trust
.use-pg11-ee:
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.24-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-11-graphicsmagick-1.3.34"
image: "registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.6.5-golang-1.12-git-2.26-lfs-2.9-chrome-73.0-node-12.x-yarn-1.21-postgresql-11-graphicsmagick-1.3.34"
services:
- name: postgres:11.6
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
......
......@@ -420,4 +420,3 @@ RSpec/RepeatedExample:
- 'ee/spec/models/group_spec.rb'
- 'ee/spec/services/boards/lists/update_service_spec.rb'
- 'ee/spec/services/geo/repository_verification_primary_service_spec.rb'
- 'ee/spec/workers/geo/file_download_dispatch_worker_spec.rb'
......@@ -6,6 +6,7 @@ import EditBlob from './edit_blob';
import BlobFileDropzone from '../blob/blob_file_dropzone';
import initPopover from '~/blob/suggest_gitlab_ci_yml';
import { setCookie } from '~/lib/utils/common_utils';
import Tracking from '~/tracking';
export default () => {
const editBlobForm = $('.js-edit-blob-form');
......@@ -66,10 +67,19 @@ export default () => {
initPopover(suggestEl);
if (commitButton) {
const commitCookieName = `suggest_gitlab_ci_yml_commit_${suggestEl.dataset.dismissKey}`;
const { dismissKey, humanAccess } = suggestEl.dataset;
const commitCookieName = `suggest_gitlab_ci_yml_commit_${dismissKey}`;
const commitTrackLabel = 'suggest_gitlab_ci_yml_commit_changes';
const commitTrackValue = '20';
commitButton.addEventListener('click', () => {
setCookie(commitCookieName, true);
Tracking.event(undefined, 'click_button', {
label: commitTrackLabel,
property: humanAccess,
value: commitTrackValue,
});
});
}
}
......
<script>
import { GlSingleStat } from '@gitlab/ui/dist/charts';
import { roundOffFloat } from '~/lib/utils/common_utils';
import { SUPPORTED_FORMATS, getFormatter } from '~/lib/utils/unit_format';
import { graphDataValidatorForValues } from '../../utils';
const defaultPrecision = 2;
export default {
components: {
GlSingleStat,
......@@ -25,15 +27,19 @@ export default {
/**
* This method formats the query result from a promQL expression
* allowing a user to format the data in percentile values
* by using the `max_value` inner property from the graphData prop
* by using the `maxValue` inner property from the graphData prop
* @returns {(String)}
*/
statValue() {
const chartValue = this.graphData?.max_value
? (this.queryResult / Number(this.graphData.max_value)) * 100
: this.queryResult;
let formatter;
if (this.graphData?.maxValue) {
formatter = getFormatter(SUPPORTED_FORMATS.percent);
return formatter(this.queryResult / Number(this.graphData.maxValue), defaultPrecision);
}
return `${roundOffFloat(chartValue, 1)}${this.queryInfo.unit}`;
formatter = getFormatter(SUPPORTED_FORMATS.number);
return `${formatter(this.queryResult, defaultPrecision)}${this.queryInfo.unit}`;
},
graphTitle() {
return this.queryInfo.label;
......
......@@ -13,7 +13,6 @@ import {
lineWidths,
symbolSizes,
dateFormats,
chartColorValues,
} from '../../constants';
import { getYAxisOptions, getChartGrid, getTooltipFormatter } from './options';
import { makeDataSeries } from '~/helpers/monitor_helper';
......@@ -124,7 +123,7 @@ export default {
// Transforms & supplements query data to render appropriate labels & styles
// Input: [{ queryAttributes1 }, { queryAttributes2 }]
// Output: [{ seriesAttributes1 }, { seriesAttributes2 }]
return this.graphData.metrics.reduce((acc, query, i) => {
return this.graphData.metrics.reduce((acc, query) => {
const { appearance } = query;
const lineType =
appearance && appearance.line && appearance.line.type
......@@ -145,7 +144,6 @@ export default {
lineStyle: {
type: lineType,
width: lineWidth,
color: chartColorValues[i % chartColorValues.length],
},
showSymbol: false,
areaStyle: this.graphData.type === 'area-chart' ? areaStyle : undefined,
......
......@@ -67,13 +67,6 @@ export const colorValues = {
anomalyAreaColor: '#1f78d1',
};
export const chartColorValues = [
'#1f78d1', // $blue-500 (see variables.scss)
'#1aaa55', // $green-500
'#fc9403', // $orange-500
'#6d49cb', // $purple
];
export const lineTypes = {
default: 'solid',
};
......
......@@ -109,6 +109,7 @@ const mapPanelToViewModel = ({
y_label,
y_axis = {},
metrics = [],
max_value,
}) => {
// Both `x_axis.name` and `x_label` are supported for now
// https://gitlab.com/gitlab-org/gitlab/issues/210521
......@@ -125,6 +126,7 @@ const mapPanelToViewModel = ({
y_label: yAxis.name, // Changing y_label to yLabel is pending https://gitlab.com/gitlab-org/gitlab/issues/207198
yAxis,
xAxis,
maxValue: max_value,
metrics: mapToMetricsViewModel(metrics, yAxis.name),
};
};
......
......@@ -602,9 +602,9 @@ def project_permissions_panel_data(project)
registryAvailable: Gitlab.config.registry.enabled,
registryHelpPath: help_page_path('user/packages/container_registry/index'),
lfsAvailable: Gitlab.config.lfs.enabled,
lfsHelpPath: help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs'),
lfsHelpPath: help_page_path('topics/git/lfs/index'),
lfsObjectsExist: project.lfs_objects.exists?,
lfsObjectsRemovalHelpPath: help_page_path('administration/lfs/manage_large_binaries_with_git_lfs', anchor: 'removing-objects-from-lfs'),
lfsObjectsRemovalHelpPath: help_page_path('topics/git/lfs/index', anchor: 'removing-objects-from-lfs'),
pagesAvailable: Gitlab.config.pages.enabled,
pagesAccessControlEnabled: Gitlab.config.pages.access_control,
pagesAccessControlForced: ::Gitlab::Pages.access_control_is_forced?,
......
......@@ -55,7 +55,7 @@
%span.light= _('Group Git LFS status:')
%strong
= group_lfs_status(@group)
= link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
= link_to icon('question-circle'), help_page_path('topics/git/lfs/index')
= render_if_exists 'namespaces/shared_runner_status', namespace: @group
......
......@@ -89,7 +89,7 @@
%span.light Git LFS status:
%strong
= project_lfs_status(@project)
= link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
= link_to icon('question-circle'), help_page_path('topics/git/lfs/index')
- else
%li
%span.light repository:
......
......@@ -7,7 +7,7 @@
= f.label :lfs_enabled, class: 'form-check-label' do
%strong
Allow projects within this group to use Git LFS
= link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
= link_to icon('question-circle'), help_page_path('topics/git/lfs/index')
%br/
%span This setting can be overridden in each project.
.form-group.row
......
- docs_link_url = help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
- docs_link_url = help_page_path('topics/git/lfs/index')
- docs_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: docs_link_url }
%h5= _('Large File Storage')
......
---
title: Fix wrong colors displayed in charts
merge_request: 28095
author:
type: fixed
---
title: Fix single stat panel percentile format support
merge_request: 28365
author:
type: fixed
......@@ -43,7 +43,13 @@ The process will execute the following access checks:
- Ensure the user is still present in LDAP.
- If the LDAP server is Active Directory, ensure the user is active (not
blocked/disabled state). This will only be checked if
`active_directory: true` is set in the LDAP configuration. [^1]
`active_directory: true` is set in the LDAP configuration.
NOTE: **Note:**
In Active Directory, a user is marked as disabled/blocked if the user
account control attribute (`userAccountControl:1.2.840.113556.1.4.803`)
has bit 2 set. See <https://ctogonewild.com/2009/09/03/bitmask-searches-in-ldap/>
for more information.
The user will be set to `ldap_blocked` state in GitLab if the above conditions
fail. This means the user will not be able to login or push/pull code.
......@@ -93,7 +99,7 @@ following.
EOS
```
1. [Reconfigure GitLab][reconfigure] for the changes to take effect.
1. [Apply your changes to GitLab](../restart_gitlab.md#omnibus-gitlab-reconfigure).
**Source configuration**
......@@ -108,7 +114,7 @@ following.
group_base: ou=groups,dc=example,dc=com
```
1. [Restart GitLab][restart] for the changes to take effect.
1. [Restart GitLab](../restart_gitlab.md#installations-from-source) for the changes to take effect.
To take advantage of group sync, group owners or maintainers will need to [create one
or more LDAP group links](#adding-group-links).
......@@ -183,7 +189,7 @@ group, as opposed to the full DN.
EOS
```
1. [Reconfigure GitLab][reconfigure] for the changes to take effect.
1. [Apply your changes to GitLab](../restart_gitlab.md#omnibus-gitlab-reconfigure).
**Source configuration**
......@@ -199,7 +205,7 @@ group, as opposed to the full DN.
admin_group: my_admin_group
```
1. [Restart GitLab][restart] for the changes to take effect.
1. [Restart GitLab](../restart_gitlab.md#installations-from-source) for the changes to take effect.
## Global group memberships lock
......@@ -318,7 +324,7 @@ task.
EOS
```
1. [Reconfigure GitLab][reconfigure] for the changes to take effect.
1. [Apply your changes to GitLab](../restart_gitlab.md#omnibus-gitlab-reconfigure).
**Source configuration**
......@@ -333,7 +339,7 @@ task.
external_groups: ['interns', 'contractors']
```
1. [Restart GitLab][restart] for the changes to take effect.
1. [Restart GitLab](../restart_gitlab.md#installations-from-source) for the changes to take effect.
## Group sync technical details
......
......@@ -84,7 +84,7 @@ following is most likely true:
- The `bind_dn` user doesn't have enough permissions to traverse the user tree.
- The user(s) don't fall under the [configured `base`](ldap.md#configuration).
- The [configured `user_filter`][user-filter] blocks access to the user(s).
- The [configured `user_filter`](ldap.md#using-an-ldap-filter-to-limit-access-to-your-gitlab-server) blocks access to the user(s).
In this case, you con confirm which of the above is true using
[ldapsearch](#ldapsearch) with the existing LDAP configuration in your
......@@ -97,7 +97,7 @@ here are some questions to ask yourself:
- Does the user fall under the [configured `base`](ldap.md#configuration) in
LDAP? The user must fall under this `base` to login.
- Does the user pass through the [configured `user_filter`][user-filter]?
- Does the user pass through the [configured `user_filter`](ldap.md#using-an-ldap-filter-to-limit-access-to-your-gitlab-server)?
If one is not configured, this question can be ignored. If it is, then the
user must also pass through this filter to be allowed to login.
- Refer to our docs on [debugging the `user_filter`](#debug-ldap-user-filter).
......@@ -132,7 +132,7 @@ are true for the user in question:
#### Email has already been taken
A user tries to login with the correct LDAP credentials, is denied access,
and the [production.log][production-log] shows an error that looks like this:
and the [production.log](../logs.md#productionlog) shows an error that looks like this:
```plaintext
(LDAP) Error saving user <USER DN> (email@example.com): ["Email has already been taken"]
......@@ -168,7 +168,7 @@ profile](../../user/profile/index.md#user-profile) or an admin can do it.
#### Debug LDAP user filter
[`ldapsearch`](#ldapsearch) allows you to test your configured
[user filter][user-filter]
[user filter](ldap.md#using-an-ldap-filter-to-limit-access-to-your-gitlab-server)
to confirm that it returns the users you expect it to return.
```shell
......@@ -184,7 +184,7 @@ ldapsearch -H ldaps://$host:$port -D "$bind_dn" -y bind_dn_password.txt -b "$ba
#### Sync all users **(STARTER ONLY)**
The output from a manual [user sync][user-sync] can show you what happens when
The output from a manual [user sync](ldap-ee.md#user-sync) can show you what happens when
GitLab tries to sync its users against LDAP. Enter the [rails console](#rails-console)
and then run:
......@@ -297,9 +297,9 @@ LDAP group sync, but for some reason it's not happening. There are several
things to check to debug the situation.
- Ensure LDAP configuration has a `group_base` specified.
[This configuration][group-sync] is required for group sync to work properly.
[This configuration](ldap-ee.md#group-sync) is required for group sync to work properly.
- Ensure the correct [LDAP group link is added to the GitLab
group][group-links].
group](ldap-ee.md#adding-group-links).
- Check that the user has an LDAP identity:
1. Sign in to GitLab as an administrator user.
1. Navigate to **Admin area -> Users**.
......@@ -312,7 +312,7 @@ things to check to debug the situation.
interval](ldap-ee.md#adjusting-ldap-group-sync-schedule) for the group to
sync. To speed up the process, either go to the GitLab group **Settings ->
Members** and press **Sync now** (sync one group) or [run the group sync Rake
task][group-sync-rake] (sync all groups).
task](../raketasks/ldap.md#run-a-group-sync) (sync all groups).
If all of the above looks good, jump in to a little more advanced debugging in
the rails console.
......@@ -352,9 +352,9 @@ GitLab syncs the `admin_group`.
NOTE: **NOTE:**
To sync all groups manually when debugging is unnecessary, [use the Rake
task][group-sync-rake] instead.
task](../raketasks/ldap.md#run-a-group-sync) instead.
The output from a manual [group sync][group-sync] can show you what happens
The output from a manual [group sync](ldap-ee.md#group-sync) can show you what happens
when GitLab syncs its LDAP group memberships against LDAP.
```ruby
......@@ -449,7 +449,7 @@ this line will indicate the sync is finished:
Finished syncing admin users for 'ldapmain' provider
```
If [admin sync][admin-sync] is not configured, you'll see a message
If [admin sync](ldap-ee.md#administrator-sync) is not configured, you'll see a message
stating as such:
```shell
......@@ -541,7 +541,7 @@ for each of these users.
### LDAP check
The [Rake task to check LDAP][ldap-check] is a valuable tool
The [Rake task to check LDAP](../raketasks/ldap.md#check) is a valuable tool
to help determine whether GitLab can successfully establish a connection to
LDAP and can get so far as to even read users.
......@@ -561,11 +561,11 @@ users, [see what to do when no users are found](#no-users-are-found).
### GitLab logs
If a user account is blocked or unblocked due to the LDAP configuration, a
message will be [logged to `application.log`][application-log].
message will be [logged to `application.log`](../logs.md#applicationlog).
If there is an unexpected error during an LDAP lookup (configuration error,
timeout), the login is rejected and a message will be [logged to
`production.log`][production-log].
`production.log`](../logs.md#productionlog).
### ldapsearch
......@@ -649,24 +649,3 @@ console](#rails-console) and run:
```ruby
Rails.logger.level = Logger::DEBUG
```
<!-- LINK REFERENCES -->
[tail-logs]: https://docs.gitlab.com/omnibus/settings/logs.html#tail-logs-in-a-console-on-the-server
[production-log]: ../logs.md#productionlog
[application-log]: ../logs.md#applicationlog
[reconfigure]: ../restart_gitlab.md#omnibus-gitlab-reconfigure
[restart]: ../restart_gitlab.md#installations-from-source
[ldap-check]: ../raketasks/ldap.md#check
[group-sync-rake]: ../raketasks/ldap.md#run-a-group-sync
[user-filter]: ldap.md#using-an-ldap-filter-to-limit-access-to-your-gitlab-server
[user-sync]: ldap-ee.md#user-sync
[group-sync]: ldap-ee.md#group-sync
[admin-sync]: ldap-ee.md#administrator-sync
[config]: ldap.md#configuration
[group-links]: ldap-ee.md#adding-group-links
[^1]: In Active Directory, a user is marked as disabled/blocked if the user
account control attribute (`userAccountControl:1.2.840.113556.1.4.803`)
has bit 2 set. See <https://ctogonewild.com/2009/09/03/bitmask-searches-in-ldap/>
for more information.
......@@ -236,7 +236,7 @@ push origin
[deprecate-annex-issue]: https://gitlab.com/gitlab-org/gitlab/issues/1648
[git-annex]: https://git-annex.branchable.com/ "git-annex website"
[gitlab shell]: https://gitlab.com/gitlab-org/gitlab-shell "GitLab Shell repository"
[guide]: lfs/migrate_from_git_annex_to_git_lfs.html
[guide]: ../topics/git/lfs/migrate_from_git_annex_to_git_lfs.md
[issue]: https://git-annex.branchable.com/forum/Error_from_git-annex-shell_on_creation_of_gcrypt_special_remote/ "git-annex issue"
[reconfigure GitLab]: restart_gitlab.md#omnibus-gitlab-reconfigure
[restart GitLab]: restart_gitlab.md#installations-from-source
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment