Commit 5fbf7682 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 867671f9 2a072751
......@@ -8,22 +8,26 @@ export default class CycleAnalyticsService {
}
fetchCycleAnalyticsData(options = { startDate: 30 }) {
const { startDate, projectIds } = options;
return this.axios
.get('', {
params: {
'cycle_analytics[start_date]': options.startDate,
'cycle_analytics[start_date]': startDate,
'cycle_analytics[project_ids]': projectIds,
},
})
.then(x => x.data);
}
fetchStageData(options) {
const { stage, startDate } = options;
const { stage, startDate, projectIds } = options;
return this.axios
.get(`events/${stage.name}.json`, {
params: {
'cycle_analytics[start_date]': startDate,
'cycle_analytics[project_ids]': projectIds,
},
})
.then(x => x.data);
......
......@@ -10,7 +10,7 @@ class Import::GithubController < Import::BaseController
rescue_from Octokit::Unauthorized, with: :provider_unauthorized
def new
if github_import_configured? && logged_in_with_provider?
if !ci_cd_only? && github_import_configured? && logged_in_with_provider?
go_to_provider_for_permissions
elsif session[access_token_key]
redirect_to status_import_url
......@@ -169,11 +169,15 @@ class Import::GithubController < Import::BaseController
# rubocop: enable CodeReuse/ActiveRecord
def provider_auth
if session[access_token_key].blank?
if !ci_cd_only? && session[access_token_key].blank?
go_to_provider_for_permissions
end
end
def ci_cd_only?
%w[1 true].include?(params[:ci_cd_only])
end
def client_options
{}
end
......
......@@ -33,6 +33,16 @@ describe Import::GithubController do
expect(response).to have_http_status(200)
end
context 'when importing a CI/CD project' do
it 'always prompts for an access token' do
allow(controller).to receive(:github_import_configured?).and_return(true)
get :new, params: { ci_cd_only: true }
expect(response).to render_template(:new)
end
end
end
describe "GET callback" do
......
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