Skip to content
Snippets Groups Projects
Commit 58f29d5f authored by Jacques Erasmus's avatar Jacques Erasmus
Browse files

Merge branch 'master' into 48746-fix-files-uploaded-in-base64

parents 0572da24 a9827357
No related branches found
No related tags found
No related merge requests found
Showing
with 134 additions and 45 deletions
Loading
Loading
@@ -1046,3 +1046,19 @@
left: auto;
line-height: 0;
}
@media (max-width: map-get($grid-breakpoints, md)-1) {
.diffs .files {
@include fixed-width-container;
flex-direction: column;
.diff-tree-list {
width: 100%;
}
.tree-list-holder {
max-height: calc(50px + 50vh);
padding-right: 0;
}
}
}
// Limit MR description for side-by-side diff view
.fixed-width-container {
max-width: $limited-layout-width - ($gl-padding * 2);
margin-left: auto;
margin-right: auto;
@include fixed-width-container;
}
 
.issuable-warning-icon {
Loading
Loading
Loading
Loading
@@ -68,6 +68,10 @@
}
}
 
.current-host.canary {
color: $perf-bar-canary-text;
}
strong {
color: $white-light;
}
Loading
Loading
Loading
Loading
@@ -7,8 +7,9 @@ class BranchesFinder
end
 
def execute
branches = @repository.branches_sorted_by(sort)
filter_by_name(branches)
branches = repository.branches_sorted_by(sort)
branches = by_search(branches)
branches
end
 
private
Loading
Loading
@@ -23,11 +24,39 @@ class BranchesFinder
@params[:sort].presence || 'name'
end
 
def filter_by_name(branches)
if search
branches.select { |branch| branch.name.upcase.include?(search.upcase) }
def by_search(branches)
return branches unless search
case search
when ->(v) { v.starts_with?('^') }
filter_branches_with_prefix(branches, search.slice(1..-1).upcase)
when ->(v) { v.ends_with?('$') }
filter_branches_with_suffix(branches, search.chop.upcase)
else
branches
matches = filter_branches_by_name(branches, search.upcase)
set_exact_match_as_first_result(matches, search)
end
end
def filter_branches_with_prefix(branches, prefix)
branches.select { |branch| branch.name.upcase.starts_with?(prefix) }
end
def filter_branches_with_suffix(branches, suffix)
branches.select { |branch| branch.name.upcase.ends_with?(suffix) }
end
def filter_branches_by_name(branches, term)
branches.select { |branch| branch.name.upcase.include?(term) }
end
def set_exact_match_as_first_result(matches, term)
exact_match_index = find_exact_match_index(matches, term)
matches.insert(0, matches.delete_at(exact_match_index)) if exact_match_index
matches
end
def find_exact_match_index(matches, term)
matches.index { |branch| branch.name.casecmp(term) == 0 }
end
end
Loading
Loading
@@ -42,17 +42,7 @@ class ProjectsFinder < UnionFinder
init_collection
end
 
collection = by_ids(collection)
collection = by_personal(collection)
collection = by_starred(collection)
collection = by_trending(collection)
collection = by_visibilty_level(collection)
collection = by_tags(collection)
collection = by_search(collection)
collection = by_archived(collection)
collection = by_custom_attributes(collection)
collection = by_deleted_status(collection)
collection = filter_projects(collection)
sort(collection)
end
 
Loading
Loading
@@ -66,6 +56,21 @@ class ProjectsFinder < UnionFinder
end
end
 
# EE would override this to add more filters
def filter_projects(collection)
collection = by_ids(collection)
collection = by_personal(collection)
collection = by_starred(collection)
collection = by_trending(collection)
collection = by_visibilty_level(collection)
collection = by_tags(collection)
collection = by_search(collection)
collection = by_archived(collection)
collection = by_custom_attributes(collection)
collection = by_deleted_status(collection)
collection
end
# rubocop: disable CodeReuse/ActiveRecord
def collection_with_user
if owned_projects?
Loading
Loading
Loading
Loading
@@ -18,22 +18,20 @@ module PreferencesHelper
groups: _("Your Groups"),
todos: _("Your Todos"),
issues: _("Assigned Issues"),
merge_requests: _("Assigned Merge Requests")
merge_requests: _("Assigned Merge Requests"),
operations: _("Operations Dashboard")
}.with_indifferent_access.freeze
 
# Returns an Array usable by a select field for more user-friendly option text
def dashboard_choices
defined = User.dashboards
dashboards = User.dashboards.keys
 
