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

Add latest changes from gitlab-org/gitlab@master

parent 78adf0c5
No related branches found
No related tags found
No related merge requests found
Showing
with 111 additions and 51 deletions
<script>
import { s__, __ } from '~/locale';
import { GlLink, GlButton } from '@gitlab/ui';
import { GlLink, GlButton, GlTooltip } from '@gitlab/ui';
import { GlAreaChart, GlLineChart, GlChartSeriesLabel } from '@gitlab/ui/dist/charts';
import dateFormat from 'dateformat';
import { debounceByAnimationFrame, roundOffFloat } from '~/lib/utils/common_utils';
Loading
Loading
@@ -16,6 +16,7 @@ export default {
components: {
GlAreaChart,
GlLineChart,
GlTooltip,
GlButton,
GlChartSeriesLabel,
GlLink,
Loading
Loading
@@ -72,6 +73,7 @@ export default {
isDeployment: false,
sha: '',
},
showTitleTooltip: false,
width: 0,
height: chartHeight,
svgs: {},
Loading
Loading
@@ -202,6 +204,12 @@ export default {
watch: {
containerWidth: 'onResize',
},
mounted() {
const graphTitleEl = this.$refs.graphTitle;
if (graphTitleEl && graphTitleEl.scrollWidth > graphTitleEl.offsetWidth) {
this.showTitleTooltip = true;
}
},
beforeDestroy() {
window.removeEventListener('resize', debouncedResize);
},
Loading
Loading
@@ -265,8 +273,16 @@ export default {
<template>
<div class="prometheus-graph">
<div class="prometheus-graph-header">
<h5 class="prometheus-graph-title js-graph-title">{{ graphData.title }}</h5>
<div class="prometheus-graph-widgets js-graph-widgets">
<h5
ref="graphTitle"
class="prometheus-graph-title js-graph-title text-truncate append-right-8"
>
{{ graphData.title }}
</h5>
<gl-tooltip :target="() => $refs.graphTitle" :disabled="!showTitleTooltip">
{{ graphData.title }}
</gl-tooltip>
<div class="prometheus-graph-widgets js-graph-widgets flex-fill">
<slot></slot>
</div>
</div>
Loading
Loading
Loading
Loading
@@ -475,7 +475,10 @@ export default {
:project-path="projectPath"
group-id="monitor-time-series-chart"
>
<div class="d-flex align-items-center">
<div
class="d-flex align-items-center"
:class="alertWidgetAvailable ? 'justify-content-between' : 'justify-content-end'"
>
<alert-widget
v-if="alertWidgetAvailable && graphData"
:modal-id="`alert-modal-${index}-${graphIndex}`"
Loading
Loading
@@ -486,7 +489,7 @@ export default {
/>
<gl-dropdown
v-gl-tooltip
class="mx-2"
class="ml-2 mr-3"
toggle-class="btn btn-transparent border-0"
:right="true"
:no-caret="true"
Loading
Loading
Loading
Loading
@@ -39,11 +39,14 @@
align-items: center;
justify-content: space-between;
margin-bottom: $gl-padding-8;
}
 
h5 {
font-size: $gl-font-size-large;
margin: 0;
}
.prometheus-graph-title {
font-size: $gl-font-size-large;
}
.alert-current-setting {
max-width: 240px;
}
 
.prometheus-graph-cursor {
Loading
Loading
Loading
Loading
@@ -2312,7 +2312,7 @@ class Project < ApplicationRecord
end
 
def repository_with_same_path_already_exists?
gitlab_shell.exists?(repository_storage, "#{disk_path}.git")
gitlab_shell.repository_exists?(repository_storage, "#{disk_path}.git")
end
 
def set_timestamps_for_create
Loading
Loading
Loading
Loading
@@ -123,11 +123,9 @@ module Projects
mv_repository(old_path, new_path)
end
 
# rubocop: disable CodeReuse/ActiveRecord
def repo_exists?(path)
gitlab_shell.exists?(project.repository_storage, path + '.git')
gitlab_shell.repository_exists?(project.repository_storage, path + '.git')
end
# rubocop: enable CodeReuse/ActiveRecord
 
def mv_repository(from_path, to_path)
return true unless repo_exists?(from_path)
Loading
Loading
Loading
Loading
@@ -20,16 +20,13 @@ module Projects
 
protected
 
# rubocop: disable CodeReuse/ActiveRecord
def has_wiki?
gitlab_shell.exists?(project.repository_storage, "#{old_wiki_disk_path}.git")
gitlab_shell.repository_exists?(project.repository_storage, "#{old_wiki_disk_path}.git")
end
# rubocop: enable CodeReuse/ActiveRecord
 
# rubocop: disable CodeReuse/ActiveRecord
def move_repository(from_name, to_name)
from_exists = gitlab_shell.exists?(project.repository_storage, "#{from_name}.git")
to_exists = gitlab_shell.exists?(project.repository_storage, "#{to_name}.git")
from_exists = gitlab_shell.repository_exists?(project.repository_storage, "#{from_name}.git")
to_exists = gitlab_shell.repository_exists?(project.repository_storage, "#{to_name}.git")
 
# If we don't find the repository on either original or target we should log that as it could be an issue if the
# project was not originally empty.
Loading
Loading
@@ -46,7 +43,6 @@ module Projects
 
gitlab_shell.mv_repository(project.repository_storage, from_name, to_name)
end
# rubocop: enable CodeReuse/ActiveRecord
 
def rollback_folder_move
move_repository(new_disk_path, old_disk_path)
Loading
Loading
Loading
Loading
@@ -297,6 +297,12 @@ module Gitlab
end
# rubocop: enable CodeReuse/ActiveRecord
 
def repository_exists?(storage, dir_name)
Gitlab::Git::Repository.new(storage, dir_name, nil, nil).exists?
rescue GRPC::Internal
false
end
def hooks_path
File.join(gitlab_shell_path, 'hooks')
end
Loading
Loading
Loading
Loading
@@ -12641,6 +12641,9 @@ msgstr ""
msgid "Prometheus listen_address in config/gitlab.yml is not a valid URI"
msgstr ""
 
msgid "PrometheusAlerts|%{count} alerts applied"
msgstr ""
msgid "PrometheusAlerts|Add alert"
msgstr ""
 
Loading
Loading
@@ -16017,6 +16020,9 @@ msgstr ""
msgid "The snippet is visible to any logged in user."
msgstr ""
 
msgid "The specified tab is invalid, please select another"
msgstr ""
msgid "The staging stage shows the time between merging the MR and deploying code to the production environment. The data will be automatically added once you deploy to production for the first time."
msgstr ""
 
Loading
Loading
@@ -16671,9 +16677,6 @@ msgstr ""
msgid "Timeago|right now"
msgstr ""
 
msgid "Timeframe"
msgstr ""
msgid "Timeout"
msgstr ""
 
Loading
Loading
Loading
Loading
@@ -153,7 +153,7 @@ describe ProfilesController, :request_store do
user.reload
 
expect(response.status).to eq(302)
expect(gitlab_shell.exists?(project.repository_storage, "#{new_username}/#{project.path}.git")).to be_truthy
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{new_username}/#{project.path}.git")).to be_truthy
end
end
 
Loading
Loading
@@ -171,7 +171,7 @@ describe ProfilesController, :request_store do
user.reload
 
expect(response.status).to eq(302)
expect(gitlab_shell.exists?(project.repository_storage, "#{project.disk_path}.git")).to be_truthy
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{project.disk_path}.git")).to be_truthy
expect(before_disk_path).to eq(project.disk_path)
end
end
Loading
Loading
Loading
Loading
@@ -89,7 +89,7 @@ describe Gitlab::BareRepositoryImport::Importer, :seed_helper do
repo_path = "#{project.disk_path}.git"
hook_path = File.join(repo_path, 'hooks')
 
expect(gitlab_shell.exists?(project.repository_storage, repo_path)).to be(true)
expect(gitlab_shell.repository_exists?(project.repository_storage, repo_path)).to be(true)
expect(gitlab_shell.exists?(project.repository_storage, hook_path)).to be(true)
end
 
Loading
Loading
@@ -145,8 +145,8 @@ describe Gitlab::BareRepositoryImport::Importer, :seed_helper do
 
project = Project.find_by_full_path("#{admin.full_path}/#{project_path}")
 
expect(gitlab_shell.exists?(project.repository_storage, project.disk_path + '.git')).to be(true)
expect(gitlab_shell.exists?(project.repository_storage, project.disk_path + '.wiki.git')).to be(true)
expect(gitlab_shell.repository_exists?(project.repository_storage, project.disk_path + '.git')).to be(true)
expect(gitlab_shell.repository_exists?(project.repository_storage, project.disk_path + '.wiki.git')).to be(true)
end
 
context 'with a repository already on disk' do
Loading
Loading
@@ -186,7 +186,7 @@ describe Gitlab::BareRepositoryImport::Importer, :seed_helper do
 
project = Project.find_by_full_path(project_path)
 
expect(gitlab_shell.exists?(project.repository_storage, project.disk_path + '.wiki.git')).to be(true)
expect(gitlab_shell.repository_exists?(project.repository_storage, project.disk_path + '.wiki.git')).to be(true)
end
end
 
Loading
Loading
Loading
Loading
@@ -422,6 +422,30 @@ describe Gitlab::Shell do
end
end
 
describe '#repository_exists?' do
context 'when the storage path does not exist' do
subject { described_class.new.repository_exists?(storage, "non-existing.git") }
it { is_expected.to be_falsey }
end
context 'when the repository does not exist' do
let(:project) { create(:project, :repository, :legacy_storage) }
subject { described_class.new.repository_exists?(storage, "#{project.repository.disk_path}-some-other-repo.git") }
it { is_expected.to be_falsey }
end
context 'when the repository exists' do
let(:project) { create(:project, :repository, :legacy_storage) }
subject { described_class.new.repository_exists?(storage, "#{project.repository.disk_path}.git") }
it { is_expected.to be_truthy }
end
end
describe '#remove' do
it 'removes the namespace' do
subject.add_namespace(storage, "mepmep")
Loading
Loading
Loading
Loading
@@ -250,7 +250,7 @@ describe Namespace do
it "moves dir if path changed" do
namespace.update(path: namespace.full_path + '_new')
 
expect(gitlab_shell.exists?(project.repository_storage, "#{namespace.path}/#{project.path}.git")).to be_truthy
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{namespace.path}/#{project.path}.git")).to be_truthy
end
 
context 'when #write_projects_repository_config raises an error' do
Loading
Loading
@@ -358,7 +358,7 @@ describe Namespace do
namespace.update(path: namespace.full_path + '_new')
 
expect(before_disk_path).to eq(project.disk_path)
expect(gitlab_shell.exists?(project.repository_storage, "#{project.disk_path}.git")).to be_truthy
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{project.disk_path}.git")).to be_truthy
end
end
 
Loading
Loading
Loading
Loading
@@ -4192,13 +4192,24 @@ describe Project do
end
 
describe '#check_repository_path_availability' do
let(:project) { build(:project) }
let(:project) { build(:project, :repository, :legacy_storage) }
subject { project.check_repository_path_availability }
context 'when the repository already exists' do
let(:project) { create(:project, :repository, :legacy_storage) }
 
it 'skips gitlab-shell exists?' do
project.skip_disk_validation = true
it { is_expected.to be_falsey }
end
 
expect(project.gitlab_shell).not_to receive(:exists?)
expect(project.check_repository_path_availability).to be_truthy
context 'when the repository does not exist' do
it { is_expected.to be_truthy }
it 'skips gitlab-shell exists?' do
project.skip_disk_validation = true
expect(project.gitlab_shell).not_to receive(:repository_exists?)
is_expected.to be_truthy
end
end
end
 
Loading
Loading
Loading
Loading
@@ -119,7 +119,7 @@ describe Groups::DestroyService do
let!(:project) { create(:project, :legacy_storage, :empty_repo, namespace: group) }
 
it 'removes repository' do
expect(gitlab_shell.exists?(project.repository_storage, "#{project.disk_path}.git")).to be_falsey
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{project.disk_path}.git")).to be_falsey
end
end
 
Loading
Loading
@@ -127,7 +127,7 @@ describe Groups::DestroyService do
let!(:project) { create(:project, :empty_repo, namespace: group) }
 
it 'removes repository' do
expect(gitlab_shell.exists?(project.repository_storage, "#{project.disk_path}.git")).to be_falsey
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{project.disk_path}.git")).to be_falsey
end
end
end
Loading
Loading
Loading
Loading
@@ -24,8 +24,8 @@ describe Projects::DestroyService do
it 'deletes the project' do
expect(Project.unscoped.all).not_to include(project)
 
expect(project.gitlab_shell.exists?(project.repository_storage, path + '.git')).to be_falsey
expect(project.gitlab_shell.exists?(project.repository_storage, remove_path + '.git')).to be_falsey
expect(project.gitlab_shell.repository_exists?(project.repository_storage, path + '.git')).to be_falsey
expect(project.gitlab_shell.repository_exists?(project.repository_storage, remove_path + '.git')).to be_falsey
end
end
 
Loading
Loading
Loading
Loading
@@ -48,8 +48,8 @@ describe Projects::HashedStorage::MigrateRepositoryService do
it 'renames project and wiki repositories' do
service.execute
 
expect(gitlab_shell.exists?(project.repository_storage, "#{new_disk_path}.git")).to be_truthy
expect(gitlab_shell.exists?(project.repository_storage, "#{new_disk_path}.wiki.git")).to be_truthy
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{new_disk_path}.git")).to be_truthy
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{new_disk_path}.wiki.git")).to be_truthy
end
 
it 'updates project to be hashed and not read-only' do
Loading
Loading
@@ -84,8 +84,8 @@ describe Projects::HashedStorage::MigrateRepositoryService do
 
service.execute
 
expect(gitlab_shell.exists?(project.repository_storage, "#{new_disk_path}.git")).to be_falsey
expect(gitlab_shell.exists?(project.repository_storage, "#{new_disk_path}.wiki.git")).to be_falsey
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{new_disk_path}.git")).to be_falsey
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{new_disk_path}.wiki.git")).to be_falsey
expect(project.repository_read_only?).to be_falsey
end
 
Loading
Loading
Loading
Loading
@@ -48,8 +48,8 @@ describe Projects::HashedStorage::RollbackRepositoryService, :clean_gitlab_redis
it 'renames project and wiki repositories' do
service.execute
 
expect(gitlab_shell.exists?(project.repository_storage, "#{new_disk_path}.git")).to be_truthy
expect(gitlab_shell.exists?(project.repository_storage, "#{new_disk_path}.wiki.git")).to be_truthy
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{new_disk_path}.git")).to be_truthy
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{new_disk_path}.wiki.git")).to be_truthy
end
 
it 'updates project to be legacy and not read-only' do
Loading
Loading
@@ -84,8 +84,8 @@ describe Projects::HashedStorage::RollbackRepositoryService, :clean_gitlab_redis
 
service.execute
 
expect(gitlab_shell.exists?(project.repository_storage, "#{new_disk_path}.git")).to be_falsey
expect(gitlab_shell.exists?(project.repository_storage, "#{new_disk_path}.wiki.git")).to be_falsey
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{new_disk_path}.git")).to be_falsey
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{new_disk_path}.wiki.git")).to be_falsey
expect(project.repository_read_only?).to be_falsey
end
 
Loading
Loading
Loading
Loading
@@ -103,7 +103,7 @@ describe Projects::TransferService do
it 'rolls back repo location' do
attempt_project_transfer
 
expect(gitlab_shell.exists?(project.repository_storage, "#{project.disk_path}.git")).to be(true)
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{project.disk_path}.git")).to be(true)
expect(original_path).to eq current_path
end
 
Loading
Loading
Loading
Loading
@@ -183,7 +183,7 @@ describe Users::DestroyService do
let!(:project) { create(:project, :empty_repo, :legacy_storage, namespace: user.namespace) }
 
it 'removes repository' do
expect(gitlab_shell.exists?(project.repository_storage, "#{project.disk_path}.git")).to be_falsey
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{project.disk_path}.git")).to be_falsey
end
end
 
Loading
Loading
@@ -191,7 +191,7 @@ describe Users::DestroyService do
let!(:project) { create(:project, :empty_repo, namespace: user.namespace) }
 
it 'removes repository' do
expect(gitlab_shell.exists?(project.repository_storage, "#{project.disk_path}.git")).to be_falsey
expect(gitlab_shell.repository_exists?(project.repository_storage, "#{project.disk_path}.git")).to be_falsey
end
end
end
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