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 Oct 4, 2023
1 parent b68afda commit 49d36ce
Show file tree
Hide file tree
Showing 109 changed files with 1,149 additions and 839 deletions.
1 change: 0 additions & 1 deletion .rubocop_todo/rspec/context_wording.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ RSpec/ContextWording:
- 'ee/spec/features/projects/settings/push_rules_settings_spec.rb'
- 'ee/spec/features/promotion_spec.rb'
- 'ee/spec/features/protected_branches_spec.rb'
- 'ee/spec/features/signup_spec.rb'
- 'ee/spec/features/users/login_spec.rb'
- 'ee/spec/features/users/signup_spec.rb'
- 'ee/spec/finders/approval_rules/group_finder_spec.rb'
Expand Down
1 change: 0 additions & 1 deletion .rubocop_todo/rspec/expect_in_hook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ RSpec/ExpectInHook:
- 'ee/spec/features/projects/feature_flags/user_creates_feature_flag_spec.rb'
- 'ee/spec/features/projects/feature_flags/user_deletes_feature_flag_spec.rb'
- 'ee/spec/features/projects/settings/ee/service_desk_setting_spec.rb'
- 'ee/spec/features/signup_spec.rb'
- 'ee/spec/finders/license_template_finder_spec.rb'
- 'ee/spec/finders/projects/integrations/jira/issues_finder_spec.rb'
- 'ee/spec/finders/template_finder_spec.rb'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default {

if (window.location.hash) {
const hash = getLocationHash();
const lineToMatch = `L${line.lineNumber + 1}`;
const lineToMatch = `L${line.lineNumber}`;

if (hash === lineToMatch) {
applyHashHighlight = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default {
},
mounted() {
const hash = getLocationHash();
const lineToMatch = `L${this.line.lineNumber + 1}`;
const lineToMatch = `L${this.line.lineNumber}`;
if (hash === lineToMatch) {
this.applyHashHighlight = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export default {
render(h, { props }) {
const { lineNumber, path } = props;
const parsedLineNumber = lineNumber + 1;
const lineId = `L${parsedLineNumber}`;
const lineId = `L${lineNumber}`;
const lineHref = `${path}#${lineId}`;
return h(
Expand All @@ -27,7 +26,7 @@ export default {
href: lineHref,
},
},
parsedLineNumber,
lineNumber,
);
},
};
Expand Down
81 changes: 38 additions & 43 deletions app/assets/javascripts/ci/job_details/store/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,17 @@ export const parseLine = (line = {}, lineNumber) => ({
* @param Number lineNumber
*/
export const parseHeaderLine = (line = {}, lineNumber, hash) => {
let isClosed = parseBoolean(line.section_options?.collapsed);

// if a hash is present in the URL then we ensure
// all sections are visible so we can scroll to the hash
// in the DOM
if (hash) {
return {
isClosed: false,
isHeader: true,
line: parseLine(line, lineNumber),
lines: [],
};
isClosed = false;
}

return {
isClosed: parseBoolean(line.section_options?.collapsed),
isClosed,
isHeader: true,
line: parseLine(line, lineNumber),
lines: [],
Expand Down Expand Up @@ -80,27 +77,28 @@ export const isCollapsibleSection = (acc = [], last = {}, section = {}) =>
section.section === last.line.section;

/**
* Returns the lineNumber of the last line in
* a parsed log
* Returns the next line number in the parsed log
*
* @param Array acc
* @returns Number
*/
export const getIncrementalLineNumber = (acc) => {
let lineNumberValue;
const lastIndex = acc.length - 1;
const lastElement = acc[lastIndex];
export const getNextLineNumber = (acc) => {
if (!acc?.length) {
return 1;
}

const lastElement = acc[acc.length - 1];
const nestedLines = lastElement.lines;

if (lastElement.isHeader && !nestedLines.length && lastElement.line) {
lineNumberValue = lastElement.line.lineNumber;
} else if (lastElement.isHeader && nestedLines.length) {
lineNumberValue = nestedLines[nestedLines.length - 1].lineNumber;
} else {
lineNumberValue = lastElement.lineNumber;
return lastElement.line.lineNumber + 1;
}

return lineNumberValue === 0 ? 1 : lineNumberValue + 1;
if (lastElement.isHeader && nestedLines.length) {
return nestedLines[nestedLines.length - 1].lineNumber + 1;
}

return lastElement.lineNumber + 1;
};

/**
Expand All @@ -119,31 +117,28 @@ export const getIncrementalLineNumber = (acc) => {
* @returns Array parsed log lines
*/
export const logLinesParser = (lines = [], prevLogLines = [], hash = '') =>
lines.reduce(
(acc, line, index) => {
const lineNumber = acc.length > 0 ? getIncrementalLineNumber(acc) : index;

const last = acc[acc.length - 1];

// If the object is an header, we parse it into another structure
if (line.section_header) {
acc.push(parseHeaderLine(line, lineNumber, hash));
} else if (isCollapsibleSection(acc, last, line)) {
// if the object belongs to a nested section, we append it to the new `lines` array of the
// previously formatted header
last.lines.push(parseLine(line, lineNumber));
} else if (line.section_duration) {
// if the line has section_duration, we look for the correct header to add it
addDurationToHeader(acc, line);
} else {
// otherwise it's a regular line
acc.push(parseLine(line, lineNumber));
}
lines.reduce((acc, line) => {
const lineNumber = getNextLineNumber(acc);

const last = acc[acc.length - 1];

// If the object is an header, we parse it into another structure
if (line.section_header) {
acc.push(parseHeaderLine(line, lineNumber, hash));
} else if (isCollapsibleSection(acc, last, line)) {
// if the object belongs to a nested section, we append it to the new `lines` array of the
// previously formatted header
last.lines.push(parseLine(line, lineNumber));
} else if (line.section_duration) {
// if the line has section_duration, we look for the correct header to add it
addDurationToHeader(acc, line);
} else {
// otherwise it's a regular line
acc.push(parseLine(line, lineNumber));
}

return acc;
},
[...prevLogLines],
);
return acc;
}, prevLogLines);

/**
* Finds the repeated offset, removes the old one
Expand Down
14 changes: 12 additions & 2 deletions app/assets/javascripts/issues/show/components/description.vue
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,12 @@ export default {
},
},
update: (cache, { data: { workItemCreate } }) =>
addHierarchyChild(cache, this.fullPath, String(this.issueIid), workItemCreate.workItem),
addHierarchyChild({
cache,
fullPath: this.fullPath,
iid: String(this.issueIid),
workItem: workItemCreate.workItem,
}),
});

const { workItem, errors } = data.workItemCreate;
Expand Down Expand Up @@ -392,7 +397,12 @@ export default {
mutation: deleteWorkItemMutation,
variables: { input: { id } },
update: (cache) =>
removeHierarchyChild(cache, this.fullPath, String(this.issueIid), { id }),
removeHierarchyChild({
cache,
fullPath: this.fullPath,
iid: String(this.issueIid),
workItem: { id },
}),
});

if (data.workItemDelete.errors?.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ export const I18N_OAUTH_FAILED_MESSAGE = s__(
export const INTEGRATIONS_DOC_LINK = helpPagePath('integration/jira/development_panel', {
anchor: 'use-the-integration',
});
export const OAUTH_SELF_MANAGED_DOC_LINK = helpPagePath('integration/jira/connect-app', {
anchor: 'connect-the-gitlab-for-jira-cloud-app-for-self-managed-instances',
export const OAUTH_SELF_MANAGED_DOC_LINK = helpPagePath('administration/settings/jira_cloud_app', {
anchor: 'set-up-oauth-authentication',
});
export const FAILED_TO_UPDATE_DOC_LINK = helpPagePath('integration/jira/connect-app', {
anchor: 'failed-to-update-the-gitlab-instance-for-self-managed-instances',
export const FAILED_TO_UPDATE_DOC_LINK = helpPagePath('administration/settings/jira_cloud_app', {
anchor: 'failed-to-update-the-gitlab-instance',
});

export const GITLAB_COM_BASE_PATH = 'https://gitlab.com';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default {

<template>
<gl-disclosure-dropdown-item
data-qa-selector="delete_member_dropdown_item"
data-testid="delete-member-dropdown-item"
@action="showRemoveMemberModal(modalData)"
>
<template #list-item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export default {
no-caret
placement="right"
data-testid="user-action-dropdown"
data-qa-selector="user_action_dropdown"
>
<disable-two-factor-dropdown-item
v-if="permissions.canDisableTwoFactor"
Expand Down
4 changes: 4 additions & 0 deletions app/assets/javascripts/pages/groups/work_items/show/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { WORKSPACE_GROUP } from '~/issues/constants';
import { initWorkItemsRoot } from '~/work_items';

initWorkItemsRoot(WORKSPACE_GROUP);
2 changes: 1 addition & 1 deletion app/assets/javascripts/pages/projects/work_items/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { initWorkItemsRoot } from '~/work_items/index';
import { initWorkItemsRoot } from '~/work_items';

initWorkItemsRoot();
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export default {
class="table tree-table"
:class="{ 'gl-table-layout-fixed': !showParentRow }"
aria-live="polite"
data-qa-selector="file_tree_table"
data-testid="file-tree-table"
>
<table-header v-once />
<tbody>
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/repository/components/table/row.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export default {
'is-submodule': isSubmodule,
}"
class="tree-item-link str-truncated"
data-qa-selector="file_name_link"
data-testid="file-name-link"
>
<file-icon
:file-name="fullPath"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default {
item.extraAttrs = {
...USER_MENU_TRACKING_DEFAULTS,
'data-track-label': 'user_profile',
'data-testid': 'user_profile_link',
'data-testid': 'user-profile-link',
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ASC } from '~/notes/constants';
import { __ } from '~/locale';
import { clearDraft } from '~/lib/utils/autosave';
import createNoteMutation from '../../graphql/notes/create_work_item_note.mutation.graphql';
import groupWorkItemByIidQuery from '../../graphql/group_work_item_by_iid.query.graphql';
import workItemByIidQuery from '../../graphql/work_item_by_iid.query.graphql';
import { TRACKING_CATEGORY_SHOW, i18n } from '../../constants';
import WorkItemNoteSignedOut from './work_item_note_signed_out.vue';
Expand All @@ -21,7 +22,7 @@ export default {
WorkItemCommentForm,
},
mixins: [Tracking.mixin()],
inject: ['fullPath'],
inject: ['fullPath', 'isGroup'],
props: {
workItemId: {
type: String,
Expand Down Expand Up @@ -90,7 +91,9 @@ export default {
},
apollo: {
workItem: {
query: workItemByIidQuery,
query() {
return this.isGroup ? groupWorkItemByIidQuery : workItemByIidQuery;
},
variables() {
return {
fullPath: this.fullPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@ import { GlAvatarLink, GlAvatar } from '@gitlab/ui';
import * as Sentry from '@sentry/browser';
import toast from '~/vue_shared/plugins/global_toast';
import { __ } from '~/locale';
import { i18n, TRACKING_CATEGORY_SHOW } from '~/work_items/constants';
import Tracking from '~/tracking';
import { updateDraft, clearDraft } from '~/lib/utils/autosave';
import { renderMarkdown } from '~/notes/utils';
import { getLocationHash } from '~/lib/utils/url_utility';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
import EditedAt from '~/issues/show/components/edited.vue';
import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue';
import NoteBody from '~/work_items/components/notes/work_item_note_body.vue';
import NoteHeader from '~/notes/components/note_header.vue';
import NoteActions from '~/work_items/components/notes/work_item_note_actions.vue';
import updateWorkItemMutation from '~/work_items/graphql/update_work_item.mutation.graphql';
import { i18n, TRACKING_CATEGORY_SHOW } from '../../constants';
import groupWorkItemByIidQuery from '../../graphql/group_work_item_by_iid.query.graphql';
import updateWorkItemMutation from '../../graphql/update_work_item.mutation.graphql';
import updateWorkItemNoteMutation from '../../graphql/notes/update_work_item_note.mutation.graphql';
import workItemByIidQuery from '../../graphql/work_item_by_iid.query.graphql';
import { isAssigneesWidget } from '../../utils';
import WorkItemCommentForm from './work_item_comment_form.vue';
import NoteActions from './work_item_note_actions.vue';
import WorkItemNoteAwardsList from './work_item_note_awards_list.vue';
import NoteBody from './work_item_note_body.vue';
export default {
name: 'WorkItemNoteThread',
Expand All @@ -35,7 +36,7 @@ export default {
EditedAt,
},
mixins: [Tracking.mixin()],
inject: ['fullPath'],
inject: ['fullPath', 'isGroup'],
props: {
workItemId: {
type: String,
Expand Down Expand Up @@ -169,7 +170,9 @@ export default {
},
apollo: {
workItem: {
query: workItemByIidQuery,
query() {
return this.isGroup ? groupWorkItemByIidQuery : workItemByIidQuery;
},
variables() {
return {
fullPath: this.fullPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import { __, s__ } from '~/locale';
import Tracking from '~/tracking';
import toast from '~/vue_shared/plugins/global_toast';
import { isLoggedIn } from '~/lib/utils/common_utils';
import workItemByIidQuery from '~/work_items/graphql/work_item_by_iid.query.graphql';
import groupWorkItemByIidQuery from '../graphql/group_work_item_by_iid.query.graphql';
import workItemByIidQuery from '../graphql/work_item_by_iid.query.graphql';
import {
sprintfWorkItem,
Expand Down Expand Up @@ -70,7 +71,7 @@ export default {
copyCreateNoteEmailTestId: TEST_ID_COPY_CREATE_NOTE_EMAIL_ACTION,
deleteActionTestId: TEST_ID_DELETE_ACTION,
promoteActionTestId: TEST_ID_PROMOTE_ACTION,
inject: ['fullPath'],
inject: ['fullPath', 'isGroup'],
props: {
workItemId: {
type: String,
Expand Down Expand Up @@ -256,7 +257,7 @@ export default {
},
updateWorkItemNotificationsWidgetCache({ cache, issue }) {
const query = {
query: workItemByIidQuery,
query: this.isGroup ? groupWorkItemByIidQuery : workItemByIidQuery,
variables: { fullPath: this.fullPath, iid: this.workItemIid },
};
// Read the work item object
Expand Down
Loading

0 comments on commit 49d36ce

Please sign in to comment.