Commit f835649b authored by Olena Horal-Koretska's avatar Olena Horal-Koretska Committed by David O'Regan

Switch environments endpoint for better performance

parent 2dbb2234
...@@ -127,7 +127,7 @@ export const fetchEnvironments = ({ commit, dispatch }, environmentsPath) => { ...@@ -127,7 +127,7 @@ export const fetchEnvironments = ({ commit, dispatch }, environmentsPath) => {
return axios return axios
.get(environmentsPath) .get(environmentsPath)
.then(({ data }) => { .then(({ data }) => {
commit(types.RECEIVE_ENVIRONMENTS_DATA_SUCCESS, data.environments); commit(types.RECEIVE_ENVIRONMENTS_DATA_SUCCESS, data);
dispatch('fetchLogs', tracking.ENVIRONMENT_SELECTED); dispatch('fetchLogs', tracking.ENVIRONMENT_SELECTED);
}) })
.catch(() => { .catch(() => {
......
...@@ -34,7 +34,7 @@ module EnvironmentsHelper ...@@ -34,7 +34,7 @@ module EnvironmentsHelper
def environment_logs_data(project, environment) def environment_logs_data(project, environment)
{ {
"environment_name": environment.name, "environment_name": environment.name,
"environments_path": project_environments_path(project, format: :json), "environments_path": api_v4_projects_environments_path(id: project.id),
"environment_id": environment.id, "environment_id": environment.id,
"cluster_applications_documentation_path" => help_page_path('user/clusters/applications.md', anchor: 'elastic-stack'), "cluster_applications_documentation_path" => help_page_path('user/clusters/applications.md', anchor: 'elastic-stack'),
"clusters_path": project_clusters_path(project, format: :json) "clusters_path": project_clusters_path(project, format: :json)
......
...@@ -61,7 +61,7 @@ RSpec.describe EnvironmentsHelper do ...@@ -61,7 +61,7 @@ RSpec.describe EnvironmentsHelper do
it 'returns environment parameters data' do it 'returns environment parameters data' do
expect(subject).to include( expect(subject).to include(
"environment_name": environment.name, "environment_name": environment.name,
"environments_path": project_environments_path(project, format: :json) "environments_path": api_v4_projects_environments_path(id: project.id)
) )
end end
......
...@@ -191,7 +191,7 @@ describe('Logs Store actions', () => { ...@@ -191,7 +191,7 @@ describe('Logs Store actions', () => {
}); });
it('should commit RECEIVE_ENVIRONMENTS_DATA_SUCCESS mutation on correct data', () => { it('should commit RECEIVE_ENVIRONMENTS_DATA_SUCCESS mutation on correct data', () => {
mock.onGet(mockEnvironmentsEndpoint).replyOnce(200, { environments: mockEnvironments }); mock.onGet(mockEnvironmentsEndpoint).replyOnce(200, mockEnvironments);
return testAction( return testAction(
fetchEnvironments, fetchEnvironments,
mockEnvironmentsEndpoint, mockEnvironmentsEndpoint,
......
...@@ -191,7 +191,7 @@ RSpec.describe EnvironmentsHelper do ...@@ -191,7 +191,7 @@ RSpec.describe EnvironmentsHelper do
it 'returns logs data' do it 'returns logs data' do
expected_data = { expected_data = {
"environment_name": environment.name, "environment_name": environment.name,
"environments_path": project_environments_path(project, format: :json), "environments_path": api_v4_projects_environments_path(id: project.id),
"environment_id": environment.id, "environment_id": environment.id,
"cluster_applications_documentation_path" => help_page_path('user/clusters/applications.md', anchor: 'elastic-stack'), "cluster_applications_documentation_path" => help_page_path('user/clusters/applications.md', anchor: 'elastic-stack'),
"clusters_path": project_clusters_path(project, format: :json) "clusters_path": project_clusters_path(project, format: :json)
......
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