if defined.size != DASHBOARD_CHOICES.size
# Ensure that anyone adding new options updates this method too
raise "`User` defines #{defined.size} dashboard choices," \
" but `DASHBOARD_CHOICES` defined #{DASHBOARD_CHOICES.size}."
else
defined.map do |key, _|
# Use `fetch` so `KeyError` gets raised when a key is missing
[DASHBOARD_CHOICES.fetch(key), key]
end
validate_dashboard_choices!(dashboards)
dashboards -= excluded_dashboard_choices
dashboards.map do |key|
# Use `fetch` so `KeyError` gets raised when a key is missing
[DASHBOARD_CHOICES.fetch(key), key]
end
end
 
Loading
Loading
@@ -52,4 +50,20 @@ module PreferencesHelper
def user_color_scheme
Gitlab::ColorSchemes.for_user(current_user).css_class
end
private
# Ensure that anyone adding new options updates `DASHBOARD_CHOICES` too
def validate_dashboard_choices!(user_dashboards)
if user_dashboards.size != DASHBOARD_CHOICES.size
raise "`User` defines #{user_dashboards.size} dashboard choices," \
" but `DASHBOARD_CHOICES` defined #{DASHBOARD_CHOICES.size}."
end
end
# List of dashboard choice to be excluded from CE.
# EE would override this.
def excluded_dashboard_choices
['operations']
end
end
Loading
Loading
@@ -48,15 +48,21 @@ module SortingHelper
 
def groups_sort_options_hash
{
sort_value_name => sort_title_name,
sort_value_name_desc => sort_title_name_desc,
sort_value_name => sort_title_name,
sort_value_name_desc => sort_title_name_desc,
sort_value_recently_created => sort_title_recently_created,
sort_value_oldest_created => sort_title_oldest_created,
sort_value_oldest_created => sort_title_oldest_created,
sort_value_recently_updated => sort_title_recently_updated,
sort_value_oldest_updated => sort_title_oldest_updated
sort_value_oldest_updated => sort_title_oldest_updated
}
end
 
def subgroups_sort_options_hash
groups_sort_options_hash.merge(
sort_value_most_stars => sort_title_most_stars
)
end
def admin_groups_sort_options_hash
groups_sort_options_hash.merge(
sort_value_largest_group => sort_title_largest_group
Loading
Loading
Loading
Loading
@@ -19,6 +19,17 @@ class Deployment < ActiveRecord::Base
after_create :create_ref
after_create :invalidate_cache
 
scope :for_environment, -> (environment) { where(environment_id: environment) }
def self.last_for_environment(environment)
ids = self
.for_environment(environment)
.select('MAX(id) AS id')
.group(:environment_id)
.map(&:id)
find(ids)
end
def commit
project.commit(sha)
end
Loading
Loading
Loading
Loading
@@ -48,6 +48,8 @@ class Environment < ActiveRecord::Base
order(Gitlab::Database.nulls_first_order("(#{max_deployment_id_sql})", 'ASC'))
end
scope :in_review_folder, -> { where(environment_type: "review") }
scope :for_name, -> (name) { where(name: name) }
scope :for_project, -> (project) { where(project_id: project) }
 
state_machine :state, initial: :available do
event :start do
Loading
Loading
Loading
Loading
@@ -1789,7 +1789,7 @@ class Project < ActiveRecord::Base
return unless export_file_exists?
 
import_export_upload.remove_export_file!
import_export_upload.save
import_export_upload.save unless import_export_upload.destroyed?
end
 
def export_file_exists?
Loading
Loading
Loading
Loading
@@ -217,7 +217,7 @@ class User < ActiveRecord::Base
 
# User's Dashboard preference
# Note: When adding an option, it MUST go on the end of the array.
enum dashboard: [:projects, :stars, :project_activity, :starred_project_activity, :groups, :todos, :issues, :merge_requests]
enum dashboard: [:projects, :stars, :project_activity, :starred_project_activity, :groups, :todos, :issues, :merge_requests, :operations]
 
# User's Project preference
# Note: When adding an option, it MUST go on the end of the array.
Loading
Loading
Loading
Loading
@@ -4,6 +4,7 @@ class BuildDetailsEntity < JobEntity
expose :coverage, :erased_at, :duration
expose :tag_list, as: :tags
expose :has_trace?, as: :has_trace
expose :stage
expose :user, using: UserEntity
expose :runner, using: RunnerEntity
expose :pipeline, using: PipelineEntity
Loading
Loading
Loading
Loading
@@ -22,7 +22,7 @@
.input-group
%input.label.label-monospace{ id: "secret", type: "text", autocomplete: 'off', value: @application.secret, readonly: true }
.input-group-append
= clipboard_button(target: '#application_id', title: _("Copy secret to clipboard"), class: "btn btn btn-default")
= clipboard_button(target: '#secret', title: _("Copy secret to clipboard"), class: "btn btn btn-default")
%tr
%td
= _('Callback URL')
Loading
Loading
Loading
Loading
@@ -5,7 +5,7 @@
.d-flex.justify-content-between.flex-wrap
- providers.each do |provider|
- has_icon = provider_has_icon?(provider)
= link_to omniauth_authorize_path(:user, provider), method: :post, class: 'btn d-flex align-items-center omniauth-btn text-left oauth-login', id: "oauth-login-#{provider}" do
= link_to omniauth_authorize_path(:user, provider), method: :post, class: 'btn d-flex align-items-center omniauth-btn text-left oauth-login qa-saml-login-button', id: "oauth-login-#{provider}" do
- if has_icon
= provider_image_tag(provider)
%span
Loading
Loading
Loading
Loading
@@ -25,7 +25,7 @@
.input-group
%input.label.label-monospace{ id: "secret", type: "text", autocomplete: 'off', value: @application.secret, readonly: true }
.input-group-append
= clipboard_button(target: '#application_id', title: _("Copy secret to clipboard"), class: "btn btn btn-default")
= clipboard_button(target: '#secret', title: _("Copy secret to clipboard"), class: "btn btn btn-default")
%tr
%td
= _('Callback URL')
Loading
Loading
Loading
Loading
@@ -53,7 +53,7 @@
= _("Archived projects")
 
.nav-controls
= render "shared/groups/dropdown"
= render "shared/groups/dropdown", options_hash: subgroups_sort_options_hash
 
.tab-content
#subgroups_and_projects.tab-pane
Loading
Loading
Loading
Loading
@@ -66,6 +66,7 @@
 
- if Gitlab::Sherlock.enabled? || can?(current_user, :read_instance_statistics)
%li.line-separator.d-none.d-sm-block
= render_if_exists 'dashboard/operations/nav_link'
- if can?(current_user, :read_instance_statistics)
= nav_link(controller: [:conversational_development_index, :cohorts]) do
= link_to instance_statistics_root_path, title: _('Instance Statistics'), aria: { label: _('Instance Statistics') }, data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
Loading
Loading
Loading
Loading
@@ -309,7 +309,7 @@
%span
= _('General')
= nav_link(controller: :project_members) do
= link_to project_project_members_path(@project), title: _('Members') do
= link_to project_project_members_path(@project), title: _('Members'), class: 'qa-link-members-settings' do
%span
= _('Members')
- if can_edit
Loading
Loading
Loading
Loading
@@ -47,4 +47,6 @@
 
.js-build-options{ data: javascript_build_options }
 
#js-job-details-vue{ data: { endpoint: project_job_path(@project, @build, format: :json), runner_help_url: help_page_path('ci/runners/README.html', anchor: 'setting-maximum-job-timeout-for-a-runner') } }
#js-job-details-vue{ data: { endpoint: project_job_path(@project, @build, format: :json),
runner_help_url: help_page_path('ci/runners/README.html', anchor: 'setting-maximum-job-timeout-for-a-runner'),
runner_settings_url: project_runners_path(@build.project, anchor: 'js-runners-settings') } }
Loading
Loading
@@ -3,7 +3,7 @@
= form_for @project_member, as: :project_member, url: project_project_members_path(@project), html: { class: 'users-project-form' } do |f|
.form-group
= label_tag :user_ids, "Select members to invite", class: "label-bold"
= users_select_tag(:user_ids, multiple: true, class: "input-clamp", scope: :all, email_user: true, placeholder: "Search for members to update or invite")
= users_select_tag(:user_ids, multiple: true, class: "input-clamp qa-member-select-input", scope: :all, email_user: true, placeholder: "Search for members to update or invite")
.form-group
= label_tag :access_level, "Choose a role permission", class: "label-bold"
.select-wrapper
Loading
Loading
@@ -17,5 +17,5 @@
= label_tag :expires_at, 'Access expiration date', class: 'label-bold'
= text_field_tag :expires_at, nil, class: 'form-control js-access-expiration-date', placeholder: 'Expiration date'
%i.clear-icon.js-clear-input
= f.submit "Add to project", class: "btn btn-success"
= f.submit "Add to project", class: "btn btn-success qa-add-member-button"
= link_to "Import", import_project_project_members_path(@project), class: "btn btn-default", title: "Import members from another project"
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