Commit 8ce9ca77 authored by Amy Qualls's avatar Amy Qualls

Merge branch 'pl-doc-generic-alerts-redirect' into 'master'

Docs: Redirect former "Generic alerts integrations" to "Alert integrations"

See merge request gitlab-org/gitlab!46868
parents 8bb1cfa8 070c90e1
...@@ -16,7 +16,7 @@ inherit_mode: ...@@ -16,7 +16,7 @@ inherit_mode:
- Include - Include
AllCops: AllCops:
TargetRubyVersion: 2.6 TargetRubyVersion: 2.7
TargetRailsVersion: 6.0 TargetRailsVersion: 6.0
Exclude: Exclude:
- 'vendor/**/*' - 'vendor/**/*'
......
89e94b4b16d9bac60bfa5efe4773c270a69ddf4e 020b5f709d58277c360ba409b8f8a9e81cee2781
...@@ -168,9 +168,6 @@ export default class CreateMergeRequestDropdown { ...@@ -168,9 +168,6 @@ export default class CreateMergeRequestDropdown {
disable() { disable() {
this.disableCreateAction(); this.disableCreateAction();
this.dropdownToggle.classList.add('disabled');
this.dropdownToggle.setAttribute('disabled', 'disabled');
} }
disableCreateAction() { disableCreateAction() {
...@@ -189,9 +186,6 @@ export default class CreateMergeRequestDropdown { ...@@ -189,9 +186,6 @@ export default class CreateMergeRequestDropdown {
this.createTargetButton.classList.remove('disabled'); this.createTargetButton.classList.remove('disabled');
this.createTargetButton.removeAttribute('disabled'); this.createTargetButton.removeAttribute('disabled');
this.dropdownToggle.classList.remove('disabled');
this.dropdownToggle.removeAttribute('disabled');
} }
static findByValue(objects, ref, returnFirstMatch = false) { static findByValue(objects, ref, returnFirstMatch = false) {
......
...@@ -626,7 +626,7 @@ export function switchToFullDiffFromRenamedFile({ commit, dispatch, state }, { d ...@@ -626,7 +626,7 @@ export function switchToFullDiffFromRenamedFile({ commit, dispatch, state }, { d
.then(({ data }) => { .then(({ data }) => {
const lines = data.map((line, index) => const lines = data.map((line, index) =>
prepareLineForRenamedFile({ prepareLineForRenamedFile({
diffViewType: state.diffViewType, diffViewType: window.gon?.features?.unifiedDiffLines ? 'inline' : state.diffViewType,
line, line,
diffFile, diffFile,
index, index,
...@@ -638,6 +638,7 @@ export function switchToFullDiffFromRenamedFile({ commit, dispatch, state }, { d ...@@ -638,6 +638,7 @@ export function switchToFullDiffFromRenamedFile({ commit, dispatch, state }, { d
viewer: { viewer: {
...diffFile.alternate_viewer, ...diffFile.alternate_viewer,
automaticallyCollapsed: false, automaticallyCollapsed: false,
manuallyCollapsed: false,
}, },
}); });
commit(types.SET_CURRENT_VIEW_DIFF_FILE_LINES, { filePath: diffFile.file_path, lines }); commit(types.SET_CURRENT_VIEW_DIFF_FILE_LINES, { filePath: diffFile.file_path, lines });
......
...@@ -378,8 +378,13 @@ export default { ...@@ -378,8 +378,13 @@ export default {
}, },
[types.SET_CURRENT_VIEW_DIFF_FILE_LINES](state, { filePath, lines }) { [types.SET_CURRENT_VIEW_DIFF_FILE_LINES](state, { filePath, lines }) {
const file = state.diffFiles.find(f => f.file_path === filePath); const file = state.diffFiles.find(f => f.file_path === filePath);
const currentDiffLinesKey = let currentDiffLinesKey;
state.diffViewType === 'inline' ? 'highlighted_diff_lines' : 'parallel_diff_lines';
if (window.gon?.features?.unifiedDiffLines || state.diffViewType === 'inline') {
currentDiffLinesKey = 'highlighted_diff_lines';
} else {
currentDiffLinesKey = 'parallel_diff_lines';
}
file[currentDiffLinesKey] = lines; file[currentDiffLinesKey] = lines;
}, },
......
...@@ -8,9 +8,9 @@ import { ...@@ -8,9 +8,9 @@ import {
GlBadge, GlBadge,
GlAlert, GlAlert,
GlSprintf, GlSprintf,
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlDeprecatedDropdownDivider, GlDropdownDivider,
GlIcon, GlIcon,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import { deprecatedCreateFlash as createFlash } from '~/flash';
...@@ -43,9 +43,9 @@ export default { ...@@ -43,9 +43,9 @@ export default {
GlBadge, GlBadge,
GlAlert, GlAlert,
GlSprintf, GlSprintf,
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlDeprecatedDropdownDivider, GlDropdownDivider,
TimeAgoTooltip, TimeAgoTooltip,
}, },
directives: { directives: {
...@@ -331,38 +331,38 @@ export default { ...@@ -331,38 +331,38 @@ export default {
</gl-button> </gl-button>
</form> </form>
</div> </div>
<gl-deprecated-dropdown <gl-dropdown
text="Options" text="Options"
class="error-details-options d-md-none" class="error-details-options d-md-none"
right right
:disabled="issueUpdateInProgress" :disabled="issueUpdateInProgress"
> >
<gl-deprecated-dropdown-item <gl-dropdown-item
data-qa-selector="update_ignore_status_button" data-qa-selector="update_ignore_status_button"
@click="onIgnoreStatusUpdate" @click="onIgnoreStatusUpdate"
>{{ ignoreBtnLabel }}</gl-deprecated-dropdown-item >{{ ignoreBtnLabel }}</gl-dropdown-item
> >
<gl-deprecated-dropdown-item <gl-dropdown-item
data-qa-selector="update_resolve_status_button" data-qa-selector="update_resolve_status_button"
@click="onResolveStatusUpdate" @click="onResolveStatusUpdate"
>{{ resolveBtnLabel }}</gl-deprecated-dropdown-item >{{ resolveBtnLabel }}</gl-dropdown-item
> >
<gl-deprecated-dropdown-divider /> <gl-dropdown-divider />
<gl-deprecated-dropdown-item <gl-dropdown-item
v-if="error.gitlabIssuePath" v-if="error.gitlabIssuePath"
data-qa-selector="view_issue_button" data-qa-selector="view_issue_button"
:href="error.gitlabIssuePath" :href="error.gitlabIssuePath"
variant="success" variant="success"
>{{ __('View issue') }}</gl-deprecated-dropdown-item >{{ __('View issue') }}</gl-dropdown-item
> >
<gl-deprecated-dropdown-item <gl-dropdown-item
v-if="!error.gitlabIssuePath" v-if="!error.gitlabIssuePath"
:loading="issueCreationInProgress" :loading="issueCreationInProgress"
data-qa-selector="create_issue_button" data-qa-selector="create_issue_button"
@click="createIssue" @click="createIssue"
>{{ __('Create issue') }}</gl-deprecated-dropdown-item >{{ __('Create issue') }}</gl-dropdown-item
> >
</gl-deprecated-dropdown> </gl-dropdown>
</div> </div>
</div> </div>
<div> <div>
......
...@@ -8,9 +8,9 @@ import { ...@@ -8,9 +8,9 @@ import {
GlLoadingIcon, GlLoadingIcon,
GlTable, GlTable,
GlFormInput, GlFormInput,
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlDeprecatedDropdownDivider, GlDropdownDivider,
GlTooltipDirective, GlTooltipDirective,
GlPagination, GlPagination,
} from '@gitlab/ui'; } from '@gitlab/ui';
...@@ -72,9 +72,9 @@ export default { ...@@ -72,9 +72,9 @@ export default {
components: { components: {
GlEmptyState, GlEmptyState,
GlButton, GlButton,
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
GlDeprecatedDropdownDivider, GlDropdownDivider,
GlIcon, GlIcon,
GlLink, GlLink,
GlLoadingIcon, GlLoadingIcon,
...@@ -233,30 +233,30 @@ export default { ...@@ -233,30 +233,30 @@ export default {
> >
<div class="search-box flex-fill mb-1 mb-md-0"> <div class="search-box flex-fill mb-1 mb-md-0">
<div class="filtered-search-box mb-0"> <div class="filtered-search-box mb-0">
<gl-deprecated-dropdown <gl-dropdown
:text="__('Recent searches')" :text="__('Recent searches')"
class="filtered-search-history-dropdown-wrapper" class="filtered-search-history-dropdown-wrapper"
toggle-class="filtered-search-history-dropdown-toggle-button" toggle-class="filtered-search-history-dropdown-toggle-button gl-shadow-none! gl-border-r-gray-200! gl-border-1! gl-rounded-0!"
:disabled="loading" :disabled="loading"
> >
<div v-if="!$options.hasLocalStorage" class="px-3"> <div v-if="!$options.hasLocalStorage" class="px-3">
{{ __('This feature requires local storage to be enabled') }} {{ __('This feature requires local storage to be enabled') }}
</div> </div>
<template v-else-if="recentSearches.length > 0"> <template v-else-if="recentSearches.length > 0">
<gl-deprecated-dropdown-item <gl-dropdown-item
v-for="searchQuery in recentSearches" v-for="searchQuery in recentSearches"
:key="searchQuery" :key="searchQuery"
@click="setSearchText(searchQuery)" @click="setSearchText(searchQuery)"
>{{ searchQuery }} >{{ searchQuery }}
</gl-deprecated-dropdown-item> </gl-dropdown-item>
<gl-deprecated-dropdown-divider /> <gl-dropdown-divider />
<gl-deprecated-dropdown-item ref="clearRecentSearches" @click="clearRecentSearches" <gl-dropdown-item ref="clearRecentSearches" @click="clearRecentSearches"
>{{ __('Clear recent searches') }} >{{ __('Clear recent searches') }}
</gl-deprecated-dropdown-item> </gl-dropdown-item>
</template> </template>
<div v-else class="px-3">{{ __("You don't have any recent searches") }}</div> <div v-else class="px-3">{{ __("You don't have any recent searches") }}</div>
</gl-deprecated-dropdown> </gl-dropdown>
<div class="filtered-search-input-container flex-fill"> <div class="filtered-search-input-container gl-flex-fill-1">
<gl-form-input <gl-form-input
v-model="errorSearchQuery" v-model="errorSearchQuery"
class="pl-2 filtered-search" class="pl-2 filtered-search"
...@@ -280,49 +280,44 @@ export default { ...@@ -280,49 +280,44 @@ export default {
</div> </div>
</div> </div>
<gl-deprecated-dropdown <gl-dropdown
:text="$options.statusFilters[statusFilter]" :text="$options.statusFilters[statusFilter]"
class="status-dropdown mx-md-1 mb-1 mb-md-0" class="status-dropdown mx-md-1 mb-1 mb-md-0"
menu-class="dropdown"
:disabled="loading" :disabled="loading"
right
> >
<gl-deprecated-dropdown-item <gl-dropdown-item
v-for="(label, status) in $options.statusFilters" v-for="(label, status) in $options.statusFilters"
:key="status" :key="status"
@click="filterErrors(status, label)" @click="filterErrors(status, label)"
> >
<span class="d-flex"> <span class="d-flex">
<gl-icon <gl-icon
class="flex-shrink-0 append-right-4" class="gl-new-dropdown-item-check-icon"
:class="{ invisible: !isCurrentStatusFilter(status) }" :class="{ invisible: !isCurrentStatusFilter(status) }"
name="mobile-issue-close" name="mobile-issue-close"
/> />
{{ label }} {{ label }}
</span> </span>
</gl-deprecated-dropdown-item> </gl-dropdown-item>
</gl-deprecated-dropdown> </gl-dropdown>
<gl-deprecated-dropdown <gl-dropdown :text="$options.sortFields[sortField]" right :disabled="loading">
:text="$options.sortFields[sortField]" <gl-dropdown-item
left
:disabled="loading"
menu-class="dropdown"
>
<gl-deprecated-dropdown-item
v-for="(label, field) in $options.sortFields" v-for="(label, field) in $options.sortFields"
:key="field" :key="field"
@click="sortByField(field)" @click="sortByField(field)"
> >
<span class="d-flex"> <span class="d-flex">
<gl-icon <gl-icon
class="flex-shrink-0 append-right-4" class="gl-new-dropdown-item-check-icon"
:class="{ invisible: !isCurrentSortField(field) }" :class="{ invisible: !isCurrentSortField(field) }"
name="mobile-issue-close" name="mobile-issue-close"
/> />
{{ label }} {{ label }}
</span> </span>
</gl-deprecated-dropdown-item> </gl-dropdown-item>
</gl-deprecated-dropdown> </gl-dropdown>
</div> </div>
<div v-if="loading" class="py-3"> <div v-if="loading" class="py-3">
......
<script> <script>
import { GlDeprecatedDropdown, GlDeprecatedDropdownItem } from '@gitlab/ui'; import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
import { getDisplayName } from '../utils'; import { getDisplayName } from '../utils';
export default { export default {
components: { components: {
GlDeprecatedDropdown, GlDropdown,
GlDeprecatedDropdownItem, GlDropdownItem,
}, },
props: { props: {
dropdownLabel: { dropdownLabel: {
...@@ -52,22 +52,22 @@ export default { ...@@ -52,22 +52,22 @@ export default {
<div :class="{ 'gl-show-field-errors': isProjectInvalid }"> <div :class="{ 'gl-show-field-errors': isProjectInvalid }">
<label class="label-bold" for="project-dropdown">{{ __('Project') }}</label> <label class="label-bold" for="project-dropdown">{{ __('Project') }}</label>
<div class="row"> <div class="row">
<gl-deprecated-dropdown <gl-dropdown
id="project-dropdown" id="project-dropdown"
class="col-8 col-md-9 gl-pr-0" class="col-8 col-md-9 gl-pr-0"
:disabled="!hasProjects" :disabled="!hasProjects"
menu-class="w-100 mw-100" menu-class="w-100 mw-100"
toggle-class="dropdown-menu-toggle w-100 gl-field-error-outline" toggle-class="dropdown-menu-toggle gl-field-error-outline"
:text="dropdownLabel" :text="dropdownLabel"
> >
<gl-deprecated-dropdown-item <gl-dropdown-item
v-for="project in projects" v-for="project in projects"
:key="`${project.organizationSlug}.${project.slug}`" :key="`${project.organizationSlug}.${project.slug}`"
class="w-100" class="w-100"
@click="$emit('select-project', project)" @click="$emit('select-project', project)"
>{{ getDisplayName(project) }}</gl-deprecated-dropdown-item >{{ getDisplayName(project) }}</gl-dropdown-item
> >
</gl-deprecated-dropdown> </gl-dropdown>
</div> </div>
<p v-if="isProjectInvalid" class="js-project-dropdown-error gl-field-error"> <p v-if="isProjectInvalid" class="js-project-dropdown-error gl-field-error">
{{ invalidProjectLabel }} {{ invalidProjectLabel }}
......
...@@ -37,8 +37,6 @@ const restartJobsPolling = () => { ...@@ -37,8 +37,6 @@ const restartJobsPolling = () => {
if (eTagPoll) eTagPoll.restart(); if (eTagPoll) eTagPoll.restart();
}; };
const setFilter = ({ commit }, filter) => commit(types.SET_FILTER, filter);
const setImportTarget = ({ commit }, { repoId, importTarget }) => const setImportTarget = ({ commit }, { repoId, importTarget }) =>
commit(types.SET_IMPORT_TARGET, { repoId, importTarget }); commit(types.SET_IMPORT_TARGET, { repoId, importTarget });
...@@ -172,12 +170,9 @@ const fetchNamespacesFactory = (namespacesPath = isRequired()) => ({ commit }) = ...@@ -172,12 +170,9 @@ const fetchNamespacesFactory = (namespacesPath = isRequired()) => ({ commit }) =
}); });
}; };
const setPage = ({ state, commit, dispatch }, page) => { const setFilter = ({ commit, dispatch }, filter) => {
if (page === state.pageInfo.page) { commit(types.SET_FILTER, filter);
return null;
}
commit(types.SET_PAGE, page);
return dispatch('fetchRepos'); return dispatch('fetchRepos');
}; };
...@@ -188,7 +183,6 @@ export default ({ endpoints = isRequired() }) => ({ ...@@ -188,7 +183,6 @@ export default ({ endpoints = isRequired() }) => ({
setFilter, setFilter,
setImportTarget, setImportTarget,
importAll, importAll,
setPage,
fetchRepos: fetchReposFactory({ reposPath: endpoints.reposPath }), fetchRepos: fetchReposFactory({ reposPath: endpoints.reposPath }),
fetchImport: fetchImportFactory(endpoints.importPath), fetchImport: fetchImportFactory(endpoints.importPath),
fetchJobs: fetchJobsFactory(endpoints.jobsPath), fetchJobs: fetchJobsFactory(endpoints.jobsPath),
......
...@@ -21,35 +21,32 @@ function mountRemoveMemberModal() { ...@@ -21,35 +21,32 @@ function mountRemoveMemberModal() {
}); });
} }
document.addEventListener('DOMContentLoaded', () => { const SHARED_FIELDS = ['account', 'expires', 'maxRole', 'expiration', 'actions'];
groupsSelect(); initGroupMembersApp(
memberExpirationDate(); document.querySelector('.js-group-members-list'),
memberExpirationDate('.js-access-expiration-date-groups'); SHARED_FIELDS.concat(['source', 'granted']),
mountRemoveMemberModal(); memberRequestFormatter,
);
initGroupMembersApp(
document.querySelector('.js-group-linked-list'),
SHARED_FIELDS.concat('granted'),
groupLinkRequestFormatter,
);
initGroupMembersApp(
document.querySelector('.js-group-invited-members-list'),
SHARED_FIELDS.concat('invited'),
memberRequestFormatter,
);
initGroupMembersApp(
document.querySelector('.js-group-access-requests-list'),
SHARED_FIELDS.concat('requested'),
memberRequestFormatter,
);
const SHARED_FIELDS = ['account', 'expires', 'maxRole', 'expiration', 'actions']; groupsSelect();
memberExpirationDate();
memberExpirationDate('.js-access-expiration-date-groups');
mountRemoveMemberModal();
initGroupMembersApp( new Members(); // eslint-disable-line no-new
document.querySelector('.js-group-members-list'), new UsersSelect(); // eslint-disable-line no-new
SHARED_FIELDS.concat(['source', 'granted']),
memberRequestFormatter,
);
initGroupMembersApp(
document.querySelector('.js-group-linked-list'),
SHARED_FIELDS.concat('granted'),
groupLinkRequestFormatter,
);
initGroupMembersApp(
document.querySelector('.js-group-invited-members-list'),
SHARED_FIELDS.concat('invited'),
memberRequestFormatter,
);
initGroupMembersApp(
document.querySelector('.js-group-access-requests-list'),
SHARED_FIELDS.concat('requested'),
memberRequestFormatter,
);
new Members(); // eslint-disable-line no-new
new UsersSelect(); // eslint-disable-line no-new
});
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
<tooltip-on-truncate :title="jobName" truncate-target="child" placement="top"> <tooltip-on-truncate :title="jobName" truncate-target="child" placement="top">
<div <div
:id="jobId" :id="jobId"
class="pipeline-job-pill gl-bg-white gl-text-center gl-text-truncate gl-rounded-pill gl-mb-3 gl-px-5 gl-py-2 gl-relative gl-z-index-1 gl-transition-duration-slow gl-transition-timing-function-ease" class="gl-w-15 gl-bg-white gl-text-center gl-text-truncate gl-rounded-pill gl-mb-3 gl-px-5 gl-py-2 gl-relative gl-z-index-1 gl-transition-duration-slow gl-transition-timing-function-ease"
:class="jobPillClasses" :class="jobPillClasses"
@mouseover="onMouseEnter" @mouseover="onMouseEnter"
@mouseleave="onMouseLeave" @mouseleave="onMouseLeave"
......
...@@ -97,15 +97,20 @@ export default { ...@@ -97,15 +97,20 @@ export default {
this.reportFailure(DRAW_FAILURE); this.reportFailure(DRAW_FAILURE);
} }
}, },
getStageBackgroundClass(index) { getStageBackgroundClasses(index) {
const { length } = this.pipelineData.stages; const { length } = this.pipelineData.stages;
// It's possible for a graph to have only one stage, in which
// case we concatenate both the left and right rounding classes
if (length === 1) { if (length === 1) {
return 'stage-rounded'; return 'gl-rounded-bottom-left-6 gl-rounded-top-left-6 gl-rounded-bottom-right-6 gl-rounded-top-right-6';
} else if (index === 0) { }
return 'stage-left-rounded';
} else if (index === length - 1) { if (index === 0) {
return 'stage-right-rounded'; return 'gl-rounded-bottom-left-6 gl-rounded-top-left-6';
}
if (index === length - 1) {
return 'gl-rounded-bottom-right-6 gl-rounded-top-right-6';
} }
return ''; return '';
...@@ -190,7 +195,8 @@ export default { ...@@ -190,7 +195,8 @@ export default {
> >
<div <div
class="gl-display-flex gl-align-items-center gl-bg-white gl-w-full gl-px-8 gl-py-4 gl-mb-5" class="gl-display-flex gl-align-items-center gl-bg-white gl-w-full gl-px-8 gl-py-4 gl-mb-5"
:class="getStageBackgroundClass(index)" :class="getStageBackgroundClasses(index)"
data-testid="stage-background"
> >
<stage-pill :stage-name="stage.name" :is-empty="stage.groups.length === 0" /> <stage-pill :stage-name="stage.name" :is-empty="stage.groups.length === 0" />
</div> </div>
......
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
<template> <template>
<tooltip-on-truncate :title="stageName" truncate-target="child" placement="top"> <tooltip-on-truncate :title="stageName" truncate-target="child" placement="top">
<div <div
class="gl-px-5 gl-py-2 gl-text-white gl-text-center gl-text-truncate gl-rounded-pill pipeline-stage-pill" class="gl-px-5 gl-py-2 gl-text-white gl-text-center gl-text-truncate gl-rounded-pill gl-w-20"
:class="emptyClass" :class="emptyClass"
> >
{{ stageName }} {{ stageName }}
......
...@@ -137,8 +137,8 @@ export default { ...@@ -137,8 +137,8 @@ export default {
:href="commit.author.webPath" :href="commit.author.webPath"
class="commit-author-link js-user-link" class="commit-author-link js-user-link"
> >
{{ commit.author.name }} {{ commit.author.name }}</gl-link
</gl-link> >
<template v-else> <template v-else>
{{ commit.authorName }} {{ commit.authorName }}
</template> </template>
......
...@@ -486,23 +486,3 @@ ...@@ -486,23 +486,3 @@
.progress-bar.bg-primary { .progress-bar.bg-primary {
background-color: $blue-500 !important; background-color: $blue-500 !important;
} }
.pipeline-stage-pill {
width: 10rem;
}
.pipeline-job-pill {
width: 8rem;
}
.stage-rounded {
border-radius: 2rem;
}
.stage-left-rounded {
border-radius: 2rem 0 0 2rem;
}
.stage-right-rounded {
border-radius: 0 2rem 2rem 0;
}
...@@ -188,6 +188,12 @@ ul.related-merge-requests > li { ...@@ -188,6 +188,12 @@ ul.related-merge-requests > li {
border-width: 1px; border-width: 1px;
line-height: $line-height-base; line-height: $line-height-base;
width: auto; width: auto;
&.disabled {
background-color: $gray-light;
border-color: $gray-100;
color: $gl-text-color-disabled;
}
} }
} }
......
...@@ -132,13 +132,23 @@ class GroupsController < Groups::ApplicationController ...@@ -132,13 +132,23 @@ class GroupsController < Groups::ApplicationController
def update def update
if Groups::UpdateService.new(@group, current_user, group_params).execute if Groups::UpdateService.new(@group, current_user, group_params).execute
redirect_to edit_group_path(@group, anchor: params[:update_section]), notice: "Group '#{@group.name}' was successfully updated." notice = "Group '#{@group.name}' was successfully updated."
redirect_to edit_group_origin_location, notice: notice
else else
@group.reset @group.reset
render action: "edit" render action: "edit"
end end
end end
def edit_group_origin_location
if params.dig(:group, :redirect_target) == 'repository_settings'
group_settings_repository_path(@group, anchor: 'js-default-branch-name')
else
edit_group_path(@group, anchor: params[:update_section])
end
end
def destroy def destroy
Groups::DestroyService.new(@group, current_user).async_execute Groups::DestroyService.new(@group, current_user).async_execute
......
...@@ -48,18 +48,14 @@ class Import::BaseController < ApplicationController ...@@ -48,18 +48,14 @@ class Import::BaseController < ApplicationController
private private
def filter_attribute
:name
end
def sanitized_filter_param def sanitized_filter_param
@filter ||= sanitize(params[:filter]) @filter ||= sanitize(params[:filter])&.downcase
end end
def filtered(collection) def filtered(collection)
return collection unless sanitized_filter_param return collection unless sanitized_filter_param
collection.select { |item| item[filter_attribute].include?(sanitized_filter_param) } collection.select { |item| item[:name].to_s.downcase.include?(sanitized_filter_param) }
end end
def serialized_provider_repos def serialized_provider_repos
......
...@@ -132,8 +132,4 @@ class Import::BitbucketController < Import::BaseController ...@@ -132,8 +132,4 @@ class Import::BitbucketController < Import::BaseController
refresh_token: session[:bitbucket_refresh_token] refresh_token: session[:bitbucket_refresh_token]
} }
end end
def sanitized_filter_param
@filter ||= sanitize(params[:filter])
end
end end
...@@ -170,10 +170,6 @@ class Import::BitbucketServerController < Import::BaseController ...@@ -170,10 +170,6 @@ class Import::BitbucketServerController < Import::BaseController
BitbucketServer::Paginator::PAGE_LENGTH BitbucketServer::Paginator::PAGE_LENGTH
end end
def sanitized_filter_param
sanitize(params[:filter])
end
def bitbucket_connection_error(error) def bitbucket_connection_error(error)
flash[:alert] = _("Unable to connect to server: %{error}") % { error: error } flash[:alert] = _("Unable to connect to server: %{error}") % { error: error }
clear_session_data clear_session_data
......
...@@ -245,14 +245,6 @@ class Import::GithubController < Import::BaseController ...@@ -245,14 +245,6 @@ class Import::GithubController < Import::BaseController
def extra_import_params def extra_import_params
{} {}
end end
def sanitized_filter_param
@filter ||= sanitize(params[:filter])
end
def filter_attribute
:name
end
end end
Import::GithubController.prepend_if_ee('EE::Import::GithubController') Import::GithubController.prepend_if_ee('EE::Import::GithubController')
...@@ -48,6 +48,8 @@ class ApplicationRecord < ActiveRecord::Base ...@@ -48,6 +48,8 @@ class ApplicationRecord < ActiveRecord::Base
def self.safe_find_or_create_by!(*args, &block) def self.safe_find_or_create_by!(*args, &block)
safe_find_or_create_by(*args, &block).tap do |record| safe_find_or_create_by(*args, &block).tap do |record|
raise ActiveRecord::RecordNotFound unless record.present?
record.validate! unless record.persisted? record.validate! unless record.persisted?
end end
end end
......
...@@ -109,6 +109,8 @@ class Group < Namespace ...@@ -109,6 +109,8 @@ class Group < Namespace
.where("project_authorizations.user_id IN (?)", user_ids) .where("project_authorizations.user_id IN (?)", user_ids)
end end
delegate :default_branch_name, to: :namespace_settings
class << self class << self
def sort_by_attribute(method) def sort_by_attribute(method)
if method == 'storage_size_desc' if method == 'storage_size_desc'
...@@ -587,7 +589,7 @@ class Group < Namespace ...@@ -587,7 +589,7 @@ class Group < Namespace
def update_two_factor_requirement def update_two_factor_requirement
return unless saved_change_to_require_two_factor_authentication? || saved_change_to_two_factor_grace_period? return unless saved_change_to_require_two_factor_authentication? || saved_change_to_two_factor_grace_period?
members_with_descendants.find_each(&:update_two_factor_requirement) direct_and_indirect_members.find_each(&:update_two_factor_requirement)
end end
def path_changed_hook def path_changed_hook
......
...@@ -6,10 +6,18 @@ class NamespaceSetting < ApplicationRecord ...@@ -6,10 +6,18 @@ class NamespaceSetting < ApplicationRecord
validate :default_branch_name_content validate :default_branch_name_content
validate :allow_mfa_for_group validate :allow_mfa_for_group
before_validation :normalize_default_branch_name
NAMESPACE_SETTINGS_PARAMS = [:default_branch_name].freeze NAMESPACE_SETTINGS_PARAMS = [:default_branch_name].freeze
self.primary_key = :namespace_id self.primary_key = :namespace_id
private
def normalize_default_branch_name
self.default_branch_name = nil if default_branch_name.blank?
end
def default_branch_name_content def default_branch_name_content
return if default_branch_name.nil? return if default_branch_name.nil?
......
...@@ -163,16 +163,18 @@ module Ci ...@@ -163,16 +163,18 @@ module Ci
end end
def ensure_pending_state def ensure_pending_state
Ci::BuildPendingState.create_or_find_by!( build_state = Ci::BuildPendingState.safe_find_or_create_by(
build_id: build.id, build_id: build.id,
state: params.fetch(:state), state: params.fetch(:state),
trace_checksum: params.fetch(:checksum), trace_checksum: params.fetch(:checksum),
failure_reason: params.dig(:failure_reason) failure_reason: params.dig(:failure_reason)
) )
rescue ActiveRecord::RecordNotFound
metrics.increment_trace_operation(operation: :conflict)
build.pending_state unless build_state.present?
metrics.increment_trace_operation(operation: :conflict)
end
build_state || build.pending_state
end end
## ##
......
...@@ -7,7 +7,7 @@ module Clusters ...@@ -7,7 +7,7 @@ module Clusters
GITLAB_ADMIN_TOKEN_NAME = 'gitlab-token' GITLAB_ADMIN_TOKEN_NAME = 'gitlab-token'
GITLAB_CLUSTER_ROLE_BINDING_NAME = 'gitlab-admin' GITLAB_CLUSTER_ROLE_BINDING_NAME = 'gitlab-admin'
GITLAB_CLUSTER_ROLE_NAME = 'cluster-admin' GITLAB_CLUSTER_ROLE_NAME = 'cluster-admin'
PROJECT_CLUSTER_ROLE_NAME = 'edit' PROJECT_CLUSTER_ROLE_NAME = 'admin'
GITLAB_KNATIVE_SERVING_ROLE_NAME = 'gitlab-knative-serving-role' GITLAB_KNATIVE_SERVING_ROLE_NAME = 'gitlab-knative-serving-role'
GITLAB_KNATIVE_SERVING_ROLE_BINDING_NAME = 'gitlab-knative-serving-rolebinding' GITLAB_KNATIVE_SERVING_ROLE_BINDING_NAME = 'gitlab-knative-serving-rolebinding'
GITLAB_CROSSPLANE_DATABASE_ROLE_NAME = 'gitlab-crossplane-database-role' GITLAB_CROSSPLANE_DATABASE_ROLE_NAME = 'gitlab-crossplane-database-role'
......
...@@ -123,11 +123,9 @@ module Clusters ...@@ -123,11 +123,9 @@ module Clusters
end end
def role_binding_resource def role_binding_resource
role_name = Feature.enabled?(:kubernetes_cluster_namespace_role_admin) ? 'admin' : Clusters::Kubernetes::PROJECT_CLUSTER_ROLE_NAME
Gitlab::Kubernetes::RoleBinding.new( Gitlab::Kubernetes::RoleBinding.new(
name: role_binding_name, name: role_binding_name,
role_name: role_name, role_name: Clusters::Kubernetes::PROJECT_CLUSTER_ROLE_NAME,
role_kind: :ClusterRole, role_kind: :ClusterRole,
namespace: service_account_namespace, namespace: service_account_namespace,
service_account_name: service_account_name service_account_name: service_account_name
......
- breadcrumb_title _("Dashboard") - breadcrumb_title _("Dashboard")
- page_title _("Dashboard") - page_title _("Dashboard")
- billable_users_url = help_page_path('subscriptions/self_managed/index', anchor: 'billable-users')
- billable_users_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer nofollow">'.html_safe % { url: billable_users_url }
- if @notices - if @notices
- @notices.each do |notice| - @notices.each do |notice|
...@@ -22,10 +24,20 @@ ...@@ -22,10 +24,20 @@
= link_to(s_('AdminArea|New project'), new_project_path, class: "btn gl-button btn-success gl-w-full") = link_to(s_('AdminArea|New project'), new_project_path, class: "btn gl-button btn-success gl-w-full")
.col-sm-4 .col-sm-4
.info-well.dark-well .info-well.dark-well
.well-segment.well-centered .well-segment.well-centered.gl-text-center
= link_to admin_users_path do = link_to admin_users_path do
%h3.text-center %h3.gl-display-inline-block.gl-mb-0
= s_('AdminArea|Users: %{number_of_users}') % { number_of_users: approximate_count_with_delimiters(@counts, User) } = s_('AdminArea|Users: %{number_of_users}') % { number_of_users: approximate_count_with_delimiters(@counts, User) }
%span.gl-outline-0.gl-ml-2{ href: "#", tabindex: "0", data: { container: "body",
toggle: "popover",
placement: "top",
html: "true",
trigger: "focus",
content: s_("AdminArea|All users created in the instance, including users who are not %{billable_users_link_start}billable users%{billable_users_link_end}.").html_safe % { billable_users_link_start: billable_users_link_start, billable_users_link_end: '</a>'.html_safe },
} }
= sprite_icon('question', size: 16, css_class: 'gl-text-gray-700 gl-mb-1')
%hr %hr
.btn-group.d-flex{ role: 'group' } .btn-group.d-flex{ role: 'group' }
= link_to s_('AdminArea|New user'), new_admin_user_path, class: "btn gl-button btn-success gl-w-full" = link_to s_('AdminArea|New user'), new_admin_user_path, class: "btn gl-button btn-success gl-w-full"
......
%section.settings.as-default-branch-name.no-animate#js-default-branch-name{ class: ('expanded' if expanded_by_default?) }
.settings-header
%h4
= _('Default initial branch name')
%button.gl-button.js-settings-toggle{ type: 'button' }
= expanded_by_default? ? _('Collapse') : _('Expand')
%p
= _('Set the default name of the initial branch when creating new repositories through the user interface.')
.settings-content
= form_for @group, url: group_path(@group, anchor: 'js-default-branch-name'), html: { class: 'fieldset-form' } do |f|
= form_errors(@group)
- fallback_branch_name = '<code>master</code>'
%fieldset
.form-group
= f.label :default_branch_name, _('Default initial branch name'), class: 'label-light'
= f.text_field :default_branch_name, value: group.namespace_settings&.default_branch_name, placeholder: 'master', class: 'form-control'
%span.form-text.text-muted
= (_("Changes affect new repositories only. If not specified, either the configured application-wide default or Git's default name %{branch_name_default} will be used.") % { branch_name_default: fallback_branch_name }).html_safe
= f.hidden_field :redirect_target, value: "repository_settings"
= f.submit _('Save changes'), class: 'gl-button btn-success'
...@@ -4,3 +4,4 @@ ...@@ -4,3 +4,4 @@
- deploy_token_description = s_('DeployTokens|Group deploy tokens allow access to the packages, repositories, and registry images within the group.') - deploy_token_description = s_('DeployTokens|Group deploy tokens allow access to the packages, repositories, and registry images within the group.')
= render "shared/deploy_tokens/index", group_or_project: @group, description: deploy_token_description = render "shared/deploy_tokens/index", group_or_project: @group, description: deploy_token_description
= render "initial_branch_name", group: @group
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
%a.btn.gl-button.btn-default.float-right.gl-display-block.d-sm-none.gutter-toggle.issuable-gutter-toggle.js-sidebar-toggle{ href: "#" } %a.btn.gl-button.btn-default.float-right.gl-display-block.d-sm-none.gutter-toggle.issuable-gutter-toggle.js-sidebar-toggle{ href: "#" }
= sprite_icon('chevron-double-lg-left') = sprite_icon('chevron-double-lg-left')
- if Feature.enabled?(:vue_issue_header, @project) - if Feature.enabled?(:vue_issue_header, @project) && display_issuable_type == 'issue'
.js-issue-header-actions{ data: issue_header_actions_data(@project, @issue, current_user) } .js-issue-header-actions{ data: issue_header_actions_data(@project, @issue, current_user) }
- else - else
.detail-page-header-actions.js-issuable-actions.js-issuable-buttons{ data: { "action": "close-reopen" } } .detail-page-header-actions.js-issuable-actions.js-issuable-buttons{ data: { "action": "close-reopen" } }
......
---
title: Resolve User stuck in 2FA setup page even if group disable 2FA enforce
merge_request: 46432
author:
type: fixed
---
title: Replace-GlDeprecatedDropdown-with-GlDropdown-in-app/assets/javascripts/error_tracking
merge_request: 41420
author: nuwe1
type: other
---
title: Fix logging handling for API integer params
merge_request: 46551
author:
type: fixed
---
title: Assign new incoming diff lines for renamed files to the correct view type
merge_request: 46823
author:
type: fixed
---
title: Fix linebreak issue in last commit anchor
merge_request: 46643
author:
type: fixed
---
title: Add Default Initial Branch Name for Repositories Group Setting
merge_request: 43290
author:
type: added
---
title: Fix project import search box and make it case insensitive
merge_request: 45783
author:
type: fixed
---
title: Switch to admin clusterRole for GitLab created environment Kubernetes service
account
merge_request: 46417
author:
type: changed
---
title: Fixed create merge request dropdown not re-opening after typing invalid source
branch
merge_request: 46802
author:
type: fixed
---
name: kubernetes_cluster_namespace_role_admin
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45479
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/270030
type: development
group: group::configure
default_enabled: false
...@@ -118,7 +118,7 @@ To disable NFS server delegation, do the following: ...@@ -118,7 +118,7 @@ To disable NFS server delegation, do the following:
1. Restart the NFS server process. For example, on CentOS run `service nfs restart`. 1. Restart the NFS server process. For example, on CentOS run `service nfs restart`.
NOTE: **Important note:** NOTE: **Note:**
The kernel bug may be fixed in The kernel bug may be fixed in
[more recent kernels with this commit](https://github.com/torvalds/linux/commit/95da1b3a5aded124dd1bda1e3cdb876184813140). [more recent kernels with this commit](https://github.com/torvalds/linux/commit/95da1b3a5aded124dd1bda1e3cdb876184813140).
Red Hat Enterprise 7 [shipped a kernel update](https://access.redhat.com/errata/RHSA-2019:2029) Red Hat Enterprise 7 [shipped a kernel update](https://access.redhat.com/errata/RHSA-2019:2029)
......
...@@ -34,7 +34,7 @@ rcli() { ...@@ -34,7 +34,7 @@ rcli() {
# This example works for Omnibus installations of GitLab 7.3 or newer. For an # This example works for Omnibus installations of GitLab 7.3 or newer. For an
# installation from source you will have to change the socket path and the # installation from source you will have to change the socket path and the
# path to redis-cli. # path to redis-cli.
sudo /opt/gitlab/embedded/bin/redis-cli -s /var/opt/gitlab/redis/redis.shared_state.socket "$@" sudo /opt/gitlab/embedded/bin/redis-cli -s /var/opt/gitlab/redis/redis.socket "$@"
} }
# test the new shell function; the response should be PONG # test the new shell function; the response should be PONG
......
...@@ -95,7 +95,6 @@ you want using steps 1 and 2 from the GitLab downloads page. ...@@ -95,7 +95,6 @@ you want using steps 1 and 2 from the GitLab downloads page.
1. Run `gitlab-ctl reconfigure`. 1. Run `gitlab-ctl reconfigure`.
NOTE: **Note:**
You will need to restart the Sidekiq nodes after an update has occurred and database You will need to restart the Sidekiq nodes after an update has occurred and database
migrations performed. migrations performed.
......
...@@ -39,16 +39,15 @@ Feature.disable(:upload_middleware_jwt_params_handler) ...@@ -39,16 +39,15 @@ Feature.disable(:upload_middleware_jwt_params_handler)
## Using local storage ## Using local storage
NOTE: **Note:** This is the default configuration. To change the location where the uploads are
This is the default configuration stored locally, use the steps in this section based on your installation method:
To change the location where the uploads are stored locally, follow the steps
below.
**In Omnibus installations:** **In Omnibus GitLab installations:**
NOTE: **Note:** NOTE: **Note:**
For historical reasons, uploads are stored into a base directory, which by default is `uploads/-/system`. It is strongly discouraged to change this configuration option on an existing GitLab installation. For historical reasons, uploads are stored into a base directory, which by
default is `uploads/-/system`. It's strongly discouraged to change this
configuration option for an existing GitLab installation.
_The uploads are stored by default in `/var/opt/gitlab/gitlab-rails/uploads`._ _The uploads are stored by default in `/var/opt/gitlab/gitlab-rails/uploads`._
...@@ -92,7 +91,6 @@ This configuration relies on valid AWS credentials to be configured already. ...@@ -92,7 +91,6 @@ This configuration relies on valid AWS credentials to be configured already.
[Read more about using object storage with GitLab](object_storage.md). [Read more about using object storage with GitLab](object_storage.md).
NOTE: **Note:**
We recommend using the [consolidated object storage settings](object_storage.md#consolidated-object-storage-configuration). The following instructions apply to the original configuration format. We recommend using the [consolidated object storage settings](object_storage.md#consolidated-object-storage-configuration). The following instructions apply to the original configuration format.
## Object Storage Settings ## Object Storage Settings
...@@ -131,7 +129,6 @@ _The uploads are stored by default in ...@@ -131,7 +129,6 @@ _The uploads are stored by default in
} }
``` ```
NOTE: **Note:**
If you are using AWS IAM profiles, be sure to omit the AWS access key and secret access key/value pairs. If you are using AWS IAM profiles, be sure to omit the AWS access key and secret access key/value pairs.
```ruby ```ruby
......
...@@ -322,6 +322,9 @@ will now trigger a pipeline on the current project's default branch. The maximum ...@@ -322,6 +322,9 @@ will now trigger a pipeline on the current project's default branch. The maximum
number of upstream pipeline subscriptions is 2 by default, for both the upstream and number of upstream pipeline subscriptions is 2 by default, for both the upstream and
downstream projects. This [application limit](../administration/instance_limits.md#number-of-cicd-subscriptions-to-a-project) can be changed on self-managed instances by a GitLab administrator. downstream projects. This [application limit](../administration/instance_limits.md#number-of-cicd-subscriptions-to-a-project) can be changed on self-managed instances by a GitLab administrator.
The upstream project needs to be [public](../public_access/public_access.md) for
pipeline subscription to work.
## Downstream private projects confidentiality concern ## Downstream private projects confidentiality concern
If you trigger a pipeline in a downstream private project, the name of the project If you trigger a pipeline in a downstream private project, the name of the project
......
...@@ -207,6 +207,10 @@ sudo gitlab-rake gitlab:cleanup:sessions:active_sessions_lookup_keys ...@@ -207,6 +207,10 @@ sudo gitlab-rake gitlab:cleanup:sessions:active_sessions_lookup_keys
bundle exec rake gitlab:cleanup:sessions:active_sessions_lookup_keys RAILS_ENV=production bundle exec rake gitlab:cleanup:sessions:active_sessions_lookup_keys RAILS_ENV=production
``` ```
## Cleaning up stale Redis sessions
[Clean up stale sessions](../administration/operations/cleaning_up_redis_sessions.md) to compact the Redis database after you upgrade to GitLab 7.3.
## Container Registry garbage collection ## Container Registry garbage collection
Container Registry can use considerable amounts of disk space. To clear up Container Registry can use considerable amounts of disk space. To clear up
......
...@@ -19,7 +19,6 @@ cd /home/git/gitlab ...@@ -19,7 +19,6 @@ cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:list_repos RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:list_repos RAILS_ENV=production
``` ```
NOTE: **Note:**
The results use the default ordering of the GitLab Rails application. The results use the default ordering of the GitLab Rails application.
## Limit search results ## Limit search results
......
...@@ -32,7 +32,6 @@ sudo gitlab-rake gitlab:import:all_users_to_all_projects ...@@ -32,7 +32,6 @@ sudo gitlab-rake gitlab:import:all_users_to_all_projects
bundle exec rake gitlab:import:all_users_to_all_projects RAILS_ENV=production bundle exec rake gitlab:import:all_users_to_all_projects RAILS_ENV=production
``` ```
NOTE: **Note:**
Admin users are added as maintainers. Admin users are added as maintainers.
## Add user as a developer to all groups ## Add user as a developer to all groups
...@@ -59,7 +58,6 @@ sudo gitlab-rake gitlab:import:all_users_to_all_groups ...@@ -59,7 +58,6 @@ sudo gitlab-rake gitlab:import:all_users_to_all_groups
bundle exec rake gitlab:import:all_users_to_all_groups RAILS_ENV=production bundle exec rake gitlab:import:all_users_to_all_groups RAILS_ENV=production
``` ```
NOTE: **Note:**
Admin users are added as owners so they can add additional users to the group. Admin users are added as owners so they can add additional users to the group.
## Control the number of active users ## Control the number of active users
......
...@@ -74,7 +74,6 @@ Docker image based on based on the `ruby:alpine` instead of the default `ruby:la ...@@ -74,7 +74,6 @@ Docker image based on based on the `ruby:alpine` instead of the default `ruby:la
# ... put your stuff here # ... put your stuff here
``` ```
NOTE: **Note:**
Use Base64 encoding if you need to pass complex values, such as newlines and Use Base64 encoding if you need to pass complex values, such as newlines and
spaces. Left unencoded, complex values like these can cause escaping issues spaces. Left unencoded, complex values like these can cause escaping issues
due to how Auto DevOps uses the arguments. due to how Auto DevOps uses the arguments.
...@@ -123,7 +122,6 @@ to `CI_COMMIT_SHA,CI_ENVIRONMENT_NAME`. ...@@ -123,7 +122,6 @@ to `CI_COMMIT_SHA,CI_ENVIRONMENT_NAME`.
RUN --mount=type=secret,id=auto-devops-build-secrets . /run/secrets/auto-devops-build-secrets && $COMMAND RUN --mount=type=secret,id=auto-devops-build-secrets . /run/secrets/auto-devops-build-secrets && $COMMAND
``` ```
NOTE: **Note:**
When `AUTO_DEVOPS_BUILD_IMAGE_FORWARDED_CI_VARIABLES` is set, Auto DevOps When `AUTO_DEVOPS_BUILD_IMAGE_FORWARDED_CI_VARIABLES` is set, Auto DevOps
enables the experimental [Docker BuildKit](https://docs.docker.com/develop/develop-images/build_enhancements/) enables the experimental [Docker BuildKit](https://docs.docker.com/develop/develop-images/build_enhancements/)
feature to use the `--secret` flag. feature to use the `--secret` flag.
...@@ -453,7 +451,6 @@ the updated secrets. To update the secrets, either: ...@@ -453,7 +451,6 @@ the updated secrets. To update the secrets, either:
- Manually delete running pods to cause Kubernetes to create new pods with updated - Manually delete running pods to cause Kubernetes to create new pods with updated
secrets. secrets.
NOTE: **Note:**
Variables with multi-line values are not currently supported due to Variables with multi-line values are not currently supported due to
limitations with the current Auto DevOps scripting environment. limitations with the current Auto DevOps scripting environment.
......
...@@ -114,7 +114,6 @@ In this guide, we will install Ingress and Prometheus: ...@@ -114,7 +114,6 @@ In this guide, we will install Ingress and Prometheus:
- Prometheus - An open-source monitoring and alerting system used to supervise the - Prometheus - An open-source monitoring and alerting system used to supervise the
deployed application. deployed application.
NOTE: **Note:**
We won't install GitLab Runner in this quick start guide, as this guide uses the We won't install GitLab Runner in this quick start guide, as this guide uses the
shared runners provided by GitLab.com. shared runners provided by GitLab.com.
...@@ -161,7 +160,8 @@ The jobs are separated into stages: ...@@ -161,7 +160,8 @@ The jobs are separated into stages:
- **Build** - The application builds a Docker image and uploads it to your project's - **Build** - The application builds a Docker image and uploads it to your project's
[Container Registry](../../user/packages/container_registry/index.md) ([Auto Build](stages.md#auto-build)). [Container Registry](../../user/packages/container_registry/index.md) ([Auto Build](stages.md#auto-build)).
- **Test** - GitLab runs various checks on the application: - **Test** - GitLab runs various checks on the application, but all jobs except `test`
are allowed to fail in the test stage:
- The `test` job runs unit and integration tests by detecting the language and - The `test` job runs unit and integration tests by detecting the language and
framework ([Auto Test](stages.md#auto-test)) framework ([Auto Test](stages.md#auto-test))
...@@ -179,9 +179,6 @@ The jobs are separated into stages: ...@@ -179,9 +179,6 @@ The jobs are separated into stages:
licenses and is allowed to fail licenses and is allowed to fail
([Auto License Compliance](stages.md#auto-license-compliance)) **(ULTIMATE)** ([Auto License Compliance](stages.md#auto-license-compliance)) **(ULTIMATE)**
NOTE: **Note:**
All jobs except `test` are allowed to fail in the test stage.
- **Review** - Pipelines on `master` include this stage with a `dast_environment_deploy` job. - **Review** - Pipelines on `master` include this stage with a `dast_environment_deploy` job.
To learn more, see [Dynamic Application Security Testing (DAST)](../../user/application_security/dast/index.md). To learn more, see [Dynamic Application Security Testing (DAST)](../../user/application_security/dast/index.md).
......
...@@ -126,11 +126,9 @@ When you trigger a pipeline, if you have Auto DevOps enabled and if you have cor ...@@ -126,11 +126,9 @@ When you trigger a pipeline, if you have Auto DevOps enabled and if you have cor
[entered AWS credentials as environment variables](../../ci/cloud_deployment/index.md#deploy-your-application-to-the-aws-elastic-container-service-ecs), [entered AWS credentials as environment variables](../../ci/cloud_deployment/index.md#deploy-your-application-to-the-aws-elastic-container-service-ecs),
your application will be deployed to AWS ECS. your application will be deployed to AWS ECS.
NOTE: **Note:**
[GitLab Managed Apps](../../user/clusters/applications.md) are not available when deploying to AWS ECS. [GitLab Managed Apps](../../user/clusters/applications.md) are not available when deploying to AWS ECS.
You must manually configure your application (such as Ingress or Help) on AWS ECS. You must manually configure your application (such as Ingress or Help) on AWS ECS.
NOTE: **Note:**
If you have both a valid `AUTO_DEVOPS_PLATFORM_TARGET` variable and a Kubernetes cluster tied to your project, If you have both a valid `AUTO_DEVOPS_PLATFORM_TARGET` variable and a Kubernetes cluster tied to your project,
only the deployment to Kubernetes will run. only the deployment to Kubernetes will run.
......
...@@ -114,8 +114,11 @@ See the documentation on [File Locking](../../../user/project/file_lock.md). ...@@ -114,8 +114,11 @@ See the documentation on [File Locking](../../../user/project/file_lock.md).
## LFS objects in project archives ## LFS objects in project archives
> - Support for including Git LFS blobs inside [project source downloads](../../../user/project/repository/index.md) was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/15079) in GitLab 13.5. > - Support for including Git LFS blobs inside [project source downloads](../../../user/project/repository/index.md) was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/15079) in GitLab 13.5.
> - It's [deployed behind a feature flag](../../../user/feature_flags.md), disabled by default. > - It was [deployed behind a feature flag](../../../user/feature_flags.md), disabled by default.
> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-or-disable-lfs-objects-in-project-archives). **(CORE ONLY)** > - [Became enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/268409) on GitLab 13.6.
> - It's enabled on GitLab.com.
> - It's recommended for production use.
> - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#enable-or-disable-lfs-objects-in-project-archives).
CAUTION: **Warning:** CAUTION: **Warning:**
This feature might not be available to you. Check the **version history** note above for details. This feature might not be available to you. Check the **version history** note above for details.
...@@ -139,10 +142,10 @@ Technical details about how this works can be found in the [development document ...@@ -139,10 +142,10 @@ Technical details about how this works can be found in the [development document
### Enable or disable LFS objects in project archives ### Enable or disable LFS objects in project archives
_LFS objects in project archives_ is under development and not ready for production use. It is _LFS objects in project archives_ is under development but ready for production use.
deployed behind a feature flag that is **disabled by default**. It is deployed behind a feature flag that is **enabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md) [GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md)
can enable it. can opt to disable it.
To enable it: To enable it:
......
...@@ -7,7 +7,7 @@ type: reference, howto ...@@ -7,7 +7,7 @@ type: reference, howto
# Migration guide from Git Annex to Git LFS # Migration guide from Git Annex to Git LFS
NOTE: **Note:** DANGER: **Deprecated:**
Git Annex support [has been removed](https://gitlab.com/gitlab-org/gitlab/-/issues/1648) in GitLab Enterprise Git Annex support [has been removed](https://gitlab.com/gitlab-org/gitlab/-/issues/1648) in GitLab Enterprise
Edition 9.0 (2017/03/22). Edition 9.0 (2017/03/22).
...@@ -37,7 +37,6 @@ ones that GitLab developed. ...@@ -37,7 +37,6 @@ ones that GitLab developed.
## Migration steps ## Migration steps
NOTE: **Note:**
Since Git Annex files are stored in a sub-directory of the normal repositories Since Git Annex files are stored in a sub-directory of the normal repositories
(`.git/annex/objects`) and LFS files are stored outside of the repositories, (`.git/annex/objects`) and LFS files are stored outside of the repositories,
they are not compatible as they are using a different scheme. Therefore, the they are not compatible as they are using a different scheme. Therefore, the
......
...@@ -13,9 +13,7 @@ instance entirely offline. ...@@ -13,9 +13,7 @@ instance entirely offline.
NOTE: **Note:** NOTE: **Note:**
This guide assumes the server is Ubuntu 18.04. Instructions for other servers may vary. This guide assumes the server is Ubuntu 18.04. Instructions for other servers may vary.
This guide also assumes the server host resolves as `my-host`, which you should replace with your
NOTE: **Note:**
This guide assumes the server host resolves as `my-host`, which you should replace with your
server's name. server's name.
Follow the installation instructions [as outlined in the omnibus install Follow the installation instructions [as outlined in the omnibus install
......
...@@ -62,12 +62,12 @@ For more details, please refer to our [full architecture documentation](https:// ...@@ -62,12 +62,12 @@ For more details, please refer to our [full architecture documentation](https://
The setup process involves a few steps to enable GitOps deployments: The setup process involves a few steps to enable GitOps deployments:
1. Installing the Agent server. This must be done one time for every GitLab installation. 1. [Install the Agent server](#install-the-kubernetes-agent-server).
1. Defining a configuration directory. 1. [Define a configuration directory](#define-a-configuration-repository).
1. Creating an Agent record in GitLab. 1. [Create an Agent record in GitLab](#create-an-agent-record-in-gitlab).
1. Generating and copying a Secret token used to connect to the Agent. 1. [Generate and copy a Secret token used to connect to the Agent](#create-the-kubernetes-secret).
1. Installing the Agent into the cluster. 1. [Install the Agent into the cluster](#install-the-agent-into-the-cluster).
1. Creating a `manifest.yaml`. 1. [Create a `manifest.yaml`](#create-a-manifestyaml).
### Upgrades and version compatibility ### Upgrades and version compatibility
...@@ -100,9 +100,9 @@ When using the [Omnibus GitLab](https://docs.gitlab.com/omnibus/) package: ...@@ -100,9 +100,9 @@ When using the [Omnibus GitLab](https://docs.gitlab.com/omnibus/) package:
1. Edit `/etc/gitlab/gitlab.rb`: 1. Edit `/etc/gitlab/gitlab.rb`:
```plaintext ```plaintext
gitlab_kas['enable'] = true gitlab_kas['enable'] = true
``` ```
1. [Reconfigure GitLab](../../../administration/restart_gitlab.md#omnibus-gitlab-reconfigure). 1. [Reconfigure GitLab](../../../administration/restart_gitlab.md#omnibus-gitlab-reconfigure).
...@@ -124,6 +124,17 @@ helm upgrade --install gitlab gitlab/gitlab \ ...@@ -124,6 +124,17 @@ helm upgrade --install gitlab gitlab/gitlab \
--set global.kas.enabled=true --set global.kas.enabled=true
``` ```
To specify other options related to the KAS sub-chart, create a `gitlab.kas` sub-section
of your `values.yaml` file:
```shell
gitlab:
kas:
# put your KAS custom options here
```
For details, read [Using the GitLab-KAS chart](https://docs.gitlab.com/charts/charts/gitlab/kas/).
### Define a configuration repository ### Define a configuration repository
Next, you need a GitLab repository to contain your Agent configuration. The minimal Next, you need a GitLab repository to contain your Agent configuration. The minimal
...@@ -133,12 +144,14 @@ repository layout looks like this: ...@@ -133,12 +144,14 @@ repository layout looks like this:
.gitlab/agents/<agent-name>/config.yaml .gitlab/agents/<agent-name>/config.yaml
``` ```
The `config.yaml` file contents should look like this: Your `config.yaml` file can specify multiple manifest projects in the
section `manifest_projects`:
```yaml ```yaml
gitops: gitops:
manifest_projects: manifest_projects:
- id: "path-to/your-awesome-project" - id: "path-to/your-manifest-project-number1"
...
``` ```
### Create an Agent record in GitLab ### Create an Agent record in GitLab
...@@ -147,20 +160,24 @@ Next, create an GitLab Rails Agent record so the Agent can associate itself with ...@@ -147,20 +160,24 @@ Next, create an GitLab Rails Agent record so the Agent can associate itself with
the configuration repository project. Creating this record also creates a Secret needed to configure the configuration repository project. Creating this record also creates a Secret needed to configure
the Agent in subsequent steps. You can create an Agent record either: the Agent in subsequent steps. You can create an Agent record either:
- Through the Rails console, by running `rails c`: - Through the Rails console:
```ruby ```ruby
project = ::Project.find_by_full_path("path-to/your-awesome-project") project = ::Project.find_by_full_path("path-to/your-configuration-project")
# agent-name should be the same as specified above in the config.yaml
agent = ::Clusters::Agent.create(name: "<agent-name>", project: project) agent = ::Clusters::Agent.create(name: "<agent-name>", project: project)
token = ::Clusters::AgentToken.create(agent: agent) token = ::Clusters::AgentToken.create(agent: agent)
token.token # this will print out the token you need to use on the next step token.token # this will print out the token you need to use on the next step
``` ```
For full details, read [Starting a Rails console session](../../../administration/operations/rails_console.md#starting-a-rails-console-session).
- Through GraphQL: **(PREMIUM ONLY)** - Through GraphQL: **(PREMIUM ONLY)**
```graphql ```graphql
mutation createAgent { mutation createAgent {
createClusterAgent(input: { projectPath: "path-to/your-awesome-project", name: "<agent-name>" }) { # agent-name should be the same as specified above in the config.yaml
createClusterAgent(input: { projectPath: "path-to/your-configuration-project", name: "<agent-name>" }) {
clusterAgent { clusterAgent {
id id
name name
...@@ -182,7 +199,7 @@ the Agent in subsequent steps. You can create an Agent record either: ...@@ -182,7 +199,7 @@ the Agent in subsequent steps. You can create an Agent record either:
``` ```
NOTE: **Note:** NOTE: **Note:**
GraphQL only displays the token once, after creating it. GraphQL only displays the token one time after creating it.
If you are new to using the GitLab GraphQL API, refer to the If you are new to using the GitLab GraphQL API, refer to the
[Getting started with the GraphQL API page](../../../api/graphql/getting_started.md), [Getting started with the GraphQL API page](../../../api/graphql/getting_started.md),
...@@ -192,7 +209,7 @@ the Agent in subsequent steps. You can create an Agent record either: ...@@ -192,7 +209,7 @@ the Agent in subsequent steps. You can create an Agent record either:
After generating the token, you must apply it to the Kubernetes cluster. After generating the token, you must apply it to the Kubernetes cluster.
1. If you haven't previous defined or created a namespace, run the following command: 1. If you haven't previously defined or created a namespace, run the following command:
```shell ```shell
kubectl create namespace <YOUR-DESIRED-NAMESPACE> kubectl create namespace <YOUR-DESIRED-NAMESPACE>
...@@ -210,43 +227,40 @@ Next, install the in-cluster component of the Agent. This example file contains ...@@ -210,43 +227,40 @@ Next, install the in-cluster component of the Agent. This example file contains
Kubernetes resources required for the Agent to be installed. You can modify this Kubernetes resources required for the Agent to be installed. You can modify this
example [`resources.yml` file](#example-resourcesyml-file) in the following ways: example [`resources.yml` file](#example-resourcesyml-file) in the following ways:
- You can replace `gitlab-agent` with `<YOUR-DESIRED-NAMESPACE>`. - Replace `namespace: gitlab-agent` with `namespace: <YOUR-DESIRED-NAMESPACE>`.
- For the `kas-address` (Kubernetes Agent Server), the agent can use the WebSockets - You can configure `kas-address` (Kubernetes Agent Server) in several ways.
or gRPC protocols to connect to the Agent Server. Depending on your cluster The agent can use the WebSockets or gRPC protocols to connect to the Agent Server.
configuration and GitLab architecture, you may need to use one or the other. Select the option appropriate for your cluster configuration and GitLab architecture:
For the `gitlab-kas` Helm chart, an Ingress is created for the Agent Server using - The `wss` scheme (an encrypted WebSockets connection) is specified by default
the `/-/kubernetes-agent` endpoint. This can be used for the WebSockets protocol connection. after you install `gitlab-kas` sub-chart or enable `kas` for Omnibus GitLab.
- Specify the `grpc` scheme (such as `grpc://gitlab-kas:5005`) to use gRPC directly. In this case, you must set `wss://GitLab.host.tld:443/-/kubernetes-agent` as
Encrypted gRPC is not supported yet. Follow the `kas-address`, where `GitLab.host.tld` is your GitLab hostname.
- Specify the `ws` scheme (such as `ws://GitLab.host.tld:80/-/kubernetes-agent`)
to use an unencrypted WebSockets connection.
- Specify the `grpc` scheme if both Agent and Server are installed in one cluster.
In this case, you may specify `kas-address` value as
`grpc://gitlab-kas.<your-namespace>:5005`) to use gRPC directly, where `gitlab-kas`
is the name of the service created by `gitlab-kas` chart, and `your-namespace`
is the namespace where the chart was installed. Encrypted gRPC is not supported yet.
Follow the
[Support TLS for gRPC communication issue](https://gitlab.com/gitlab-org/cluster-integration/gitlab-agent/-/issues/7) [Support TLS for gRPC communication issue](https://gitlab.com/gitlab-org/cluster-integration/gitlab-agent/-/issues/7)
for progress updates. for progress updates.
- Specify the `ws` scheme (such as `ws://gitlab-kas-ingress:80/-/kubernetes-agent`) - If you defined your own secret name, replace `gitlab-agent-token` with your
to use an unencrypted WebSockets connection. secret name in the `secretName:` section.
- Specify the `wss` scheme (such as `wss://gitlab-kas-ingress:443/-/kubernetes-agent`)
to use an encrypted WebSockets connection. This is the recommended option if
installing the Agent into a separate cluster from your Agent Server.
- If you defined your own secret name, replace `gitlab-agent-token` with your secret name.
To apply this file, run the following command: To apply this file, run the following command:
```shell ```shell
kubectl apply -n gitlab-agent -f ./resources.yml kubectl apply -n <YOUR-DESIRED-NAMESPACE> -f ./resources.yml
``` ```
To review your configuration, run the following command: To review your configuration, run the following command:
```shell ```shell
$ kubectl get pods --all-namespaces $ kubectl get pods -n <YOUR-DESIRED-NAMESPACE>
NAMESPACE NAME READY STATUS RESTARTS AGE NAMESPACE NAME READY STATUS RESTARTS AGE
gitlab-agent gitlab-agent-77689f7dcb-5skqk 1/1 Running 0 51s gitlab-agent gitlab-agent-77689f7dcb-5skqk 1/1 Running 0 51s
kube-system coredns-f9fd979d6-n6wcw 1/1 Running 0 14m
kube-system etcd-minikube 1/1 Running 0 14m
kube-system kube-apiserver-minikube 1/1 Running 0 14m
kube-system kube-controller-manager-minikube 1/1 Running 0 14m
kube-system kube-proxy-j6zdh 1/1 Running 0 14m
kube-system kube-scheduler-minikube 1/1 Running 0 14m
kube-system storage-provisioner 1/1 Running 0 14m
``` ```
#### Example `resources.yml` file #### Example `resources.yml` file
...@@ -278,7 +292,7 @@ spec: ...@@ -278,7 +292,7 @@ spec:
args: args:
- --token-file=/config/token - --token-file=/config/token
- --kas-address - --kas-address
- grpc://host.docker.internal:5005 # {"$openapi":"kas-address"} - wss://gitlab.host.tld:443/-/kubernetes-agent
volumeMounts: volumeMounts:
- name: token-volume - name: token-volume
mountPath: /config mountPath: /config
...@@ -353,7 +367,9 @@ subjects: ...@@ -353,7 +367,9 @@ subjects:
In a previous step, you configured a `config.yaml` to point to the GitLab projects In a previous step, you configured a `config.yaml` to point to the GitLab projects
the Agent should synchronize. In each of those projects, you must create a `manifest.yaml` the Agent should synchronize. In each of those projects, you must create a `manifest.yaml`
file for the Agent to monitor. You can auto-generate this `manifest.yaml` with a file for the Agent to monitor. You can auto-generate this `manifest.yaml` with a
templating engine or other means. templating engine or other means. Only public projects are supported as
manifest projects. Support for private projects is planned in the issue
[Agent authorization for private manifest projects](https://gitlab.com/gitlab-org/gitlab/-/issues/220912).
Each time you commit and push a change to this file, the Agent logs the change: Each time you commit and push a change to this file, the Agent logs the change:
...@@ -363,7 +379,7 @@ Each time you commit and push a change to this file, the Agent logs the change: ...@@ -363,7 +379,7 @@ Each time you commit and push a change to this file, the Agent logs the change:
#### Example `manifest.yaml` file #### Example `manifest.yaml` file
This file creates a simple NGINX deployment. This file creates an NGINX deployment.
```yaml ```yaml
apiVersion: apps/v1 apiVersion: apps/v1
......
...@@ -518,6 +518,23 @@ If you want to retain ownership over the original namespace and ...@@ -518,6 +518,23 @@ If you want to retain ownership over the original namespace and
protect the URL redirects, then instead of changing a group's path or renaming a protect the URL redirects, then instead of changing a group's path or renaming a
username, you can create a new group and transfer projects to it. username, you can create a new group and transfer projects to it.
### Group repository settings
You can change settings that are specific to repositories in your group.
#### Custom initial branch name **(CORE ONLY)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/43290) in GitLab 13.6.
By default, when you create a new project in GitLab, the initial branch is called `master`.
For groups, a group administrator can customize the initial branch name to something
else. This way, every new project created under that group from then on will start from the custom branch name rather than `master`. To do so:
1. Go to the **Group page > Settings > Repository** and expand **Default initial
branch name**.
1. Change the default initial branch to a custom name of your choice.
1. **Save Changes**.
### Remove a group ### Remove a group
To remove a group and its contents: To remove a group and its contents:
......
...@@ -94,7 +94,11 @@ GitLab creates the following resources for RBAC clusters. ...@@ -94,7 +94,11 @@ GitLab creates the following resources for RBAC clusters.
| Environment namespace | `Namespace` | Contains all environment-specific resources | Deploying to a cluster | | Environment namespace | `Namespace` | Contains all environment-specific resources | Deploying to a cluster |
| Environment namespace | `ServiceAccount` | Uses namespace of environment | Deploying to a cluster | | Environment namespace | `ServiceAccount` | Uses namespace of environment | Deploying to a cluster |
| Environment namespace | `Secret` | Token for environment ServiceAccount | Deploying to a cluster | | Environment namespace | `Secret` | Token for environment ServiceAccount | Deploying to a cluster |
| Environment namespace | `RoleBinding` | [`edit`](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) roleRef | Deploying to a cluster | | Environment namespace | `RoleBinding` | [`admin`](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) roleRef | Deploying to a cluster |
The environment namespace `RoleBinding` was
[updated](https://gitlab.com/gitlab-org/gitlab/-/issues/31113) in GitLab 13.6
to `admin` roleRef. Previously, the `edit` roleRef was used.
### ABAC cluster resources ### ABAC cluster resources
......
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import { GlCard, GlEmptyState, GlSkeletonLoader, GlTable } from '@gitlab/ui'; import { GlCard, GlEmptyState, GlLink, GlSkeletonLoader, GlTable } from '@gitlab/ui';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
import { joinPaths } from '~/lib/utils/url_utility';
import { SUPPORTED_FORMATS, getFormatter } from '~/lib/utils/unit_format'; import { SUPPORTED_FORMATS, getFormatter } from '~/lib/utils/unit_format';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import SelectProjectsDropdown from './select_projects_dropdown.vue'; import SelectProjectsDropdown from './select_projects_dropdown.vue';
...@@ -12,6 +13,7 @@ export default { ...@@ -12,6 +13,7 @@ export default {
components: { components: {
GlCard, GlCard,
GlEmptyState, GlEmptyState,
GlLink,
GlSkeletonLoader, GlSkeletonLoader,
GlTable, GlTable,
SelectProjectsDropdown, SelectProjectsDropdown,
...@@ -31,12 +33,16 @@ export default { ...@@ -31,12 +33,16 @@ export default {
// fetch the same data more than once // fetch the same data more than once
this.allCoverageData = [ this.allCoverageData = [
...this.allCoverageData, ...this.allCoverageData,
...data.projects.nodes.map(project => ({ // Remove the projects that don't have any code coverage
...project, ...data.projects.nodes
// if a project has no code coverage, set to default values .filter(({ codeCoverageSummary }) => Boolean(codeCoverageSummary))
codeCoverageSummary: .map(project => ({
project.codeCoverageSummary || this.$options.noCoverageDefaultSummary, ...project,
})), codeCoveragePath: joinPaths(
gon.relative_url_root || '',
`/${project.fullPath}/-/graphs/${project.repository.rootRef}/charts`,
),
})),
]; ];
}, },
error() { error() {
...@@ -76,6 +82,17 @@ export default { ...@@ -76,6 +82,17 @@ export default {
selectedCoverageData() { selectedCoverageData() {
return this.allCoverageData.filter(({ id }) => this.projectIds[id]); return this.allCoverageData.filter(({ id }) => this.projectIds[id]);
}, },
sortedCoverageData() {
// Sort the table by most recently updated coverage report
return [...this.selectedCoverageData].sort((a, b) => {
if (a.codeCoverageSummary.lastUpdatedAt > b.codeCoverageSummary.lastUpdatedAt) {
return -1;
} else if (a.codeCoverageSummary.lastUpdatedAt < b.codeCoverageSummary.lastUpdatedAt) {
return 1;
}
return 0;
});
},
}, },
methods: { methods: {
handleError() { handleError() {
...@@ -127,11 +144,6 @@ export default { ...@@ -127,11 +144,6 @@ export default {
'RepositoriesAnalytics|Please select a project or multiple projects to display their most recent test coverage data.', 'RepositoriesAnalytics|Please select a project or multiple projects to display their most recent test coverage data.',
), ),
}, },
noCoverageDefaultSummary: {
averageCoverage: 0,
coverageCount: 0,
lastUpdatedAt: '', // empty string will default to "just now" in table
},
LOADING_STATE: { LOADING_STATE: {
rows: 4, rows: 4,
height: 10, height: 10,
...@@ -183,7 +195,7 @@ export default { ...@@ -183,7 +195,7 @@ export default {
data-testid="test-coverage-data-table" data-testid="test-coverage-data-table"
thead-class="thead-white" thead-class="thead-white"
:fields="$options.tableFields" :fields="$options.tableFields"
:items="selectedCoverageData" :items="sortedCoverageData"
> >
<template #head(project)="data"> <template #head(project)="data">
<div>{{ data.label }}</div> <div>{{ data.label }}</div>
...@@ -199,7 +211,9 @@ export default { ...@@ -199,7 +211,9 @@ export default {
</template> </template>
<template #cell(project)="{ item }"> <template #cell(project)="{ item }">
<div :data-testid="`${item.id}-name`">{{ item.name }}</div> <gl-link target="_blank" :href="item.codeCoveragePath" :data-testid="`${item.id}-name`">
{{ item.name }}
</gl-link>
</template> </template>
<template #cell(averageCoverage)="{ item }"> <template #cell(averageCoverage)="{ item }">
<div :data-testid="`${item.id}-average`"> <div :data-testid="`${item.id}-average`">
......
query getProjectsTestCoverage($projectIds: [ID!]) { query getProjectsTestCoverage($projectIds: [ID!]) {
projects(ids: $projectIds) { projects(ids: $projectIds) {
nodes { nodes {
fullPath
id id
name name
repository {
rootRef
}
codeCoverageSummary { codeCoverageSummary {
averageCoverage averageCoverage
coverageCount coverageCount
......
...@@ -12,6 +12,7 @@ import { ...@@ -12,6 +12,7 @@ import {
GlFormCheckbox, GlFormCheckbox,
GlFormRadioGroup, GlFormRadioGroup,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { initFormField } from 'ee/security_configuration/utils';
import * as Sentry from '~/sentry/wrapper'; import * as Sentry from '~/sentry/wrapper';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
import { redirectTo } from '~/lib/utils/url_utility'; import { redirectTo } from '~/lib/utils/url_utility';
...@@ -21,13 +22,6 @@ import dastScannerProfileUpdateMutation from '../graphql/dast_scanner_profile_up ...@@ -21,13 +22,6 @@ import dastScannerProfileUpdateMutation from '../graphql/dast_scanner_profile_up
import tooltipIcon from './tooltip_icon.vue'; import tooltipIcon from './tooltip_icon.vue';
import { SCAN_TYPE, SCAN_TYPE_OPTIONS } from '../constants'; import { SCAN_TYPE, SCAN_TYPE_OPTIONS } from '../constants';
const initField = (value, isRequired = true) => ({
value,
required: isRequired,
state: null,
feedback: null,
});
const SPIDER_TIMEOUT_MIN = 0; const SPIDER_TIMEOUT_MIN = 0;
const SPIDER_TIMEOUT_MAX = 2880; const SPIDER_TIMEOUT_MAX = 2880;
const TARGET_TIMEOUT_MIN = 1; const TARGET_TIMEOUT_MIN = 1;
...@@ -74,12 +68,12 @@ export default { ...@@ -74,12 +68,12 @@ export default {
} = this.profile; } = this.profile;
const form = { const form = {
profileName: initField(name), profileName: initFormField({ value: name }),
spiderTimeout: initField(spiderTimeout), spiderTimeout: initFormField({ value: spiderTimeout }),
targetTimeout: initField(targetTimeout), targetTimeout: initFormField({ value: targetTimeout }),
scanType: initField(scanType), scanType: initFormField({ value: scanType }),
useAjaxSpider: initField(useAjaxSpider), useAjaxSpider: initFormField({ value: useAjaxSpider }),
showDebugMessages: initField(showDebugMessages), showDebugMessages: initFormField({ value: showDebugMessages }),
}; };
return { return {
......
<script>
import { GlFormGroup, GlFormInput, GlFormCheckbox } from '@gitlab/ui';
import { initFormField } from 'ee/security_configuration/utils';
import validation from '~/vue_shared/directives/validation';
export default {
components: {
GlFormGroup,
GlFormInput,
GlFormCheckbox,
},
directives: {
validation: validation(),
},
props: {
fields: {
type: Object,
required: false,
default: () => ({}),
},
showValidation: {
type: Boolean,
required: false,
default: false,
},
},
data() {
const {
authEnabled,
authenticationUrl,
userName,
password,
// default to commonly used names for `userName` and `password` fields in authentcation forms
userNameFormField = 'username',
passwordFormField = 'password',
} = this.fields;
return {
form: {
state: false,
fields: {
authEnabled: initFormField({ value: authEnabled, skipValidation: true }),
authenticationUrl: initFormField({ value: authenticationUrl }),
userName: initFormField({ value: userName }),
password: initFormField({ value: password }),
userNameFormField: initFormField({ value: userNameFormField }),
passwordFormField: initFormField({ value: passwordFormField }),
},
},
};
},
computed: {
showValidationOrInEditMode() {
return this.showValidation || Object.keys(this.fields).length > 0;
},
},
watch: {
form: { handler: 'emitUpdate', immediate: true, deep: true },
},
methods: {
emitUpdate() {
this.$emit('input', this.form);
},
},
};
</script>
<template>
<section>
<gl-form-group :label="s__('DastProfiles|Authentication')">
<gl-form-checkbox v-model="form.fields.authEnabled.value">{{
s__('DastProfiles|Enable Authentication')
}}</gl-form-checkbox>
</gl-form-group>
<div v-if="form.fields.authEnabled.value" data-testid="auth-form">
<div class="row">
<gl-form-group
:label="s__('DastProfiles|Authentication URL')"
:invalid-feedback="form.fields.authenticationUrl.feedback"
class="col-md-6"
>
<gl-form-input
v-model="form.fields.authenticationUrl.value"
v-validation:[showValidationOrInEditMode]
name="authenticationUrl"
type="url"
required
:state="form.fields.authenticationUrl.state"
/>
</gl-form-group>
</div>
<div class="row">
<gl-form-group
:label="s__('DastProfiles|Username')"
:invalid-feedback="form.fields.userName.feedback"
class="col-md-6"
>
<gl-form-input
v-model="form.fields.userName.value"
v-validation:[showValidationOrInEditMode]
autocomplete="off"
name="userName"
type="text"
required
:state="form.fields.userName.state"
/>
</gl-form-group>
<gl-form-group
:label="s__('DastProfiles|Password')"
:invalid-feedback="form.fields.password.feedback"
class="col-md-6"
>
<gl-form-input
v-model="form.fields.password.value"
v-validation:[showValidationOrInEditMode]
autocomplete="off"
name="password"
type="password"
required
:state="form.fields.password.state"
/>
</gl-form-group>
</div>
<div class="row">
<gl-form-group
:label="s__('DastProfiles|Username form field')"
:invalid-feedback="form.fields.userNameFormField.feedback"
class="col-md-6"
>
<gl-form-input
v-model="form.fields.userNameFormField.value"
v-validation:[showValidationOrInEditMode]
name="userNameFormField"
type="text"
required
:state="form.fields.userNameFormField.state"
/>
</gl-form-group>
<gl-form-group
:label="s__('DastProfiles|Password form field')"
:invalid-feedback="form.fields.passwordFormField.feedback"
class="col-md-6"
>
<gl-form-input
v-model="form.fields.passwordFormField.value"
v-validation:[showValidationOrInEditMode]
name="passwordFormField"
type="text"
required
:state="form.fields.passwordFormField.state"
/>
</gl-form-group>
</div>
</div>
</section>
</template>
...@@ -10,6 +10,7 @@ import { ...@@ -10,6 +10,7 @@ import {
GlModal, GlModal,
GlToggle, GlToggle,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { initFormField } from 'ee/security_configuration/utils';
import * as Sentry from '~/sentry/wrapper'; import * as Sentry from '~/sentry/wrapper';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
import { redirectTo } from '~/lib/utils/url_utility'; import { redirectTo } from '~/lib/utils/url_utility';
...@@ -26,12 +27,6 @@ import { DAST_SITE_VALIDATION_STATUS, DAST_SITE_VALIDATION_POLL_INTERVAL } from ...@@ -26,12 +27,6 @@ import { DAST_SITE_VALIDATION_STATUS, DAST_SITE_VALIDATION_POLL_INTERVAL } from
const { PENDING, INPROGRESS, PASSED, FAILED } = DAST_SITE_VALIDATION_STATUS; const { PENDING, INPROGRESS, PASSED, FAILED } = DAST_SITE_VALIDATION_STATUS;
const initField = value => ({
value,
state: null,
feedback: null,
});
export default { export default {
name: 'DastSiteProfileForm', name: 'DastSiteProfileForm',
components: { components: {
...@@ -71,8 +66,8 @@ export default { ...@@ -71,8 +66,8 @@ export default {
state: false, state: false,
showValidation: false, showValidation: false,
fields: { fields: {
profileName: initField(name), profileName: initFormField({ value: name }),
targetUrl: initField(targetUrl), targetUrl: initFormField({ value: targetUrl }),
}, },
}; };
......
export const initFormField = ({ value, required = true, skipValidation = false }) => ({
value,
required,
state: skipValidation ? true : null,
feedback: null,
});
<script> <script>
import { GlLink, GlSprintf, GlModalDirective, GlButton, GlIcon } from '@gitlab/ui'; import {
GlLink,
GlSprintf,
GlModalDirective,
GlButton,
GlIcon,
GlKeysetPagination,
} from '@gitlab/ui';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import ProjectsTable from './projects_table.vue'; import ProjectsTable from './projects_table.vue';
import UsageGraph from './usage_graph.vue'; import UsageGraph from './usage_graph.vue';
...@@ -9,18 +16,20 @@ import query from '../queries/storage.query.graphql'; ...@@ -9,18 +16,20 @@ import query from '../queries/storage.query.graphql';
import TemporaryStorageIncreaseModal from './temporary_storage_increase_modal.vue'; import TemporaryStorageIncreaseModal from './temporary_storage_increase_modal.vue';
import { parseBoolean } from '~/lib/utils/common_utils'; import { parseBoolean } from '~/lib/utils/common_utils';
import { formatUsageSize, parseGetStorageResults } from '../utils'; import { formatUsageSize, parseGetStorageResults } from '../utils';
import { PROJECTS_PER_PAGE } from '../constants';
export default { export default {
name: 'StorageCounterApp', name: 'StorageCounterApp',
components: { components: {
ProjectsTable,
GlLink, GlLink,
GlIcon,
GlButton, GlButton,
GlSprintf, GlSprintf,
GlIcon,
StorageInlineAlert,
UsageGraph, UsageGraph,
ProjectsTable,
UsageStatistics, UsageStatistics,
StorageInlineAlert,
GlKeysetPagination,
TemporaryStorageIncreaseModal, TemporaryStorageIncreaseModal,
}, },
directives: { directives: {
...@@ -55,20 +64,25 @@ export default { ...@@ -55,20 +64,25 @@ export default {
fullPath: this.namespacePath, fullPath: this.namespacePath,
searchTerm: this.searchTerm, searchTerm: this.searchTerm,
withExcessStorageData: this.isAdditionalStorageFlagEnabled, withExcessStorageData: this.isAdditionalStorageFlagEnabled,
first: PROJECTS_PER_PAGE,
}; };
}, },
update: parseGetStorageResults, update: parseGetStorageResults,
result() {
this.firstFetch = false;
},
}, },
}, },
data() { data() {
return { return {
namespace: {}, namespace: {},
searchTerm: '', searchTerm: '',
firstFetch: true,
}; };
}, },
computed: { computed: {
namespaceProjects() { namespaceProjects() {
return this.namespace?.projects ?? []; return this.namespace?.projects?.data ?? [];
}, },
isStorageIncreaseModalVisible() { isStorageIncreaseModalVisible() {
return parseBoolean(this.isTemporaryStorageIncreaseVisible); return parseBoolean(this.isTemporaryStorageIncreaseVisible);
...@@ -92,8 +106,24 @@ export default { ...@@ -92,8 +106,24 @@ export default {
additionalPurchasedStorageSize: this.namespace.additionalPurchasedStorageSize, additionalPurchasedStorageSize: this.namespace.additionalPurchasedStorageSize,
}; };
}, },
isQueryLoading() {
return this.$apollo.queries.namespace.loading;
},
pageInfo() {
return this.namespace.projects?.pageInfo ?? {};
},
shouldShowStorageInlineAlert() { shouldShowStorageInlineAlert() {
return this.isAdditionalStorageFlagEnabled && !this.$apollo.queries.namespace.loading; if (this.firstFetch) {
// for initial load check if the data fetch is done (isQueryLoading)
return this.isAdditionalStorageFlagEnabled && !this.isQueryLoading;
}
// for all subsequent queries the storage inline alert doesn't
// have to be re-rendered as the data from graphql will remain
// the same.
return this.isAdditionalStorageFlagEnabled;
},
showPagination() {
return Boolean(this.pageInfo?.hasPreviousPage || this.pageInfo?.hasNextPage);
}, },
}, },
methods: { methods: {
...@@ -103,8 +133,30 @@ export default { ...@@ -103,8 +133,30 @@ export default {
this.searchTerm = input; this.searchTerm = input;
} }
}, },
fetchMoreProjects(vars) {
this.$apollo.queries.namespace.fetchMore({
variables: {
fullPath: this.namespacePath,
withExcessStorageData: this.isAdditionalStorageFlagEnabled,
first: PROJECTS_PER_PAGE,
...vars,
},
updateQuery(previousResult, { fetchMoreResult }) {
return fetchMoreResult;
},
});
},
onPrev(before) {
if (this.pageInfo?.hasPreviousPage) {
this.fetchMoreProjects({ before });
}
},
onNext(after) {
if (this.pageInfo?.hasNextPage) {
this.fetchMoreProjects({ after });
}
},
}, },
modalId: 'temporary-increase-storage-modal', modalId: 'temporary-increase-storage-modal',
}; };
</script> </script>
...@@ -181,9 +233,13 @@ export default { ...@@ -181,9 +233,13 @@ export default {
</div> </div>
<projects-table <projects-table
:projects="namespaceProjects" :projects="namespaceProjects"
:is-loading="isQueryLoading"
:additional-purchased-storage-size="namespace.additionalPurchasedStorageSize || 0" :additional-purchased-storage-size="namespace.additionalPurchasedStorageSize || 0"
@search="handleSearch" @search="handleSearch"
/> />
<div class="gl-display-flex gl-justify-content-center gl-mt-5">
<gl-keyset-pagination v-if="showPagination" v-bind="pageInfo" @prev="onPrev" @next="onNext" />
</div>
<temporary-storage-increase-modal <temporary-storage-increase-modal
v-if="isStorageIncreaseModalVisible" v-if="isStorageIncreaseModalVisible"
:limit="formattedNamespaceLimit" :limit="formattedNamespaceLimit"
......
<script>
import { GlSkeletonLoader } from '@gitlab/ui';
import { SKELETON_LOADER_ROWS } from '../constants';
export default {
name: 'ProjectsSkeletonLoader',
components: { GlSkeletonLoader },
SKELETON_LOADER_ROWS,
};
</script>
<template>
<div class="gl-border-b-solid gl-border-b-1 gl-border-gray-100">
<div class="gl-flex-direction-column gl-display-md-none" data-testid="mobile-loader">
<div
v-for="index in $options.SKELETON_LOADER_ROWS.mobile"
:key="index"
class="gl-responsive-table-row gl-border-solid gl-border-b-1 gl-pt-3 gl-pb-3 gl-border-b-gray-100"
>
<gl-skeleton-loader :width="500" :height="172">
<rect width="480" height="20" x="10" y="15" rx="4" />
<rect width="480" height="20" x="10" y="80" rx="4" />
<rect width="480" height="20" x="10" y="145" rx="4" />
</gl-skeleton-loader>
</div>
</div>
<div
class="gl-display-none gl-display-md-flex gl-flex-direction-column"
data-testid="desktop-loader"
>
<gl-skeleton-loader
v-for="index in $options.SKELETON_LOADER_ROWS.desktop"
:key="index"
:width="1000"
:height="39"
>
<rect rx="4" width="320" height="8" x="0" y="18" />
<rect rx="4" width="60" height="8" x="500" y="18" />
<rect rx="4" width="60" height="8" x="750" y="18" />
</gl-skeleton-loader>
</div>
</div>
</template>
...@@ -3,11 +3,13 @@ import { GlSearchBoxByType } from '@gitlab/ui'; ...@@ -3,11 +3,13 @@ import { GlSearchBoxByType } from '@gitlab/ui';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import Project from './project.vue'; import Project from './project.vue';
import ProjectWithExcessStorage from './project_with_excess_storage.vue'; import ProjectWithExcessStorage from './project_with_excess_storage.vue';
import ProjectsSkeletonLoader from './projects_skeleton_loader.vue';
import { SEARCH_DEBOUNCE_MS } from '~/ref/constants'; import { SEARCH_DEBOUNCE_MS } from '~/ref/constants';
export default { export default {
components: { components: {
Project, Project,
ProjectsSkeletonLoader,
ProjectWithExcessStorage, ProjectWithExcessStorage,
GlSearchBoxByType, GlSearchBoxByType,
}, },
...@@ -21,6 +23,11 @@ export default { ...@@ -21,6 +23,11 @@ export default {
type: Number, type: Number,
required: true, required: true,
}, },
isLoading: {
type: Boolean,
required: false,
default: false,
},
}, },
computed: { computed: {
isAdditionalStorageFlagEnabled() { isAdditionalStorageFlagEnabled() {
...@@ -44,7 +51,7 @@ export default { ...@@ -44,7 +51,7 @@ export default {
role="row" role="row"
> >
<template v-if="isAdditionalStorageFlagEnabled"> <template v-if="isAdditionalStorageFlagEnabled">
<div class="table-section section-50 gl-font-weight-bold gl-pl-5" role="columnheader"> <div class="table-section section-50 gl-font-weight-bold gl-pl-5" role="columnheader">
{{ __('Project') }} {{ __('Project') }}
</div> </div>
<div class="table-section section-15 gl-font-weight-bold" role="columnheader"> <div class="table-section section-15 gl-font-weight-bold" role="columnheader">
...@@ -70,13 +77,15 @@ export default { ...@@ -70,13 +77,15 @@ export default {
</div> </div>
</template> </template>
</div> </div>
<projects-skeleton-loader v-if="isAdditionalStorageFlagEnabled && isLoading" />
<component <template v-else>
:is="projectRowComponent" <component
v-for="project in projects" :is="projectRowComponent"
:key="project.id" v-for="project in projects"
:project="project" :key="project.id"
:additional-purchased-storage-size="additionalPurchasedStorageSize" :project="project"
/> :additional-purchased-storage-size="additionalPurchasedStorageSize"
/>
</template>
</div> </div>
</template> </template>
...@@ -11,3 +11,10 @@ export const STORAGE_USAGE_THRESHOLDS = { ...@@ -11,3 +11,10 @@ export const STORAGE_USAGE_THRESHOLDS = {
[ALERT_THRESHOLD]: 0.95, [ALERT_THRESHOLD]: 0.95,
[ERROR_THRESHOLD]: 1.0, [ERROR_THRESHOLD]: 1.0,
}; };
export const PROJECTS_PER_PAGE = 20;
export const SKELETON_LOADER_ROWS = {
desktop: PROJECTS_PER_PAGE,
mobile: 5,
};
#import "~/graphql_shared/fragments/pageInfo.fragment.graphql"
query getStorageCounter( query getStorageCounter(
$fullPath: ID! $fullPath: ID!
$searchTerm: String = ""
$withExcessStorageData: Boolean = false $withExcessStorageData: Boolean = false
$searchTerm: String = ""
$first: Int!
$after: String
$before: String
) { ) {
namespace(fullPath: $fullPath) { namespace(fullPath: $fullPath) {
id id
...@@ -23,29 +28,37 @@ query getStorageCounter( ...@@ -23,29 +28,37 @@ query getStorageCounter(
wikiSize wikiSize
snippetsSize snippetsSize
} }
projects(includeSubgroups: true, sort: STORAGE, search: $searchTerm) { projects(
edges { includeSubgroups: true
node { search: $searchTerm
id first: $first
fullPath after: $after
nameWithNamespace before: $before
avatarUrl sort: STORAGE
webUrl ) {
name nodes {
repositorySizeExcess @include(if: $withExcessStorageData) id
actualRepositorySizeLimit @include(if: $withExcessStorageData) fullPath
statistics { nameWithNamespace
commitCount avatarUrl
storageSize webUrl
repositorySize name
lfsObjectsSize repositorySizeExcess @include(if: $withExcessStorageData)
buildArtifactsSize actualRepositorySizeLimit @include(if: $withExcessStorageData)
packagesSize statistics {
wikiSize commitCount
snippetsSize storageSize
} repositorySize
lfsObjectsSize
buildArtifactsSize
packagesSize
wikiSize
snippetsSize
} }
} }
pageInfo {
...PageInfo
}
} }
} }
} }
...@@ -86,7 +86,7 @@ export const parseProjects = ({ ...@@ -86,7 +86,7 @@ export const parseProjects = ({
additionalPurchasedStorageSize - totalRepositorySizeExcess, additionalPurchasedStorageSize - totalRepositorySizeExcess,
); );
return projects.edges.map(({ node: project }) => return projects.nodes.map(project =>
calculateUsedAndRemStorage(project, purchasedStorageRemaining), calculateUsedAndRemStorage(project, purchasedStorageRemaining),
); );
}; };
...@@ -118,21 +118,26 @@ export const parseGetStorageResults = data => { ...@@ -118,21 +118,26 @@ export const parseGetStorageResults = data => {
}, },
} = data || {}; } = data || {};
const totalUsage = rootStorageStatistics?.storageSize
? numberToHumanSize(rootStorageStatistics.storageSize)
: 'N/A';
return { return {
projects: parseProjects({ projects: {
projects, data: parseProjects({
additionalPurchasedStorageSize, projects,
totalRepositorySizeExcess, additionalPurchasedStorageSize,
}), totalRepositorySizeExcess,
}),
pageInfo: projects.pageInfo,
},
additionalPurchasedStorageSize, additionalPurchasedStorageSize,
actualRepositorySizeLimit, actualRepositorySizeLimit,
containsLockedProjects, containsLockedProjects,
repositorySizeExcessProjectCount, repositorySizeExcessProjectCount,
totalRepositorySize, totalRepositorySize,
totalRepositorySizeExcess, totalRepositorySizeExcess,
totalUsage: rootStorageStatistics?.storageSize totalUsage,
? numberToHumanSize(rootStorageStatistics.storageSize)
: 'N/A',
rootStorageStatistics, rootStorageStatistics,
limit: storageSizeLimit, limit: storageSizeLimit,
}; };
......
- billable_users_url = help_page_path('subscriptions/self_managed/index', anchor: 'billable-users')
- billable_users_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer nofollow">'.html_safe % { url: billable_users_url }
= s_('AdminArea|Billable users') = s_('AdminArea|Billable users')
%span.gl-outline-0.gl-ml-2{ href: "#", tabindex: "0", role: "button", data: { container: "body",
toggle: "popover",
placement: "top",
html: "true",
trigger: "focus",
content: s_("AdminArea|%{billable_users_link_start}Learn more%{billable_users_link_end} about what defines a billable user").html_safe % { billable_users_link_start: billable_users_link_start, billable_users_link_end: '</a>'.html_safe } } }
= sprite_icon('question', size: 16, css_class: 'gl-text-gray-700')
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
- true_up_url = 'https://about.gitlab.com/license-faq/' - true_up_url = 'https://about.gitlab.com/license-faq/'
- true_up_link_start = '<a href="%{url}">'.html_safe % { url: true_up_url } - true_up_link_start = '<a href="%{url}">'.html_safe % { url: true_up_url }
- billable_users_url = help_page_path('subscriptions/self_managed/index', anchor: 'billable-users')
- billable_users_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer nofollow">'.html_safe % { url: billable_users_url }
- link_end = '</a>'.html_safe - link_end = '</a>'.html_safe
.license-panel.gl-mt-5 .license-panel.gl-mt-5
...@@ -57,7 +59,7 @@ ...@@ -57,7 +59,7 @@
= number_with_delimiter current_active_user_count = number_with_delimiter current_active_user_count
%hr %hr
%p %p
= _('This is the number of currently active users on your installation, and this is the minimum number you need to purchase when you renew your license.') = _('This is the number of %{billable_users_link_start}billable users%{link_end} on your installation, and this is the minimum number you need to purchase when you renew your license.').html_safe % { billable_users_link_start: billable_users_link_start, link_end: link_end }
.d-flex.gl-pb-5 .d-flex.gl-pb-5
.col-sm-6.d-flex.pl-0 .col-sm-6.d-flex.pl-0
.info-well.dark-well.flex-fill.gl-mb-0 .info-well.dark-well.flex-fill.gl-mb-0
......
---
title: Add text/tips to clarify various user counts in self-managed admin panels
merge_request: 44986
author:
type: other
...@@ -17,6 +17,7 @@ describe('Test coverage table component', () => { ...@@ -17,6 +17,7 @@ describe('Test coverage table component', () => {
const findEmptyState = () => wrapper.find('[data-testid="test-coverage-table-empty-state"]'); const findEmptyState = () => wrapper.find('[data-testid="test-coverage-table-empty-state"]');
const findLoadingState = () => wrapper.find('[data-testid="test-coverage-loading-state"'); const findLoadingState = () => wrapper.find('[data-testid="test-coverage-loading-state"');
const findTable = () => wrapper.find('[data-testid="test-coverage-data-table"'); const findTable = () => wrapper.find('[data-testid="test-coverage-data-table"');
const findTableRows = () => findTable().findAll('tbody tr');
const findProjectNameById = id => wrapper.find(`[data-testid="${id}-name"`); const findProjectNameById = id => wrapper.find(`[data-testid="${id}-name"`);
const findProjectAverageById = id => wrapper.find(`[data-testid="${id}-average"`); const findProjectAverageById = id => wrapper.find(`[data-testid="${id}-average"`);
const findProjectCountById = id => wrapper.find(`[data-testid="${id}-count"`); const findProjectCountById = id => wrapper.find(`[data-testid="${id}-count"`);
...@@ -96,8 +97,10 @@ describe('Test coverage table component', () => { ...@@ -96,8 +97,10 @@ describe('Test coverage table component', () => {
describe('when code coverage is available', () => { describe('when code coverage is available', () => {
it('renders coverage table', () => { it('renders coverage table', () => {
const fullPath = 'gitlab-org/gitlab';
const id = 'gid://gitlab/Project/1'; const id = 'gid://gitlab/Project/1';
const name = 'GitLab'; const name = 'GitLab';
const rootRef = 'master';
const averageCoverage = '74.35'; const averageCoverage = '74.35';
const coverageCount = '5'; const coverageCount = '5';
const yesterday = new Date(); const yesterday = new Date();
...@@ -107,8 +110,13 @@ describe('Test coverage table component', () => { ...@@ -107,8 +110,13 @@ describe('Test coverage table component', () => {
data: { data: {
allCoverageData: [ allCoverageData: [
{ {
fullPath,
id, id,
name, name,
repository: {
rootRef,
},
codeCoveragePath: '#',
codeCoverageSummary: { codeCoverageSummary: {
averageCoverage, averageCoverage,
coverageCount, coverageCount,
...@@ -129,11 +137,103 @@ describe('Test coverage table component', () => { ...@@ -129,11 +137,103 @@ describe('Test coverage table component', () => {
expect(findProjectCountById(id).text()).toBe(coverageCount); expect(findProjectCountById(id).text()).toBe(coverageCount);
expect(findProjectDateById(id).text()).toBe('1 day ago'); expect(findProjectDateById(id).text()).toBe('1 day ago');
}); });
it('sorts the table by the most recently updated report', () => {
const today = new Date();
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
const allCoverageData = [
{
fullPath: '-',
id: 1,
name: 'should be last',
repository: { rootRef: 'master' },
codeCoveragePath: '#',
codeCoverageSummary: {
averageCoverage: '1.45',
coverageCount: '1',
lastUpdatedAt: yesterday.toISOString(),
},
},
{
fullPath: '-',
id: 2,
name: 'should be first',
repository: { rootRef: 'master' },
codeCoveragePath: '#',
codeCoverageSummary: {
averageCoverage: '1.45',
coverageCount: '1',
lastUpdatedAt: today.toISOString(),
},
},
];
createComponent({
data: {
allCoverageData,
projectIds: {
1: true,
2: true,
},
},
mountFn: mount,
});
expect(findTable().exists()).toBe(true);
expect(
findTableRows()
.at(0)
.text(),
).toContain('should be first');
expect(
findTableRows()
.at(1)
.text(),
).toContain('should be last');
});
it('renders the correct link', async () => {
const id = 1;
const fullPath = 'test/test';
const rootRef = 'master';
const expectedPath = `/${fullPath}/-/graphs/${rootRef}/charts`;
createComponentWithApollo({
data: {
projectIds: { [id]: true },
},
queryData: {
data: {
projects: {
nodes: [
{
fullPath,
name: 'test',
id,
repository: {
rootRef,
},
codeCoverageSummary: {
averageCoverage: '1.45',
coverageCount: '1',
lastUpdatedAt: new Date().toISOString(),
},
},
],
},
},
},
mountFn: mount,
});
jest.runOnlyPendingTimers();
await waitForPromises();
expect(findTable().exists()).toBe(true);
expect(findProjectNameById(id).attributes('href')).toBe(expectedPath);
});
}); });
describe('when selected project has no coverage', () => { describe('when selected project has no coverage', () => {
it('sets coverage to default values', async () => { it('does not render the table', async () => {
const name = 'test';
const id = 1; const id = 1;
createComponentWithApollo({ createComponentWithApollo({
data: { data: {
...@@ -144,8 +244,12 @@ describe('Test coverage table component', () => { ...@@ -144,8 +244,12 @@ describe('Test coverage table component', () => {
projects: { projects: {
nodes: [ nodes: [
{ {
name, fullPath: 'test/test',
name: 'test',
id, id,
repository: {
rootRef: 'master',
},
codeCoverageSummary: null, codeCoverageSummary: null,
}, },
], ],
...@@ -157,11 +261,7 @@ describe('Test coverage table component', () => { ...@@ -157,11 +261,7 @@ describe('Test coverage table component', () => {
jest.runOnlyPendingTimers(); jest.runOnlyPendingTimers();
await waitForPromises(); await waitForPromises();
expect(findTable().exists()).toBe(true); expect(findTable().exists()).toBe(false);
expect(findProjectNameById(id).text()).toBe(name);
expect(findProjectAverageById(id).text()).toBe('0.00%');
expect(findProjectCountById(id).text()).toBe('0');
expect(findProjectDateById(id).text()).toBe('just now');
}); });
}); });
}); });
import { mount } from '@vue/test-utils';
import { GlFormCheckbox } from '@gitlab/ui';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import DastSiteAuthSection from 'ee/security_configuration/dast_site_profiles_form/components/dast_site_auth_section.vue';
describe('DastSiteAuthSection', () => {
let wrapper;
const createComponent = ({ fields } = {}) => {
wrapper = extendedWrapper(
mount(DastSiteAuthSection, {
propsData: {
fields,
},
}),
);
};
beforeEach(() => {
createComponent();
});
afterEach(() => {
wrapper.destroy();
});
const findByNameAttribute = name => wrapper.find(`[name="${name}"]`);
const findAuthForm = () => wrapper.findByTestId('auth-form');
const findAuthCheckbox = () => wrapper.find(GlFormCheckbox);
const setAuthentication = ({ enabled }) => {
findAuthCheckbox().vm.$emit('input', enabled);
return wrapper.vm.$nextTick();
};
const getLatestInputEventPayload = () => {
const latestInputEvent = [...wrapper.emitted('input')].pop();
const [payload] = latestInputEvent;
return payload;
};
describe('authentication toggle', () => {
it.each([true, false])(
'is set correctly when the "authEnabled" field is set to "%s"',
authEnabled => {
createComponent({ fields: { authEnabled } });
expect(findAuthCheckbox().vm.$attrs.checked).toBe(authEnabled);
},
);
it('controls the visibility of the authentication-fields form', async () => {
expect(findAuthForm().exists()).toBe(false);
await setAuthentication({ enabled: true });
expect(findAuthForm().exists()).toBe(true);
});
it.each([true, false])(
'makes the component emit an "input" event when changed',
async enabled => {
await setAuthentication({ enabled });
expect(getLatestInputEventPayload().fields.authEnabled.value).toBe(enabled);
},
);
});
describe('authentication form', () => {
beforeEach(async () => {
await setAuthentication({ enabled: true });
});
const inputFieldsWithValues = {
authenticationUrl: 'http://www.gitlab.com',
userName: 'foo',
password: 'foo',
userNameFormField: 'foo',
passwordFormField: 'foo',
};
const inputFieldNames = Object.keys(inputFieldsWithValues);
describe.each(inputFieldNames)('input field "%s"', inputFieldName => {
it('is rendered', () => {
expect(findByNameAttribute(inputFieldName).exists()).toBe(true);
});
it('makes the component emit an "input" event when its value changes', () => {
const input = findByNameAttribute(inputFieldName);
const newValue = 'foo';
input.setValue(newValue);
expect(getLatestInputEventPayload().fields[inputFieldName].value).toBe(newValue);
});
});
describe('validity', () => {
it('is not valid per default', () => {
expect(getLatestInputEventPayload().state).toBe(false);
});
it('is valid when correct values are passed in via the "fields" prop', async () => {
createComponent({ fields: inputFieldsWithValues });
await setAuthentication({ enabled: true });
expect(getLatestInputEventPayload().state).toBe(true);
});
it('is valid once all fields have been entered correctly', () => {
Object.entries(inputFieldsWithValues).forEach(([inputFieldName, inputFieldValue]) => {
const input = findByNameAttribute(inputFieldName);
input.setValue(inputFieldValue);
input.trigger('blur');
});
expect(getLatestInputEventPayload().state).toBe(true);
});
});
});
});
...@@ -23,6 +23,8 @@ describe('Storage counter app', () => { ...@@ -23,6 +23,8 @@ describe('Storage counter app', () => {
const findUsageStatistics = () => wrapper.find(UsageStatistics); const findUsageStatistics = () => wrapper.find(UsageStatistics);
const findStorageInlineAlert = () => wrapper.find(StorageInlineAlert); const findStorageInlineAlert = () => wrapper.find(StorageInlineAlert);
const findProjectsTable = () => wrapper.find(ProjectsTable); const findProjectsTable = () => wrapper.find(ProjectsTable);
const findPrevButton = () => wrapper.find('[data-testid="prevButton"]');
const findNextButton = () => wrapper.find('[data-testid="nextButton"]');
const createComponent = ({ const createComponent = ({
props = {}, props = {},
...@@ -257,4 +259,30 @@ describe('Storage counter app', () => { ...@@ -257,4 +259,30 @@ describe('Storage counter app', () => {
expect(wrapper.vm.searchTerm).toBe(''); expect(wrapper.vm.searchTerm).toBe('');
}); });
}); });
describe('renders projects table pagination component', () => {
const namespaceWithPageInfo = {
namespace: {
...withRootStorageStatistics,
projects: {
...withRootStorageStatistics.projects,
pageInfo: {
hasPreviousPage: false,
hasNextPage: true,
},
},
},
};
beforeEach(() => {
createComponent(namespaceWithPageInfo);
});
it('with disabled "Prev" button', () => {
expect(findPrevButton().attributes().disabled).toBe('disabled');
});
it('with enabled "Next" button', () => {
expect(findNextButton().attributes().disabled).toBeUndefined();
});
});
}); });
import { mount } from '@vue/test-utils';
import ProjectsSkeletonLoader from 'ee/storage_counter/components/projects_skeleton_loader.vue';
describe('ProjectsSkeletonLoader', () => {
let wrapper;
const createComponent = (props = {}) => {
wrapper = mount(ProjectsSkeletonLoader, {
propsData: {
...props,
},
});
};
const findDesktopLoader = () => wrapper.find('[data-testid="desktop-loader"]');
const findMobileLoader = () => wrapper.find('[data-testid="mobile-loader"]');
beforeEach(createComponent);
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
describe('desktop loader', () => {
it('produces 20 rows', () => {
expect(findDesktopLoader().findAll('rect[width="1000"]')).toHaveLength(20);
});
it('has the correct classes', () => {
expect(findDesktopLoader().classes()).toEqual([
'gl-display-none',
'gl-display-md-flex',
'gl-flex-direction-column',
]);
});
});
describe('mobile loader', () => {
it('produces 5 rows', () => {
expect(findMobileLoader().findAll('rect[height="172"]')).toHaveLength(5);
});
it('has the correct classes', () => {
expect(findMobileLoader().classes()).toEqual([
'gl-flex-direction-column',
'gl-display-md-none',
]);
});
});
});
...@@ -61,7 +61,7 @@ export const projects = [ ...@@ -61,7 +61,7 @@ export const projects = [
export const namespaceData = { export const namespaceData = {
totalUsage: 'N/A', totalUsage: 'N/A',
limit: 10000000, limit: 10000000,
projects, projects: { data: projects },
}; };
export const withRootStorageStatistics = { export const withRootStorageStatistics = {
...@@ -86,5 +86,5 @@ export const withRootStorageStatistics = { ...@@ -86,5 +86,5 @@ export const withRootStorageStatistics = {
}; };
export const mockGetStorageCounterGraphQLResponse = { export const mockGetStorageCounterGraphQLResponse = {
edges: projects.map(node => ({ node })), nodes: projects.map(node => node),
}; };
...@@ -4,6 +4,7 @@ stages: ...@@ -4,6 +4,7 @@ stages:
- review - review
- deploy - deploy
- production - production
- cleanup
variables: variables:
AUTO_DEVOPS_PLATFORM_TARGET: ECS AUTO_DEVOPS_PLATFORM_TARGET: ECS
......
...@@ -41,6 +41,8 @@ module Gitlab ...@@ -41,6 +41,8 @@ module Gitlab
data.map! { |v| utf8_encode_values(v) } data.map! { |v| utf8_encode_values(v) }
when String when String
encode_utf8(data) encode_utf8(data)
when Integer
data
end end
end end
end end
......
# frozen_string_literal: true # frozen_string_literal: true
require 'snowplow-tracker'
module Gitlab module Gitlab
module Tracking module Tracking
SNOWPLOW_NAMESPACE = 'gl' SNOWPLOW_NAMESPACE = 'gl'
...@@ -27,16 +25,11 @@ module Gitlab ...@@ -27,16 +25,11 @@ module Gitlab
end end
def event(category, action, label: nil, property: nil, value: nil, context: nil) def event(category, action, label: nil, property: nil, value: nil, context: nil)
return unless enabled? snowplow.event(category, action, label: label, property: property, value: value, context: context)
snowplow.track_struct_event(category, action, label, property, value, context, (Time.now.to_f * 1000).to_i)
end end
def self_describing_event(schema_url, event_data_json, context: nil) def self_describing_event(schema_url, event_data_json, context: nil)
return unless enabled? snowplow.self_describing_event(schema_url, event_data_json, context: context)
event_json = SnowplowTracker::SelfDescribingJson.new(schema_url, event_data_json)
snowplow.track_self_describing_event(event_json, context, (Time.now.to_f * 1000).to_i)
end end
def snowplow_options(group) def snowplow_options(group)
...@@ -54,19 +47,7 @@ module Gitlab ...@@ -54,19 +47,7 @@ module Gitlab
private private
def snowplow def snowplow
@snowplow ||= SnowplowTracker::Tracker.new( @snowplow ||= Gitlab::Tracking::Destinations::Snowplow.new
emitter,
SnowplowTracker::Subject.new,
SNOWPLOW_NAMESPACE,
Gitlab::CurrentSettings.snowplow_app_id
)
end
def emitter
SnowplowTracker::AsyncEmitter.new(
Gitlab::CurrentSettings.snowplow_collector_hostname,
protocol: 'https'
)
end end
end end
end end
......
# frozen_string_literal: true
module Gitlab
module Tracking
module Destinations
class Base
def event(category, action, label: nil, property: nil, value: nil, context: nil)
raise NotImplementedError, "#{self} does not implement #{__method__}"
end
end
end
end
end
# frozen_string_literal: true
require 'snowplow-tracker'
module Gitlab
module Tracking
module Destinations
class Snowplow < Base
extend ::Gitlab::Utils::Override
override :event
def event(category, action, label: nil, property: nil, value: nil, context: nil)
return unless enabled?
tracker.track_struct_event(category, action, label, property, value, context, (Time.now.to_f * 1000).to_i)
end
def self_describing_event(schema_url, event_data_json, context: nil)
return unless enabled?
event_json = SnowplowTracker::SelfDescribingJson.new(schema_url, event_data_json)
tracker.track_self_describing_event(event_json, context, (Time.now.to_f * 1000).to_i)
end
private
def enabled?
Gitlab::CurrentSettings.snowplow_enabled?
end
def tracker
@tracker ||= SnowplowTracker::Tracker.new(
emitter,
SnowplowTracker::Subject.new,
Gitlab::Tracking::SNOWPLOW_NAMESPACE,
Gitlab::CurrentSettings.snowplow_app_id
)
end
def emitter
SnowplowTracker::AsyncEmitter.new(
Gitlab::CurrentSettings.snowplow_collector_hostname,
protocol: 'https'
)
end
end
end
end
end
...@@ -217,7 +217,8 @@ module Gitlab ...@@ -217,7 +217,8 @@ module Gitlab
personal_snippets: count(PersonalSnippet.where(last_28_days_time_period)), personal_snippets: count(PersonalSnippet.where(last_28_days_time_period)),
project_snippets: count(ProjectSnippet.where(last_28_days_time_period)) project_snippets: count(ProjectSnippet.where(last_28_days_time_period))
}.merge( }.merge(
snowplow_event_counts(last_28_days_time_period(column: :collector_tstamp)) snowplow_event_counts(last_28_days_time_period(column: :collector_tstamp)),
aggregated_metrics_monthly
).tap do |data| ).tap do |data|
data[:snippets] = data[:personal_snippets] + data[:project_snippets] data[:snippets] = data[:personal_snippets] + data[:project_snippets]
end end
...@@ -239,7 +240,10 @@ module Gitlab ...@@ -239,7 +240,10 @@ module Gitlab
def system_usage_data_weekly def system_usage_data_weekly
{ {
counts_weekly: {} counts_weekly: {
}.merge(
aggregated_metrics_weekly
)
} }
end end
...@@ -691,11 +695,19 @@ module Gitlab ...@@ -691,11 +695,19 @@ module Gitlab
{ redis_hll_counters: ::Gitlab::UsageDataCounters::HLLRedisCounter.unique_events_data } { redis_hll_counters: ::Gitlab::UsageDataCounters::HLLRedisCounter.unique_events_data }
end end
def aggregated_metrics def aggregated_metrics_monthly
return {} unless Feature.enabled?(:product_analytics_aggregated_metrics)
{
aggregated_metrics: ::Gitlab::UsageDataCounters::HLLRedisCounter.aggregated_metrics_monthly_data
}
end
def aggregated_metrics_weekly
return {} unless Feature.enabled?(:product_analytics_aggregated_metrics) return {} unless Feature.enabled?(:product_analytics_aggregated_metrics)
{ {
aggregated_metrics: ::Gitlab::UsageDataCounters::HLLRedisCounter.aggregated_metrics_data aggregated_metrics: ::Gitlab::UsageDataCounters::HLLRedisCounter.aggregated_metrics_weekly_data
} }
end end
......
...@@ -90,18 +90,24 @@ module Gitlab ...@@ -90,18 +90,24 @@ module Gitlab
event_for(event_name).present? event_for(event_name).present?
end end
def aggregated_metrics_data def aggregated_metrics_monthly_data
aggregated_metrics.to_h do |aggregation| aggregated_metrics.to_h do |aggregation|
[aggregation[:name], calculate_count_for_aggregation(aggregation)] [aggregation[:name], calculate_count_for_aggregation(aggregation, start_date: 4.weeks.ago.to_date, end_date: Date.current)]
end
end
def aggregated_metrics_weekly_data
aggregated_metrics.to_h do |aggregation|
[aggregation[:name], calculate_count_for_aggregation(aggregation, start_date: 7.days.ago.to_date, end_date: Date.current)]
end end
end end
private private
def calculate_count_for_aggregation(aggregation) def calculate_count_for_aggregation(aggregation, start_date:, end_date:)
validate_aggregation_operator!(aggregation[:operator]) validate_aggregation_operator!(aggregation[:operator])
count_unique_events(event_names: aggregation[:events], start_date: 4.weeks.ago.to_date, end_date: Date.current) do |events| count_unique_events(event_names: aggregation[:events], start_date: start_date, end_date: end_date) do |events|
raise SlotMismatch, events unless events_in_same_slot?(events) raise SlotMismatch, events unless events_in_same_slot?(events)
raise AggregationMismatch, events unless events_same_aggregation?(events) raise AggregationMismatch, events unless events_same_aggregation?(events)
end end
......
...@@ -1856,9 +1856,15 @@ msgstr "" ...@@ -1856,9 +1856,15 @@ msgstr ""
msgid "Admin notes" msgid "Admin notes"
msgstr "" msgstr ""
msgid "AdminArea|%{billable_users_link_start}Learn more%{billable_users_link_end} about what defines a billable user"
msgstr ""
msgid "AdminArea|Active users" msgid "AdminArea|Active users"
msgstr "" msgstr ""
msgid "AdminArea|All users created in the instance, including users who are not %{billable_users_link_start}billable users%{billable_users_link_end}."
msgstr ""
msgid "AdminArea|Billable users" msgid "AdminArea|Billable users"
msgstr "" msgstr ""
...@@ -4953,6 +4959,9 @@ msgstr "" ...@@ -4953,6 +4959,9 @@ msgstr ""
msgid "Changes affect new repositories only. If not specified, Git's default name %{branch_name_default} will be used." msgid "Changes affect new repositories only. If not specified, Git's default name %{branch_name_default} will be used."
msgstr "" msgstr ""
msgid "Changes affect new repositories only. If not specified, either the configured application-wide default or Git's default name %{branch_name_default} will be used."
msgstr ""
msgid "Changes are shown as if the %{b_open}source%{b_close} revision was being merged into the %{b_open}target%{b_close} revision." msgid "Changes are shown as if the %{b_open}source%{b_close} revision was being merged into the %{b_open}target%{b_close} revision."
msgstr "" msgstr ""
...@@ -8304,6 +8313,12 @@ msgstr "" ...@@ -8304,6 +8313,12 @@ msgstr ""
msgid "DastProfiles|Are you sure you want to delete this profile?" msgid "DastProfiles|Are you sure you want to delete this profile?"
msgstr "" msgstr ""
msgid "DastProfiles|Authentication"
msgstr ""
msgid "DastProfiles|Authentication URL"
msgstr ""
msgid "DastProfiles|Could not create site validation token. Please refresh the page, or try again later." msgid "DastProfiles|Could not create site validation token. Please refresh the page, or try again later."
msgstr "" msgstr ""
...@@ -8364,6 +8379,9 @@ msgstr "" ...@@ -8364,6 +8379,9 @@ msgstr ""
msgid "DastProfiles|Edit site profile" msgid "DastProfiles|Edit site profile"
msgstr "" msgstr ""
msgid "DastProfiles|Enable Authentication"
msgstr ""
msgid "DastProfiles|Error Details" msgid "DastProfiles|Error Details"
msgstr "" msgstr ""
...@@ -8400,6 +8418,12 @@ msgstr "" ...@@ -8400,6 +8418,12 @@ msgstr ""
msgid "DastProfiles|Passive" msgid "DastProfiles|Passive"
msgstr "" msgstr ""
msgid "DastProfiles|Password"
msgstr ""
msgid "DastProfiles|Password form field"
msgstr ""
msgid "DastProfiles|Please enter a valid timeout value" msgid "DastProfiles|Please enter a valid timeout value"
msgstr "" msgstr ""
...@@ -8469,6 +8493,12 @@ msgstr "" ...@@ -8469,6 +8493,12 @@ msgstr ""
msgid "DastProfiles|Turn on AJAX spider" msgid "DastProfiles|Turn on AJAX spider"
msgstr "" msgstr ""
msgid "DastProfiles|Username"
msgstr ""
msgid "DastProfiles|Username form field"
msgstr ""
msgid "DastProfiles|Validate" msgid "DastProfiles|Validate"
msgstr "" msgstr ""
...@@ -27349,7 +27379,7 @@ msgstr "" ...@@ -27349,7 +27379,7 @@ msgstr ""
msgid "This is the highest peak of users on your installation since the license started." msgid "This is the highest peak of users on your installation since the license started."
msgstr "" msgstr ""
msgid "This is the number of currently active users on your installation, and this is the minimum number you need to purchase when you renew your license." msgid "This is the number of %{billable_users_link_start}billable users%{link_end} on your installation, and this is the minimum number you need to purchase when you renew your license."
msgstr "" msgstr ""
msgid "This is your current session" msgid "This is your current session"
......
...@@ -25,4 +25,21 @@ RSpec.describe 'Group Repository settings' do ...@@ -25,4 +25,21 @@ RSpec.describe 'Group Repository settings' do
let(:entity_type) { 'group' } let(:entity_type) { 'group' }
end end
end end
context 'Default initial branch name' do
before do
visit group_settings_repository_path(group)
end
it 'has the setting section' do
expect(page).to have_css("#js-default-branch-name")
end
it 'renders the correct setting section content' do
within("#js-default-branch-name") do
expect(page).to have_content("Default initial branch name")
expect(page).to have_content("Set the default name of the initial branch when creating new repositories through the user interface.")
end
end
end
end end
...@@ -1149,7 +1149,11 @@ describe('DiffsStoreActions', () => { ...@@ -1149,7 +1149,11 @@ describe('DiffsStoreActions', () => {
file_hash: 'testhash', file_hash: 'testhash',
alternate_viewer: { name: updatedViewerName }, alternate_viewer: { name: updatedViewerName },
}; };
const updatedViewer = { name: updatedViewerName, automaticallyCollapsed: false }; const updatedViewer = {
name: updatedViewerName,
automaticallyCollapsed: false,
manuallyCollapsed: false,
};
const testData = [{ rich_text: 'test' }, { rich_text: 'file2' }]; const testData = [{ rich_text: 'test' }, { rich_text: 'file2' }];
let renamedFile; let renamedFile;
let mock; let mock;
......
import { createLocalVue, mount } from '@vue/test-utils'; import { createLocalVue, mount } from '@vue/test-utils';
import Vuex from 'vuex'; import Vuex from 'vuex';
import { import { GlEmptyState, GlLoadingIcon, GlFormInput, GlPagination, GlDropdown } from '@gitlab/ui';
GlEmptyState,
GlLoadingIcon,
GlFormInput,
GlPagination,
GlDeprecatedDropdown,
} from '@gitlab/ui';
import stubChildren from 'helpers/stub_children'; import stubChildren from 'helpers/stub_children';
import ErrorTrackingList from '~/error_tracking/components/error_tracking_list.vue'; import ErrorTrackingList from '~/error_tracking/components/error_tracking_list.vue';
import ErrorTrackingActions from '~/error_tracking/components/error_tracking_actions.vue'; import ErrorTrackingActions from '~/error_tracking/components/error_tracking_actions.vue';
...@@ -24,19 +18,19 @@ describe('ErrorTrackingList', () => { ...@@ -24,19 +18,19 @@ describe('ErrorTrackingList', () => {
const findErrorListTable = () => wrapper.find('table'); const findErrorListTable = () => wrapper.find('table');
const findErrorListRows = () => wrapper.findAll('tbody tr'); const findErrorListRows = () => wrapper.findAll('tbody tr');
const dropdownsArray = () => wrapper.findAll(GlDeprecatedDropdown); const dropdownsArray = () => wrapper.findAll(GlDropdown);
const findRecentSearchesDropdown = () => const findRecentSearchesDropdown = () =>
dropdownsArray() dropdownsArray()
.at(0) .at(0)
.find(GlDeprecatedDropdown); .find(GlDropdown);
const findStatusFilterDropdown = () => const findStatusFilterDropdown = () =>
dropdownsArray() dropdownsArray()
.at(1) .at(1)
.find(GlDeprecatedDropdown); .find(GlDropdown);
const findSortDropdown = () => const findSortDropdown = () =>
dropdownsArray() dropdownsArray()
.at(2) .at(2)
.find(GlDeprecatedDropdown); .find(GlDropdown);
const findLoadingIcon = () => wrapper.find(GlLoadingIcon); const findLoadingIcon = () => wrapper.find(GlLoadingIcon);
const findPagination = () => wrapper.find(GlPagination); const findPagination = () => wrapper.find(GlPagination);
const findErrorActions = () => wrapper.find(ErrorTrackingActions); const findErrorActions = () => wrapper.find(ErrorTrackingActions);
...@@ -134,8 +128,8 @@ describe('ErrorTrackingList', () => { ...@@ -134,8 +128,8 @@ describe('ErrorTrackingList', () => {
mountComponent({ mountComponent({
stubs: { stubs: {
GlTable: false, GlTable: false,
GlDeprecatedDropdown: false, GlDropdown: false,
GlDeprecatedDropdownItem: false, GlDropdownItem: false,
GlLink: false, GlLink: false,
}, },
}); });
...@@ -205,8 +199,8 @@ describe('ErrorTrackingList', () => { ...@@ -205,8 +199,8 @@ describe('ErrorTrackingList', () => {
mountComponent({ mountComponent({
stubs: { stubs: {
GlTable: false, GlTable: false,
GlDeprecatedDropdown: false, GlDropdown: false,
GlDeprecatedDropdownItem: false, GlDropdownItem: false,
}, },
}); });
}); });
...@@ -325,8 +319,8 @@ describe('ErrorTrackingList', () => { ...@@ -325,8 +319,8 @@ describe('ErrorTrackingList', () => {
beforeEach(() => { beforeEach(() => {
mountComponent({ mountComponent({
stubs: { stubs: {
GlDeprecatedDropdown: false, GlDropdown: false,
GlDeprecatedDropdownItem: false, GlDropdownItem: false,
}, },
}); });
}); });
......
import { pick, clone } from 'lodash'; import { pick, clone } from 'lodash';
import Vuex from 'vuex'; import Vuex from 'vuex';
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { createLocalVue, shallowMount } from '@vue/test-utils';
import { GlDeprecatedDropdown, GlDeprecatedDropdownItem } from '@gitlab/ui'; import { GlDropdown, GlDropdownItem } from '@gitlab/ui';
import ProjectDropdown from '~/error_tracking_settings/components/project_dropdown.vue'; import ProjectDropdown from '~/error_tracking_settings/components/project_dropdown.vue';
import { defaultProps, projectList, staleProject } from '../mock'; import { defaultProps, projectList, staleProject } from '../mock';
...@@ -43,7 +43,7 @@ describe('error tracking settings project dropdown', () => { ...@@ -43,7 +43,7 @@ describe('error tracking settings project dropdown', () => {
describe('empty project list', () => { describe('empty project list', () => {
it('renders the dropdown', () => { it('renders the dropdown', () => {
expect(wrapper.find('#project-dropdown').exists()).toBeTruthy(); expect(wrapper.find('#project-dropdown').exists()).toBeTruthy();
expect(wrapper.find(GlDeprecatedDropdown).exists()).toBeTruthy(); expect(wrapper.find(GlDropdown).exists()).toBeTruthy();
}); });
it('shows helper text', () => { it('shows helper text', () => {
...@@ -58,8 +58,8 @@ describe('error tracking settings project dropdown', () => { ...@@ -58,8 +58,8 @@ describe('error tracking settings project dropdown', () => {
}); });
it('does not contain any dropdown items', () => { it('does not contain any dropdown items', () => {
expect(wrapper.find(GlDeprecatedDropdownItem).exists()).toBeFalsy(); expect(wrapper.find(GlDropdownItem).exists()).toBeFalsy();
expect(wrapper.find(GlDeprecatedDropdown).props('text')).toBe('No projects available'); expect(wrapper.find(GlDropdown).props('text')).toBe('No projects available');
}); });
}); });
...@@ -72,12 +72,12 @@ describe('error tracking settings project dropdown', () => { ...@@ -72,12 +72,12 @@ describe('error tracking settings project dropdown', () => {
it('renders the dropdown', () => { it('renders the dropdown', () => {
expect(wrapper.find('#project-dropdown').exists()).toBeTruthy(); expect(wrapper.find('#project-dropdown').exists()).toBeTruthy();
expect(wrapper.find(GlDeprecatedDropdown).exists()).toBeTruthy(); expect(wrapper.find(GlDropdown).exists()).toBeTruthy();
}); });
it('contains a number of dropdown items', () => { it('contains a number of dropdown items', () => {
expect(wrapper.find(GlDeprecatedDropdownItem).exists()).toBeTruthy(); expect(wrapper.find(GlDropdownItem).exists()).toBeTruthy();
expect(wrapper.findAll(GlDeprecatedDropdownItem).length).toBe(2); expect(wrapper.findAll(GlDropdownItem).length).toBe(2);
}); });
}); });
......
...@@ -33,7 +33,6 @@ describe('ImportProjectsTable', () => { ...@@ -33,7 +33,6 @@ describe('ImportProjectsTable', () => {
const importAllFn = jest.fn(); const importAllFn = jest.fn();
const importAllModalShowFn = jest.fn(); const importAllModalShowFn = jest.fn();
const setPageFn = jest.fn();
const fetchReposFn = jest.fn(); const fetchReposFn = jest.fn();
function createComponent({ function createComponent({
...@@ -60,7 +59,6 @@ describe('ImportProjectsTable', () => { ...@@ -60,7 +59,6 @@ describe('ImportProjectsTable', () => {
stopJobsPolling: jest.fn(), stopJobsPolling: jest.fn(),
clearJobsEtagPoll: jest.fn(), clearJobsEtagPoll: jest.fn(),
setFilter: jest.fn(), setFilter: jest.fn(),
setPage: setPageFn,
}, },
}); });
......
...@@ -16,6 +16,7 @@ import { ...@@ -16,6 +16,7 @@ import {
RECEIVE_NAMESPACES_SUCCESS, RECEIVE_NAMESPACES_SUCCESS,
RECEIVE_NAMESPACES_ERROR, RECEIVE_NAMESPACES_ERROR,
SET_PAGE, SET_PAGE,
SET_FILTER,
} from '~/import_projects/store/mutation_types'; } from '~/import_projects/store/mutation_types';
import actionsFactory from '~/import_projects/store/actions'; import actionsFactory from '~/import_projects/store/actions';
import { getImportTarget } from '~/import_projects/store/getters'; import { getImportTarget } from '~/import_projects/store/getters';
...@@ -40,7 +41,7 @@ const { ...@@ -40,7 +41,7 @@ const {
fetchImport, fetchImport,
fetchJobs, fetchJobs,
fetchNamespaces, fetchNamespaces,
setPage, setFilter,
} = actionsFactory({ } = actionsFactory({
endpoints, endpoints,
}); });
...@@ -359,21 +360,17 @@ describe('import_projects store actions', () => { ...@@ -359,21 +360,17 @@ describe('import_projects store actions', () => {
], ],
); );
}); });
});
describe('setPage', () => { describe('setFilter', () => {
it('dispatches fetchRepos and commits setPage when page number differs from current one', async () => { it('dispatches sets the filter value and dispatches fetchRepos', async () => {
await testAction( await testAction(
setPage, setFilter,
2, 'filteredRepo',
{ ...localState, pageInfo: { page: 1 } }, localState,
[{ type: SET_PAGE, payload: 2 }], [{ type: SET_FILTER, payload: 'filteredRepo' }],
[{ type: 'fetchRepos' }], [{ type: 'fetchRepos' }],
); );
});
it('does not perform any action if page equals to current one', async () => {
await testAction(setPage, 2, { ...localState, pageInfo: { page: 2 } }, [], []);
});
}); });
}); });
}); });
...@@ -91,3 +91,18 @@ export const pipelineData = { ...@@ -91,3 +91,18 @@ export const pipelineData = {
[jobId4]: {}, [jobId4]: {},
}, },
}; };
export const singleStageData = {
stages: [
{
name: 'build',
groups: [
{
name: 'build_1',
jobs: [{ script: 'echo hello', stage: 'build' }],
id: jobId1,
},
],
},
],
};
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { pipelineData } from './mock_data'; import { pipelineData, singleStageData } from './mock_data';
import PipelineGraph from '~/pipelines/components/pipeline_graph/pipeline_graph.vue'; import PipelineGraph from '~/pipelines/components/pipeline_graph/pipeline_graph.vue';
import StagePill from '~/pipelines/components/pipeline_graph/stage_pill.vue'; import StagePill from '~/pipelines/components/pipeline_graph/stage_pill.vue';
import JobPill from '~/pipelines/components/pipeline_graph/job_pill.vue'; import JobPill from '~/pipelines/components/pipeline_graph/job_pill.vue';
...@@ -18,6 +18,8 @@ describe('pipeline graph component', () => { ...@@ -18,6 +18,8 @@ describe('pipeline graph component', () => {
}; };
const findAllStagePills = () => wrapper.findAll(StagePill); const findAllStagePills = () => wrapper.findAll(StagePill);
const findAllStageBackgroundElements = () => wrapper.findAll('[data-testid="stage-background"]');
const findStageBackgroundElementAt = index => findAllStageBackgroundElements().at(index);
const findAllJobPills = () => wrapper.findAll(JobPill); const findAllJobPills = () => wrapper.findAll(JobPill);
afterEach(() => { afterEach(() => {
...@@ -41,12 +43,43 @@ describe('pipeline graph component', () => { ...@@ -41,12 +43,43 @@ describe('pipeline graph component', () => {
beforeEach(() => { beforeEach(() => {
wrapper = createComponent(); wrapper = createComponent();
}); });
it('renders the right number of stage pills', () => { it('renders the right number of stage pills', () => {
const expectedStagesLength = pipelineData.stages.length; const expectedStagesLength = pipelineData.stages.length;
expect(findAllStagePills()).toHaveLength(expectedStagesLength); expect(findAllStagePills()).toHaveLength(expectedStagesLength);
}); });
it.each`
cssClass | expectedState
${'gl-rounded-bottom-left-6'} | ${true}
${'gl-rounded-top-left-6'} | ${true}
${'gl-rounded-top-right-6'} | ${false}
${'gl-rounded-bottom-right-6'} | ${false}
`(
'rounds corner: $class should be $expectedState on the first element',
({ cssClass, expectedState }) => {
const classes = findStageBackgroundElementAt(0).classes();
expect(classes.includes(cssClass)).toBe(expectedState);
},
);
it.each`
cssClass | expectedState
${'gl-rounded-bottom-left-6'} | ${false}
${'gl-rounded-top-left-6'} | ${false}
${'gl-rounded-top-right-6'} | ${true}
${'gl-rounded-bottom-right-6'} | ${true}
`(
'rounds corner: $class should be $expectedState on the last element',
({ cssClass, expectedState }) => {
const classes = findStageBackgroundElementAt(pipelineData.stages.length - 1).classes();
expect(classes.includes(cssClass)).toBe(expectedState);
},
);
it('renders the right number of job pills', () => { it('renders the right number of job pills', () => {
// We count the number of jobs in the mock data // We count the number of jobs in the mock data
const expectedJobsLength = pipelineData.stages.reduce((acc, val) => { const expectedJobsLength = pipelineData.stages.reduce((acc, val) => {
...@@ -56,4 +89,25 @@ describe('pipeline graph component', () => { ...@@ -56,4 +89,25 @@ describe('pipeline graph component', () => {
expect(findAllJobPills()).toHaveLength(expectedJobsLength); expect(findAllJobPills()).toHaveLength(expectedJobsLength);
}); });
}); });
describe('with only one stage', () => {
beforeEach(() => {
wrapper = createComponent({ pipelineData: singleStageData });
});
it.each`
cssClass | expectedState
${'gl-rounded-bottom-left-6'} | ${true}
${'gl-rounded-top-left-6'} | ${true}
${'gl-rounded-top-right-6'} | ${true}
${'gl-rounded-bottom-right-6'} | ${true}
`(
'rounds corner: $class should be $expectedState on the only element',
({ cssClass, expectedState }) => {
const classes = findStageBackgroundElementAt(0).classes();
expect(classes.includes(cssClass)).toBe(expectedState);
},
);
});
}); });
...@@ -40,7 +40,6 @@ exports[`Repository last commit component renders commit widget 1`] = ` ...@@ -40,7 +40,6 @@ exports[`Repository last commit component renders commit widget 1`] = `
> >
Test Test
</gl-link-stub> </gl-link-stub>
authored authored
...@@ -147,7 +146,6 @@ exports[`Repository last commit component renders the signature HTML as returned ...@@ -147,7 +146,6 @@ exports[`Repository last commit component renders the signature HTML as returned
> >
Test Test
</gl-link-stub> </gl-link-stub>
authored authored
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Deploy-ECS.gitlab-ci.yml' do
subject(:template) { Gitlab::Template::GitlabCiYmlTemplate.find('AWS/Deploy-ECS') }
describe 'the created pipeline' do
let_it_be(:user) { create(:admin) }
let(:default_branch) { 'master' }
let(:pipeline_branch) { default_branch }
let(:project) { create(:project, :auto_devops, :custom_repo, files: { 'README.md' => '' }) }
let(:service) { Ci::CreatePipelineService.new(project, user, ref: pipeline_branch ) }
let(:pipeline) { service.execute!(:push) }
let(:build_names) { pipeline.builds.pluck(:name) }
let(:platform_target) { 'ECS' }
before do
create(:ci_variable, project: project, key: 'AUTO_DEVOPS_PLATFORM_TARGET', value: platform_target)
stub_ci_pipeline_yaml_file(template.content)
allow_any_instance_of(Ci::BuildScheduleWorker).to receive(:perform).and_return(true)
allow(project).to receive(:default_branch).and_return(default_branch)
end
shared_examples 'no pipeline yaml error' do
it 'does not have any error' do
expect(pipeline.has_yaml_errors?).to be_falsey
end
end
it_behaves_like 'no pipeline yaml error'
it 'creates the expected jobs' do
expect(build_names).to include('production_ecs')
end
context 'when running a pipeline for a branch' do
let(:pipeline_branch) { 'test_branch' }
before do
project.repository.create_branch(pipeline_branch)
end
it_behaves_like 'no pipeline yaml error'
it 'creates the expected jobs' do
expect(build_names).to include('review_ecs', 'stop_review_ecs')
end
context 'when deploying to ECS Fargate' do
let(:platform_target) { 'FARGATE' }
it 'creates the expected jobs' do
expect(build_names).to include('review_fargate', 'stop_review_fargate')
end
end
end
end
end
...@@ -15,7 +15,8 @@ RSpec.describe Gitlab::GrapeLogging::Formatters::LogrageWithTimestamp do ...@@ -15,7 +15,8 @@ RSpec.describe Gitlab::GrapeLogging::Formatters::LogrageWithTimestamp do
path: '/api/v4/projects/1', path: '/api/v4/projects/1',
params: { params: {
'description': '[FILTERED]', 'description': '[FILTERED]',
'name': 'gitlab test' 'name': 'gitlab test',
'int': 42
}, },
host: 'localhost', host: 'localhost',
remote_ip: '127.0.0.1', remote_ip: '127.0.0.1',
...@@ -44,7 +45,8 @@ RSpec.describe Gitlab::GrapeLogging::Formatters::LogrageWithTimestamp do ...@@ -44,7 +45,8 @@ RSpec.describe Gitlab::GrapeLogging::Formatters::LogrageWithTimestamp do
expect(params).to eq([ expect(params).to eq([
{ 'key' => 'description', 'value' => '[FILTERED]' }, { 'key' => 'description', 'value' => '[FILTERED]' },
{ 'key' => 'name', 'value' => 'gitlab test' } { 'key' => 'name', 'value' => 'gitlab test' },
{ 'key' => 'int', 'value' => 42 }
]) ])
end end
end end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Tracking::Destinations::Snowplow do
let(:emitter) { SnowplowTracker::Emitter.new('localhost', buffer_size: 1) }
let(:tracker) { SnowplowTracker::Tracker.new(emitter, SnowplowTracker::Subject.new, 'namespace', 'app_id') }
before do
stub_application_setting(snowplow_collector_hostname: 'gitfoo.com')
stub_application_setting(snowplow_app_id: '_abc123_')
end
around do |example|
freeze_time { example.run }
end
context 'when snowplow is enabled' do
before do
stub_application_setting(snowplow_enabled: true)
expect(SnowplowTracker::AsyncEmitter)
.to receive(:new)
.with('gitfoo.com', { protocol: 'https' })
.and_return(emitter)
expect(SnowplowTracker::Tracker)
.to receive(:new)
.with(emitter, an_instance_of(SnowplowTracker::Subject), Gitlab::Tracking::SNOWPLOW_NAMESPACE, '_abc123_')
.and_return(tracker)
end
describe '#event' do
it 'sends event to tracker' do
allow(tracker).to receive(:track_struct_event).and_call_original
subject.event('category', 'action', label: 'label', property: 'property', value: 1.5)
expect(tracker)
.to have_received(:track_struct_event)
.with('category', 'action', 'label', 'property', 1.5, nil, (Time.now.to_f * 1000).to_i)
end
end
describe '#self_describing_event' do
it 'sends event to tracker' do
allow(tracker).to receive(:track_self_describing_event).and_call_original
subject.self_describing_event('iglu:com.gitlab/foo/jsonschema/1-0-0', foo: 'bar')
expect(tracker).to have_received(:track_self_describing_event) do |event, context, timestamp|
expect(event.to_json[:schema]).to eq('iglu:com.gitlab/foo/jsonschema/1-0-0')
expect(event.to_json[:data]).to eq(foo: 'bar')
expect(context).to eq(nil)
expect(timestamp).to eq((Time.now.to_f * 1000).to_i)
end
end
end
end
context 'when snowplow is not enabled' do
describe '#event' do
it 'does not send event to tracker' do
expect_any_instance_of(SnowplowTracker::Tracker).not_to receive(:track_struct_event)
subject.event('category', 'action', label: 'label', property: 'property', value: 1.5)
end
end
describe '#self_describing_event' do
it 'does not send event to tracker' do
expect_any_instance_of(SnowplowTracker::Tracker).not_to receive(:track_self_describing_event)
subject.self_describing_event('iglu:com.gitlab/foo/jsonschema/1-0-0', foo: 'bar')
end
end
end
end
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Gitlab::Tracking do RSpec.describe Gitlab::Tracking do
let(:timestamp) { Time.utc(2017, 3, 22) }
before do before do
stub_application_setting(snowplow_enabled: true) stub_application_setting(snowplow_enabled: true)
stub_application_setting(snowplow_collector_hostname: 'gitfoo.com') stub_application_setting(snowplow_collector_hostname: 'gitfoo.com')
stub_application_setting(snowplow_cookie_domain: '.gitfoo.com') stub_application_setting(snowplow_cookie_domain: '.gitfoo.com')
stub_application_setting(snowplow_app_id: '_abc123_') stub_application_setting(snowplow_app_id: '_abc123_')
described_class.instance_variable_set("@snowplow", nil)
end end
describe '.snowplow_options' do describe '.snowplow_options' do
...@@ -35,99 +35,23 @@ RSpec.describe Gitlab::Tracking do ...@@ -35,99 +35,23 @@ RSpec.describe Gitlab::Tracking do
end end
end end
describe 'tracking events' do describe '.event' do
shared_examples 'events not tracked' do it 'delegates to snowplow destination' do
it 'does not track events' do expect_any_instance_of(Gitlab::Tracking::Destinations::Snowplow)
stub_application_setting(snowplow_enabled: false) .to receive(:event)
expect(SnowplowTracker::AsyncEmitter).not_to receive(:new) .with('category', 'action', label: 'label', property: 'property', value: 1.5, context: nil)
expect(SnowplowTracker::Tracker).not_to receive(:new)
track_event
end
end
around do |example|
travel_to(timestamp) { example.run }
end
before do
described_class.instance_variable_set("@snowplow", nil)
end
let(:tracker) { double }
def receive_events
expect(SnowplowTracker::AsyncEmitter).to receive(:new).with(
'gitfoo.com', { protocol: 'https' }
).and_return('_emitter_')
expect(SnowplowTracker::Tracker).to receive(:new).with( described_class.event('category', 'action', label: 'label', property: 'property', value: 1.5)
'_emitter_',
an_instance_of(SnowplowTracker::Subject),
'gl',
'_abc123_'
).and_return(tracker)
end end
end
describe '.event' do describe '.self_describing_event' do
let(:track_event) do it 'delegates to snowplow destination' do
described_class.event('category', 'action', expect_any_instance_of(Gitlab::Tracking::Destinations::Snowplow)
label: '_label_', .to receive(:self_describing_event)
property: '_property_', .with('iglu:com.gitlab/foo/jsonschema/1-0-0', { foo: 'bar' }, context: nil)
value: '_value_',
context: nil
)
end
it_behaves_like 'events not tracked'
it 'can track events' do
receive_events
expect(tracker).to receive(:track_struct_event).with(
'category',
'action',
'_label_',
'_property_',
'_value_',
nil,
(timestamp.to_f * 1000).to_i
)
track_event
end
end
describe '.self_describing_event' do
let(:track_event) do
described_class.self_describing_event('iglu:com.gitlab/example/jsonschema/1-0-2',
{
foo: 'bar',
foo_count: 42
},
context: nil
)
end
it_behaves_like 'events not tracked'
it 'can track self describing events' do
receive_events
expect(SnowplowTracker::SelfDescribingJson).to receive(:new).with(
'iglu:com.gitlab/example/jsonschema/1-0-2',
{
foo: 'bar',
foo_count: 42
}
).and_return('_event_json_')
expect(tracker).to receive(:track_self_describing_event).with(
'_event_json_',
nil,
(timestamp.to_f * 1000).to_i
)
track_event described_class.self_describing_event('iglu:com.gitlab/foo/jsonschema/1-0-0', foo: 'bar')
end
end end
end end
end end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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