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 { ...@@ -26,7 +26,7 @@ export default {
inject: [ inject: [
'newClusterPath', 'newClusterPath',
'addClusterPath', 'addClusterPath',
'createClusterPath', 'newClusterDocsPath',
'canAddCluster', 'canAddCluster',
'displayClusterAgents', 'displayClusterAgents',
'certificateBasedClustersEnabled', 'certificateBasedClustersEnabled',
...@@ -77,7 +77,7 @@ export default { ...@@ -77,7 +77,7 @@ export default {
> >
{{ $options.i18n.connectWithAgent }} {{ $options.i18n.connectWithAgent }}
</gl-dropdown-item> </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 }} {{ $options.i18n.createAndConnectCluster }}
</gl-dropdown-item> </gl-dropdown-item>
</template> </template>
......
...@@ -25,7 +25,7 @@ export default () => { ...@@ -25,7 +25,7 @@ export default () => {
kasAddress, kasAddress,
newClusterPath, newClusterPath,
addClusterPath, addClusterPath,
createClusterPath, newClusterDocsPath,
emptyStateHelpText, emptyStateHelpText,
clustersEmptyStateImage, clustersEmptyStateImage,
canAddCluster, canAddCluster,
...@@ -44,7 +44,7 @@ export default () => { ...@@ -44,7 +44,7 @@ export default () => {
kasAddress, kasAddress,
newClusterPath, newClusterPath,
addClusterPath, addClusterPath,
createClusterPath, newClusterDocsPath,
emptyStateHelpText, emptyStateHelpText,
clustersEmptyStateImage, clustersEmptyStateImage,
canAddCluster: parseBoolean(canAddCluster), canAddCluster: parseBoolean(canAddCluster),
......
...@@ -14,7 +14,7 @@ class Clusters::ClustersController < Clusters::BaseController ...@@ -14,7 +14,7 @@ class Clusters::ClustersController < Clusters::BaseController
before_action :authorize_create_cluster!, only: [:new, :connect, :authorize_aws_role] before_action :authorize_create_cluster!, only: [:new, :connect, :authorize_aws_role]
before_action :authorize_update_cluster!, only: [:update] before_action :authorize_update_cluster!, only: [:update]
before_action :update_applications_status, only: [:cluster_status] 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 helper_method :token_in_session
......
...@@ -19,7 +19,7 @@ module ClustersHelper ...@@ -19,7 +19,7 @@ module ClustersHelper
empty_state_help_text: clusterable.empty_state_help_text, empty_state_help_text: clusterable.empty_state_help_text,
new_cluster_path: clusterable.new_path, new_cluster_path: clusterable.new_path,
add_cluster_path: clusterable.connect_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_add_cluster: clusterable.can_add_cluster?.to_s,
can_admin_cluster: clusterable.can_admin_cluster?.to_s, can_admin_cluster: clusterable.can_admin_cluster?.to_s,
display_cluster_agents: display_cluster_agents?(clusterable).to_s, display_cluster_agents: display_cluster_agents?(clusterable).to_s,
......
...@@ -36,8 +36,8 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated ...@@ -36,8 +36,8 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated
polymorphic_path([clusterable, :clusters], action: :connect) polymorphic_path([clusterable, :clusters], action: :connect)
end end
def create_path def new_cluster_docs_path
polymorphic_path([clusterable, :clusters], action: :create_cluster) polymorphic_path([clusterable, :clusters], action: :new_cluster_docs)
end end
def authorize_aws_role_path def authorize_aws_role_path
......
...@@ -43,8 +43,8 @@ class InstanceClusterablePresenter < ClusterablePresenter ...@@ -43,8 +43,8 @@ class InstanceClusterablePresenter < ClusterablePresenter
connect_admin_clusters_path connect_admin_clusters_path
end end
override :create_path override :new_cluster_docs_path
def create_path def new_cluster_docs_path
nil nil
end end
......
...@@ -28,7 +28,7 @@ class ProjectClusterablePresenter < ClusterablePresenter ...@@ -28,7 +28,7 @@ class ProjectClusterablePresenter < ClusterablePresenter
override :learn_more_link override :learn_more_link
def learn_more_link(docs_mode = false) def learn_more_link(docs_mode = false)
if docs_mode 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 else
ApplicationController.helpers.link_to(s_('ClusterIntegration|Learn more about Kubernetes.'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer') ApplicationController.helpers.link_to(s_('ClusterIntegration|Learn more about Kubernetes.'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
end end
......
...@@ -237,7 +237,7 @@ Rails.application.routes.draw do ...@@ -237,7 +237,7 @@ Rails.application.routes.draw do
resources :clusters, only: [:index, :new, :show, :update, :destroy] do resources :clusters, only: [:index, :new, :show, :update, :destroy] do
collection do collection do
get :connect get :connect
get :create_cluster get :new_cluster_docs
post :create_user post :create_user
post :create_gcp post :create_gcp
post :create_aws post :create_aws
......
...@@ -9,12 +9,12 @@ describe('ClustersActionsComponent', () => { ...@@ -9,12 +9,12 @@ describe('ClustersActionsComponent', () => {
const newClusterPath = 'path/to/add/cluster'; const newClusterPath = 'path/to/add/cluster';
const addClusterPath = 'path/to/connect/existing/cluster'; const addClusterPath = 'path/to/connect/existing/cluster';
const createClusterPath = 'path/to/create/new/cluster'; const newClusterDocsPath = 'path/to/create/new/cluster';
const defaultProvide = { const defaultProvide = {
newClusterPath, newClusterPath,
addClusterPath, addClusterPath,
createClusterPath, newClusterDocsPath,
canAddCluster: true, canAddCluster: true,
displayClusterAgents: true, displayClusterAgents: true,
certificateBasedClustersEnabled: true, certificateBasedClustersEnabled: true,
......
...@@ -75,7 +75,7 @@ RSpec.describe ClustersHelper do ...@@ -75,7 +75,7 @@ RSpec.describe ClustersHelper do
end end
it 'displays create cluster path' do 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 end
it 'displays project default branch' do it 'displays project default branch' do
......
...@@ -49,10 +49,10 @@ RSpec.describe ProjectClusterablePresenter do ...@@ -49,10 +49,10 @@ RSpec.describe ProjectClusterablePresenter do
it { is_expected.to eq(connect_project_clusters_path(project)) } it { is_expected.to eq(connect_project_clusters_path(project)) }
end end
describe '#create_path' do describe '#new_cluster_docs_path' do
subject { presenter.create_path } 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 end
describe '#authorize_aws_role_path' do 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