Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
8bb9ee8769
commit
53758cb2ca
44 changed files with 334 additions and 388 deletions
|
@ -72,18 +72,11 @@ export default {
|
|||
GlPagination,
|
||||
GlTabs,
|
||||
GlTab,
|
||||
PublishedCell: () => import('ee_component/incidents/components/published_cell.vue'),
|
||||
},
|
||||
directives: {
|
||||
GlTooltip: GlTooltipDirective,
|
||||
},
|
||||
inject: [
|
||||
'projectPath',
|
||||
'newIssuePath',
|
||||
'incidentTemplateName',
|
||||
'issuePath',
|
||||
'publishedAvailable',
|
||||
],
|
||||
inject: ['projectPath', 'newIssuePath', 'incidentTemplateName', 'issuePath'],
|
||||
apollo: {
|
||||
incidents: {
|
||||
query: getIncidents,
|
||||
|
@ -151,20 +144,6 @@ export default {
|
|||
newIncidentPath() {
|
||||
return mergeUrlParams({ issuable_template: this.incidentTemplateName }, this.newIssuePath);
|
||||
},
|
||||
availableFields() {
|
||||
return this.publishedAvailable
|
||||
? [
|
||||
...this.$options.fields,
|
||||
...[
|
||||
{
|
||||
key: 'published',
|
||||
label: s__('IncidentManagement|Published'),
|
||||
thClass: 'gl-pointer-events-none',
|
||||
},
|
||||
],
|
||||
]
|
||||
: this.$options.fields;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onInputChange: debounce(function debounceSearch(input) {
|
||||
|
@ -251,7 +230,7 @@ export default {
|
|||
</h4>
|
||||
<gl-table
|
||||
:items="incidents.list || []"
|
||||
:fields="availableFields"
|
||||
:fields="$options.fields"
|
||||
:show-empty="true"
|
||||
:busy="loading"
|
||||
stacked="md"
|
||||
|
@ -266,7 +245,7 @@ export default {
|
|||
<gl-icon
|
||||
v-if="item.state === 'closed'"
|
||||
name="issue-close"
|
||||
class="gl-ml-1 gl-fill-blue-500"
|
||||
class="gl-fill-blue-500"
|
||||
data-testid="incident-closed"
|
||||
/>
|
||||
</div>
|
||||
|
@ -306,13 +285,6 @@ export default {
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<template v-if="publishedAvailable" #cell(published)="{ item }">
|
||||
<published-cell
|
||||
:status-page-published-incident="item.statusPagePublishedIncident"
|
||||
:un-published="$options.i18n.unPublished"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #table-busy>
|
||||
<gl-loading-icon size="lg" color="dark" class="mt-3" />
|
||||
</template>
|
||||
|
|
|
@ -6,7 +6,6 @@ export const I18N = {
|
|||
unassigned: s__('IncidentManagement|Unassigned'),
|
||||
createIncidentBtnLabel: s__('IncidentManagement|Create incident'),
|
||||
searchPlaceholder: __('Search or filter results...'),
|
||||
unPublished: s__('IncidentManagement|Unpublished'),
|
||||
};
|
||||
|
||||
export const INCIDENT_STATE_TABS = [
|
||||
|
|
|
@ -37,7 +37,6 @@ query getIncidents(
|
|||
webUrl
|
||||
}
|
||||
}
|
||||
statusPagePublishedIncident
|
||||
}
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
|
|
|
@ -8,13 +8,7 @@ export default () => {
|
|||
const selector = '#js-incidents';
|
||||
|
||||
const domEl = document.querySelector(selector);
|
||||
const {
|
||||
projectPath,
|
||||
newIssuePath,
|
||||
incidentTemplateName,
|
||||
issuePath,
|
||||
publishedAvailable,
|
||||
} = domEl.dataset;
|
||||
const { projectPath, newIssuePath, incidentTemplateName, issuePath } = domEl.dataset;
|
||||
|
||||
const apolloProvider = new VueApollo({
|
||||
defaultClient: createDefaultClient(),
|
||||
|
@ -27,7 +21,6 @@ export default () => {
|
|||
incidentTemplateName,
|
||||
newIssuePath,
|
||||
issuePath,
|
||||
publishedAvailable,
|
||||
},
|
||||
apolloProvider,
|
||||
components: {
|
||||
|
|
|
@ -98,9 +98,4 @@
|
|||
@include gl-w-full;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Abstract to `@gitlab/ui` utility set: https://gitlab.com/gitlab-org/gitlab-ui/-/issues/921
|
||||
.gl-fill-green-500 {
|
||||
fill: $gray-500;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,9 +97,6 @@ module Types
|
|||
|
||||
field :design_collection, Types::DesignManagement::DesignCollectionType, null: true,
|
||||
description: 'Collection of design images associated with this issue'
|
||||
|
||||
field :status_page_published_incident, GraphQL::BOOLEAN_TYPE, null: true,
|
||||
description: 'Indicates whether an issue is published to the status page'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -10,5 +10,3 @@ module Projects::IncidentsHelper
|
|||
}
|
||||
end
|
||||
end
|
||||
|
||||
Projects::IncidentsHelper.prepend_if_ee('EE::Projects::IncidentsHelper')
|
||||
|
|
|
@ -103,15 +103,15 @@ module Ci
|
|||
|
||||
after_create :keep_around_commits, unless: :importing?
|
||||
|
||||
# We use `Enums::Ci::Pipeline.sources` here so that EE can more easily extend
|
||||
# We use `Ci::PipelineEnums.sources` here so that EE can more easily extend
|
||||
# this `Hash` with new values.
|
||||
enum_with_nil source: Enums::Ci::Pipeline.sources
|
||||
enum_with_nil source: ::Ci::PipelineEnums.sources
|
||||
|
||||
enum_with_nil config_source: Enums::Ci::Pipeline.config_sources
|
||||
enum_with_nil config_source: ::Ci::PipelineEnums.config_sources
|
||||
|
||||
# We use `Enums::Ci::Pipeline.failure_reasons` here so that EE can more easily
|
||||
# We use `Ci::PipelineEnums.failure_reasons` here so that EE can more easily
|
||||
# extend this `Hash` with new values.
|
||||
enum failure_reason: Enums::Ci::Pipeline.failure_reasons
|
||||
enum failure_reason: ::Ci::PipelineEnums.failure_reasons
|
||||
|
||||
enum locked: { unlocked: 0, artifacts_locked: 1 }
|
||||
|
||||
|
@ -253,7 +253,7 @@ module Ci
|
|||
|
||||
scope :internal, -> { where(source: internal_sources) }
|
||||
scope :no_child, -> { where.not(source: :parent_pipeline) }
|
||||
scope :ci_sources, -> { where(config_source: Enums::Ci::Pipeline.ci_config_sources_values) }
|
||||
scope :ci_sources, -> { where(config_source: ::Ci::PipelineEnums.ci_config_sources_values) }
|
||||
scope :for_user, -> (user) { where(user: user) }
|
||||
scope :for_sha, -> (sha) { where(sha: sha) }
|
||||
scope :for_source_sha, -> (source_sha) { where(source_sha: source_sha) }
|
||||
|
@ -1058,7 +1058,7 @@ module Ci
|
|||
end
|
||||
|
||||
def cacheable?
|
||||
Enums::Ci::Pipeline.ci_config_sources.key?(config_source.to_sym)
|
||||
Ci::PipelineEnums.ci_config_sources.key?(config_source.to_sym)
|
||||
end
|
||||
|
||||
def source_ref_path
|
||||
|
|
73
app/models/ci/pipeline_enums.rb
Normal file
73
app/models/ci/pipeline_enums.rb
Normal file
|
@ -0,0 +1,73 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Ci
|
||||
module PipelineEnums
|
||||
# Returns the `Hash` to use for creating the `failure_reason` enum for
|
||||
# `Ci::Pipeline`.
|
||||
def self.failure_reasons
|
||||
{
|
||||
unknown_failure: 0,
|
||||
config_error: 1,
|
||||
external_validation_failure: 2
|
||||
}
|
||||
end
|
||||
|
||||
# Returns the `Hash` to use for creating the `sources` enum for
|
||||
# `Ci::Pipeline`.
|
||||
def self.sources
|
||||
{
|
||||
unknown: nil,
|
||||
push: 1,
|
||||
web: 2,
|
||||
trigger: 3,
|
||||
schedule: 4,
|
||||
api: 5,
|
||||
external: 6,
|
||||
# TODO: Rename `pipeline` to `cross_project_pipeline` in 13.0
|
||||
# https://gitlab.com/gitlab-org/gitlab/issues/195991
|
||||
pipeline: 7,
|
||||
chat: 8,
|
||||
webide: 9,
|
||||
merge_request_event: 10,
|
||||
external_pull_request_event: 11,
|
||||
parent_pipeline: 12,
|
||||
ondemand_dast_scan: 13
|
||||
}
|
||||
end
|
||||
|
||||
# Returns the `Hash` to use for creating the `config_sources` enum for
|
||||
# `Ci::Pipeline`.
|
||||
def self.config_sources
|
||||
{
|
||||
unknown_source: nil,
|
||||
repository_source: 1,
|
||||
auto_devops_source: 2,
|
||||
webide_source: 3,
|
||||
remote_source: 4,
|
||||
external_project_source: 5,
|
||||
bridge_source: 6,
|
||||
parameter_source: 7
|
||||
}
|
||||
end
|
||||
|
||||
def self.ci_config_sources
|
||||
config_sources.slice(
|
||||
:unknown_source,
|
||||
:repository_source,
|
||||
:auto_devops_source,
|
||||
:remote_source,
|
||||
:external_project_source
|
||||
)
|
||||
end
|
||||
|
||||
def self.ci_config_sources_values
|
||||
ci_config_sources.values
|
||||
end
|
||||
|
||||
def self.non_ci_config_source_values
|
||||
config_sources.values - ci_config_sources.values
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Ci::PipelineEnums.prepend_if_ee('EE::Ci::PipelineEnums')
|
|
@ -77,9 +77,9 @@ class CommitStatus < ApplicationRecord
|
|||
merge(or_conditions)
|
||||
end
|
||||
|
||||
# We use `Enums::CommitStatus.failure_reasons` here so that EE can more easily
|
||||
# We use `CommitStatusEnums.failure_reasons` here so that EE can more easily
|
||||
# extend this `Hash` with new values.
|
||||
enum_with_nil failure_reason: Enums::CommitStatus.failure_reasons
|
||||
enum_with_nil failure_reason: ::CommitStatusEnums.failure_reasons
|
||||
|
||||
##
|
||||
# We still create some CommitStatuses outside of CreatePipelineService.
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Enums
|
||||
module Ci
|
||||
module Pipeline
|
||||
# Returns the `Hash` to use for creating the `failure_reason` enum for
|
||||
# `Ci::Pipeline`.
|
||||
def self.failure_reasons
|
||||
{
|
||||
unknown_failure: 0,
|
||||
config_error: 1,
|
||||
external_validation_failure: 2
|
||||
}
|
||||
end
|
||||
|
||||
# Returns the `Hash` to use for creating the `sources` enum for
|
||||
# `Ci::Pipeline`.
|
||||
def self.sources
|
||||
{
|
||||
unknown: nil,
|
||||
push: 1,
|
||||
web: 2,
|
||||
trigger: 3,
|
||||
schedule: 4,
|
||||
api: 5,
|
||||
external: 6,
|
||||
# TODO: Rename `pipeline` to `cross_project_pipeline` in 13.0
|
||||
# https://gitlab.com/gitlab-org/gitlab/issues/195991
|
||||
pipeline: 7,
|
||||
chat: 8,
|
||||
webide: 9,
|
||||
merge_request_event: 10,
|
||||
external_pull_request_event: 11,
|
||||
parent_pipeline: 12,
|
||||
ondemand_dast_scan: 13
|
||||
}
|
||||
end
|
||||
|
||||
# Returns the `Hash` to use for creating the `config_sources` enum for
|
||||
# `Ci::Pipeline`.
|
||||
def self.config_sources
|
||||
{
|
||||
unknown_source: nil,
|
||||
repository_source: 1,
|
||||
auto_devops_source: 2,
|
||||
webide_source: 3,
|
||||
remote_source: 4,
|
||||
external_project_source: 5,
|
||||
bridge_source: 6,
|
||||
parameter_source: 7
|
||||
}
|
||||
end
|
||||
|
||||
def self.ci_config_sources
|
||||
config_sources.slice(
|
||||
:unknown_source,
|
||||
:repository_source,
|
||||
:auto_devops_source,
|
||||
:remote_source,
|
||||
:external_project_source
|
||||
)
|
||||
end
|
||||
|
||||
def self.ci_config_sources_values
|
||||
ci_config_sources.values
|
||||
end
|
||||
|
||||
def self.non_ci_config_source_values
|
||||
config_sources.values - ci_config_sources.values
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Enums::Ci::Pipeline.prepend_if_ee('EE::Enums::Ci::Pipeline')
|
|
@ -1,34 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Enums
|
||||
module CommitStatus
|
||||
# Returns the Hash to use for creating the `failure_reason` enum for
|
||||
# `CommitStatus`.
|
||||
def self.failure_reasons
|
||||
{
|
||||
unknown_failure: nil,
|
||||
script_failure: 1,
|
||||
api_failure: 2,
|
||||
stuck_or_timeout_failure: 3,
|
||||
runner_system_failure: 4,
|
||||
missing_dependency_failure: 5,
|
||||
runner_unsupported: 6,
|
||||
stale_schedule: 7,
|
||||
job_execution_timeout: 8,
|
||||
archived_failure: 9,
|
||||
unmet_prerequisites: 10,
|
||||
scheduler_failure: 11,
|
||||
data_integrity_failure: 12,
|
||||
forward_deployment_failure: 13,
|
||||
protected_environment_failure: 1_000,
|
||||
insufficient_bridge_permissions: 1_001,
|
||||
downstream_bridge_project_not_found: 1_002,
|
||||
invalid_bridge_trigger: 1_003,
|
||||
upstream_bridge_project_not_found: 1_004,
|
||||
insufficient_upstream_permissions: 1_005,
|
||||
bridge_pipeline_is_child_pipeline: 1_006,
|
||||
downstream_pipeline_creation_failed: 1_007
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,86 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Enums
|
||||
module PrometheusMetric
|
||||
def self.groups
|
||||
{
|
||||
# built-in groups
|
||||
nginx_ingress_vts: -1,
|
||||
ha_proxy: -2,
|
||||
aws_elb: -3,
|
||||
nginx: -4,
|
||||
kubernetes: -5,
|
||||
nginx_ingress: -6,
|
||||
cluster_health: -100
|
||||
}.merge(custom_groups).freeze
|
||||
end
|
||||
|
||||
# custom/user groups
|
||||
def self.custom_groups
|
||||
{
|
||||
business: 0,
|
||||
response: 1,
|
||||
system: 2
|
||||
}.freeze
|
||||
end
|
||||
|
||||
def self.group_details
|
||||
{
|
||||
# built-in groups
|
||||
nginx_ingress_vts: {
|
||||
group_title: _('Response metrics (NGINX Ingress VTS)'),
|
||||
required_metrics: %w(nginx_upstream_responses_total nginx_upstream_response_msecs_avg),
|
||||
priority: 10
|
||||
}.freeze,
|
||||
nginx_ingress: {
|
||||
group_title: _('Response metrics (NGINX Ingress)'),
|
||||
required_metrics: %w(nginx_ingress_controller_requests nginx_ingress_controller_ingress_upstream_latency_seconds_sum),
|
||||
priority: 10
|
||||
}.freeze,
|
||||
ha_proxy: {
|
||||
group_title: _('Response metrics (HA Proxy)'),
|
||||
required_metrics: %w(haproxy_frontend_http_requests_total haproxy_frontend_http_responses_total),
|
||||
priority: 10
|
||||
}.freeze,
|
||||
aws_elb: {
|
||||
group_title: _('Response metrics (AWS ELB)'),
|
||||
required_metrics: %w(aws_elb_request_count_sum aws_elb_latency_average aws_elb_httpcode_backend_5_xx_sum),
|
||||
priority: 10
|
||||
}.freeze,
|
||||
nginx: {
|
||||
group_title: _('Response metrics (NGINX)'),
|
||||
required_metrics: %w(nginx_server_requests nginx_server_requestMsec),
|
||||
priority: 10
|
||||
}.freeze,
|
||||
kubernetes: {
|
||||
group_title: _('System metrics (Kubernetes)'),
|
||||
required_metrics: %w(container_memory_usage_bytes container_cpu_usage_seconds_total),
|
||||
priority: 5
|
||||
}.freeze,
|
||||
cluster_health: {
|
||||
group_title: _('Cluster Health'),
|
||||
required_metrics: %w(container_memory_usage_bytes container_cpu_usage_seconds_total),
|
||||
priority: 10
|
||||
}.freeze
|
||||
}.merge(custom_group_details).freeze
|
||||
end
|
||||
|
||||
# custom/user groups
|
||||
def self.custom_group_details
|
||||
{
|
||||
business: {
|
||||
group_title: _('Business metrics (Custom)'),
|
||||
priority: 0
|
||||
}.freeze,
|
||||
response: {
|
||||
group_title: _('Response metrics (Custom)'),
|
||||
priority: -5
|
||||
}.freeze,
|
||||
system: {
|
||||
group_title: _('System metrics (Custom)'),
|
||||
priority: -10
|
||||
}.freeze
|
||||
}.freeze
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,28 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Enums
|
||||
module UserCallout
|
||||
# Returns the `Hash` to use for the `feature_name` enum in the `UserCallout`
|
||||
# model.
|
||||
#
|
||||
# This method is separate from the `UserCallout` model so that it can be
|
||||
# extended by EE.
|
||||
#
|
||||
# If you are going to add new items to this hash, check that you're not going
|
||||
# to conflict with EE-only values: https://gitlab.com/gitlab-org/gitlab/blob/master/ee/app/models/concerns/ee/enums/user_callout.rb
|
||||
def self.feature_names
|
||||
{
|
||||
gke_cluster_integration: 1,
|
||||
gcp_signup_offer: 2,
|
||||
cluster_security_warning: 3,
|
||||
suggest_popover_dismissed: 9,
|
||||
tabs_position_highlight: 10,
|
||||
webhooks_moved: 13,
|
||||
admin_integrations_moved: 15,
|
||||
personal_access_token_expiry: 21 # EE-only
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Enums::UserCallout.prepend_if_ee('EE::Enums::UserCallout')
|
|
@ -21,7 +21,7 @@ class InternalId < ApplicationRecord
|
|||
belongs_to :project
|
||||
belongs_to :namespace
|
||||
|
||||
enum usage: Enums::InternalId.usage_resources
|
||||
enum usage: ::InternalIdEnums.usage_resources
|
||||
|
||||
validates :usage, presence: true
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Enums
|
||||
module InternalId
|
||||
def self.usage_resources
|
||||
# when adding new resource, make sure it doesn't conflict with EE usage_resources
|
||||
{
|
||||
module InternalIdEnums
|
||||
def self.usage_resources
|
||||
# when adding new resource, make sure it doesn't conflict with EE usage_resources
|
||||
{
|
||||
issues: 0,
|
||||
merge_requests: 1,
|
||||
deployments: 2,
|
||||
|
@ -15,9 +14,8 @@ module Enums
|
|||
operations_user_lists: 7,
|
||||
alert_management_alerts: 8,
|
||||
sprints: 9 # iterations
|
||||
}
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Enums::InternalId.prepend_if_ee('EE::Enums::InternalId')
|
||||
InternalIdEnums.prepend_if_ee('EE::InternalIdEnums')
|
|
@ -4,7 +4,7 @@ class PrometheusMetric < ApplicationRecord
|
|||
belongs_to :project, validate: true, inverse_of: :prometheus_metrics
|
||||
has_many :prometheus_alerts, inverse_of: :prometheus_metric
|
||||
|
||||
enum group: Enums::PrometheusMetric.groups
|
||||
enum group: PrometheusMetricEnums.groups
|
||||
|
||||
validates :title, presence: true
|
||||
validates :query, presence: true
|
||||
|
@ -72,6 +72,6 @@ class PrometheusMetric < ApplicationRecord
|
|||
private
|
||||
|
||||
def group_details(group)
|
||||
Enums::PrometheusMetric.group_details.fetch(group.to_sym)
|
||||
PrometheusMetricEnums.group_details.fetch(group.to_sym)
|
||||
end
|
||||
end
|
||||
|
|
84
app/models/prometheus_metric_enums.rb
Normal file
84
app/models/prometheus_metric_enums.rb
Normal file
|
@ -0,0 +1,84 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module PrometheusMetricEnums
|
||||
def self.groups
|
||||
{
|
||||
# built-in groups
|
||||
nginx_ingress_vts: -1,
|
||||
ha_proxy: -2,
|
||||
aws_elb: -3,
|
||||
nginx: -4,
|
||||
kubernetes: -5,
|
||||
nginx_ingress: -6,
|
||||
cluster_health: -100
|
||||
}.merge(custom_groups).freeze
|
||||
end
|
||||
|
||||
# custom/user groups
|
||||
def self.custom_groups
|
||||
{
|
||||
business: 0,
|
||||
response: 1,
|
||||
system: 2
|
||||
}.freeze
|
||||
end
|
||||
|
||||
def self.group_details
|
||||
{
|
||||
# built-in groups
|
||||
nginx_ingress_vts: {
|
||||
group_title: _('Response metrics (NGINX Ingress VTS)'),
|
||||
required_metrics: %w(nginx_upstream_responses_total nginx_upstream_response_msecs_avg),
|
||||
priority: 10
|
||||
}.freeze,
|
||||
nginx_ingress: {
|
||||
group_title: _('Response metrics (NGINX Ingress)'),
|
||||
required_metrics: %w(nginx_ingress_controller_requests nginx_ingress_controller_ingress_upstream_latency_seconds_sum),
|
||||
priority: 10
|
||||
}.freeze,
|
||||
ha_proxy: {
|
||||
group_title: _('Response metrics (HA Proxy)'),
|
||||
required_metrics: %w(haproxy_frontend_http_requests_total haproxy_frontend_http_responses_total),
|
||||
priority: 10
|
||||
}.freeze,
|
||||
aws_elb: {
|
||||
group_title: _('Response metrics (AWS ELB)'),
|
||||
required_metrics: %w(aws_elb_request_count_sum aws_elb_latency_average aws_elb_httpcode_backend_5_xx_sum),
|
||||
priority: 10
|
||||
}.freeze,
|
||||
nginx: {
|
||||
group_title: _('Response metrics (NGINX)'),
|
||||
required_metrics: %w(nginx_server_requests nginx_server_requestMsec),
|
||||
priority: 10
|
||||
}.freeze,
|
||||
kubernetes: {
|
||||
group_title: _('System metrics (Kubernetes)'),
|
||||
required_metrics: %w(container_memory_usage_bytes container_cpu_usage_seconds_total),
|
||||
priority: 5
|
||||
}.freeze,
|
||||
cluster_health: {
|
||||
group_title: _('Cluster Health'),
|
||||
required_metrics: %w(container_memory_usage_bytes container_cpu_usage_seconds_total),
|
||||
priority: 10
|
||||
}.freeze
|
||||
}.merge(custom_group_details).freeze
|
||||
end
|
||||
|
||||
# custom/user groups
|
||||
def self.custom_group_details
|
||||
{
|
||||
business: {
|
||||
group_title: _('Business metrics (Custom)'),
|
||||
priority: 0
|
||||
}.freeze,
|
||||
response: {
|
||||
group_title: _('Response metrics (Custom)'),
|
||||
priority: -5
|
||||
}.freeze,
|
||||
system: {
|
||||
group_title: _('System metrics (Custom)'),
|
||||
priority: -10
|
||||
}.freeze
|
||||
}.freeze
|
||||
end
|
||||
end
|
|
@ -3,9 +3,9 @@
|
|||
class UserCallout < ApplicationRecord
|
||||
belongs_to :user
|
||||
|
||||
# We use `Enums::UserCallout.feature_names` here so that EE can more easily
|
||||
# We use `UserCalloutEnums.feature_names` here so that EE can more easily
|
||||
# extend this `Hash` with new values.
|
||||
enum feature_name: Enums::UserCallout.feature_names
|
||||
enum feature_name: ::UserCalloutEnums.feature_names
|
||||
|
||||
validates :user, presence: true
|
||||
validates :feature_name,
|
||||
|
|
26
app/models/user_callout_enums.rb
Normal file
26
app/models/user_callout_enums.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module UserCalloutEnums
|
||||
# Returns the `Hash` to use for the `feature_name` enum in the `UserCallout`
|
||||
# model.
|
||||
#
|
||||
# This method is separate from the `UserCallout` model so that it can be
|
||||
# extended by EE.
|
||||
#
|
||||
# If you are going to add new items to this hash, check that you're not going
|
||||
# to conflict with EE-only values: https://gitlab.com/gitlab-org/gitlab/blob/master/ee/app/models/ee/user_callout_enums.rb
|
||||
def self.feature_names
|
||||
{
|
||||
gke_cluster_integration: 1,
|
||||
gcp_signup_offer: 2,
|
||||
cluster_security_warning: 3,
|
||||
suggest_popover_dismissed: 9,
|
||||
tabs_position_highlight: 10,
|
||||
webhooks_moved: 13,
|
||||
admin_integrations_moved: 15,
|
||||
personal_access_token_expiry: 21 # EE-only
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
UserCalloutEnums.prepend_if_ee('EE::UserCalloutEnums')
|
|
@ -31,7 +31,7 @@ module Metrics
|
|||
# A group title is valid if it is one of the limited
|
||||
# options the user can select in the UI.
|
||||
def valid_group_title?(group)
|
||||
Enums::PrometheusMetric
|
||||
PrometheusMetricEnums
|
||||
.custom_group_details
|
||||
.map { |_, details| details[:group_title] }
|
||||
.include?(group)
|
||||
|
@ -100,12 +100,12 @@ module Metrics
|
|||
# Returns a symbol representing the group that
|
||||
# the dashboard's group title belongs to.
|
||||
# It will be one of the keys found under
|
||||
# Enums::PrometheusMetric.custom_groups.
|
||||
# PrometheusMetricEnums.custom_groups.
|
||||
#
|
||||
# @return [String]
|
||||
def group_key
|
||||
strong_memoize(:group_key) do
|
||||
Enums::PrometheusMetric
|
||||
PrometheusMetricEnums
|
||||
.group_details
|
||||
.find { |_, details| details[:group_title] == group }
|
||||
.first
|
||||
|
|
|
@ -13,7 +13,7 @@ class DeleteUserCalloutAlertsMoved < ActiveRecord::Migration[6.0]
|
|||
|
||||
BATCH_SIZE = 1_000
|
||||
|
||||
# Inlined from Enums::UserCallout.feature_names
|
||||
# Inlined from UserCalloutEnums.feature_names
|
||||
FEATURE_NAME_ALERTS_MOVED = 20
|
||||
|
||||
def up
|
||||
|
|
|
@ -4475,11 +4475,6 @@ type EpicIssue implements Noteable {
|
|||
"""
|
||||
state: IssueState!
|
||||
|
||||
"""
|
||||
Indicates whether an issue is published to the status page
|
||||
"""
|
||||
statusPagePublishedIncident: Boolean
|
||||
|
||||
"""
|
||||
Indicates the currently logged in user is subscribed to the issue
|
||||
"""
|
||||
|
@ -6113,11 +6108,6 @@ type Issue implements Noteable {
|
|||
"""
|
||||
state: IssueState!
|
||||
|
||||
"""
|
||||
Indicates whether an issue is published to the status page
|
||||
"""
|
||||
statusPagePublishedIncident: Boolean
|
||||
|
||||
"""
|
||||
Indicates the currently logged in user is subscribed to the issue
|
||||
"""
|
||||
|
|
|
@ -12471,20 +12471,6 @@
|
|||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "statusPagePublishedIncident",
|
||||
"description": "Indicates whether an issue is published to the status page",
|
||||
"args": [
|
||||
|
||||
],
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "Boolean",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "subscribed",
|
||||
"description": "Indicates the currently logged in user is subscribed to the issue",
|
||||
|
@ -16841,20 +16827,6 @@
|
|||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "statusPagePublishedIncident",
|
||||
"description": "Indicates whether an issue is published to the status page",
|
||||
"args": [
|
||||
|
||||
],
|
||||
"type": {
|
||||
"kind": "SCALAR",
|
||||
"name": "Boolean",
|
||||
"ofType": null
|
||||
},
|
||||
"isDeprecated": false,
|
||||
"deprecationReason": null
|
||||
},
|
||||
{
|
||||
"name": "subscribed",
|
||||
"description": "Indicates the currently logged in user is subscribed to the issue",
|
||||
|
|
|
@ -750,7 +750,6 @@ Relationship between an epic and an issue
|
|||
| `relationPath` | String | URI path of the epic-issue relation |
|
||||
| `relativePosition` | Int | Relative position of the issue (used for positioning in epic tree and issue boards) |
|
||||
| `state` | IssueState! | State of the issue |
|
||||
| `statusPagePublishedIncident` | Boolean | Indicates whether an issue is published to the status page |
|
||||
| `subscribed` | Boolean! | Indicates the currently logged in user is subscribed to the issue |
|
||||
| `taskCompletionStatus` | TaskCompletionStatus! | Task completion status of the issue |
|
||||
| `timeEstimate` | Int! | Time estimate of the issue |
|
||||
|
@ -917,7 +916,6 @@ Represents a Group Member
|
|||
| `reference` | String! | Internal reference of the issue. Returned in shortened format by default |
|
||||
| `relativePosition` | Int | Relative position of the issue (used for positioning in epic tree and issue boards) |
|
||||
| `state` | IssueState! | State of the issue |
|
||||
| `statusPagePublishedIncident` | Boolean | Indicates whether an issue is published to the status page |
|
||||
| `subscribed` | Boolean! | Indicates the currently logged in user is subscribed to the issue |
|
||||
| `taskCompletionStatus` | TaskCompletionStatus! | Task completion status of the issue |
|
||||
| `timeEstimate` | Int! | Time estimate of the issue |
|
||||
|
|
|
@ -33,32 +33,28 @@ tempted to organize the `enum` as the following:
|
|||
```ruby
|
||||
# Define `failure_reason` enum in `Pipeline` model:
|
||||
class Pipeline < ApplicationRecord
|
||||
enum failure_reason: Enums::Pipeline.failure_reasons
|
||||
enum failure_reason: ::PipelineEnums.failure_reasons
|
||||
end
|
||||
```
|
||||
|
||||
```ruby
|
||||
# Define key/value pairs that used in FOSS and EE:
|
||||
module Enums
|
||||
module Pipeline
|
||||
def self.failure_reasons
|
||||
{ unknown_failure: 0, config_error: 1 }
|
||||
end
|
||||
module PipelineEnums
|
||||
def self.failure_reasons
|
||||
{ unknown_failure: 0, config_error: 1 }
|
||||
end
|
||||
end
|
||||
|
||||
Enums::Pipeline.prepend_if_ee('EE::Enums::Pipeline')
|
||||
PipelineEnums.prepend_if_ee('EE::PipelineEnums')
|
||||
```
|
||||
|
||||
```ruby
|
||||
# Define key/value pairs that used in EE only:
|
||||
module EE
|
||||
module Enums
|
||||
module Pipeline
|
||||
override :failure_reasons
|
||||
def failure_reasons
|
||||
super.merge(activity_limit_exceeded: 2)
|
||||
end
|
||||
module PipelineEnums
|
||||
override :failure_reasons
|
||||
def failure_reasons
|
||||
super.merge(activity_limit_exceeded: 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -67,7 +63,7 @@ end
|
|||
This works as-is, however, it has a couple of downside that:
|
||||
|
||||
- Someone could define a key/value pair in EE that is **conflicted** with a value defined in FOSS.
|
||||
e.g. Define `activity_limit_exceeded: 1` in `EE::Enums::Pipeline`.
|
||||
e.g. Define `activity_limit_exceeded: 1` in `EE::PipelineEnums`.
|
||||
- When it happens, the feature works totally different.
|
||||
e.g. We cannot figure out `failure_reason` is either `config_error` or `activity_limit_exceeded`.
|
||||
- When it happens, we have to ship a database migration to fix the data integrity,
|
||||
|
@ -78,12 +74,10 @@ For example, this example sets `1000` as the offset:
|
|||
|
||||
```ruby
|
||||
module EE
|
||||
module Enums
|
||||
module Pipeline
|
||||
override :failure_reasons
|
||||
def failure_reasons
|
||||
super.merge(activity_limit_exceeded: 1_000, size_limit_exceeded: 1_001)
|
||||
end
|
||||
module PipelineEnums
|
||||
override :failure_reasons
|
||||
def failure_reasons
|
||||
super.merge(activity_limit_exceeded: 1_000, size_limit_exceeded: 1_001)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -374,6 +374,8 @@ You can supply a custom root certificate to complete TLS verification by using t
|
|||
specifying a `ca` setting in a [`.bowerrc`](https://bower.io/docs/config/#bowerrc-specification)
|
||||
file.
|
||||
|
||||
### Configuring Bundler projects
|
||||
|
||||
#### Using private Bundler registries
|
||||
|
||||
If you have a private Bundler registry you can use the
|
||||
|
@ -394,6 +396,39 @@ specifying a [`BUNDLE_SSL_CA_CERT`](https://bundler.io/v2.0/man/bundle-config.1.
|
|||
[environment variable](../../../ci/variables/README.md#custom-environment-variables)
|
||||
in the job definition.
|
||||
|
||||
### Configuring Composer projects
|
||||
|
||||
#### Using private Composer registries
|
||||
|
||||
If you have a private Composer registry you can use the
|
||||
[`repositories`](https://getcomposer.org/doc/05-repositories.md)
|
||||
setting to specify its location.
|
||||
|
||||
For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"repositories": [
|
||||
{ "packagist.org": false },
|
||||
{
|
||||
"type": "composer",
|
||||
"url": "https://composer.example.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"monolog/monolog": "1.0.*"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Custom root certificates for Composer
|
||||
|
||||
You can supply a custom root certificate to complete TLS verification by using the
|
||||
`ADDITIONAL_CA_CERT_BUNDLE` [environment variable](#available-variables), or by
|
||||
specifying a [`COMPOSER_CAFILE`](https://getcomposer.org/doc/03-cli.md#composer-cafile)
|
||||
[environment variable](../../../ci/variables/README.md#custom-environment-variables)
|
||||
in the job definition.
|
||||
|
||||
### Configuring Conan projects
|
||||
|
||||
You can configure [Conan](https://conan.io/) projects by adding a `.conan` directory to your
|
||||
|
|
|
@ -9,8 +9,49 @@ info: To determine the technical writer assigned to the Stage/Group associated w
|
|||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/6861) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.6.
|
||||
|
||||
When you create a new [project](../project/index.md), creating it based on custom project templates is
|
||||
a convenient option.
|
||||
Custom project templates are useful for organizations that need to create many similar types of [projects](../project/index.md) and want to start from the same jumping-off point.
|
||||
|
||||
## Setting up Group-level Project Templates
|
||||
|
||||
To use a custom project template for a new project you need to:
|
||||
|
||||
1. [Create a 'templates' subgroup](subgroups/index.md).
|
||||
1. [Add repositories (projects) to the that new subgroup](index.md#add-projects-to-a-group), as your templates.
|
||||
1. Edit your group's settings to look to your 'templates' subgroup for templates:
|
||||
1. In the left-hand menu, click **{settings}** **Settings > General**.
|
||||
|
||||
NOTE: **Note:**
|
||||
If you don't have access to the group's settings, you may not have sufficient privileges (for example, you may need developer or higher permissions).
|
||||
|
||||
1. Scroll to **Custom project templates** and click **Expand**. If no **Custom project templates** section displays, make sure you've created a subgroup, and added a project (repository) to it.
|
||||
1. Select the 'templates' subgroup.
|
||||
|
||||
### Example structure
|
||||
|
||||
Here is a sample group/project structure for a hypothetical "Acme Co" for project templates:
|
||||
|
||||
```txt
|
||||
# GitLab instance and group
|
||||
gitlab.com/acmeco/
|
||||
# Subgroups
|
||||
internal
|
||||
tools
|
||||
# Subgroup for handling project templates
|
||||
websites
|
||||
templates
|
||||
# Project templates
|
||||
client-site-django
|
||||
client-site-gatsby
|
||||
client-site-hTML
|
||||
|
||||
# Other projects
|
||||
client-site-a
|
||||
client-site-b
|
||||
client-site-c
|
||||
...
|
||||
```
|
||||
|
||||
### Adjust Settings
|
||||
|
||||
Users can configure a GitLab group that serves as template
|
||||
source under a group's **Settings > General > Custom project templates**.
|
||||
|
|
|
@ -15,7 +15,7 @@ module Banzai
|
|||
|
||||
def xpath_search
|
||||
"descendant-or-self::a[contains(@href,'clusters') and \
|
||||
starts-with(@href, '#{::Gitlab.config.gitlab.url}')]"
|
||||
starts-with(@href, '#{gitlab_domain}')]"
|
||||
end
|
||||
|
||||
def link_pattern
|
||||
|
|
|
@ -82,6 +82,10 @@ module Banzai
|
|||
def metrics_dashboard_url
|
||||
raise NotImplementedError
|
||||
end
|
||||
|
||||
def gitlab_domain
|
||||
::Gitlab.config.gitlab.url
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ module Banzai
|
|||
def xpath_search
|
||||
"descendant-or-self::a[contains(@href,'metrics') and \
|
||||
contains(@href,'environments') and \
|
||||
starts-with(@href, '#{Gitlab.config.gitlab.url}')]"
|
||||
starts-with(@href, '#{gitlab_domain}')]"
|
||||
end
|
||||
|
||||
# Regular expression matching metrics urls
|
||||
|
|
|
@ -27,7 +27,7 @@ module Gitlab
|
|||
private
|
||||
|
||||
def custom_group_titles
|
||||
@custom_group_titles ||= Enums::PrometheusMetric.custom_group_details.values.map { |group_details| group_details[:group_title] }
|
||||
@custom_group_titles ||= PrometheusMetricEnums.custom_group_details.values.map { |group_details| group_details[:group_title] }
|
||||
end
|
||||
|
||||
def edit_path(metric)
|
||||
|
|
|
@ -92,12 +92,16 @@ module Gitlab
|
|||
end
|
||||
|
||||
def gitlab_host_pattern
|
||||
Regexp.escape(Gitlab.config.gitlab.url)
|
||||
Regexp.escape(gitlab_domain)
|
||||
end
|
||||
|
||||
def project_path_pattern
|
||||
"\/#{Project.reference_pattern}"
|
||||
end
|
||||
|
||||
def gitlab_domain
|
||||
Gitlab.config.gitlab.url
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12749,21 +12749,12 @@ msgstr ""
|
|||
msgid "IncidentManagement|Open"
|
||||
msgstr ""
|
||||
|
||||
msgid "IncidentManagement|Published"
|
||||
msgstr ""
|
||||
|
||||
msgid "IncidentManagement|Published to status page"
|
||||
msgstr ""
|
||||
|
||||
msgid "IncidentManagement|There was an error displaying the incidents."
|
||||
msgstr ""
|
||||
|
||||
msgid "IncidentManagement|Unassigned"
|
||||
msgstr ""
|
||||
|
||||
msgid "IncidentManagement|Unpublished"
|
||||
msgstr ""
|
||||
|
||||
msgid "IncidentSettings|Alert integration"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -18,10 +18,7 @@ RSpec.describe 'Metrics rendering', :js, :kubeclient, :use_clean_rails_memory_st
|
|||
|
||||
before do
|
||||
clear_host_from_memoized_variables
|
||||
|
||||
allow(::Gitlab.config.gitlab)
|
||||
.to receive(:url)
|
||||
.and_return(urls.root_url.chomp('/'))
|
||||
stub_gitlab_domain
|
||||
|
||||
project.add_developer(user)
|
||||
sign_in(user)
|
||||
|
|
|
@ -56,7 +56,6 @@ describe('Incidents List', () => {
|
|||
newIssuePath,
|
||||
incidentTemplateName,
|
||||
issuePath: '/project/isssues',
|
||||
publishedAvailable: true,
|
||||
},
|
||||
stubs: {
|
||||
GlButton: true,
|
||||
|
|
|
@ -8,7 +8,7 @@ RSpec.describe Gitlab::DatabaseImporters::CommonMetrics::PrometheusMetric do
|
|||
end
|
||||
|
||||
it '.group_titles equals ::PrometheusMetric' do
|
||||
existing_group_titles = Enums::PrometheusMetric.group_details.transform_values do |value|
|
||||
existing_group_titles = ::PrometheusMetricEnums.group_details.transform_values do |value|
|
||||
value[:group_title]
|
||||
end
|
||||
expect(Gitlab::DatabaseImporters::CommonMetrics::PrometheusMetricEnums.group_titles).to eq(existing_group_titles)
|
||||
|
|
|
@ -2020,7 +2020,7 @@ RSpec.describe Ci::Pipeline, :mailer do
|
|||
let(:project) { create(:project, :repository) }
|
||||
let(:branch) { project.default_branch }
|
||||
let(:ref) { project.ci_refs.take }
|
||||
let(:config_source) { Enums::Ci::Pipeline.config_sources[:parameter_source] }
|
||||
let(:config_source) { Ci::PipelineEnums.config_sources[:parameter_source] }
|
||||
let!(:pipeline1) { create(:ci_pipeline, :success, project: project, ref: branch) }
|
||||
let!(:pipeline2) { create(:ci_pipeline, :success, project: project, ref: branch) }
|
||||
let!(:pipeline3) { create(:ci_pipeline, :failed, project: project, ref: branch) }
|
||||
|
|
|
@ -125,7 +125,7 @@ RSpec.describe Ci::Ref do
|
|||
|
||||
describe '#last_finished_pipeline_id' do
|
||||
let(:pipeline_status) { :running }
|
||||
let(:config_source) { Enums::Ci::Pipeline.config_sources[:repository_source] }
|
||||
let(:config_source) { Ci::PipelineEnums.config_sources[:repository_source] }
|
||||
let(:pipeline) { create(:ci_pipeline, pipeline_status, config_source: config_source) }
|
||||
let(:ci_ref) { pipeline.ci_ref }
|
||||
|
||||
|
@ -143,7 +143,7 @@ RSpec.describe Ci::Ref do
|
|||
end
|
||||
|
||||
context 'when the pipeline is not a ci_source' do
|
||||
let(:config_source) { Enums::Ci::Pipeline.config_sources[:parameter_source] }
|
||||
let(:config_source) { Ci::PipelineEnums.config_sources[:parameter_source] }
|
||||
|
||||
it 'returns nil' do
|
||||
expect(ci_ref.last_finished_pipeline_id).to be_nil
|
||||
|
|
|
@ -65,7 +65,7 @@ RSpec.describe Ci::PipelinePresenter do
|
|||
|
||||
describe '#failure_reason' do
|
||||
context 'when pipeline has a failure reason' do
|
||||
Enums::Ci::Pipeline.failure_reasons.keys.each do |failure_reason|
|
||||
::Ci::PipelineEnums.failure_reasons.keys.each do |failure_reason|
|
||||
context "when failure reason is #{failure_reason}" do
|
||||
before do
|
||||
pipeline.failure_reason = failure_reason
|
||||
|
|
|
@ -477,7 +477,7 @@ RSpec.describe API::Ci::Pipelines do
|
|||
end
|
||||
|
||||
context 'when config source is not ci' do
|
||||
let(:non_ci_config_source) { Enums::Ci::Pipeline.non_ci_config_source_values.first }
|
||||
let(:non_ci_config_source) { ::Ci::PipelineEnums.non_ci_config_source_values.first }
|
||||
let(:pipeline_not_ci) do
|
||||
create(:ci_pipeline, config_source: non_ci_config_source, project: project)
|
||||
end
|
||||
|
|
|
@ -240,7 +240,7 @@ RSpec.describe API::Jobs do
|
|||
end
|
||||
|
||||
context 'when config source not ci' do
|
||||
let(:non_ci_config_source) { Enums::Ci::Pipeline.non_ci_config_source_values.first }
|
||||
let(:non_ci_config_source) { ::Ci::PipelineEnums.non_ci_config_source_values.first }
|
||||
let(:pipeline) do
|
||||
create(:ci_pipeline, config_source: non_ci_config_source, project: project)
|
||||
end
|
||||
|
|
|
@ -41,7 +41,7 @@ module MetricsDashboardHelpers
|
|||
end
|
||||
|
||||
def business_metric_title
|
||||
Enums::PrometheusMetric.group_details[:business][:group_title]
|
||||
PrometheusMetricEnums.group_details[:business][:group_title]
|
||||
end
|
||||
|
||||
def self_monitoring_dashboard_path
|
||||
|
|
|
@ -13,4 +13,14 @@ module MetricsDashboardUrlHelpers
|
|||
Gitlab::Metrics::Dashboard::Url.clear_memoization(method_name)
|
||||
end
|
||||
end
|
||||
|
||||
def stub_gitlab_domain
|
||||
allow_any_instance_of(Banzai::Filter::InlineEmbedsFilter)
|
||||
.to receive(:gitlab_domain)
|
||||
.and_return(urls.root_url.chomp('/'))
|
||||
|
||||
allow(Gitlab::Metrics::Dashboard::Url)
|
||||
.to receive(:gitlab_domain)
|
||||
.and_return(urls.root_url.chomp('/'))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue