diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/search/sidebar/components/archived_filter/index.vue | 6 | ||||
-rw-r--r-- | app/assets/javascripts/super_sidebar/components/create_menu.vue | 2 | ||||
-rw-r--r-- | app/assets/javascripts/super_sidebar/constants.js | 2 | ||||
-rw-r--r-- | app/models/application_setting.rb | 1 | ||||
-rw-r--r-- | app/models/concerns/storage/legacy_namespace.rb | 112 | ||||
-rw-r--r-- | app/models/namespace.rb | 6 |
6 files changed, 7 insertions, 122 deletions
diff --git a/app/assets/javascripts/search/sidebar/components/archived_filter/index.vue b/app/assets/javascripts/search/sidebar/components/archived_filter/index.vue index c31c46f2e6a..ece4a35b864 100644 --- a/app/assets/javascripts/search/sidebar/components/archived_filter/index.vue +++ b/app/assets/javascripts/search/sidebar/components/archived_filter/index.vue @@ -20,9 +20,9 @@ export default { return [parseBoolean(this.urlQuery?.include_archived)]; }, set(value) { - const newValue = value?.pop() ?? false; - this.setQuery({ key: archivedFilterData.filterParam, value: newValue?.toString() }); - this.trackSelectCheckbox(newValue); + const includeArchived = [...value].pop() ?? false; + this.setQuery({ key: archivedFilterData.filterParam, value: includeArchived?.toString() }); + this.trackSelectCheckbox(includeArchived); }, }, }, diff --git a/app/assets/javascripts/super_sidebar/components/create_menu.vue b/app/assets/javascripts/super_sidebar/components/create_menu.vue index d1e96479631..c526afa2371 100644 --- a/app/assets/javascripts/super_sidebar/components/create_menu.vue +++ b/app/assets/javascripts/super_sidebar/components/create_menu.vue @@ -14,7 +14,7 @@ import { import { DROPDOWN_Y_OFFSET, IMPERSONATING_OFFSET } from '../constants'; // Left offset required for the dropdown to be aligned with the super sidebar -const DROPDOWN_X_OFFSET_BASE = -179; +const DROPDOWN_X_OFFSET_BASE = -177; const DROPDOWN_X_OFFSET_IMPERSONATING = DROPDOWN_X_OFFSET_BASE + IMPERSONATING_OFFSET; export default { diff --git a/app/assets/javascripts/super_sidebar/constants.js b/app/assets/javascripts/super_sidebar/constants.js index 77bd8b4a734..e96dca3f365 100644 --- a/app/assets/javascripts/super_sidebar/constants.js +++ b/app/assets/javascripts/super_sidebar/constants.js @@ -59,4 +59,4 @@ export const DROPDOWN_Y_OFFSET = 4; export const NAV_ITEM_LINK_ACTIVE_CLASS = 'gl-bg-t-gray-a-08'; -export const IMPERSONATING_OFFSET = 32; +export const IMPERSONATING_OFFSET = 34; diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 8f8b1dd0bdb..9a5765d8074 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -799,6 +799,7 @@ class ApplicationSetting < MainClusterwide::ApplicationRecord attr_encrypted :openai_api_key, encryption_options_base_32_aes_256_gcm.merge(encode: false, encode_iv: false) attr_encrypted :anthropic_api_key, encryption_options_base_32_aes_256_gcm.merge(encode: false, encode_iv: false) attr_encrypted :vertex_ai_credentials, encryption_options_base_32_aes_256_gcm.merge(encode: false, encode_iv: false) + attr_encrypted :vertex_ai_access_token, encryption_options_base_32_aes_256_gcm.merge(encode: false, encode_iv: false) # Restricting the validation to `on: :update` only to avoid cyclical dependencies with # License <--> ApplicationSetting. This method calls a license check when we create diff --git a/app/models/concerns/storage/legacy_namespace.rb b/app/models/concerns/storage/legacy_namespace.rb deleted file mode 100644 index 5455a2159cd..00000000000 --- a/app/models/concerns/storage/legacy_namespace.rb +++ /dev/null @@ -1,112 +0,0 @@ -# frozen_string_literal: true - -module Storage - module LegacyNamespace - extend ActiveSupport::Concern - - include Gitlab::ShellAdapter - - def move_dir - proj_with_tags = first_project_with_container_registry_tags - - if proj_with_tags - raise Gitlab::UpdatePathError, "Namespace #{name} (#{id}) cannot be moved because at least one project (e.g. #{proj_with_tags.name} (#{proj_with_tags.id})) has tags in container registry" - end - - parent_was = if saved_change_to_parent? && parent_id_before_last_save.present? - Namespace.find(parent_id_before_last_save) # raise NotFound early if needed - end - - if saved_change_to_parent? - former_parent_full_path = parent_was&.full_path - parent_full_path = parent&.full_path - Gitlab::UploadsTransfer.new.move_namespace(path, former_parent_full_path, parent_full_path) - else - Gitlab::UploadsTransfer.new.rename_namespace(full_path_before_last_save, full_path) - end - - # If repositories moved successfully we need to - # send update instructions to users. - # However we cannot allow rollback since we moved namespace dir - # So we basically we mute exceptions in next actions - begin - send_update_instructions - write_projects_repository_config - rescue StandardError => e - Gitlab::ErrorTracking.track_and_raise_for_dev_exception(e, - full_path_before_last_save: full_path_before_last_save, - full_path: full_path, - action: 'move_dir') - end - - true # false would cancel later callbacks but not rollback - end - - # Hooks - - # Save the storages before the projects are destroyed to use them on after destroy - def prepare_for_destroy - old_repository_storages - end - - private - - def move_repositories - # Move the namespace directory in all storages used by member projects - repository_storages(legacy_only: true).each do |repository_storage| - # Ensure old directory exists before moving it - Gitlab::GitalyClient::NamespaceService.allow do - gitlab_shell.add_namespace(repository_storage, full_path_before_last_save) - - # Ensure new directory exists before moving it (if there's a parent) - gitlab_shell.add_namespace(repository_storage, parent.full_path) if parent - - unless gitlab_shell.mv_namespace(repository_storage, full_path_before_last_save, full_path) - - Gitlab::AppLogger.error("Exception moving path #{repository_storage} from #{full_path_before_last_save} to #{full_path}") - - # if we cannot move namespace directory we should rollback - # db changes in order to prevent out of sync between db and fs - raise Gitlab::UpdatePathError, 'namespace directory cannot be moved' - end - end - end - end - - def old_repository_storages - @old_repository_storage_paths ||= repository_storages(legacy_only: true) - end - - def repository_storages(legacy_only: false) - # We need to get the storage paths for all the projects, even the ones that are - # pending delete. Unscoping also get rids of the default order, which causes - # problems with SELECT DISTINCT. - Project.unscoped do - namespace_projects = all_projects - namespace_projects = namespace_projects.without_storage_feature(:repository) if legacy_only - namespace_projects.pluck(Arel.sql('distinct(repository_storage)')) - end - end - - def rm_dir - # Remove the namespace directory in all storages paths used by member projects - old_repository_storages.each do |repository_storage| - # Move namespace directory into trash. - # We will remove it later async - new_path = "#{full_path}+#{id}+deleted" - - Gitlab::GitalyClient::NamespaceService.allow do - if gitlab_shell.mv_namespace(repository_storage, full_path, new_path) - Gitlab::AppLogger.info %(Namespace directory "#{full_path}" moved to "#{new_path}") - - # Remove namespace directory async with delay so - # GitLab has time to remove all projects first - run_after_commit do - GitlabShellWorker.perform_in(5.minutes, :rm_namespace, repository_storage, new_path) - end - end - end - end - end - end -end diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 5aed1f4f5fb..733b89fcaf2 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -6,7 +6,6 @@ class Namespace < ApplicationRecord include Gitlab::VisibilityLevel include Routable include AfterCommitQueue - include Storage::LegacyNamespace include Gitlab::SQL::Pattern include FeatureGate include FromUnion @@ -153,7 +152,6 @@ class Namespace < ApplicationRecord before_update :sync_share_with_group_lock_with_parent, if: :parent_changed? after_update :force_share_with_group_lock_on_descendants, if: -> { saved_change_to_share_with_group_lock? && share_with_group_lock? } after_update :expire_first_auto_devops_config_cache, if: -> { saved_change_to_auto_devops_enabled? } - after_update :move_dir, if: :saved_change_to_path_or_parent?, unless: -> { is_a?(Namespaces::ProjectNamespace) } after_save :reload_namespace_details @@ -161,8 +159,6 @@ class Namespace < ApplicationRecord after_sync_traversal_ids :schedule_sync_event_worker # custom callback defined in Namespaces::Traversal::Linear - # Legacy Storage specific hooks - after_commit :expire_child_caches, on: :update, if: -> { Feature.enabled?(:cached_route_lookups, self, type: :ops) && saved_change_to_name? || saved_change_to_path? || saved_change_to_parent_id? @@ -312,7 +308,7 @@ class Namespace < ApplicationRecord end def human_name - owner_name + owner_name || path end def any_project_has_container_registry_tags? |