Commit 6d5482bf authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent fff40ee848ee
......@@ -5,6 +5,14 @@ import { ApolloLink } from 'apollo-link';
import { BatchHttpLink } from 'apollo-link-batch-http';
import csrf from '~/lib/utils/csrf';
export const fetchPolicies = {
CACHE_FIRST: 'cache-first',
CACHE_AND_NETWORK: 'cache-and-network',
NETWORK_ONLY: 'network-only',
NO_CACHE: 'no-cache',
CACHE_ONLY: 'cache-only',
};
export default (resolvers = {}, config = {}) => {
let uri = `${gon.relative_url_root}/api/graphql`;
......@@ -32,5 +40,10 @@ export default (resolvers = {}, config = {}) => {
}),
resolvers,
assumeImmutableResults: config.assumeImmutableResults,
defaultOptions: {
query: {
fetchPolicy: config.fetchPolicy || fetchPolicies.CACHE_FIRST,
},
},
});
};
import { omit } from 'lodash';
import createGqClient from '~/lib/graphql';
import createGqClient, { fetchPolicies } from '~/lib/graphql';
import { getIdFromGraphQLId } from '~/graphql_shared/utils';
export const gqClient = createGqClient();
export const gqClient = createGqClient(
{},
{
fetchPolicy: fetchPolicies.NO_CACHE,
},
);
export const uniqMetricsId = metric => `${metric.metric_id}_${metric.id}`;
......
......@@ -63,11 +63,6 @@
background-color: $gray-normal;
}
a,
button {
color: $gray-700;
}
svg {
vertical-align: middle;
top: -1px;
......
......@@ -4,9 +4,15 @@ module Projects
module Serverless
class FunctionsFinder
include Gitlab::Utils::StrongMemoize
include ReactiveCaching
attr_reader :project
self.reactive_cache_key = ->(finder) { finder.cache_key }
self.reactive_cache_worker_finder = ->(_id, *args) { from_cache(*args) }
MAX_CLUSTERS = 10
def initialize(project)
@project = project
end
......@@ -15,8 +21,9 @@ def execute
knative_services.flatten.compact
end
# Possible return values: Clusters::KnativeServicesFinder::KNATIVE_STATE
def knative_installed
return knative_installed_from_cluster?(*cache_key) if available_environments.empty?
states = services_finders.map do |finder|
finder.knative_detected.tap do |state|
return state if state == ::Clusters::KnativeServicesFinder::KNATIVE_STATES['checking'] # rubocop:disable Cop/AvoidReturnFromBlocks
......@@ -45,8 +52,41 @@ def has_prometheus?(environment_scope)
end
end
def self.from_cache(project_id)
project = Project.find(project_id)
new(project)
end
def cache_key(*args)
[project.id]
end
def calculate_reactive_cache(*)
# rubocop: disable CodeReuse/ActiveRecord
project.all_clusters.enabled.take(MAX_CLUSTERS).any? do |cluster|
cluster.kubeclient.knative_client.discover
rescue Kubeclient::ResourceNotFoundError
next
end
end
private
def knative_installed_from_cluster?(*cache_key)
cached_data = with_reactive_cache_memoized(*cache_key) { |data| data }
return ::Clusters::KnativeServicesFinder::KNATIVE_STATES['checking'] if cached_data.nil?
cached_data ? true : false
end
def with_reactive_cache_memoized(*cache_key)
strong_memoize(:reactive_cache) do
with_reactive_cache(*cache_key) { |data| data }
end
end
def knative_service(environment_scope, name)
finders_for_scope(environment_scope).map do |finder|
services = finder
......@@ -95,6 +135,10 @@ def finders_for_scope(environment_scope)
environment_scope == finder.cluster.environment_scope
end
end
def id
nil
end
end
end
end
......@@ -19,6 +19,18 @@ def filter_projects_path(options = {})
request_path_with_options(options)
end
def filter_audit_path(options = {})
exist_opts = {
entity_type: params[:entity_type],
entity_id: params[:entity_id],
created_before: params[:created_before],
created_after: params[:created_after],
sort: params[:sort]
}
options = exist_opts.merge(options).delete_if { |key, value| value.blank? }
request_path_with_options(options)
end
def filter_groups_path(options = {})
request_path_with_options(options)
end
......
......@@ -207,6 +207,13 @@ def issuable_reverse_sort_order_hash
}.merge(issuable_sort_option_overrides)
end
def audit_logs_sort_order_hash
{
sort_value_recently_created => sort_title_recently_created,
sort_value_oldest_created => sort_title_oldest_created
}
end
def issuable_sort_option_title(sort_value)
sort_value = issuable_sort_option_overrides[sort_value] || sort_value
......
......@@ -13,6 +13,8 @@ class AuditEvent < ApplicationRecord
scope :by_entity_type, -> (entity_type) { where(entity_type: entity_type) }
scope :by_entity_id, -> (entity_id) { where(entity_id: entity_id) }
scope :order_by_id_desc, -> { order(id: :desc) }
scope :order_by_id_asc, -> { order(id: :asc) }
after_initialize :initialize_details
......
......@@ -3,7 +3,7 @@
module Clusters
module Applications
class Runner < ApplicationRecord
VERSION = '0.13.0'
VERSION = '0.13.1'
self.table_name = 'clusters_applications_runners'
......
# frozen_string_literal: true
class AkismetService
attr_accessor :text, :options
def initialize(owner_name, owner_email, text, options = {})
@owner_name = owner_name
@owner_email = owner_email
@text = text
@options = options
end
def spam?
return false unless akismet_enabled?
params = {
type: 'comment',
text: text,
created_at: DateTime.now,
author: owner_name,
author_email: owner_email,
referrer: options[:referrer]
}
begin
is_spam, is_blatant = akismet_client.check(options[:ip_address], options[:user_agent], params)
is_spam || is_blatant
rescue => e
Rails.logger.error("Unable to connect to Akismet: #{e}, skipping check") # rubocop:disable Gitlab/RailsLogger
false
end
end
def submit_ham
submit(:ham)
end
def submit_spam
submit(:spam)
end
private
attr_accessor :owner_name, :owner_email
def akismet_client
@akismet_client ||= ::Akismet::Client.new(Gitlab::CurrentSettings.akismet_api_key,
Gitlab.config.gitlab.url)
end
def akismet_enabled?
Gitlab::CurrentSettings.akismet_enabled
end
def submit(type)
return false unless akismet_enabled?
params = {
type: 'comment',
text: text,
author: owner_name,
author_email: owner_email
}
begin
akismet_client.public_send(type, options[:ip_address], options[:user_agent], params) # rubocop:disable GitlabSecurity/PublicSend
true
rescue => e
Rails.logger.error("Unable to connect to Akismet: #{e}, skipping!") # rubocop:disable Gitlab/RailsLogger
false
end
end
end
......@@ -6,7 +6,7 @@ def spammable_owner
end
def akismet
@akismet ||= AkismetService.new(
@akismet ||= Spam::AkismetService.new(
spammable_owner.name,
spammable_owner.email,
spammable.spammable_text,
......
......@@ -3,7 +3,7 @@
module Notes
class UpdateService < BaseService
def execute(note)
return note unless note.editable?
return note unless note.editable? && params.present?
old_mentioned_users = note.mentioned_users(current_user).to_a
......
# frozen_string_literal: true
module Spam
class AkismetService
attr_accessor :text, :options
def initialize(owner_name, owner_email, text, options = {})
@owner_name = owner_name
@owner_email = owner_email
@text = text
@options = options
end
def spam?
return false unless akismet_enabled?
params = {
type: 'comment',
text: text,
created_at: DateTime.now,
author: owner_name,
author_email: owner_email,
referrer: options[:referrer]
}
begin
is_spam, is_blatant = akismet_client.check(options[:ip_address], options[:user_agent], params)
is_spam || is_blatant
rescue => e
Rails.logger.error("Unable to connect to Akismet: #{e}, skipping check") # rubocop:disable Gitlab/RailsLogger
false
end
end
def submit_ham
submit(:ham)
end
def submit_spam
submit(:spam)
end
private
attr_accessor :owner_name, :owner_email
def akismet_client
@akismet_client ||= ::Akismet::Client.new(Gitlab::CurrentSettings.akismet_api_key,
Gitlab.config.gitlab.url)
end
def akismet_enabled?
Gitlab::CurrentSettings.akismet_enabled
end
def submit(type)
return false unless akismet_enabled?
params = {
type: 'comment',
text: text,
author: owner_name,
author_email: owner_email
}
begin
akismet_client.public_send(type, options[:ip_address], options[:user_agent], params) # rubocop:disable GitlabSecurity/PublicSend
true
rescue => e
Rails.logger.error("Unable to connect to Akismet: #{e}, skipping!") # rubocop:disable Gitlab/RailsLogger
false
end
end
end
end
......@@ -22,7 +22,7 @@
%span.board-title-main-text.block-truncated{ "v-if": "list.type !== \"label\"",
":title" => '((list.label && list.label.description) || list.title || "")',
data: { container: "body" },
":class": "{ 'has-tooltip': !['backlog', 'closed'].includes(list.type) }" }
":class": "{ 'has-tooltip': !['backlog', 'closed'].includes(list.type), 'd-block': list.type === 'milestone' }" }
{{ list.title }}
%span.board-title-sub-text.prepend-left-5.has-tooltip{ "v-if": "list.type === \"assignee\"",
......
---
title: Allow long milestone titles on board lists to be truncated
merge_request:
author:
type: fixed
---
title: Fix JIRA::HTTPError initialize parameter
merge_request: 24060
author:
type: fixed
---
title: Remove gray color from diff buttons
merge_request: 24041
author:
type: fixed
---
title: Add separate classes for project related classes
merge_request: 23887
author: Rajendra Kadam
type: added
---
title: Update GitLab Runner Helm Chart to 0.13.1 (GitLab Runner 12.7.1)
merge_request: 23588
author:
type: other
# frozen_string_literal: true
# This file requires config/initializers/1_settings.rb
if Rails.env.development?
Rails.application.config.hosts << Gitlab.config.gitlab.host
end
......@@ -144,7 +144,7 @@ the steps bellow.
1. Enter the Rails console:
```sh
```shell
sudo gitlab-rails console
```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment