Skip to content

Commit

Permalink
Add latest changes from gitlab-org/gitlab@master
Browse files Browse the repository at this point in the history
  • Loading branch information
GitLab Bot committed Jun 11, 2024
1 parent 3803942 commit 6190d24
Show file tree
Hide file tree
Showing 49 changed files with 1,163 additions and 114 deletions.
2 changes: 1 addition & 1 deletion .gitlab/ci/qa-common/variables.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ variables:
QA_OMNIBUS_MR_TESTS: "only-smoke"
# Retry failed specs in separate process
QA_RETRY_FAILED_SPECS: "true"
GITLAB_HELM_CHART_REF: "343ef285e2e06c1d66a7077ba3c251bacad56868" # helm chart ref used by test-on-cng pipeline
GITLAB_HELM_CHART_REF: "d1eaee3922df2bfbdc23b55720965c10eec2b93d" # helm chart ref used by test-on-cng pipeline
15 changes: 4 additions & 11 deletions .gitlab/ci/test-on-cng/main.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ workflow:
rules:
- when: always

.set-suite-status:
after_script:
- |
if [ "$CI_JOB_STATUS" == "failed" ]; then
echo "SUITE_FAILED=true" >> "$QA_SUITE_STATUS_ENV_FILE"
fi
.cng-base:
image: ${REGISTRY_HOST}/${REGISTRY_GROUP}/gitlab-build-images/${BUILD_OS}-${OS_VERSION}-ruby-${RUBY_VERSION}:bundler-${BUNDLER_VERSION}-git-2.36-lfs-2.9-chrome-${CHROME_VERSION}-docker-${DOCKER_VERSION}-kubectl-1.23-helm-3.14-kind-0.20
stage: test
Expand Down Expand Up @@ -72,6 +65,10 @@ workflow:
retry_failed_e2e_rspec_examples
fi
after_script:
- |
if [ "$CI_JOB_STATUS" == "failed" ]; then
echo "SUITE_FAILED=true" >> "$QA_SUITE_STATUS_ENV_FILE"
fi
- cd qa
- bundle exec cng log events --save
- bundle exec cng log pods --save --containers all
Expand Down Expand Up @@ -119,7 +116,6 @@ download-knapsack-report:
# ==========================================
# Test stage
# ==========================================
# Test suite against cng is still MVP, while we gather metrics, do not report failures
cng-instance:
extends: .cng-base
variables:
Expand All @@ -139,9 +135,6 @@ cng-qa-min-redis-version:
redis_version=$(awk -F "=" "/MIN_REDIS_VERSION =/ {print \$2}" $CI_PROJECT_DIR/lib/system_check/app/redis_version_check.rb | sed "s/['\" ]//g")
export EXTRA_DEPLOY_VALUES="--set redis.image.tag=${redis_version%.*}"
- !reference [.cng-base, before_script]
after_script:
- !reference [.set-suite-status, after_script]
- !reference [.cng-base, after_script]

# ==========================================
# Post test stage
Expand Down
2 changes: 2 additions & 0 deletions app/assets/javascripts/pages/projects/wikis/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Wikis from '~/pages/shared/wikis/wikis';
import { mountApplications } from '~/pages/shared/wikis/edit';
import { mountMoreActions } from '~/pages/shared/wikis/more_actions';

mountApplications();
mountMoreActions();

export default new Wikis();
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default {
GlModal: GlModalDirective,
GlTooltip: GlTooltipDirective,
},
inject: ['wikiPath', 'cloneSshUrl', 'cloneHttpUrl', 'cloneLinkClass'],
inject: ['wikiPath', 'cloneSshUrl', 'cloneHttpUrl'],
props: {
showAsDropdownItem: {
type: Boolean,
Expand Down Expand Up @@ -71,7 +71,6 @@ export default {
return {
text: __('Clone repository'),
extraAttrs: {
class: this.cloneLinkClass,
'data-testid': 'page-clone-button',
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default {
directives: {
GlTooltip: GlTooltipDirective,
},
inject: ['newUrl', 'historyUrl', 'templatesUrl', 'cloneLinkClass', 'pagePersisted'],
inject: ['newUrl', 'historyUrl', 'templatesUrl', 'pagePersisted'],
i18n: {
wikiActions: s__('Wiki|Wiki actions'),
},
Expand Down Expand Up @@ -75,7 +75,7 @@ export default {
return !this.isDropdownVisible ? this.$options.i18n.wikiActions : '';
},
showPrintItem() {
return !this.isTemplate;
return !this.isTemplate && this.pagePersisted;
},
},
methods: {
Expand Down
28 changes: 28 additions & 0 deletions app/assets/javascripts/pages/shared/wikis/more_actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Vue from 'vue';
import WikiMoreDropdown from './components/wiki_more_dropdown.vue';

const mountWikiMoreActions = () => {
const el = document.querySelector('#js-vue-wiki-more-actions');

if (!el) return false;
const { pageHeading, cloneSshUrl, cloneHttpUrl, wikiUrl, newUrl, templatesUrl } = el.dataset;

return new Vue({
el,
provide: {
pageHeading,
cloneSshUrl,
cloneHttpUrl,
wikiUrl,
newUrl,
templatesUrl,
},
render(createElement) {
return createElement(WikiMoreDropdown);
},
});
};

export const mountMoreActions = () => {
mountWikiMoreActions();
};
2 changes: 0 additions & 2 deletions app/assets/javascripts/pages/shared/wikis/show.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const mountWikiContentApp = () => {
newUrl,
historyUrl,
templatesUrl,
cloneLinkClass,
wikiUrl,
pagePersisted,
templates,
Expand Down Expand Up @@ -58,7 +57,6 @@ const mountWikiContentApp = () => {
newUrl,
historyUrl,
templatesUrl,
cloneLinkClass,
wikiUrl,
formatOptions: JSON.parse(formatOptions),
csrfToken: csrf.token,
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/pages/shared/wikis/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function isTemplate() {
return window.location.href.includes('/wikis/templates/');
return window.location.href.includes('/wikis/templates');
}
20 changes: 19 additions & 1 deletion app/assets/javascripts/pages/shared/wikis/wikis.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,26 @@ export default class Wikis {
sidebarToggles[i].addEventListener('click', (e) => this.handleToggleSidebar(e));
}

const listToggles = document.querySelectorAll('.js-wiki-list-toggle');
// Store pages visbility in localStorage
const pagesToggle = document.querySelector('.js-wiki-expand-pages-list');
if (pagesToggle) {
if (localStorage.getItem('wiki-sidebar-expanded') === 'expanded') {
pagesToggle.classList.remove('collapsed');
}
pagesToggle.addEventListener('click', (e) => {
pagesToggle.classList.toggle('collapsed');

if (!pagesToggle.classList.contains('collapsed')) {
localStorage.setItem('wiki-sidebar-expanded', 'expanded');
} else {
localStorage.removeItem('wiki-sidebar-expanded');
}

e.stopImmediatePropagation();
});
}

const listToggles = document.querySelectorAll('.js-wiki-list-toggle');
listToggles.forEach((listToggle) => {
listToggle.querySelectorAll('a').forEach((link) => {
link.addEventListener('click', (e) => e.stopPropagation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { GlAvatar, GlAlert, GlLoadingIcon, GlDisclosureDropdownGroup } from '@gitlab/ui';
// eslint-disable-next-line no-restricted-imports
import { mapState, mapGetters } from 'vuex';
import { s__ } from '~/locale';
import { InternalEvents } from '~/tracking';
import SafeHtml from '~/vue_shared/directives/safe_html';
import highlight from '~/lib/utils/highlight';
Expand All @@ -10,6 +11,16 @@ import {
AUTOCOMPLETE_ERROR_MESSAGE,
NO_SEARCH_RESULTS,
} from '~/vue_shared/global_search/constants';
import {
EVENT_CLICK_PROJECT_RESULT_IN_COMMAND_PALETTE,
EVENT_CLICK_GROUP_RESULT_IN_COMMAND_PALETTE,
EVENT_CLICK_MERGE_REQUEST_RESULT_IN_COMMAND_PALETTE,
EVENT_CLICK_ISSUE_RESULT_IN_COMMAND_PALETTE,
EVENT_CLICK_RECENT_ISSUE_RESULT_IN_COMMAND_PALETTE,
EVENT_CLICK_RECENT_EPIC_RESULT_IN_COMMAND_PALETTE,
EVENT_CLICK_RECENT_MERGE_REQUEST_RESULT_IN_COMMAND_PALETTE,
EVENT_CLICK_USER_RESULT_IN_COMMAND_PALETTE,
} from '~/super_sidebar/components/global_search/tracking_constants';
import {
OVERLAY_GOTO,
OVERLAY_PROFILE,
Expand Down Expand Up @@ -40,6 +51,10 @@ export default {
ISSUES_GROUP_TITLE,
PAGES_GROUP_TITLE,
GROUPS_GROUP_TITLE,
MERGE_REQUESTS_GROUP_TITLE: s__('GlobalSearch|Merge Requests'),
RECENT_ISSUES_GROUP_TITLE: s__('GlobalSearch|Recent issues'),
RECENT_EPICS_GROUP_TITLE: s__('GlobalSearch|Recent epics'),
RECENT_MERGE_REQUESTS_GROUP_TITLE: s__('GlobalSearch|Recent merge requests'),
},
components: {
GlAvatar,
Expand Down Expand Up @@ -103,20 +118,39 @@ export default {
}
return text;
},
trackingTypes({ category }) {
switch (category) {
trackingTypes({ name }) {
switch (name) {
case this.$options.i18n.PROJECTS_GROUP_TITLE: {
this.trackEvent(EVENT_CLICK_PROJECT_RESULT_IN_COMMAND_PALETTE);
break;
}
case this.$options.i18n.GROUPS_GROUP_TITLE: {
this.trackEvent('click_group_result_in_command_palette');
this.trackEvent(EVENT_CLICK_GROUP_RESULT_IN_COMMAND_PALETTE);
break;
}
case this.$options.i18n.PROJECTS_GROUP_TITLE: {
this.trackEvent('click_project_result_in_command_palette');
case this.$options.i18n.MERGE_REQUESTS_GROUP_TITLE: {
this.trackEvent(EVENT_CLICK_MERGE_REQUEST_RESULT_IN_COMMAND_PALETTE);
break;
}
case this.$options.i18n.ISSUES_GROUP_TITLE: {
this.trackEvent(EVENT_CLICK_ISSUE_RESULT_IN_COMMAND_PALETTE);
break;
}
case this.$options.i18n.RECENT_ISSUES_GROUP_TITLE: {
this.trackEvent(EVENT_CLICK_RECENT_ISSUE_RESULT_IN_COMMAND_PALETTE);
break;
}
case this.$options.i18n.RECENT_EPICS_GROUP_TITLE: {
this.trackEvent(EVENT_CLICK_RECENT_EPIC_RESULT_IN_COMMAND_PALETTE);
break;
}
case this.$options.i18n.RECENT_MERGE_REQUESTS_GROUP_TITLE: {
this.trackEvent(EVENT_CLICK_RECENT_MERGE_REQUEST_RESULT_IN_COMMAND_PALETTE);
break;
}
default: {
/* empty */
this.trackEvent(EVENT_CLICK_USER_RESULT_IN_COMMAND_PALETTE);
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,16 @@ export const EVENT_CLICK_GROUP_SCOPED_SEARCH_TO_ADVANCED_SEARCH =
'click_group_scoped_search_to_advanced_search';
export const EVENT_CLICK_PROJECT_SCOPED_SEARCH_TO_ADVANCED_SEARCH =
'click_project_scoped_search_to_advanced_search';
export const EVENT_CLICK_PROJECT_RESULT_IN_COMMAND_PALETTE =
'click_project_result_in_command_palette';
export const EVENT_CLICK_GROUP_RESULT_IN_COMMAND_PALETTE = 'click_group_result_in_command_palette';
export const EVENT_CLICK_MERGE_REQUEST_RESULT_IN_COMMAND_PALETTE =
'click_merge_request_result_in_command_palette';
export const EVENT_CLICK_ISSUE_RESULT_IN_COMMAND_PALETTE = 'click_issue_result_in_command_palette';
export const EVENT_CLICK_RECENT_ISSUE_RESULT_IN_COMMAND_PALETTE =
'click_recent_issue_result_in_command_palette';
export const EVENT_CLICK_RECENT_EPIC_RESULT_IN_COMMAND_PALETTE =
'click_recent_epic_result_in_command_palette';
export const EVENT_CLICK_RECENT_MERGE_REQUEST_RESULT_IN_COMMAND_PALETTE =
'click_recent_merge_request_result_in_command_palette';
export const EVENT_CLICK_USER_RESULT_IN_COMMAND_PALETTE = 'click_user_result_in_command_palette';
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default {
return h(
'span',
{
class: ['gl-white-space-pre-wrap', content.style],
class: ['gl-whitespace-pre-wrap', content.style],
},
// Simple "tokenization": Split text in chunks of text
// which alternate between text and urls.
Expand All @@ -36,7 +36,7 @@ export default {
{
attrs: {
href: chunk,
class: 'gl-reset-color! gl-text-decoration-underline',
class: '!gl-text-inherit gl-underline',
rel: 'nofollow noopener noreferrer', // eslint-disable-line @gitlab/require-i18n-strings
target: '_blank',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ export default {
update(data) {
return this.isGroup ? data.group?.projects?.nodes : data.project?.group?.projects?.nodes;
},
result() {
if (this.selectedProject === null) {
this.selectedProjectFullPath = this.fullPath;
}
},
debounce: SEARCH_DEBOUNCE,
},
},
Expand Down Expand Up @@ -156,7 +161,11 @@ export default {
/* Filter for the current group */
storedFrequentProjects = storedFrequentProjects.filter((item) => {
return Boolean(item.webUrl?.slice(1)?.startsWith(this.fullPath));
const groupPath = this.isGroup
? this.fullPath
: this.fullPath.substring(0, this.fullPath.lastIndexOf('/'));
return Boolean(item.webUrl?.slice(1)?.startsWith(groupPath));
});
if (searchTerm) {
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/wikis/_sidebar.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
= render 'shared/alert_info', body: s_('Wiki|The sidebar failed to load. You can reload the page to try again.')

.blocks-container{ class: '!gl-px-3' }
.gl-flex.gl-place-content-between.gl-items-center.gl-pb-3.gl-pr-1{ class: (@sidebar_page ? 'js-wiki-list-toggle wiki-list collapsed gl-pl-0' : 'gl-pl-3') }
.gl-flex.gl-place-content-between.gl-items-center.gl-pb-3.gl-pr-1{ class: (@sidebar_page ? 'js-wiki-expand-pages-list wiki-list collapsed gl-pl-0' : 'gl-pl-3') }
.gl-flex.gl-items-center
- if @sidebar_page
= render Pajamas::ButtonComponent.new(category: :tertiary, size: :small, icon: 'chevron-right', button_options: { class: "js-wiki-list-expand-button wiki-list-expand-button !gl-static gl-mr-2", data: { testid: 'expand-pages-list' } })
Expand Down
14 changes: 11 additions & 3 deletions app/views/shared/wikis/diff.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@
- commit = @diffs.diffable
- add_page_specific_style 'page_bundles/commit_description'

.wiki-page-header.top-area.has-sidebar-toggle.flex-column.flex-lg-row
.wiki-page-header.has-sidebar-toggle.gl-flex.gl-items-center{ class: '!gl-mt-5' }
= wiki_sidebar_toggle_button

%h1.page-title.gl-font-size-h-display.gl-flex-grow-1
%h1.gl-heading-1.gl-grow{ class: '!gl-mb-0' }
= link_to_wiki_page @page
%span.light
·
= _('Changes')

.nav-controls.pb-md-3.pb-lg-0
.nav-controls.gl-flex.gl-gap-3
= link_button_to wiki_page_path(@wiki, @page, action: :history), role: 'button', data: { testid: 'page-history-button' } do
= @page.template? ? s_('Wiki|Template history') : s_('Wiki|Page history')

#js-vue-wiki-more-actions{ data: {
clone_ssh_url: ssh_clone_url_to_repo(@wiki),
clone_http_url: http_clone_url_to_repo(@wiki),
wiki_url: wiki_path(@wiki),
new_url: wiki_path(@wiki, action: :new),
templates_url: wiki_page_path(@wiki, Wiki::TEMPLATES_DIR),
} }

.page-content-header
.header-main-content
%strong= markdown_field(commit, :title)
Expand Down
16 changes: 12 additions & 4 deletions app/views/shared/wikis/history.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@
- wiki_page_title @page, _('History')
- add_page_specific_style 'page_bundles/wiki'

.wiki-page-header.top-area.has-sidebar-toggle.flex-column.flex-lg-row.gl-border-b-0
.wiki-page-header.has-sidebar-toggle.gl-flex.gl-items-center{ class: '!gl-mt-5' }
= wiki_sidebar_toggle_button

%h1.page-title.gl-font-size-h-display
%h1.gl-heading-1.gl-grow{ class: '!gl-mb-0' }
= link_to_wiki_page @page
%span.light
%span.gl-text-secondary
·
= _('History')

#js-vue-wiki-more-actions{ data: {
clone_ssh_url: ssh_clone_url_to_repo(@wiki),
clone_http_url: http_clone_url_to_repo(@wiki),
wiki_url: wiki_path(@wiki),
new_url: wiki_path(@wiki, action: :new),
templates_url: wiki_page_path(@wiki, Wiki::TEMPLATES_DIR),
} }

.prepend-top-default.gl-mb-3
= render Pajamas::CardComponent.new(card_options: { class: 'gl-new-card gl-mt-0 gl-mb-5' }, header_options: { class: 'gl-new-card-header gl-border-b-0' }, body_options: { class: 'gl-new-card-body gl-px-0' }) do |c|
= render Pajamas::CardComponent.new(card_options: { class: 'gl-new-card gl-mb-5' }, header_options: { class: 'gl-new-card-header gl-border-b-0' }, body_options: { class: 'gl-new-card-body gl-px-0' }) do |c|
- c.with_header do
.gl-new-card-title-wrapper.gl-flex-col
%h3.gl-new-card-title
Expand Down
Loading

0 comments on commit 6190d24

Please sign in to comment.