Skip to content
Snippets Groups Projects
Commit 536aa3a1 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 50ae4065
No related branches found
No related tags found
No related merge requests found
Showing
with 198 additions and 86 deletions
Loading
Loading
@@ -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`;
 
Loading
Loading
@@ -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}`;
 
Loading
Loading
Loading
Loading
@@ -63,11 +63,6 @@
background-color: $gray-normal;
}
 
a,
button {
color: $gray-700;
}
svg {
vertical-align: middle;
top: -1px;
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -15,8 +21,9 @@ module Projects
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
Loading
Loading
@@ -45,8 +52,41 @@ module Projects
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
Loading
Loading
@@ -95,6 +135,10 @@ module Projects
environment_scope == finder.cluster.environment_scope
end
end
def id
nil
end
end
end
end
Loading
Loading
@@ -19,6 +19,18 @@ module ExploreHelper
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
Loading
Loading
Loading
Loading
@@ -207,6 +207,13 @@ module SortingHelper
}.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
 
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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'
 
Loading
Loading
# 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
Loading
Loading
@@ -6,7 +6,7 @@ module AkismetMethods
end
 
def akismet
@akismet ||= AkismetService.new(
@akismet ||= Spam::AkismetService.new(
spammable_owner.name,
spammable_owner.email,
spammable.spammable_text,
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
# 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
Loading
Loading
@@ -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\"",
Loading
Loading
---
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
Loading
Loading
@@ -144,7 +144,7 @@ the steps bellow.
 
1. Enter the Rails console:
 
```sh
```shell
sudo gitlab-rails console
```
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment