Commit d054d271 authored by Mikolaj Wawrzyniak's avatar Mikolaj Wawrzyniak Committed by Jose Vargas

Remove unreadable clusters for select menu

When expposing gitlab managed apps logs, unreadable clusters
return empty path. Such entries should not be present on the
select menu.
parent c4247c9c
......@@ -112,7 +112,9 @@ export default {
},
// Managed apps data
[types.RECEIVE_MANAGED_APPS_DATA_SUCCESS](state, apps) {
state.managedApps.options = apps;
state.managedApps.options = apps.filter(
({ gitlab_managed_apps_logs_path }) => gitlab_managed_apps_logs_path, // eslint-disable-line babel/camelcase
);
state.managedApps.isLoading = false;
},
[types.RECEIVE_MANAGED_APPS_DATA_ERROR](state) {
......
......@@ -36,6 +36,16 @@ export const mockManagedApps = [
path: '/root/autodevops-deploy/-/clusters/15',
gitlab_managed_apps_logs_path: '/root/autodevops-deploy/-/logs?cluster_id=15',
},
{
cluster_type: 'project_type',
enabled: true,
environment_scope: '*',
name: 'kubernetes-cluster-2',
provider_type: 'user',
status: 'connected',
path: '/root/autodevops-deploy/-/clusters/16',
gitlab_managed_apps_logs_path: null,
},
];
export const mockPodName = 'production-764c58d697-aaaaa';
......
......@@ -272,7 +272,8 @@ describe('Logs Store Mutations', () => {
mutations[types.RECEIVE_MANAGED_APPS_DATA_SUCCESS](state, mockManagedApps);
expect(state.managedApps.options).toEqual(mockManagedApps);
expect(state.managedApps.options.length).toEqual(1);
expect(state.managedApps.options).toEqual([mockManagedApps[0]]);
expect(state.managedApps.isLoading).toBe(false);
});
});
......
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