diff options
Diffstat (limited to 'app')
22 files changed, 80 insertions, 531 deletions
diff --git a/app/assets/javascripts/blob/components/blob_header.vue b/app/assets/javascripts/blob/components/blob_header.vue index 933ad448c77..6c7d963ae39 100644 --- a/app/assets/javascripts/blob/components/blob_header.vue +++ b/app/assets/javascripts/blob/components/blob_header.vue @@ -81,7 +81,7 @@ export default { </blob-filepath> </div> - <div class="gl-display-none gl-sm-display-flex"> + <div class="gl-display-none gl-sm-display-flex file-actions"> <viewer-switcher v-if="showViewerSwitcher" v-model="viewer" /> <slot name="actions"></slot> diff --git a/app/assets/javascripts/pages/projects/planning_hierarchy/index.js b/app/assets/javascripts/pages/projects/planning_hierarchy/index.js deleted file mode 100644 index d5dfe2d5f37..00000000000 --- a/app/assets/javascripts/pages/projects/planning_hierarchy/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import { initWorkItemsHierarchy } from '~/work_items_hierarchy/work_items_hierarchy_bundle'; - -initWorkItemsHierarchy(); diff --git a/app/assets/javascripts/repository/components/blob_controls.vue b/app/assets/javascripts/repository/components/blob_controls.vue index bde1b217ec9..c36f5201a87 100644 --- a/app/assets/javascripts/repository/components/blob_controls.vue +++ b/app/assets/javascripts/repository/components/blob_controls.vue @@ -3,6 +3,7 @@ import { GlButton } from '@gitlab/ui'; import { __ } from '~/locale'; import createFlash from '~/flash'; import getRefMixin from '~/repository/mixins/get_ref'; +import initSourcegraph from '~/sourcegraph'; import { updateElementsVisibility } from '../utils/dom'; import blobControlsQuery from '../queries/blob_controls.query.graphql'; @@ -76,6 +77,9 @@ export default { showBlobControls(shouldShow) { updateElementsVisibility('.tree-controls', !shouldShow); }, + blobInfo() { + initSourcegraph(); + }, }, }; </script> @@ -97,6 +101,7 @@ export default { data-testid="permalink" :href="blobInfo.permalinkPath" :class="$options.buttonClassList" + class="js-data-file-blob-permalink-url" > {{ $options.i18n.permalink }} </gl-button> diff --git a/app/assets/javascripts/vue_shared/components/source_viewer.vue b/app/assets/javascripts/vue_shared/components/source_viewer.vue index 51fef7823f9..c92ab77b34f 100644 --- a/app/assets/javascripts/vue_shared/components/source_viewer.vue +++ b/app/assets/javascripts/vue_shared/components/source_viewer.vue @@ -2,7 +2,6 @@ import { GlSafeHtmlDirective } from '@gitlab/ui'; import LineNumbers from '~/vue_shared/components/line_numbers.vue'; import { sanitize } from '~/lib/dompurify'; -import '~/sourcegraph/load'; const LINE_SELECT_CLASS_NAME = 'hll'; diff --git a/app/assets/javascripts/work_items/constants.js b/app/assets/javascripts/work_items/constants.js index 6b72c89bb29..995c02a2c5b 100644 --- a/app/assets/javascripts/work_items/constants.js +++ b/app/assets/javascripts/work_items/constants.js @@ -1,54 +1,5 @@ -import { __ } from '~/locale'; - export const widgetTypes = { title: 'TITLE', }; export const WI_TITLE_TRACK_LABEL = 'item_title'; - -export const workItemTypes = { - EPIC: { - title: __('Epic'), - icon: 'epic', - color: '#694CC0', - backgroundColor: '#E1D8F9', - }, - ISSUE: { - title: __('Issue'), - icon: 'issues', - color: '#1068BF', - backgroundColor: '#CBE2F9', - }, - TASK: { - title: __('Task'), - icon: 'task-done', - color: '#217645', - backgroundColor: '#C3E6CD', - }, - INCIDENT: { - title: __('Incident'), - icon: 'issue-type-incident', - backgroundColor: '#db2a0f', - color: '#FDD4CD', - iconSize: 16, - }, - SUB_EPIC: { - title: __('Child epic'), - icon: 'epic', - color: '#AB6100', - backgroundColor: '#F5D9A8', - }, - REQUIREMENT: { - title: __('Requirement'), - icon: 'requirements', - color: '#0068c5', - backgroundColor: '#c5e3fb', - }, - TEST_CASE: { - title: __('Test case'), - icon: 'issue-type-test-case', - backgroundColor: '#007a3f', - color: '#bae8cb', - iconSize: 16, - }, -}; diff --git a/app/assets/javascripts/work_items_hierarchy/components/app.vue b/app/assets/javascripts/work_items_hierarchy/components/app.vue deleted file mode 100644 index ef8632df3be..00000000000 --- a/app/assets/javascripts/work_items_hierarchy/components/app.vue +++ /dev/null @@ -1,96 +0,0 @@ -<script> -import { GlBanner } from '@gitlab/ui'; -import Cookies from 'js-cookie'; -import { parseBoolean } from '~/lib/utils/common_utils'; -import { workItemTypes } from '~/work_items/constants'; -import RESPONSE from '../static_response'; -import { WORK_ITEMS_SURVEY_COOKIE_NAME } from '../constants'; -import Hierarchy from './hierarchy.vue'; - -export default { - components: { - GlBanner, - Hierarchy, - }, - inject: ['illustrationPath', 'licensePlan'], - data() { - return { - bannerVisible: !parseBoolean(Cookies.get(WORK_ITEMS_SURVEY_COOKIE_NAME)), - workItemHierarchy: RESPONSE[this.licensePlan], - }; - }, - computed: { - hasUnavailableStructure() { - return this.workItemTypes.unavailable.length > 0; - }, - workItemTypes() { - return this.workItemHierarchy.reduce( - (itemTypes, item) => { - const key = item.available ? 'available' : 'unavailable'; - itemTypes[key].push({ - ...item, - ...workItemTypes[item.type], - nestedTypes: item.nestedTypes - ? item.nestedTypes.map((type) => workItemTypes[type]) - : null, - }); - return itemTypes; - }, - { available: [], unavailable: [] }, - ); - }, - }, - methods: { - handleClose() { - Cookies.set(WORK_ITEMS_SURVEY_COOKIE_NAME, 'true', { expires: 365 * 10 }); - this.bannerVisible = false; - }, - }, -}; -</script> - -<template> - <div> - <gl-banner - v-if="bannerVisible" - class="gl-mt-4 gl-px-5!" - :title="s__('Hierarchy|Help us improve work items in GitLab!')" - :button-text="s__('Hierarchy|Take the work items survey')" - button-link="https://forms.gle/u1BmRp8rTbwj52iq5" - :svg-path="illustrationPath" - @close="handleClose" - > - <p> - {{ - s__( - 'Hierarchy|Is there a framework or type of work item you wish you had access to in GitLab? Give us your feedback and help us build the experiences valuable to you.', - ) - }} - </p> - </gl-banner> - <h3 class="gl-mt-5!">{{ s__('Hierarchy|Planning hierarchy') }}</h3> - <p> - {{ - s__( - 'Hierarchy|Deliver value more efficiently by breaking down necessary work into a hierarchical structure. This structure helps teams understand scope, priorities, and how work cascades up toward larger goals.', - ) - }} - </p> - - <div class="gl-font-weight-bold gl-mb-2">{{ s__('Hierarchy|Current structure') }}</div> - <p class="gl-mb-3!">{{ s__('Hierarchy|You can start using these items now.') }}</p> - <hierarchy :work-item-types="workItemTypes.available" /> - - <div - v-if="hasUnavailableStructure" - data-testid="unavailable-structure" - class="gl-font-weight-bold gl-mt-5 gl-mb-2" - > - {{ s__('Hierarchy|Unavailable structure') }} - </div> - <p v-if="hasUnavailableStructure" class="gl-mb-3!"> - {{ s__('Hierarchy|These items are unavailable in the current structure.') }} - </p> - <hierarchy :work-item-types="workItemTypes.unavailable" /> - </div> -</template> diff --git a/app/assets/javascripts/work_items_hierarchy/components/hierarchy.vue b/app/assets/javascripts/work_items_hierarchy/components/hierarchy.vue deleted file mode 100644 index 9b81218b6e4..00000000000 --- a/app/assets/javascripts/work_items_hierarchy/components/hierarchy.vue +++ /dev/null @@ -1,119 +0,0 @@ -<script> -import { GlIcon, GlBadge } from '@gitlab/ui'; - -export default { - components: { - GlIcon, - GlBadge, - }, - props: { - workItemTypes: { - type: Array, - required: true, - }, - }, - methods: { - isLastItem(index, workItem) { - const hasMoreThanOneItem = workItem.nestedTypes.length > 1; - const isLastItemInArray = index === workItem.nestedTypes.length - 1; - - return isLastItemInArray && hasMoreThanOneItem; - }, - nestedWorkItemTypeMargin(index, workItem) { - const isLastItemInArray = index === workItem.nestedTypes.length - 1; - const hasMoreThanOneItem = workItem.nestedTypes.length > 1; - - if (isLastItemInArray && hasMoreThanOneItem) { - return 'gl-ml-0'; - } - - return 'gl-ml-6'; - }, - }, -}; -</script> -<template> - <div> - <div - v-for="workItem in workItemTypes" - :key="workItem.id" - class="gl-mb-3" - :class="{ flex: !workItem.available }" - > - <span - class="gl-border-gray-100 gl-border-1 gl-border-solid gl-rounded-base gl-pl-2 gl-pt-2 gl-pb-2 gl-pr-3 gl-display-inline-flex gl-align-items-center gl-justify-content-center gl-line-height-normal" - data-testid="work-item-wrapper" - > - <span - :style="{ - backgroundColor: workItem.backgroundColor, - color: workItem.color, - }" - class="gl-rounded-base gl-mr-2 gl-display-inline-flex justify-content-center align-items-center hierarchy-icon-wrapper" - > - <gl-icon :size="workItem.iconSize || 12" :name="workItem.icon" /> - </span> - - {{ workItem.title }} - </span> - - <gl-badge - v-if="!workItem.available" - variant="info" - icon="license" - size="sm" - class="gl-ml-3 gl-align-self-center" - >{{ workItem.license }}</gl-badge - > - - <div v-if="workItem.nestedTypes" :class="{ 'gl-relative': workItem.nestedTypes.length > 1 }"> - <svg - v-if="workItem.nestedTypes.length > 1" - class="hierarchy-rounded-arrow-tail gl-text-gray-400" - data-testid="hierarchy-rounded-arrow-tail" - width="2" - fill="none" - xmlns="http://www.w3.org/2000/svg" - > - <line - x1="0.75" - y1="1" - x2="0.75" - y2="100%" - stroke="currentColor" - stroke-width="1.5" - stroke-linecap="round" - /> - </svg> - <template v-for="(nestedWorkItem, index) in workItem.nestedTypes"> - <div :key="nestedWorkItem.id" class="gl-display-block gl-mt-2 gl-ml-6"> - <gl-icon name="arrow-down" class="gl-text-gray-400" /> - </div> - <gl-icon - v-if="isLastItem(index, workItem)" - :key="nestedWorkItem.id" - name="level-up" - class="gl-text-gray-400 gl-ml-2 hierarchy-rounded-arrow" - /> - <span - :key="nestedWorkItem.id" - class="gl-border-gray-100 gl-border-1 gl-border-solid gl-rounded-base gl-pl-2 gl-pt-2 gl-pb-2 gl-pr-3 gl-display-inline-flex gl-align-items-center gl-justify-content-center gl-mt-2 gl-line-height-normal" - :class="nestedWorkItemTypeMargin(index, workItem)" - > - <span - :style="{ - backgroundColor: nestedWorkItem.backgroundColor, - color: nestedWorkItem.color, - }" - class="gl-rounded-base gl-mr-2 gl-display-inline-flex justify-content-center align-items-center hierarchy-icon-wrapper" - > - <gl-icon :size="nestedWorkItem.iconSize || 12" :name="nestedWorkItem.icon" /> - </span> - - {{ nestedWorkItem.title }} - </span> - </template> - </div> - </div> - </div> -</template> diff --git a/app/assets/javascripts/work_items_hierarchy/constants.js b/app/assets/javascripts/work_items_hierarchy/constants.js deleted file mode 100644 index f001f556c0e..00000000000 --- a/app/assets/javascripts/work_items_hierarchy/constants.js +++ /dev/null @@ -1,12 +0,0 @@ -export const WORK_ITEMS_SURVEY_COOKIE_NAME = 'hide_work_items_hierarchy_survey'; - -/** - * Hard-coded strings since we're rendering hierarchy - * items from mock responses. Remove this when we - * have a real hierarchy endpoint. - */ -export const LICENSE_PLAN = { - FREE: 'free', - PREMIUM: 'premium', - ULTIMATE: 'ultimate', -}; diff --git a/app/assets/javascripts/work_items_hierarchy/hierarchy_util.js b/app/assets/javascripts/work_items_hierarchy/hierarchy_util.js deleted file mode 100644 index 61d93acdb91..00000000000 --- a/app/assets/javascripts/work_items_hierarchy/hierarchy_util.js +++ /dev/null @@ -1,10 +0,0 @@ -import { LICENSE_PLAN } from './constants'; - -export function inferLicensePlan({ hasSubEpics, hasEpics }) { - if (hasSubEpics) { - return LICENSE_PLAN.ULTIMATE; - } else if (hasEpics) { - return LICENSE_PLAN.PREMIUM; - } - return LICENSE_PLAN.FREE; -} diff --git a/app/assets/javascripts/work_items_hierarchy/static_response.js b/app/assets/javascripts/work_items_hierarchy/static_response.js deleted file mode 100644 index d1e2e486082..00000000000 --- a/app/assets/javascripts/work_items_hierarchy/static_response.js +++ /dev/null @@ -1,142 +0,0 @@ -const FREE_TIER = 'free'; -const ULTIMATE_TIER = 'ultimate'; -const PREMIUM_TIER = 'premium'; - -const RESPONSE = { - [FREE_TIER]: [ - { - id: '1', - type: 'ISSUE', - available: true, - license: null, - nestedTypes: null, - }, - { - id: '2', - type: 'TASK', - available: true, - license: null, - nestedTypes: null, - }, - { - id: '3', - type: 'INCIDENT', - available: true, - license: null, - nestedTypes: null, - }, - { - id: '4', - type: 'EPIC', - available: false, - license: 'Premium', // eslint-disable-line @gitlab/require-i18n-strings - nestedTypes: null, - }, - { - id: '5', - type: 'SUB_EPIC', - available: false, - license: 'Ultimate', // eslint-disable-line @gitlab/require-i18n-strings - nestedTypes: null, - }, - { - id: '6', - type: 'REQUIREMENT', - available: false, - license: 'Ultimate', // eslint-disable-line @gitlab/require-i18n-strings - nestedTypes: null, - }, - { - id: '7', - type: 'TEST_CASE', - available: false, - license: 'Ultimate', // eslint-disable-line @gitlab/require-i18n-strings - nestedTypes: null, - }, - ], - - [PREMIUM_TIER]: [ - { - id: '1', - type: 'EPIC', - available: true, - license: null, - nestedTypes: ['ISSUE'], - }, - { - id: '2', - type: 'TASK', - available: true, - license: null, - nestedTypes: null, - }, - { - id: '3', - type: 'INCIDENT', - available: true, - license: null, - nestedTypes: null, - }, - { - id: '5', - type: 'SUB_EPIC', - available: false, - license: 'Ultimate', // eslint-disable-line @gitlab/require-i18n-strings - nestedTypes: null, - }, - { - id: '6', - type: 'REQUIREMENT', - available: false, - license: 'Ultimate', // eslint-disable-line @gitlab/require-i18n-strings - nestedTypes: null, - }, - { - id: '7', - type: 'TEST_CASE', - available: false, - license: 'Ultimate', // eslint-disable-line @gitlab/require-i18n-strings - nestedTypes: null, - }, - ], - - [ULTIMATE_TIER]: [ - { - id: '1', - type: 'EPIC', - available: true, - license: null, - nestedTypes: ['SUB_EPIC', 'ISSUE'], - }, - { - id: '2', - type: 'TASK', - available: true, - license: null, - nestedTypes: null, - }, - { - id: '3', - type: 'INCIDENT', - available: true, - license: null, - nestedTypes: null, - }, - { - id: '6', - type: 'REQUIREMENT', - available: true, - license: null, - nestedTypes: null, - }, - { - id: '7', - type: 'TEST_CASE', - available: true, - license: null, - nestedTypes: null, - }, - ], -}; - -export default RESPONSE; diff --git a/app/assets/javascripts/work_items_hierarchy/work_items_hierarchy_bundle.js b/app/assets/javascripts/work_items_hierarchy/work_items_hierarchy_bundle.js deleted file mode 100644 index 2258c725301..00000000000 --- a/app/assets/javascripts/work_items_hierarchy/work_items_hierarchy_bundle.js +++ /dev/null @@ -1,26 +0,0 @@ -import Vue from 'vue'; -import { parseBoolean } from '~/lib/utils/common_utils'; -import App from './components/app.vue'; -import { inferLicensePlan } from './hierarchy_util'; - -export const initWorkItemsHierarchy = () => { - const el = document.querySelector('#js-work-items-hierarchy'); - - const { illustrationPath, hasEpics, hasSubEpics } = el.dataset; - - const licensePlan = inferLicensePlan({ - hasEpics: parseBoolean(hasEpics), - hasSubEpics: parseBoolean(hasSubEpics), - }); - - return new Vue({ - el, - provide: { - illustrationPath, - licensePlan, - }, - render(createElement) { - return createElement(App); - }, - }); -}; diff --git a/app/assets/stylesheets/_page_specific_files.scss b/app/assets/stylesheets/_page_specific_files.scss index 072b78305a9..8f3b5b3b7cc 100644 --- a/app/assets/stylesheets/_page_specific_files.scss +++ b/app/assets/stylesheets/_page_specific_files.scss @@ -32,4 +32,3 @@ @import './pages/storage_quota'; @import './pages/tree'; @import './pages/users'; -@import './pages/hierarchy'; diff --git a/app/assets/stylesheets/highlight/white_base.scss b/app/assets/stylesheets/highlight/white_base.scss index c0f8475323a..80052f4a4d5 100644 --- a/app/assets/stylesheets/highlight/white_base.scss +++ b/app/assets/stylesheets/highlight/white_base.scss @@ -255,18 +255,23 @@ span.highlight_word { .hll { background-color: $white-hll-bg; } -.c { color: $white-c; +.c, +.hljs-comment { color: $white-c; font-style: italic; } .err { color: $white-err; background-color: $white-err-bg; } -.k { font-weight: $gl-font-weight-bold; } + +.k, +.hljs-variable.language_, +.hljs-built_in { font-weight: $gl-font-weight-bold; } .o { font-weight: $gl-font-weight-bold; } .cm { color: $white-cm; font-style: italic; } -.cp { color: $white-cp; +.cp, +.hljs-meta { color: $white-cp; font-weight: $gl-font-weight-bold; } .c1 { color: $white-c1; @@ -310,20 +315,34 @@ span.highlight_word { font-weight: $gl-font-weight-bold; } .gt { color: $white-gt; } .kc { font-weight: $gl-font-weight-bold; } -.kd { font-weight: $gl-font-weight-bold; } + +.kd, +.hljs-keyword { font-weight: $gl-font-weight-bold; } .kn { font-weight: $gl-font-weight-bold; } .kp { font-weight: $gl-font-weight-bold; } .kr { font-weight: $gl-font-weight-bold; } -.kt { color: $white-kt; +.kt, +.hljs-type { color: $white-kt; font-weight: $gl-font-weight-bold; } .m { color: $white-m; } .s { color: $white-s; } -.n { color: $white-n; } -.na { color: $white-na; } -.nb { color: $white-nb; } -.nc { color: $white-nc; +.n, +.hljs-built_in { color: $white-n; } + +.na, +.hljs-attr, +.hljs-property, +.hljs-title.function_ { color: $white-na; } + +.nb, +.hljs-title.class_, +.hljs-literal { color: $white-nb; } + +.nc, +.hljs-title.class_, +.hljs-built_in { color: $white-nc; font-weight: $gl-font-weight-bold; } .no { color: $white-no; } .ni { color: $white-ni; } @@ -331,7 +350,9 @@ span.highlight_word { .ne { color: $white-ne; font-weight: $gl-font-weight-bold; } -.nf { color: $white-nf; +.nf, +.hljs-title, +.hljs-title.function_ { color: $white-nf; font-weight: $gl-font-weight-bold; } .nn { color: $white-nn; } .nt { color: $white-nt; } @@ -340,7 +361,9 @@ span.highlight_word { .w { color: $white-w; } .mf { color: $white-mf; } .mh { color: $white-mh; } -.mi { color: $white-mi; } + +.mi, +.hljs-number { color: $white-mi; } .mo { color: $white-mo; } .sb { color: $white-sb; } .sc { color: $white-sc; } @@ -351,7 +374,9 @@ span.highlight_word { .si { color: $white-si; } .sx { color: $white-sx; } .sr { color: $white-sr; } -.s1 { color: $white-s1; } + +.s1, +.hljs-string { color: $white-s1; } .ss { color: $white-ss; } .bp { color: $white-bp; } .vc { color: $white-vc; } diff --git a/app/assets/stylesheets/pages/hierarchy.scss b/app/assets/stylesheets/pages/hierarchy.scss deleted file mode 100644 index 0812e4cc41e..00000000000 --- a/app/assets/stylesheets/pages/hierarchy.scss +++ /dev/null @@ -1,15 +0,0 @@ -.hierarchy-rounded-arrow-tail { - position: absolute; - top: 4px; - left: 5px; - height: calc(100% - 20px); -} - -.hierarchy-icon-wrapper { - height: $default-icon-size; - width: $default-icon-size; -} - -.hierarchy-rounded-arrow { - transform: scale(1, -1) rotate(90deg); -} diff --git a/app/controllers/concerns/work_items_hierarchy.rb b/app/controllers/concerns/work_items_hierarchy.rb deleted file mode 100644 index 6008256408c..00000000000 --- a/app/controllers/concerns/work_items_hierarchy.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module WorkItemsHierarchy - extend ActiveSupport::Concern - - # rubocop:disable Gitlab/ModuleWithInstanceVariables - def planning_hierarchy - return render_404 unless Feature.enabled?(:work_items_hierarchy, @project, default_enabled: :yaml) - - render 'shared/planning_hierarchy' - end - # rubocop:enable Gitlab/ModuleWithInstanceVariables -end - -WorkItemsHierarchy.prepend_mod_with('WorkItemsHierarchy') diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb index 482ae2c35f5..c48f3352530 100644 --- a/app/controllers/projects/tree_controller.rb +++ b/app/controllers/projects/tree_controller.rb @@ -6,6 +6,7 @@ class Projects::TreeController < Projects::ApplicationController include CreatesCommit include ActionView::Helpers::SanitizeHelper include RedirectsForMissingPathOnTree + include SourcegraphDecorator around_action :allow_gitaly_ref_name_caching, only: [:show] diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 27483d455b1..369fdbee089 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -9,7 +9,7 @@ class ProjectsController < Projects::ApplicationController include RecordUserLastActivity include ImportUrlParams include FiltersEvents - include WorkItemsHierarchy + include SourcegraphDecorator prepend_before_action(only: [:show]) { authenticate_sessionless_user!(:rss) } @@ -53,7 +53,6 @@ class ProjectsController < Projects::ApplicationController feature_category :team_planning, [:preview_markdown, :new_issuable_address] feature_category :importers, [:export, :remove_export, :generate_new_export, :download_export] feature_category :code_review, [:unfoldered_environment_names] - feature_category :portfolio_management, [:planning_hierarchy] urgency :low, [:refs] urgency :high, [:unfoldered_environment_names] diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 7ae301cdf73..52a4d2ca736 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -69,6 +69,7 @@ module Ci has_many :builds, foreign_key: :commit_id, inverse_of: :pipeline has_many :generic_commit_statuses, foreign_key: :commit_id, inverse_of: :pipeline, class_name: 'GenericCommitStatus' has_many :job_artifacts, through: :builds + has_many :build_trace_chunks, class_name: 'Ci::BuildTraceChunk', through: :builds, source: :trace_chunks has_many :trigger_requests, dependent: :destroy, foreign_key: :commit_id # rubocop:disable Cop/ActiveRecordDependent has_many :variables, class_name: 'Ci::PipelineVariable' has_many :deployments, through: :builds @@ -130,6 +131,7 @@ module Ci after_create :keep_around_commits, unless: :importing? use_fast_destroy :job_artifacts + use_fast_destroy :build_trace_chunks # We use `Enums::Ci::Pipeline.sources` here so that EE can more easily extend # this `Hash` with new values. diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index d89a449bdd5..55f43cd9f7b 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -240,7 +240,6 @@ class ProjectPolicy < BasePolicy enable :read_wiki enable :read_issue enable :read_label - enable :read_work_items_hierarchy enable :read_milestone enable :read_snippet enable :read_project_member @@ -573,7 +572,6 @@ class ProjectPolicy < BasePolicy enable :read_issue_board_list enable :read_wiki enable :read_label - enable :read_work_items_hierarchy enable :read_milestone enable :read_snippet enable :read_project_member diff --git a/app/services/ci/after_requeue_job_service.rb b/app/services/ci/after_requeue_job_service.rb index 9101ae91967..ee0ae6651ca 100644 --- a/app/services/ci/after_requeue_job_service.rb +++ b/app/services/ci/after_requeue_job_service.rb @@ -3,39 +3,50 @@ module Ci class AfterRequeueJobService < ::BaseService def execute(processable) - process_subsequent_jobs(processable) - reset_source_bridge(processable) + @processable = processable + + process_subsequent_jobs + reset_source_bridge end private - def process_subsequent_jobs(processable) - (stage_dependent_jobs(processable) | needs_dependent_jobs(processable)) - .each do |processable| - process(processable) + def process_subsequent_jobs + dependent_jobs.each do |job| + process(job) end end - def reset_source_bridge(processable) - processable.pipeline.reset_source_bridge!(current_user) + def reset_source_bridge + @processable.pipeline.reset_source_bridge!(current_user) + end + + def dependent_jobs + if ::Feature.enabled?(:ci_order_subsequent_jobs_by_stage, @processable.pipeline.project, default_enabled: :yaml) + stage_dependent_jobs + .or(needs_dependent_jobs.except(:preload)) + .ordered_by_stage + else + stage_dependent_jobs | needs_dependent_jobs + end end - def process(processable) - Gitlab::OptimisticLocking.retry_lock(processable, name: 'ci_requeue_job') do |processable| - processable.process(current_user) + def process(job) + Gitlab::OptimisticLocking.retry_lock(job, name: 'ci_requeue_job') do |job| + job.process(current_user) end end - def skipped_jobs(processable) - processable.pipeline.processables.skipped + def stage_dependent_jobs + skipped_jobs.after_stage(@processable.stage_idx) end - def stage_dependent_jobs(processable) - skipped_jobs(processable).after_stage(processable.stage_idx) + def needs_dependent_jobs + skipped_jobs.scheduling_type_dag.with_needs([@processable.name]) end - def needs_dependent_jobs(processable) - skipped_jobs(processable).scheduling_type_dag.with_needs([processable.name]) + def skipped_jobs + @skipped_jobs ||= @processable.pipeline.processables.skipped end end end diff --git a/app/services/ci/destroy_pipeline_service.rb b/app/services/ci/destroy_pipeline_service.rb index 476c7523d60..d85e52e1312 100644 --- a/app/services/ci/destroy_pipeline_service.rb +++ b/app/services/ci/destroy_pipeline_service.rb @@ -9,9 +9,11 @@ module Ci pipeline.cancel_running if pipeline.cancelable? - # Ci::Pipeline#destroy triggers `use_fast_destroy :job_artifacts` and - # ci_builds has ON DELETE CASCADE to ci_pipelines. The pipeline, the builds, - # job and pipeline artifacts all get destroyed here. + # The pipeline, the builds, job and pipeline artifacts all get destroyed here. + # Ci::Pipeline#destroy triggers fast destroy on job_artifacts and + # build_trace_chunks to remove the records and data stored in object storage. + # ci_builds records are deleted using ON DELETE CASCADE from ci_pipelines + # pipeline.reset.destroy! ServiceResponse.success(message: 'Pipeline not found') diff --git a/app/views/shared/planning_hierarchy.html.haml b/app/views/shared/planning_hierarchy.html.haml deleted file mode 100644 index d67ecc6ee48..00000000000 --- a/app/views/shared/planning_hierarchy.html.haml +++ /dev/null @@ -1,5 +0,0 @@ -- page_title _("Planning hierarchy") -- has_sub_epics = Gitlab.ee? && @project&.feature_available?(:subepics) -- has_epics = Gitlab.ee? && @project&.feature_available?(:epics) - -#js-work-items-hierarchy{ data: { has_sub_epics: has_sub_epics.to_s, has_epics: has_epics.to_s, illustration_path: image_path('illustrations/rocket-launch-md.svg') } } |