Commit 8b5e9ed9 authored by anna_vovchenko's avatar anna_vovchenko Committed by Anna Vovchenko

Implemented suggestions after the BE review

- renamed the new page from 'create_cluster' to 'new_cluster_docs'
- fixed issue with the page not being available for the FF off
- updated the link attributes for the consistency
parent 8463632f
......@@ -26,7 +26,7 @@ export default {
inject: [
'newClusterPath',
'addClusterPath',
'createClusterPath',
'newClusterDocsPath',
'canAddCluster',
'displayClusterAgents',
'certificateBasedClustersEnabled',
......@@ -77,7 +77,7 @@ export default {
>
{{ $options.i18n.connectWithAgent }}
</gl-dropdown-item>
<gl-dropdown-item :href="createClusterPath" data-testid="create-cluster-link" @click.stop>
<gl-dropdown-item :href="newClusterDocsPath" data-testid="create-cluster-link" @click.stop>
{{ $options.i18n.createAndConnectCluster }}
</gl-dropdown-item>
</template>
......
......@@ -25,7 +25,7 @@ export default () => {
kasAddress,
newClusterPath,
addClusterPath,
createClusterPath,
newClusterDocsPath,
emptyStateHelpText,
clustersEmptyStateImage,
canAddCluster,
......@@ -44,7 +44,7 @@ export default () => {
kasAddress,
newClusterPath,
addClusterPath,
createClusterPath,
newClusterDocsPath,
emptyStateHelpText,
clustersEmptyStateImage,
canAddCluster: parseBoolean(canAddCluster),
......
......@@ -14,7 +14,7 @@ class Clusters::ClustersController < Clusters::BaseController
before_action :authorize_create_cluster!, only: [:new, :connect, :authorize_aws_role]
before_action :authorize_update_cluster!, only: [:update]
before_action :update_applications_status, only: [:cluster_status]
before_action :ensure_feature_enabled!, except: :index
before_action :ensure_feature_enabled!, except: [:index, :new_cluster_docs]
helper_method :token_in_session
......
......@@ -19,7 +19,7 @@ module ClustersHelper
empty_state_help_text: clusterable.empty_state_help_text,
new_cluster_path: clusterable.new_path,
add_cluster_path: clusterable.connect_path,
create_cluster_path: clusterable.create_path,
new_cluster_docs_path: clusterable.new_cluster_docs_path,
can_add_cluster: clusterable.can_add_cluster?.to_s,
can_admin_cluster: clusterable.can_admin_cluster?.to_s,
display_cluster_agents: display_cluster_agents?(clusterable).to_s,
......
......@@ -36,8 +36,8 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated
polymorphic_path([clusterable, :clusters], action: :connect)
end
def create_path
polymorphic_path([clusterable, :clusters], action: :create_cluster)
def new_cluster_docs_path
polymorphic_path([clusterable, :clusters], action: :new_cluster_docs)
end
def authorize_aws_role_path
......
......@@ -43,8 +43,8 @@ class InstanceClusterablePresenter < ClusterablePresenter
connect_admin_clusters_path
end
override :create_path
def create_path
override :new_cluster_docs_path
def new_cluster_docs_path
nil
end
......
......@@ -28,7 +28,7 @@ class ProjectClusterablePresenter < ClusterablePresenter
override :learn_more_link
def learn_more_link(docs_mode = false)
if docs_mode
ApplicationController.helpers.link_to(s_('ClusterIntegration|Learn more about our integrations.'), help_page_path('user/infrastructure/iac/index', anchor: 'create-a-new-cluster-through-iac'))
ApplicationController.helpers.link_to(s_('ClusterIntegration|Learn more about our integrations.'), help_page_path('user/infrastructure/iac/index', anchor: 'create-a-new-cluster-through-iac'), target: '_blank', rel: 'noopener noreferrer')
else
ApplicationController.helpers.link_to(s_('ClusterIntegration|Learn more about Kubernetes.'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
end
......
......@@ -237,7 +237,7 @@ Rails.application.routes.draw do
resources :clusters, only: [:index, :new, :show, :update, :destroy] do
collection do
get :connect
get :create_cluster
get :new_cluster_docs
post :create_user
post :create_gcp
post :create_aws
......
......@@ -9,12 +9,12 @@ describe('ClustersActionsComponent', () => {
const newClusterPath = 'path/to/add/cluster';
const addClusterPath = 'path/to/connect/existing/cluster';
const createClusterPath = 'path/to/create/new/cluster';
const newClusterDocsPath = 'path/to/create/new/cluster';
const defaultProvide = {
newClusterPath,
addClusterPath,
createClusterPath,
newClusterDocsPath,
canAddCluster: true,
displayClusterAgents: true,
certificateBasedClustersEnabled: true,
......
......@@ -75,7 +75,7 @@ RSpec.describe ClustersHelper do
end
it 'displays create cluster path' do
expect(subject[:create_cluster_path]).to eq("#{project_path(project)}/-/clusters/create_cluster")
expect(subject[:new_cluster_docs_path]).to eq("#{project_path(project)}/-/clusters/new_cluster_docs")
end
it 'displays project default branch' do
......
......@@ -49,10 +49,10 @@ RSpec.describe ProjectClusterablePresenter do
it { is_expected.to eq(connect_project_clusters_path(project)) }
end
describe '#create_path' do
subject { presenter.create_path }
describe '#new_cluster_docs_path' do
subject { presenter.new_cluster_docs_path }
it { is_expected.to eq(create_cluster_project_clusters_path(project)) }
it { is_expected.to eq(new_cluster_docs_project_clusters_path(project)) }
end
describe '#authorize_aws_role_path' 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