Commit 08ecf153 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'remove-work-faster-modal' into 'master'

Remove the Geo Clone Modal

Closes #14785

See merge request gitlab-org/gitlab!18897
parents f2a3ec28 dee360bb
......@@ -495,7 +495,6 @@ linters:
- 'ee/app/views/projects/services/prometheus/_metrics.html.haml'
- 'ee/app/views/projects/settings/slacks/edit.html.haml'
- 'ee/app/views/shared/_additional_email_text.html.haml'
- 'ee/app/views/shared/_geo_info_modal.html.haml'
- 'ee/app/views/shared/_mirror_update_button.html.haml'
- 'ee/app/views/shared/_shared_runners_minutes_limit.html.haml'
- 'ee/app/views/shared/audit_events/_event_table.html.haml'
......
......@@ -40,11 +40,6 @@ export default class Project {
$label.text(activeText);
});
$('#modal-geo-info').data({
cloneUrlSecondary: $this.attr('href'),
cloneUrlPrimary: $this.data('primaryUrl') || '',
});
if (mobileCloneField) {
mobileCloneField.dataset.clipboardText = url;
} else {
......
......@@ -25,5 +25,3 @@
= clipboard_button(target: '#http_project_clone', title: _("Copy URL"), class: "input-group-text btn-default btn-clipboard")
= render_if_exists 'projects/buttons/geo'
= render_if_exists 'projects/buttons/kerberos_clone_field'
= render_if_exists 'shared/geo_info_modal', project: project
......@@ -22,6 +22,3 @@
.input-group-append
= clipboard_button(target: '#project_clone', title: _("Copy URL"), class: "input-group-text btn-default btn-clipboard")
= render_if_exists 'shared/geo_modal_button'
= render_if_exists 'shared/geo_modal', project: project
import $ from 'jquery';
export default () => {
const $modal = $('#modal-geo-info');
if (!$modal.length) return;
$modal.appendTo('body').modal({
modal: true,
show: false,
});
};
import '~/pages/projects/show/index';
import initGeoInfoModal from '../../../init_geo_info_modal';
document.addEventListener('DOMContentLoaded', initGeoInfoModal);
......@@ -44,15 +44,5 @@ module EE
title: 'Get a Kerberos token for your<br>account with kinit.'
}
end
def geo_button(modal_target: nil)
data = { placement: 'bottom', container: 'body', toggle: 'modal', target: modal_target }
content_tag :button,
sprite_icon('location-dot', size: 15),
class: 'btn btn-geo has-tooltip',
data: data,
type: :button,
title: 'See Geo-specific instructions'
end
end
end
- if Gitlab::Geo.secondary?
= geo_button(modal_target: '#modal-geo-info')
- if Gitlab::Geo.secondary?
#modal-geo-info.modal.in{ tabindex: '-1' }
.modal-dialog
.modal-content
.modal-header
%h3.page-title
How to work faster with Geo
%a.close{ href: "#", "data-dismiss" => "modal" } ×
.modal-body
%p
%strong= 'Step 1.'
Clone the repository from your secondary node:
- if project.ssh_url_to_repo.present?
%p
%strong= 'SSH'
.form-group
.input-group
%input#geo-info-1-ssh.form-control{ value: "git clone " + project.ssh_url_to_repo, readonly: "readonly" }
.input-group-append
= clipboard_button(target: '#geo-info-1-ssh', class: "btn-default", container: "#modal-geo-info")
- if project.http_url_to_repo.present?
%p
%strong= 'HTTP'
.form-group
.input-group
%input#geo-info-1-http.form-control{ value: "git clone " + project.http_url_to_repo, readonly: "readonly" }
.input-group-append
= clipboard_button(target: '#geo-info-1-http', class: "btn-default", container: "#modal-geo-info")
- if alternative_kerberos_url?
%p
%strong= 'Kerberos'
.form-group
.input-group
%input#geo-info-1-kerberos.form-control{ value: "git clone " + project.kerberos_url_to_repo, readonly: "readonly" }
.input-group-append
= clipboard_button(target: '#geo-info-1-kerberos', class: "btn-default", container: "#modal-geo-info")
%p
%strong= 'Step 2.'
Go to the new directory and define
%strong= "primary node's"
repository URL as the
%strong= 'push'
remote:
- if geo_primary_ssh_url_to_repo(project).present? or geo_primary_http_url_to_repo(project).present?
- if geo_primary_ssh_url_to_repo(project).present?
%p
%strong= 'SSH'
.form-group
.input-group
%input#geo-info-2-ssh.form-control{ value: "git remote set-url --push origin " + geo_primary_ssh_url_to_repo(project), readonly: "readonly" }
.input-group-append
= clipboard_button(target: '#geo-info-2-ssh', class: "btn-default", container: "#modal-geo-info")
- if geo_primary_http_url_to_repo(project).present?
%p
%strong= 'HTTP'
.form-group
.input-group
%input#geo-info-2-http.form-control{ value: "git remote set-url --push origin " + geo_primary_http_url_to_repo(project), readonly: "readonly" }
.input-group-append
= clipboard_button(target: '#geo-info-2-http', class: "btn-default", container: "#modal-geo-info")
- else
.form-group
.input-group
%input#geo-info-2.form-control{ value: "git remote set-url --push origin &lt;clone url for primary repository&gt;", readonly: "readonly" }
.input-group-append
= clipboard_button(target: '#geo-info-2', class: "btn-default", container: "#modal-geo-info")
%p
%strong= 'Done.'
You can now commit and push code as you normally do, but with increased speed.
= render 'shared/geo_info_modal', project: project if Gitlab::Geo.secondary?
= geo_button(modal_target: '#modal-geo-info') if Gitlab::Geo.secondary?
---
title: Remove the Geo Clone Modal
merge_request: 18897
author: Zack Cuddy
type: removed
# frozen_string_literal: true
require 'spec_helper'
describe 'Geo clone instructions', :geo, :js do
include Devise::Test::IntegrationHelpers
include ::EE::GeoHelpers
let(:project) { create(:project, :empty_repo) }
let(:developer) { create(:user) }
before do
primary = create(:geo_node, :primary, url: 'https://primary.domain.com')
primary.update_columns(clone_url_prefix: 'git@primary.domain.com:')
secondary = create(:geo_node)
stub_current_geo_node(secondary)
project.add_developer(developer)
sign_in(developer)
end
context 'with an SSH key' do
before do
create(:personal_key, user: developer)
end
it 'displays clone instructions' do
visit_project
show_geo_clone_instructions
expect_instructions_for('ssh')
expect_instructions_for('http')
end
end
def visit_project
visit project_path(project)
end
def show_geo_clone_instructions
find('.qa-clone-dropdown').click
find('.btn-geo', match: :first).click
end
def expect_instructions_for(protocol)
primary_remote = primary_url(protocol)
secondary_remote = secondary_url(protocol)
expect(page).to have_content('How to work faster with Geo')
expect(page.find("#geo-info-1-#{protocol}").value).to eq "git clone #{secondary_remote}"
# the primary_url does not return the full url, but just the part up to the host:
expect(page.find("#geo-info-2-#{protocol}").value).to start_with("git remote set-url --push origin #{primary_remote}")
end
def primary_url(protocol)
case protocol
when 'ssh'
'git@primary.domain.com:'
when 'http'
'https://primary.domain.com'
end
end
def secondary_url(protocol)
case protocol
when 'ssh'
project.ssh_url_to_repo
when 'http'
project.http_url_to_repo
end
end
end
......@@ -34,10 +34,6 @@ describe 'shared/_clone_panel' do
stub_current_geo_node(secondary)
end
it 'renders Geo-specific instructions button' do
render 'shared/clone_panel', project: project
expect(rendered).to match /See Geo-specific instructions/
end
it_behaves_like 'has no geo-specific instructions'
end
end
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