Commit 1186a6fd authored by João Cunha's avatar João Cunha Committed by jerasmus

Sends update route to the client

- extends presenters to include update endpoint path
- sends path to the client on clusters clusters show view.
parent f8234d9a
...@@ -44,6 +44,10 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated ...@@ -44,6 +44,10 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated
raise NotImplementedError raise NotImplementedError
end end
def update_applications_cluster_path(cluster, application)
raise NotImplementedError
end
def cluster_path(cluster, params = {}) def cluster_path(cluster, params = {})
raise NotImplementedError raise NotImplementedError
end end
......
...@@ -14,6 +14,11 @@ class GroupClusterablePresenter < ClusterablePresenter ...@@ -14,6 +14,11 @@ class GroupClusterablePresenter < ClusterablePresenter
install_applications_group_cluster_path(clusterable, cluster, application) install_applications_group_cluster_path(clusterable, cluster, application)
end end
override :update_applications_cluster_path
def update_applications_cluster_path(cluster, application)
update_applications_group_cluster_path(clusterable, cluster, application)
end
override :cluster_path override :cluster_path
def cluster_path(cluster, params = {}) def cluster_path(cluster, params = {})
group_cluster_path(clusterable, cluster, params) group_cluster_path(clusterable, cluster, params)
......
...@@ -14,6 +14,11 @@ class ProjectClusterablePresenter < ClusterablePresenter ...@@ -14,6 +14,11 @@ class ProjectClusterablePresenter < ClusterablePresenter
install_applications_project_cluster_path(clusterable, cluster, application) install_applications_project_cluster_path(clusterable, cluster, application)
end end
override :update_applications_cluster_path
def update_applications_cluster_path(cluster, application)
update_applications_project_cluster_path(clusterable, cluster, application)
end
override :cluster_path override :cluster_path
def cluster_path(cluster, params = {}) def cluster_path(cluster, params = {})
project_cluster_path(clusterable, cluster, params) project_cluster_path(clusterable, cluster, params)
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
install_runner_path: clusterable.install_applications_cluster_path(@cluster, :runner), install_runner_path: clusterable.install_applications_cluster_path(@cluster, :runner),
install_jupyter_path: clusterable.install_applications_cluster_path(@cluster, :jupyter), install_jupyter_path: clusterable.install_applications_cluster_path(@cluster, :jupyter),
install_knative_path: clusterable.install_applications_cluster_path(@cluster, :knative), install_knative_path: clusterable.install_applications_cluster_path(@cluster, :knative),
update_knative_path: clusterable.update_applications_cluster_path(@cluster, :knative),
toggle_status: @cluster.enabled? ? 'true': 'false', toggle_status: @cluster.enabled? ? 'true': 'false',
has_rbac: @cluster.platform_kubernetes_rbac? ? 'true': 'false', has_rbac: @cluster.platform_kubernetes_rbac? ? 'true': 'false',
cluster_type: @cluster.cluster_type, cluster_type: @cluster.cluster_type,
......
...@@ -69,6 +69,14 @@ describe GroupClusterablePresenter do ...@@ -69,6 +69,14 @@ describe GroupClusterablePresenter do
it { is_expected.to eq(install_applications_group_cluster_path(group, cluster, application)) } it { is_expected.to eq(install_applications_group_cluster_path(group, cluster, application)) }
end end
describe '#update_applications_cluster_path' do
let(:application) { :helm }
subject { presenter.update_applications_cluster_path(cluster, application) }
it { is_expected.to eq(update_applications_group_cluster_path(group, cluster, application)) }
end
describe '#cluster_path' do describe '#cluster_path' do
subject { presenter.cluster_path(cluster) } subject { presenter.cluster_path(cluster) }
......
...@@ -69,6 +69,14 @@ describe ProjectClusterablePresenter do ...@@ -69,6 +69,14 @@ describe ProjectClusterablePresenter do
it { is_expected.to eq(install_applications_project_cluster_path(project, cluster, application)) } it { is_expected.to eq(install_applications_project_cluster_path(project, cluster, application)) }
end end
describe '#update_applications_cluster_path' do
let(:application) { :helm }
subject { presenter.update_applications_cluster_path(cluster, application) }
it { is_expected.to eq(update_applications_project_cluster_path(project, cluster, application)) }
end
describe '#cluster_path' do describe '#cluster_path' do
subject { presenter.cluster_path(cluster) } subject { presenter.cluster_path(cluster) }
......
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