Validation error appears twice on Cluster page
Summary
We're using two forms for the same object (@cluster
) on the cluster show page:
- The
integration_form
for "Integration status", "environment scope" and "domain" (to be added soon) fields - And another one the Kubernetes fields: "name", "CA certificate", "api url", "token" and "namespace". In this case, we render different forms depending if the cluster is GCP or user)
Because of this, the errors in one form appear also in the other one, generating duplicated messages. Some examples:
When validation in the integration form fails | When validation on the kubernetes form fails |
---|---|
Steps to reproduce
- Add a cluster to your project
- Edit the cluster with invalid data
- You'll see the error appears twice on the page
Example Project
This is going to happen on gitlab.com after https://gitlab.com/gitlab-org/gitlab-ce/issues/56715 / https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24583 has being deployed to prod.
What is the current bug behavior?
Error appears twice on the same page
What is the expected correct behavior?
Error should only appear one and in the corresponding form.
Possible fixes
From https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24643:
Maybe it's time to split this form to a different controller (
Clusters::Platforms::KubernetesController
) that uses a different (Clusters::Platforms::Kubernetes::UpdateService
), that returns an independent object (@platform_kubernetes
). But of course that will involve a lot of work (I've try to do it here https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24633) and it'll need to be scheduled by PM.