From f9fe7cda4bdbc477d8d76e5def4023f7d03bab46 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 4 Dec 2020 09:09:36 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- GITALY_SERVER_VERSION | 2 +- .../boards/components/board_assignee_dropdown.vue | 2 +- .../boards/components/boards_selector.vue | 4 +- .../sidebar/board_sidebar_milestone_select.vue | 2 +- .../boards/graphql/board.fragment.graphql | 4 + .../boards/graphql/board.mutation.graphql | 11 ++ .../boards/graphql/board_labels.query.graphql | 23 +++ .../boards/graphql/board_list.fragment.graphql | 5 + .../graphql/board_list_create.mutation.graphql | 24 +++ .../graphql/board_list_destroy.mutation.graphql | 5 + .../graphql/board_list_shared.fragment.graphql | 16 ++ .../graphql/board_list_update.mutation.graphql | 10 + .../boards/graphql/board_lists.query.graphql | 28 +++ .../boards/graphql/group_boards.query.graphql | 13 ++ .../boards/graphql/group_milestones.query.graphql | 17 ++ .../boards/graphql/issue.fragment.graphql | 31 ++++ .../boards/graphql/issue_create.mutation.graphql | 10 + .../graphql/issue_move_list.mutation.graphql | 28 +++ .../graphql/issue_set_due_date.mutation.graphql | 8 + .../graphql/issue_set_labels.mutation.graphql | 15 ++ .../graphql/issue_set_milestone.mutation.graphql | 12 ++ .../issue_set_subscription.mutation.graphql | 8 + .../boards/graphql/lists_issues.query.graphql | 55 ++++++ .../issue_set_subscription.mutation.graphql | 8 - .../boards/graphql/project_boards.query.graphql | 13 ++ .../boards/graphql/users_search.query.graphql | 11 ++ .../boards/queries/board.fragment.graphql | 4 - .../boards/queries/board.mutation.graphql | 11 -- .../boards/queries/board_labels.query.graphql | 23 --- .../boards/queries/board_list.fragment.graphql | 5 - .../queries/board_list_create.mutation.graphql | 24 --- .../queries/board_list_destroy.mutation.graphql | 5 - .../queries/board_list_shared.fragment.graphql | 16 -- .../queries/board_list_update.mutation.graphql | 10 - .../boards/queries/board_lists.query.graphql | 28 --- .../boards/queries/group_boards.query.graphql | 13 -- .../boards/queries/group_milestones.query.graphql | 17 -- .../boards/queries/issue.fragment.graphql | 31 ---- .../boards/queries/issue_create.mutation.graphql | 10 - .../queries/issue_move_list.mutation.graphql | 28 --- .../queries/issue_set_due_date.mutation.graphql | 8 - .../queries/issue_set_labels.mutation.graphql | 15 -- .../queries/issue_set_milestone.mutation.graphql | 12 -- .../boards/queries/lists_issues.query.graphql | 55 ------ .../boards/queries/project_boards.query.graphql | 13 -- .../boards/queries/users_search.query.graphql | 11 -- app/assets/javascripts/boards/stores/actions.js | 34 ++-- .../javascripts/boards/stores/boards_store.js | 2 +- app/assets/javascripts/boards/stores/getters.js | 1 - .../javascripts/diffs/components/diff_file.vue | 2 +- .../diffs/components/diff_file_header.vue | 2 +- app/assets/javascripts/diffs/diff_file.js | 61 ------- app/assets/javascripts/diffs/store/actions.js | 2 +- app/assets/javascripts/diffs/store/utils.js | 2 +- app/assets/javascripts/diffs/utils/diff_file.js | 61 +++++++ .../incidents_settings/components/alerts_form.vue | 4 +- .../components/pagerduty_form.vue | 31 ++-- .../javascripts/incidents_settings/constants.js | 16 +- .../edit/components/integration_form.vue | 5 + .../notes/components/diff_with_note.vue | 2 +- .../sidebar/components/labels/sidebar_labels.vue | 2 +- .../javascripts/whats_new/components/app.vue | 130 +++++++------ .../javascripts/whats_new/components/feature.vue | 64 +++++++ app/assets/javascripts/whats_new/index.js | 8 +- app/assets/javascripts/whats_new/store/actions.js | 3 +- app/assets/stylesheets/components/whats_new.scss | 26 +++ .../stylesheets/page_bundles/oncall_schedules.scss | 112 ++++++++++++ app/controllers/whats_new_controller.rb | 27 ++- app/helpers/whats_new_helper.rb | 6 +- app/models/release_highlight.rb | 38 +++- app/models/service.rb | 3 +- app/services/groups/transfer_service.rb | 13 ++ app/services/projects/transfer_service.rb | 11 +- app/views/layouts/header/_default.html.haml | 2 +- ...23-transfer-project-group-with-integrations.yml | 5 + ...tton-should-have-a-different-color-on-press.yml | 5 + .../unreleased/tr-update-issue-to-incident.yml | 5 + doc/ci/quick_start/img/runners_activated.png | Bin 104545 -> 0 bytes lib/gitlab/experimentation.rb | 5 +- locale/gitlab.pot | 33 ++-- .../projects/settings/operations_settings_spec.rb | 2 +- .../components/board_assignee_dropdown_spec.js | 2 +- spec/frontend/boards/stores/actions_spec.js | 4 +- spec/frontend/boards/stores/getters_spec.js | 18 -- spec/frontend/diffs/diff_file_spec.js | 60 ------ spec/frontend/diffs/utils/diff_file_spec.js | 60 ++++++ .../__snapshots__/alerts_form_spec.js.snap | 6 +- .../__snapshots__/pagerduty_form_spec.js.snap | 14 +- spec/frontend/sidebar/sidebar_labels_spec.js | 2 +- spec/frontend/whats_new/components/app_spec.js | 201 ++++++++++++++------- spec/frontend/whats_new/store/actions_spec.js | 17 ++ spec/helpers/whats_new_helper_spec.rb | 14 +- spec/models/release_highlight_spec.rb | 96 ++++++---- spec/requests/whats_new_controller_spec.rb | 22 ++- spec/services/groups/transfer_service_spec.rb | 71 +++++--- spec/services/projects/transfer_service_spec.rb | 27 ++- 96 files changed, 1244 insertions(+), 799 deletions(-) create mode 100644 app/assets/javascripts/boards/graphql/board.fragment.graphql create mode 100644 app/assets/javascripts/boards/graphql/board.mutation.graphql create mode 100644 app/assets/javascripts/boards/graphql/board_labels.query.graphql create mode 100644 app/assets/javascripts/boards/graphql/board_list.fragment.graphql create mode 100644 app/assets/javascripts/boards/graphql/board_list_create.mutation.graphql create mode 100644 app/assets/javascripts/boards/graphql/board_list_destroy.mutation.graphql create mode 100644 app/assets/javascripts/boards/graphql/board_list_shared.fragment.graphql create mode 100644 app/assets/javascripts/boards/graphql/board_list_update.mutation.graphql create mode 100644 app/assets/javascripts/boards/graphql/board_lists.query.graphql create mode 100644 app/assets/javascripts/boards/graphql/group_boards.query.graphql create mode 100644 app/assets/javascripts/boards/graphql/group_milestones.query.graphql create mode 100644 app/assets/javascripts/boards/graphql/issue.fragment.graphql create mode 100644 app/assets/javascripts/boards/graphql/issue_create.mutation.graphql create mode 100644 app/assets/javascripts/boards/graphql/issue_move_list.mutation.graphql create mode 100644 app/assets/javascripts/boards/graphql/issue_set_due_date.mutation.graphql create mode 100644 app/assets/javascripts/boards/graphql/issue_set_labels.mutation.graphql create mode 100644 app/assets/javascripts/boards/graphql/issue_set_milestone.mutation.graphql create mode 100644 app/assets/javascripts/boards/graphql/issue_set_subscription.mutation.graphql create mode 100644 app/assets/javascripts/boards/graphql/lists_issues.query.graphql delete mode 100644 app/assets/javascripts/boards/graphql/mutations/issue_set_subscription.mutation.graphql create mode 100644 app/assets/javascripts/boards/graphql/project_boards.query.graphql create mode 100644 app/assets/javascripts/boards/graphql/users_search.query.graphql delete mode 100644 app/assets/javascripts/boards/queries/board.fragment.graphql delete mode 100644 app/assets/javascripts/boards/queries/board.mutation.graphql delete mode 100644 app/assets/javascripts/boards/queries/board_labels.query.graphql delete mode 100644 app/assets/javascripts/boards/queries/board_list.fragment.graphql delete mode 100644 app/assets/javascripts/boards/queries/board_list_create.mutation.graphql delete mode 100644 app/assets/javascripts/boards/queries/board_list_destroy.mutation.graphql delete mode 100644 app/assets/javascripts/boards/queries/board_list_shared.fragment.graphql delete mode 100644 app/assets/javascripts/boards/queries/board_list_update.mutation.graphql delete mode 100644 app/assets/javascripts/boards/queries/board_lists.query.graphql delete mode 100644 app/assets/javascripts/boards/queries/group_boards.query.graphql delete mode 100644 app/assets/javascripts/boards/queries/group_milestones.query.graphql delete mode 100644 app/assets/javascripts/boards/queries/issue.fragment.graphql delete mode 100644 app/assets/javascripts/boards/queries/issue_create.mutation.graphql delete mode 100644 app/assets/javascripts/boards/queries/issue_move_list.mutation.graphql delete mode 100644 app/assets/javascripts/boards/queries/issue_set_due_date.mutation.graphql delete mode 100644 app/assets/javascripts/boards/queries/issue_set_labels.mutation.graphql delete mode 100644 app/assets/javascripts/boards/queries/issue_set_milestone.mutation.graphql delete mode 100644 app/assets/javascripts/boards/queries/lists_issues.query.graphql delete mode 100644 app/assets/javascripts/boards/queries/project_boards.query.graphql delete mode 100644 app/assets/javascripts/boards/queries/users_search.query.graphql delete mode 100644 app/assets/javascripts/diffs/diff_file.js create mode 100644 app/assets/javascripts/diffs/utils/diff_file.js create mode 100644 app/assets/javascripts/whats_new/components/feature.vue create mode 100644 changelogs/unreleased/255923-transfer-project-group-with-integrations.yml create mode 100644 changelogs/unreleased/273270-save-button-should-have-a-different-color-on-press.yml create mode 100644 changelogs/unreleased/tr-update-issue-to-incident.yml delete mode 100644 doc/ci/quick_start/img/runners_activated.png delete mode 100644 spec/frontend/diffs/diff_file_spec.js create mode 100644 spec/frontend/diffs/utils/diff_file_spec.js diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 43c5a59ef08..f14b86c836c 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -add5f3dd182c99b4d9e1cf93e45fec1214c00659 +9fd57cbd0b63d448f9a9555b53f065ee1c110199 diff --git a/app/assets/javascripts/boards/components/board_assignee_dropdown.vue b/app/assets/javascripts/boards/components/board_assignee_dropdown.vue index b4a9d34e738..76b468a3402 100644 --- a/app/assets/javascripts/boards/components/board_assignee_dropdown.vue +++ b/app/assets/javascripts/boards/components/board_assignee_dropdown.vue @@ -14,7 +14,7 @@ import IssuableAssignees from '~/sidebar/components/assignees/issuable_assignees import BoardEditableItem from '~/boards/components/sidebar/board_editable_item.vue'; import MultiSelectDropdown from '~/vue_shared/components/sidebar/multiselect_dropdown.vue'; import getIssueParticipants from '~/vue_shared/components/sidebar/queries/getIssueParticipants.query.graphql'; -import searchUsers from '~/boards/queries/users_search.query.graphql'; +import searchUsers from '~/boards/graphql/users_search.query.graphql'; export default { noSearchDelay: 0, diff --git a/app/assets/javascripts/boards/components/boards_selector.vue b/app/assets/javascripts/boards/components/boards_selector.vue index 2daec46e64b..435ea3f8b7a 100644 --- a/app/assets/javascripts/boards/components/boards_selector.vue +++ b/app/assets/javascripts/boards/components/boards_selector.vue @@ -12,8 +12,8 @@ import { import httpStatusCodes from '~/lib/utils/http_status'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; -import projectQuery from '../queries/project_boards.query.graphql'; -import groupQuery from '../queries/group_boards.query.graphql'; +import projectQuery from '../graphql/project_boards.query.graphql'; +import groupQuery from '../graphql/group_boards.query.graphql'; import boardsStore from '../stores/boards_store'; import BoardForm from './board_form.vue'; diff --git a/app/assets/javascripts/boards/components/sidebar/board_sidebar_milestone_select.vue b/app/assets/javascripts/boards/components/sidebar/board_sidebar_milestone_select.vue index f7b7fd3f61f..78c3f8acc62 100644 --- a/app/assets/javascripts/boards/components/sidebar/board_sidebar_milestone_select.vue +++ b/app/assets/javascripts/boards/components/sidebar/board_sidebar_milestone_select.vue @@ -10,7 +10,7 @@ import { } from '@gitlab/ui'; import { fetchPolicies } from '~/lib/graphql'; import BoardEditableItem from '~/boards/components/sidebar/board_editable_item.vue'; -import groupMilestones from '../../queries/group_milestones.query.graphql'; +import groupMilestones from '../../graphql/group_milestones.query.graphql'; import createFlash from '~/flash'; import { __, s__ } from '~/locale'; diff --git a/app/assets/javascripts/boards/graphql/board.fragment.graphql b/app/assets/javascripts/boards/graphql/board.fragment.graphql new file mode 100644 index 00000000000..872a4c4afbc --- /dev/null +++ b/app/assets/javascripts/boards/graphql/board.fragment.graphql @@ -0,0 +1,4 @@ +fragment BoardFragment on Board { + id + name +} diff --git a/app/assets/javascripts/boards/graphql/board.mutation.graphql b/app/assets/javascripts/boards/graphql/board.mutation.graphql new file mode 100644 index 00000000000..ef2b81a7939 --- /dev/null +++ b/app/assets/javascripts/boards/graphql/board.mutation.graphql @@ -0,0 +1,11 @@ +mutation UpdateBoard($id: ID!, $hideClosedList: Boolean, $hideBacklogList: Boolean) { + updateBoard( + input: { id: $id, hideClosedList: $hideClosedList, hideBacklogList: $hideBacklogList } + ) { + board { + id + hideClosedList + hideBacklogList + } + } +} diff --git a/app/assets/javascripts/boards/graphql/board_labels.query.graphql b/app/assets/javascripts/boards/graphql/board_labels.query.graphql new file mode 100644 index 00000000000..42a94419a97 --- /dev/null +++ b/app/assets/javascripts/boards/graphql/board_labels.query.graphql @@ -0,0 +1,23 @@ +#import "~/graphql_shared/fragments/label.fragment.graphql" + +query BoardLabels( + $fullPath: ID! + $searchTerm: String + $isGroup: Boolean = false + $isProject: Boolean = false +) { + group(fullPath: $fullPath) @include(if: $isGroup) { + labels(searchTerm: $searchTerm) { + nodes { + ...Label + } + } + } + project(fullPath: $fullPath) @include(if: $isProject) { + labels(searchTerm: $searchTerm) { + nodes { + ...Label + } + } + } +} diff --git a/app/assets/javascripts/boards/graphql/board_list.fragment.graphql b/app/assets/javascripts/boards/graphql/board_list.fragment.graphql new file mode 100644 index 00000000000..bbf3314377e --- /dev/null +++ b/app/assets/javascripts/boards/graphql/board_list.fragment.graphql @@ -0,0 +1,5 @@ +#import "./board_list_shared.fragment.graphql" + +fragment BoardListFragment on BoardList { + ...BoardListShared +} diff --git a/app/assets/javascripts/boards/graphql/board_list_create.mutation.graphql b/app/assets/javascripts/boards/graphql/board_list_create.mutation.graphql new file mode 100644 index 00000000000..f78a21baa7f --- /dev/null +++ b/app/assets/javascripts/boards/graphql/board_list_create.mutation.graphql @@ -0,0 +1,24 @@ +#import "ee_else_ce/boards/graphql/board_list.fragment.graphql" + +mutation CreateBoardList( + $boardId: BoardID! + $backlog: Boolean + $labelId: LabelID + $milestoneId: MilestoneID + $assigneeId: UserID +) { + boardListCreate( + input: { + boardId: $boardId + backlog: $backlog + labelId: $labelId + milestoneId: $milestoneId + assigneeId: $assigneeId + } + ) { + list { + ...BoardListFragment + } + errors + } +} diff --git a/app/assets/javascripts/boards/graphql/board_list_destroy.mutation.graphql b/app/assets/javascripts/boards/graphql/board_list_destroy.mutation.graphql new file mode 100644 index 00000000000..ef3fd36e980 --- /dev/null +++ b/app/assets/javascripts/boards/graphql/board_list_destroy.mutation.graphql @@ -0,0 +1,5 @@ +mutation DestroyBoardList($listId: ID!) { + destroyBoardList(input: { listId: $listId }) { + errors + } +} diff --git a/app/assets/javascripts/boards/graphql/board_list_shared.fragment.graphql b/app/assets/javascripts/boards/graphql/board_list_shared.fragment.graphql new file mode 100644 index 00000000000..d85b736720b --- /dev/null +++ b/app/assets/javascripts/boards/graphql/board_list_shared.fragment.graphql @@ -0,0 +1,16 @@ +fragment BoardListShared on BoardList { + id + title + position + listType + collapsed + issuesCount + label { + id + title + color + textColor + description + descriptionHtml + } +} diff --git a/app/assets/javascripts/boards/graphql/board_list_update.mutation.graphql b/app/assets/javascripts/boards/graphql/board_list_update.mutation.graphql new file mode 100644 index 00000000000..b474c9acb93 --- /dev/null +++ b/app/assets/javascripts/boards/graphql/board_list_update.mutation.graphql @@ -0,0 +1,10 @@ +#import "./board_list.fragment.graphql" + +mutation UpdateBoardList($listId: ID!, $position: Int, $collapsed: Boolean) { + updateBoardList(input: { listId: $listId, position: $position, collapsed: $collapsed }) { + list { + ...BoardListFragment + } + errors + } +} diff --git a/app/assets/javascripts/boards/graphql/board_lists.query.graphql b/app/assets/javascripts/boards/graphql/board_lists.query.graphql new file mode 100644 index 00000000000..eb922f162f8 --- /dev/null +++ b/app/assets/javascripts/boards/graphql/board_lists.query.graphql @@ -0,0 +1,28 @@ +#import "ee_else_ce/boards/graphql/board_list.fragment.graphql" + +query ListIssues( + $fullPath: ID! + $boardId: ID! + $filters: BoardIssueInput + $isGroup: Boolean = false + $isProject: Boolean = false +) { + group(fullPath: $fullPath) @include(if: $isGroup) { + board(id: $boardId) { + lists(issueFilters: $filters) { + nodes { + ...BoardListFragment + } + } + } + } + project(fullPath: $fullPath) @include(if: $isProject) { + board(id: $boardId) { + lists(issueFilters: $filters) { + nodes { + ...BoardListFragment + } + } + } + } +} diff --git a/app/assets/javascripts/boards/graphql/group_boards.query.graphql b/app/assets/javascripts/boards/graphql/group_boards.query.graphql new file mode 100644 index 00000000000..feafd6ae10d --- /dev/null +++ b/app/assets/javascripts/boards/graphql/group_boards.query.graphql @@ -0,0 +1,13 @@ +#import "ee_else_ce/boards/graphql/board.fragment.graphql" + +query group_boards($fullPath: ID!) { + group(fullPath: $fullPath) { + boards { + edges { + node { + ...BoardFragment + } + } + } + } +} diff --git a/app/assets/javascripts/boards/graphql/group_milestones.query.graphql b/app/assets/javascripts/boards/graphql/group_milestones.query.graphql new file mode 100644 index 00000000000..f2ab12ef4a7 --- /dev/null +++ b/app/assets/javascripts/boards/graphql/group_milestones.query.graphql @@ -0,0 +1,17 @@ +query groupMilestones( + $fullPath: ID! + $state: MilestoneStateEnum + $includeDescendants: Boolean + $searchTitle: String +) { + group(fullPath: $fullPath) { + milestones(state: $state, includeDescendants: $includeDescendants, searchTitle: $searchTitle) { + edges { + node { + id + title + } + } + } + } +} diff --git a/app/assets/javascripts/boards/graphql/issue.fragment.graphql b/app/assets/javascripts/boards/graphql/issue.fragment.graphql new file mode 100644 index 00000000000..1395bef39ed --- /dev/null +++ b/app/assets/javascripts/boards/graphql/issue.fragment.graphql @@ -0,0 +1,31 @@ +#import "~/graphql_shared/fragments/user.fragment.graphql" + +fragment IssueNode on Issue { + id + iid + title + referencePath: reference(full: true) + dueDate + timeEstimate + confidential + webUrl + subscribed + relativePosition + milestone { + id + title + } + assignees { + nodes { + ...User + } + } + labels { + nodes { + id + title + color + description + } + } +} diff --git a/app/assets/javascripts/boards/graphql/issue_create.mutation.graphql b/app/assets/javascripts/boards/graphql/issue_create.mutation.graphql new file mode 100644 index 00000000000..c1a2361a4e8 --- /dev/null +++ b/app/assets/javascripts/boards/graphql/issue_create.mutation.graphql @@ -0,0 +1,10 @@ +#import "ee_else_ce/boards/graphql/issue.fragment.graphql" + +mutation CreateIssue($input: CreateIssueInput!) { + createIssue(input: $input) { + issue { + ...IssueNode + } + errors + } +} diff --git a/app/assets/javascripts/boards/graphql/issue_move_list.mutation.graphql b/app/assets/javascripts/boards/graphql/issue_move_list.mutation.graphql new file mode 100644 index 00000000000..3c574fd8c87 --- /dev/null +++ b/app/assets/javascripts/boards/graphql/issue_move_list.mutation.graphql @@ -0,0 +1,28 @@ +#import "ee_else_ce/boards/graphql/issue.fragment.graphql" + +mutation IssueMoveList( + $projectPath: ID! + $iid: String! + $boardId: ID! + $fromListId: ID + $toListId: ID + $moveBeforeId: ID + $moveAfterId: ID +) { + issueMoveList( + input: { + projectPath: $projectPath + iid: $iid + boardId: $boardId + fromListId: $fromListId + toListId: $toListId + moveBeforeId: $moveBeforeId + moveAfterId: $moveAfterId + } + ) { + issue { + ...IssueNode + } + errors + } +} diff --git a/app/assets/javascripts/boards/graphql/issue_set_due_date.mutation.graphql b/app/assets/javascripts/boards/graphql/issue_set_due_date.mutation.graphql new file mode 100644 index 00000000000..bbea248cf85 --- /dev/null +++ b/app/assets/javascripts/boards/graphql/issue_set_due_date.mutation.graphql @@ -0,0 +1,8 @@ +mutation issueSetDueDate($input: UpdateIssueInput!) { + updateIssue(input: $input) { + issue { + dueDate + } + errors + } +} diff --git a/app/assets/javascripts/boards/graphql/issue_set_labels.mutation.graphql b/app/assets/javascripts/boards/graphql/issue_set_labels.mutation.graphql new file mode 100644 index 00000000000..3c5f4b3e3bd --- /dev/null +++ b/app/assets/javascripts/boards/graphql/issue_set_labels.mutation.graphql @@ -0,0 +1,15 @@ +mutation issueSetLabels($input: UpdateIssueInput!) { + updateIssue(input: $input) { + issue { + labels { + nodes { + id + title + color + description + } + } + } + errors + } +} diff --git a/app/assets/javascripts/boards/graphql/issue_set_milestone.mutation.graphql b/app/assets/javascripts/boards/graphql/issue_set_milestone.mutation.graphql new file mode 100644 index 00000000000..5dc78a03a06 --- /dev/null +++ b/app/assets/javascripts/boards/graphql/issue_set_milestone.mutation.graphql @@ -0,0 +1,12 @@ +mutation issueSetMilestone($input: UpdateIssueInput!) { + updateIssue(input: $input) { + issue { + milestone { + id + title + description + } + } + errors + } +} diff --git a/app/assets/javascripts/boards/graphql/issue_set_subscription.mutation.graphql b/app/assets/javascripts/boards/graphql/issue_set_subscription.mutation.graphql new file mode 100644 index 00000000000..1f383245ac2 --- /dev/null +++ b/app/assets/javascripts/boards/graphql/issue_set_subscription.mutation.graphql @@ -0,0 +1,8 @@ +mutation issueSetSubscription($input: IssueSetSubscriptionInput!) { + issueSetSubscription(input: $input) { + issue { + subscribed + } + errors + } +} diff --git a/app/assets/javascripts/boards/graphql/lists_issues.query.graphql b/app/assets/javascripts/boards/graphql/lists_issues.query.graphql new file mode 100644 index 00000000000..43af7d2b2f1 --- /dev/null +++ b/app/assets/javascripts/boards/graphql/lists_issues.query.graphql @@ -0,0 +1,55 @@ +#import "ee_else_ce/boards/graphql/issue.fragment.graphql" + +query ListIssues( + $fullPath: ID! + $boardId: ID! + $id: ID + $filters: BoardIssueInput + $isGroup: Boolean = false + $isProject: Boolean = false + $after: String + $first: Int +) { + group(fullPath: $fullPath) @include(if: $isGroup) { + board(id: $boardId) { + lists(id: $id) { + nodes { + id + issues(first: $first, filters: $filters, after: $after) { + count + edges { + node { + ...IssueNode + } + } + pageInfo { + endCursor + hasNextPage + } + } + } + } + } + } + project(fullPath: $fullPath) @include(if: $isProject) { + board(id: $boardId) { + lists(id: $id) { + nodes { + id + issues(first: $first, filters: $filters, after: $after) { + count + edges { + node { + ...IssueNode + } + } + pageInfo { + endCursor + hasNextPage + } + } + } + } + } + } +} diff --git a/app/assets/javascripts/boards/graphql/mutations/issue_set_subscription.mutation.graphql b/app/assets/javascripts/boards/graphql/mutations/issue_set_subscription.mutation.graphql deleted file mode 100644 index 1f383245ac2..00000000000 --- a/app/assets/javascripts/boards/graphql/mutations/issue_set_subscription.mutation.graphql +++ /dev/null @@ -1,8 +0,0 @@ -mutation issueSetSubscription($input: IssueSetSubscriptionInput!) { - issueSetSubscription(input: $input) { - issue { - subscribed - } - errors - } -} diff --git a/app/assets/javascripts/boards/graphql/project_boards.query.graphql b/app/assets/javascripts/boards/graphql/project_boards.query.graphql new file mode 100644 index 00000000000..f98d25ba671 --- /dev/null +++ b/app/assets/javascripts/boards/graphql/project_boards.query.graphql @@ -0,0 +1,13 @@ +#import "ee_else_ce/boards/graphql/board.fragment.graphql" + +query project_boards($fullPath: ID!) { + project(fullPath: $fullPath) { + boards { + edges { + node { + ...BoardFragment + } + } + } + } +} diff --git a/app/assets/javascripts/boards/graphql/users_search.query.graphql b/app/assets/javascripts/boards/graphql/users_search.query.graphql new file mode 100644 index 00000000000..ca016495d79 --- /dev/null +++ b/app/assets/javascripts/boards/graphql/users_search.query.graphql @@ -0,0 +1,11 @@ +query usersSearch($search: String!) { + users(search: $search) { + nodes { + username + name + webUrl + avatarUrl + id + } + } +} diff --git a/app/assets/javascripts/boards/queries/board.fragment.graphql b/app/assets/javascripts/boards/queries/board.fragment.graphql deleted file mode 100644 index 872a4c4afbc..00000000000 --- a/app/assets/javascripts/boards/queries/board.fragment.graphql +++ /dev/null @@ -1,4 +0,0 @@ -fragment BoardFragment on Board { - id - name -} diff --git a/app/assets/javascripts/boards/queries/board.mutation.graphql b/app/assets/javascripts/boards/queries/board.mutation.graphql deleted file mode 100644 index ef2b81a7939..00000000000 --- a/app/assets/javascripts/boards/queries/board.mutation.graphql +++ /dev/null @@ -1,11 +0,0 @@ -mutation UpdateBoard($id: ID!, $hideClosedList: Boolean, $hideBacklogList: Boolean) { - updateBoard( - input: { id: $id, hideClosedList: $hideClosedList, hideBacklogList: $hideBacklogList } - ) { - board { - id - hideClosedList - hideBacklogList - } - } -} diff --git a/app/assets/javascripts/boards/queries/board_labels.query.graphql b/app/assets/javascripts/boards/queries/board_labels.query.graphql deleted file mode 100644 index 42a94419a97..00000000000 --- a/app/assets/javascripts/boards/queries/board_labels.query.graphql +++ /dev/null @@ -1,23 +0,0 @@ -#import "~/graphql_shared/fragments/label.fragment.graphql" - -query BoardLabels( - $fullPath: ID! - $searchTerm: String - $isGroup: Boolean = false - $isProject: Boolean = false -) { - group(fullPath: $fullPath) @include(if: $isGroup) { - labels(searchTerm: $searchTerm) { - nodes { - ...Label - } - } - } - project(fullPath: $fullPath) @include(if: $isProject) { - labels(searchTerm: $searchTerm) { - nodes { - ...Label - } - } - } -} diff --git a/app/assets/javascripts/boards/queries/board_list.fragment.graphql b/app/assets/javascripts/boards/queries/board_list.fragment.graphql deleted file mode 100644 index bbf3314377e..00000000000 --- a/app/assets/javascripts/boards/queries/board_list.fragment.graphql +++ /dev/null @@ -1,5 +0,0 @@ -#import "./board_list_shared.fragment.graphql" - -fragment BoardListFragment on BoardList { - ...BoardListShared -} diff --git a/app/assets/javascripts/boards/queries/board_list_create.mutation.graphql b/app/assets/javascripts/boards/queries/board_list_create.mutation.graphql deleted file mode 100644 index 48420b349ae..00000000000 --- a/app/assets/javascripts/boards/queries/board_list_create.mutation.graphql +++ /dev/null @@ -1,24 +0,0 @@ -#import "ee_else_ce/boards/queries/board_list.fragment.graphql" - -mutation CreateBoardList( - $boardId: BoardID! - $backlog: Boolean - $labelId: LabelID - $milestoneId: MilestoneID - $assigneeId: UserID -) { - boardListCreate( - input: { - boardId: $boardId - backlog: $backlog - labelId: $labelId - milestoneId: $milestoneId - assigneeId: $assigneeId - } - ) { - list { - ...BoardListFragment - } - errors - } -} diff --git a/app/assets/javascripts/boards/queries/board_list_destroy.mutation.graphql b/app/assets/javascripts/boards/queries/board_list_destroy.mutation.graphql deleted file mode 100644 index ef3fd36e980..00000000000 --- a/app/assets/javascripts/boards/queries/board_list_destroy.mutation.graphql +++ /dev/null @@ -1,5 +0,0 @@ -mutation DestroyBoardList($listId: ID!) { - destroyBoardList(input: { listId: $listId }) { - errors - } -} diff --git a/app/assets/javascripts/boards/queries/board_list_shared.fragment.graphql b/app/assets/javascripts/boards/queries/board_list_shared.fragment.graphql deleted file mode 100644 index d85b736720b..00000000000 --- a/app/assets/javascripts/boards/queries/board_list_shared.fragment.graphql +++ /dev/null @@ -1,16 +0,0 @@ -fragment BoardListShared on BoardList { - id - title - position - listType - collapsed - issuesCount - label { - id - title - color - textColor - description - descriptionHtml - } -} diff --git a/app/assets/javascripts/boards/queries/board_list_update.mutation.graphql b/app/assets/javascripts/boards/queries/board_list_update.mutation.graphql deleted file mode 100644 index b474c9acb93..00000000000 --- a/app/assets/javascripts/boards/queries/board_list_update.mutation.graphql +++ /dev/null @@ -1,10 +0,0 @@ -#import "./board_list.fragment.graphql" - -mutation UpdateBoardList($listId: ID!, $position: Int, $collapsed: Boolean) { - updateBoardList(input: { listId: $listId, position: $position, collapsed: $collapsed }) { - list { - ...BoardListFragment - } - errors - } -} diff --git a/app/assets/javascripts/boards/queries/board_lists.query.graphql b/app/assets/javascripts/boards/queries/board_lists.query.graphql deleted file mode 100644 index 88425e9a9c1..00000000000 --- a/app/assets/javascripts/boards/queries/board_lists.query.graphql +++ /dev/null @@ -1,28 +0,0 @@ -#import "ee_else_ce/boards/queries/board_list.fragment.graphql" - -query ListIssues( - $fullPath: ID! - $boardId: ID! - $filters: BoardIssueInput - $isGroup: Boolean = false - $isProject: Boolean = false -) { - group(fullPath: $fullPath) @include(if: $isGroup) { - board(id: $boardId) { - lists(issueFilters: $filters) { - nodes { - ...BoardListFragment - } - } - } - } - project(fullPath: $fullPath) @include(if: $isProject) { - board(id: $boardId) { - lists(issueFilters: $filters) { - nodes { - ...BoardListFragment - } - } - } - } -} diff --git a/app/assets/javascripts/boards/queries/group_boards.query.graphql b/app/assets/javascripts/boards/queries/group_boards.query.graphql deleted file mode 100644 index 74c224add7d..00000000000 --- a/app/assets/javascripts/boards/queries/group_boards.query.graphql +++ /dev/null @@ -1,13 +0,0 @@ -#import "ee_else_ce/boards/queries/board.fragment.graphql" - -query group_boards($fullPath: ID!) { - group(fullPath: $fullPath) { - boards { - edges { - node { - ...BoardFragment - } - } - } - } -} diff --git a/app/assets/javascripts/boards/queries/group_milestones.query.graphql b/app/assets/javascripts/boards/queries/group_milestones.query.graphql deleted file mode 100644 index f2ab12ef4a7..00000000000 --- a/app/assets/javascripts/boards/queries/group_milestones.query.graphql +++ /dev/null @@ -1,17 +0,0 @@ -query groupMilestones( - $fullPath: ID! - $state: MilestoneStateEnum - $includeDescendants: Boolean - $searchTitle: String -) { - group(fullPath: $fullPath) { - milestones(state: $state, includeDescendants: $includeDescendants, searchTitle: $searchTitle) { - edges { - node { - id - title - } - } - } - } -} diff --git a/app/assets/javascripts/boards/queries/issue.fragment.graphql b/app/assets/javascripts/boards/queries/issue.fragment.graphql deleted file mode 100644 index 1395bef39ed..00000000000 --- a/app/assets/javascripts/boards/queries/issue.fragment.graphql +++ /dev/null @@ -1,31 +0,0 @@ -#import "~/graphql_shared/fragments/user.fragment.graphql" - -fragment IssueNode on Issue { - id - iid - title - referencePath: reference(full: true) - dueDate - timeEstimate - confidential - webUrl - subscribed - relativePosition - milestone { - id - title - } - assignees { - nodes { - ...User - } - } - labels { - nodes { - id - title - color - description - } - } -} diff --git a/app/assets/javascripts/boards/queries/issue_create.mutation.graphql b/app/assets/javascripts/boards/queries/issue_create.mutation.graphql deleted file mode 100644 index 65be147be07..00000000000 --- a/app/assets/javascripts/boards/queries/issue_create.mutation.graphql +++ /dev/null @@ -1,10 +0,0 @@ -#import "ee_else_ce/boards/queries/issue.fragment.graphql" - -mutation CreateIssue($input: CreateIssueInput!) { - createIssue(input: $input) { - issue { - ...IssueNode - } - errors - } -} diff --git a/app/assets/javascripts/boards/queries/issue_move_list.mutation.graphql b/app/assets/javascripts/boards/queries/issue_move_list.mutation.graphql deleted file mode 100644 index ff6aa597f48..00000000000 --- a/app/assets/javascripts/boards/queries/issue_move_list.mutation.graphql +++ /dev/null @@ -1,28 +0,0 @@ -#import "ee_else_ce/boards/queries/issue.fragment.graphql" - -mutation IssueMoveList( - $projectPath: ID! - $iid: String! - $boardId: ID! - $fromListId: ID - $toListId: ID - $moveBeforeId: ID - $moveAfterId: ID -) { - issueMoveList( - input: { - projectPath: $projectPath - iid: $iid - boardId: $boardId - fromListId: $fromListId - toListId: $toListId - moveBeforeId: $moveBeforeId - moveAfterId: $moveAfterId - } - ) { - issue { - ...IssueNode - } - errors - } -} diff --git a/app/assets/javascripts/boards/queries/issue_set_due_date.mutation.graphql b/app/assets/javascripts/boards/queries/issue_set_due_date.mutation.graphql deleted file mode 100644 index bbea248cf85..00000000000 --- a/app/assets/javascripts/boards/queries/issue_set_due_date.mutation.graphql +++ /dev/null @@ -1,8 +0,0 @@ -mutation issueSetDueDate($input: UpdateIssueInput!) { - updateIssue(input: $input) { - issue { - dueDate - } - errors - } -} diff --git a/app/assets/javascripts/boards/queries/issue_set_labels.mutation.graphql b/app/assets/javascripts/boards/queries/issue_set_labels.mutation.graphql deleted file mode 100644 index 3c5f4b3e3bd..00000000000 --- a/app/assets/javascripts/boards/queries/issue_set_labels.mutation.graphql +++ /dev/null @@ -1,15 +0,0 @@ -mutation issueSetLabels($input: UpdateIssueInput!) { - updateIssue(input: $input) { - issue { - labels { - nodes { - id - title - color - description - } - } - } - errors - } -} diff --git a/app/assets/javascripts/boards/queries/issue_set_milestone.mutation.graphql b/app/assets/javascripts/boards/queries/issue_set_milestone.mutation.graphql deleted file mode 100644 index 5dc78a03a06..00000000000 --- a/app/assets/javascripts/boards/queries/issue_set_milestone.mutation.graphql +++ /dev/null @@ -1,12 +0,0 @@ -mutation issueSetMilestone($input: UpdateIssueInput!) { - updateIssue(input: $input) { - issue { - milestone { - id - title - description - } - } - errors - } -} diff --git a/app/assets/javascripts/boards/queries/lists_issues.query.graphql b/app/assets/javascripts/boards/queries/lists_issues.query.graphql deleted file mode 100644 index 5dbfe4675c6..00000000000 --- a/app/assets/javascripts/boards/queries/lists_issues.query.graphql +++ /dev/null @@ -1,55 +0,0 @@ -#import "ee_else_ce/boards/queries/issue.fragment.graphql" - -query ListIssues( - $fullPath: ID! - $boardId: ID! - $id: ID - $filters: BoardIssueInput - $isGroup: Boolean = false - $isProject: Boolean = false - $after: String - $first: Int -) { - group(fullPath: $fullPath) @include(if: $isGroup) { - board(id: $boardId) { - lists(id: $id) { - nodes { - id - issues(first: $first, filters: $filters, after: $after) { - count - edges { - node { - ...IssueNode - } - } - pageInfo { - endCursor - hasNextPage - } - } - } - } - } - } - project(fullPath: $fullPath) @include(if: $isProject) { - board(id: $boardId) { - lists(id: $id) { - nodes { - id - issues(first: $first, filters: $filters, after: $after) { - count - edges { - node { - ...IssueNode - } - } - pageInfo { - endCursor - hasNextPage - } - } - } - } - } - } -} diff --git a/app/assets/javascripts/boards/queries/project_boards.query.graphql b/app/assets/javascripts/boards/queries/project_boards.query.graphql deleted file mode 100644 index a1326bd5eff..00000000000 --- a/app/assets/javascripts/boards/queries/project_boards.query.graphql +++ /dev/null @@ -1,13 +0,0 @@ -#import "ee_else_ce/boards/queries/board.fragment.graphql" - -query project_boards($fullPath: ID!) { - project(fullPath: $fullPath) { - boards { - edges { - node { - ...BoardFragment - } - } - } - } -} diff --git a/app/assets/javascripts/boards/queries/users_search.query.graphql b/app/assets/javascripts/boards/queries/users_search.query.graphql deleted file mode 100644 index ca016495d79..00000000000 --- a/app/assets/javascripts/boards/queries/users_search.query.graphql +++ /dev/null @@ -1,11 +0,0 @@ -query usersSearch($search: String!) { - users(search: $search) { - nodes { - username - name - webUrl - avatarUrl - id - } - } -} diff --git a/app/assets/javascripts/boards/stores/actions.js b/app/assets/javascripts/boards/stores/actions.js index fd5049ef9bc..a7d8144f8af 100644 --- a/app/assets/javascripts/boards/stores/actions.js +++ b/app/assets/javascripts/boards/stores/actions.js @@ -1,6 +1,6 @@ import { pick } from 'lodash'; -import boardListsQuery from 'ee_else_ce/boards/queries/board_lists.query.graphql'; +import boardListsQuery from 'ee_else_ce/boards/graphql/board_lists.query.graphql'; import createGqClient, { fetchPolicies } from '~/lib/graphql'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { BoardType, ListType, inactiveId, DEFAULT_LABELS } from '~/boards/constants'; @@ -14,18 +14,18 @@ import { } from '../boards_util'; import boardStore from '~/boards/stores/boards_store'; -import updateAssignees from '~/vue_shared/components/sidebar/queries/updateAssignees.mutation.graphql'; -import listsIssuesQuery from '../queries/lists_issues.query.graphql'; -import boardLabelsQuery from '../queries/board_labels.query.graphql'; -import createBoardListMutation from '../queries/board_list_create.mutation.graphql'; -import updateBoardListMutation from '../queries/board_list_update.mutation.graphql'; -import issueMoveListMutation from '../queries/issue_move_list.mutation.graphql'; -import destroyBoardListMutation from '../queries/board_list_destroy.mutation.graphql'; -import issueCreateMutation from '../queries/issue_create.mutation.graphql'; -import issueSetLabels from '../queries/issue_set_labels.mutation.graphql'; -import issueSetDueDate from '../queries/issue_set_due_date.mutation.graphql'; -import issueSetSubscriptionMutation from '../graphql/mutations/issue_set_subscription.mutation.graphql'; -import issueSetMilestone from '../queries/issue_set_milestone.mutation.graphql'; +import updateAssigneesMutation from '~/vue_shared/components/sidebar/queries/updateAssignees.mutation.graphql'; +import listsIssuesQuery from '../graphql/lists_issues.query.graphql'; +import boardLabelsQuery from '../graphql/board_labels.query.graphql'; +import createBoardListMutation from '../graphql/board_list_create.mutation.graphql'; +import updateBoardListMutation from '../graphql/board_list_update.mutation.graphql'; +import issueMoveListMutation from '../graphql/issue_move_list.mutation.graphql'; +import destroyBoardListMutation from '../graphql/board_list_destroy.mutation.graphql'; +import issueCreateMutation from '../graphql/issue_create.mutation.graphql'; +import issueSetLabelsMutation from '../graphql/issue_set_labels.mutation.graphql'; +import issueSetDueDateMutation from '../graphql/issue_set_due_date.mutation.graphql'; +import issueSetSubscriptionMutation from '../graphql/issue_set_subscription.mutation.graphql'; +import issueSetMilestoneMutation from '../graphql/issue_set_milestone.mutation.graphql'; const notImplemented = () => { /* eslint-disable-next-line @gitlab/require-i18n-strings */ @@ -324,7 +324,7 @@ export default { return gqlClient .mutate({ - mutation: updateAssignees, + mutation: updateAssigneesMutation, variables: { iid: getters.activeIssue.iid, projectPath: getters.activeIssue.referencePath.split('#')[0], @@ -350,7 +350,7 @@ export default { setActiveIssueMilestone: async ({ commit, getters }, input) => { const { activeIssue } = getters; const { data } = await gqlClient.mutate({ - mutation: issueSetMilestone, + mutation: issueSetMilestoneMutation, variables: { input: { iid: String(activeIssue.iid), @@ -416,7 +416,7 @@ export default { setActiveIssueLabels: async ({ commit, getters }, input) => { const { activeIssue } = getters; const { data } = await gqlClient.mutate({ - mutation: issueSetLabels, + mutation: issueSetLabelsMutation, variables: { input: { iid: String(activeIssue.iid), @@ -441,7 +441,7 @@ export default { setActiveIssueDueDate: async ({ commit, getters }, input) => { const { activeIssue } = getters; const { data } = await gqlClient.mutate({ - mutation: issueSetDueDate, + mutation: issueSetDueDateMutation, variables: { input: { iid: String(activeIssue.iid), diff --git a/app/assets/javascripts/boards/stores/boards_store.js b/app/assets/javascripts/boards/stores/boards_store.js index 2a4bf7c7288..fa1ffdfa26a 100644 --- a/app/assets/javascripts/boards/stores/boards_store.js +++ b/app/assets/javascripts/boards/stores/boards_store.js @@ -22,7 +22,7 @@ import ListLabel from '../models/label'; import ListAssignee from '../models/assignee'; import ListMilestone from '../models/milestone'; -import createBoardMutation from '../queries/board.mutation.graphql'; +import createBoardMutation from '../graphql/board.mutation.graphql'; const PER_PAGE = 20; export const gqlClient = createDefaultClient(); diff --git a/app/assets/javascripts/boards/stores/getters.js b/app/assets/javascripts/boards/stores/getters.js index d2517fd2cfc..ca6887b6f45 100644 --- a/app/assets/javascripts/boards/stores/getters.js +++ b/app/assets/javascripts/boards/stores/getters.js @@ -2,7 +2,6 @@ import { find } from 'lodash'; import { inactiveId } from '../constants'; export default { - labelToggleState: state => (state.isShowingLabels ? 'on' : 'off'), isSidebarOpen: state => state.activeId !== inactiveId, isSwimlanesOn: () => false, getIssueById: state => id => { diff --git a/app/assets/javascripts/diffs/components/diff_file.vue b/app/assets/javascripts/diffs/components/diff_file.vue index 32191d7e309..ed94cabe124 100644 --- a/app/assets/javascripts/diffs/components/diff_file.vue +++ b/app/assets/javascripts/diffs/components/diff_file.vue @@ -10,7 +10,7 @@ import notesEventHub from '../../notes/event_hub'; import DiffFileHeader from './diff_file_header.vue'; import DiffContent from './diff_content.vue'; import { diffViewerErrors } from '~/ide/constants'; -import { collapsedType, isCollapsed } from '../diff_file'; +import { collapsedType, isCollapsed } from '../utils/diff_file'; import { DIFF_FILE_AUTOMATIC_COLLAPSE, DIFF_FILE_MANUAL_COLLAPSE, diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue index 6dc9c71e1cd..53d1383b82e 100644 --- a/app/assets/javascripts/diffs/components/diff_file_header.vue +++ b/app/assets/javascripts/diffs/components/diff_file_header.vue @@ -19,7 +19,7 @@ import { __, s__, sprintf } from '~/locale'; import { diffViewerModes } from '~/ide/constants'; import DiffStats from './diff_stats.vue'; import { scrollToElement } from '~/lib/utils/common_utils'; -import { isCollapsed } from '../diff_file'; +import { isCollapsed } from '../utils/diff_file'; import { DIFF_FILE_HEADER } from '../i18n'; export default { diff --git a/app/assets/javascripts/diffs/diff_file.js b/app/assets/javascripts/diffs/diff_file.js deleted file mode 100644 index a14a30b41a9..00000000000 --- a/app/assets/javascripts/diffs/diff_file.js +++ /dev/null @@ -1,61 +0,0 @@ -import { - DIFF_FILE_SYMLINK_MODE, - DIFF_FILE_DELETED_MODE, - DIFF_FILE_MANUAL_COLLAPSE, - DIFF_FILE_AUTOMATIC_COLLAPSE, -} from './constants'; - -function fileSymlinkInformation(file, fileList) { - const duplicates = fileList.filter(iteratedFile => iteratedFile.file_hash === file.file_hash); - const includesSymlink = duplicates.some(iteratedFile => { - return [iteratedFile.a_mode, iteratedFile.b_mode].includes(DIFF_FILE_SYMLINK_MODE); - }); - const brokenSymlinkScenario = duplicates.length > 1 && includesSymlink; - - return ( - brokenSymlinkScenario && { - replaced: file.b_mode === DIFF_FILE_DELETED_MODE, - wasSymbolic: file.a_mode === DIFF_FILE_SYMLINK_MODE, - isSymbolic: file.b_mode === DIFF_FILE_SYMLINK_MODE, - wasReal: ![DIFF_FILE_SYMLINK_MODE, DIFF_FILE_DELETED_MODE].includes(file.a_mode), - isReal: ![DIFF_FILE_SYMLINK_MODE, DIFF_FILE_DELETED_MODE].includes(file.b_mode), - } - ); -} - -function collapsed(file) { - const viewer = file.viewer || {}; - - return { - automaticallyCollapsed: viewer.automaticallyCollapsed || viewer.collapsed || false, - manuallyCollapsed: null, - }; -} - -export function prepareRawDiffFile({ file, allFiles }) { - Object.assign(file, { - brokenSymlink: fileSymlinkInformation(file, allFiles), - viewer: { - ...file.viewer, - ...collapsed(file), - }, - }); - - return file; -} - -export function collapsedType(file) { - const isManual = typeof file.viewer?.manuallyCollapsed === 'boolean'; - - return isManual ? DIFF_FILE_MANUAL_COLLAPSE : DIFF_FILE_AUTOMATIC_COLLAPSE; -} - -export function isCollapsed(file) { - const type = collapsedType(file); - const collapsedStates = { - [DIFF_FILE_AUTOMATIC_COLLAPSE]: file.viewer?.automaticallyCollapsed || false, - [DIFF_FILE_MANUAL_COLLAPSE]: file.viewer?.manuallyCollapsed, - }; - - return collapsedStates[type]; -} diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index c41828a4221..e7f950f15c1 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -49,7 +49,7 @@ import { DIFF_FILE_BY_FILE_COOKIE_NAME, } from '../constants'; import { diffViewerModes } from '~/ide/constants'; -import { isCollapsed } from '../diff_file'; +import { isCollapsed } from '../utils/diff_file'; export const setBaseConfig = ({ commit }, options) => { const { diff --git a/app/assets/javascripts/diffs/store/utils.js b/app/assets/javascripts/diffs/store/utils.js index 8f32952676a..8949c8cd23e 100644 --- a/app/assets/javascripts/diffs/store/utils.js +++ b/app/assets/javascripts/diffs/store/utils.js @@ -16,7 +16,7 @@ import { SHOW_WHITESPACE, NO_SHOW_WHITESPACE, } from '../constants'; -import { prepareRawDiffFile } from '../diff_file'; +import { prepareRawDiffFile } from '../utils/diff_file'; export const isAdded = line => ['new', 'new-nonewline'].includes(line.type); export const isRemoved = line => ['old', 'old-nonewline'].includes(line.type); diff --git a/app/assets/javascripts/diffs/utils/diff_file.js b/app/assets/javascripts/diffs/utils/diff_file.js new file mode 100644 index 00000000000..aa801783c57 --- /dev/null +++ b/app/assets/javascripts/diffs/utils/diff_file.js @@ -0,0 +1,61 @@ +import { + DIFF_FILE_SYMLINK_MODE, + DIFF_FILE_DELETED_MODE, + DIFF_FILE_MANUAL_COLLAPSE, + DIFF_FILE_AUTOMATIC_COLLAPSE, +} from '../constants'; + +function fileSymlinkInformation(file, fileList) { + const duplicates = fileList.filter(iteratedFile => iteratedFile.file_hash === file.file_hash); + const includesSymlink = duplicates.some(iteratedFile => { + return [iteratedFile.a_mode, iteratedFile.b_mode].includes(DIFF_FILE_SYMLINK_MODE); + }); + const brokenSymlinkScenario = duplicates.length > 1 && includesSymlink; + + return ( + brokenSymlinkScenario && { + replaced: file.b_mode === DIFF_FILE_DELETED_MODE, + wasSymbolic: file.a_mode === DIFF_FILE_SYMLINK_MODE, + isSymbolic: file.b_mode === DIFF_FILE_SYMLINK_MODE, + wasReal: ![DIFF_FILE_SYMLINK_MODE, DIFF_FILE_DELETED_MODE].includes(file.a_mode), + isReal: ![DIFF_FILE_SYMLINK_MODE, DIFF_FILE_DELETED_MODE].includes(file.b_mode), + } + ); +} + +function collapsed(file) { + const viewer = file.viewer || {}; + + return { + automaticallyCollapsed: viewer.automaticallyCollapsed || viewer.collapsed || false, + manuallyCollapsed: null, + }; +} + +export function prepareRawDiffFile({ file, allFiles }) { + Object.assign(file, { + brokenSymlink: fileSymlinkInformation(file, allFiles), + viewer: { + ...file.viewer, + ...collapsed(file), + }, + }); + + return file; +} + +export function collapsedType(file) { + const isManual = typeof file.viewer?.manuallyCollapsed === 'boolean'; + + return isManual ? DIFF_FILE_MANUAL_COLLAPSE : DIFF_FILE_AUTOMATIC_COLLAPSE; +} + +export function isCollapsed(file) { + const type = collapsedType(file); + const collapsedStates = { + [DIFF_FILE_AUTOMATIC_COLLAPSE]: file.viewer?.automaticallyCollapsed || false, + [DIFF_FILE_MANUAL_COLLAPSE]: file.viewer?.manuallyCollapsed, + }; + + return collapsedStates[type]; +} diff --git a/app/assets/javascripts/incidents_settings/components/alerts_form.vue b/app/assets/javascripts/incidents_settings/components/alerts_form.vue index 5fe0badc56e..e8daad8811e 100644 --- a/app/assets/javascripts/incidents_settings/components/alerts_form.vue +++ b/app/assets/javascripts/incidents_settings/components/alerts_form.vue @@ -86,7 +86,7 @@ export default {
- {{ $options.i18n.createIssue.label }} + {{ $options.i18n.createIncident.label }} @@ -96,7 +96,7 @@ export default { class="col-8 col-md-9 gl-px-6" >