Commit f96ab945 authored by Dhiraj Bodicherla's avatar Dhiraj Bodicherla

Remove environments REST API endpoint

Environments dropdown in monitoring dashboard uses
GraphQL instead of REST API. This MR removes all
occurences of envs REST API
parent 5fb30b28
...@@ -132,11 +132,6 @@ export default { ...@@ -132,11 +132,6 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
environmentsEndpoint: {
type: String,
required: false,
default: '',
},
currentEnvironmentName: { currentEnvironmentName: {
type: String, type: String,
required: true, required: true,
...@@ -218,9 +213,7 @@ export default { ...@@ -218,9 +213,7 @@ export default {
]), ]),
...mapGetters('monitoringDashboard', ['getMetricStates', 'filteredEnvironments']), ...mapGetters('monitoringDashboard', ['getMetricStates', 'filteredEnvironments']),
firstDashboard() { firstDashboard() {
return this.environmentsEndpoint.length > 0 && this.allDashboards.length > 0 return this.allDashboards.length > 0 ? this.allDashboards[0] : {};
? this.allDashboards[0]
: {};
}, },
selectedDashboard() { selectedDashboard() {
return this.allDashboards.find(d => d.path === this.currentDashboard) || this.firstDashboard; return this.allDashboards.find(d => d.path === this.currentDashboard) || this.firstDashboard;
...@@ -246,7 +239,6 @@ export default { ...@@ -246,7 +239,6 @@ export default {
created() { created() {
this.setEndpoints({ this.setEndpoints({
metricsEndpoint: this.metricsEndpoint, metricsEndpoint: this.metricsEndpoint,
environmentsEndpoint: this.environmentsEndpoint,
deploymentsEndpoint: this.deploymentsEndpoint, deploymentsEndpoint: this.deploymentsEndpoint,
dashboardEndpoint: this.dashboardEndpoint, dashboardEndpoint: this.dashboardEndpoint,
dashboardsEndpoint: this.dashboardsEndpoint, dashboardsEndpoint: this.dashboardsEndpoint,
......
...@@ -172,7 +172,6 @@ export default { ...@@ -172,7 +172,6 @@ export default {
[types.SET_ENDPOINTS](state, endpoints) { [types.SET_ENDPOINTS](state, endpoints) {
state.metricsEndpoint = endpoints.metricsEndpoint; state.metricsEndpoint = endpoints.metricsEndpoint;
state.environmentsEndpoint = endpoints.environmentsEndpoint;
state.deploymentsEndpoint = endpoints.deploymentsEndpoint; state.deploymentsEndpoint = endpoints.deploymentsEndpoint;
state.dashboardEndpoint = endpoints.dashboardEndpoint; state.dashboardEndpoint = endpoints.dashboardEndpoint;
state.dashboardsEndpoint = endpoints.dashboardsEndpoint; state.dashboardsEndpoint = endpoints.dashboardsEndpoint;
......
...@@ -2,7 +2,6 @@ import invalidUrl from '~/lib/utils/invalid_url'; ...@@ -2,7 +2,6 @@ import invalidUrl from '~/lib/utils/invalid_url';
export default () => ({ export default () => ({
metricsEndpoint: null, metricsEndpoint: null,
environmentsEndpoint: null,
deploymentsEndpoint: null, deploymentsEndpoint: null,
dashboardEndpoint: invalidUrl, dashboardEndpoint: invalidUrl,
emptyState: 'gettingStarted', emptyState: 'gettingStarted',
......
...@@ -33,7 +33,6 @@ module EnvironmentsHelper ...@@ -33,7 +33,6 @@ module EnvironmentsHelper
"dashboard-endpoint" => metrics_dashboard_project_environment_path(project, environment, format: :json), "dashboard-endpoint" => metrics_dashboard_project_environment_path(project, environment, format: :json),
"deployments-endpoint" => project_environment_deployments_path(project, environment, format: :json), "deployments-endpoint" => project_environment_deployments_path(project, environment, format: :json),
"default-branch" => project.default_branch, "default-branch" => project.default_branch,
"environments-endpoint": project_environments_path(project, format: :json),
"project-path" => project_path(project), "project-path" => project_path(project),
"tags-path" => project_tags_path(project), "tags-path" => project_tags_path(project),
"has-metrics" => "#{environment.has_metrics?}", "has-metrics" => "#{environment.has_metrics?}",
......
...@@ -23,7 +23,6 @@ export const propsData = { ...@@ -23,7 +23,6 @@ export const propsData = {
emptyNoDataSvgPath: '/path/to/no-data.svg', emptyNoDataSvgPath: '/path/to/no-data.svg',
emptyNoDataSmallSvgPath: '/path/to/no-data-small.svg', emptyNoDataSmallSvgPath: '/path/to/no-data-small.svg',
emptyUnableToConnectSvgPath: '/path/to/unable-to-connect.svg', emptyUnableToConnectSvgPath: '/path/to/unable-to-connect.svg',
environmentsEndpoint: '/root/hello-prometheus/-/environments.json',
currentEnvironmentName: 'production', currentEnvironmentName: 'production',
customMetricsAvailable: false, customMetricsAvailable: false,
customMetricsPath: '', customMetricsPath: '',
......
...@@ -159,7 +159,6 @@ describe('Monitoring store actions', () => { ...@@ -159,7 +159,6 @@ describe('Monitoring store actions', () => {
{ {
metricsEndpoint: 'additional_metrics.json', metricsEndpoint: 'additional_metrics.json',
deploymentsEndpoint: 'deployments.json', deploymentsEndpoint: 'deployments.json',
environmentsEndpoint: 'deployments.json',
}, },
mockedState, mockedState,
[ [
...@@ -168,7 +167,6 @@ describe('Monitoring store actions', () => { ...@@ -168,7 +167,6 @@ describe('Monitoring store actions', () => {
payload: { payload: {
metricsEndpoint: 'additional_metrics.json', metricsEndpoint: 'additional_metrics.json',
deploymentsEndpoint: 'deployments.json', deploymentsEndpoint: 'deployments.json',
environmentsEndpoint: 'deployments.json',
}, },
}, },
], ],
......
...@@ -81,13 +81,11 @@ describe('Monitoring mutations', () => { ...@@ -81,13 +81,11 @@ describe('Monitoring mutations', () => {
it('should set all the endpoints', () => { it('should set all the endpoints', () => {
mutations[types.SET_ENDPOINTS](stateCopy, { mutations[types.SET_ENDPOINTS](stateCopy, {
metricsEndpoint: 'additional_metrics.json', metricsEndpoint: 'additional_metrics.json',
environmentsEndpoint: 'environments.json',
deploymentsEndpoint: 'deployments.json', deploymentsEndpoint: 'deployments.json',
dashboardEndpoint: 'dashboard.json', dashboardEndpoint: 'dashboard.json',
projectPath: '/gitlab-org/gitlab-foss', projectPath: '/gitlab-org/gitlab-foss',
}); });
expect(stateCopy.metricsEndpoint).toEqual('additional_metrics.json'); expect(stateCopy.metricsEndpoint).toEqual('additional_metrics.json');
expect(stateCopy.environmentsEndpoint).toEqual('environments.json');
expect(stateCopy.deploymentsEndpoint).toEqual('deployments.json'); expect(stateCopy.deploymentsEndpoint).toEqual('deployments.json');
expect(stateCopy.dashboardEndpoint).toEqual('dashboard.json'); expect(stateCopy.dashboardEndpoint).toEqual('dashboard.json');
expect(stateCopy.projectPath).toEqual('/gitlab-org/gitlab-foss'); expect(stateCopy.projectPath).toEqual('/gitlab-org/gitlab-foss');
......
...@@ -29,7 +29,6 @@ describe EnvironmentsHelper do ...@@ -29,7 +29,6 @@ describe EnvironmentsHelper do
'metrics-endpoint' => additional_metrics_project_environment_path(project, environment, format: :json), 'metrics-endpoint' => additional_metrics_project_environment_path(project, environment, format: :json),
'deployments-endpoint' => project_environment_deployments_path(project, environment, format: :json), 'deployments-endpoint' => project_environment_deployments_path(project, environment, format: :json),
'default-branch' => 'master', 'default-branch' => 'master',
'environments-endpoint': project_environments_path(project, format: :json),
'project-path' => project_path(project), 'project-path' => project_path(project),
'tags-path' => project_tags_path(project), 'tags-path' => project_tags_path(project),
'has-metrics' => "#{environment.has_metrics?}", 'has-metrics' => "#{environment.has_metrics?}",
......
...@@ -30,7 +30,6 @@ const propsData = { ...@@ -30,7 +30,6 @@ const propsData = {
emptyNoDataSvgPath: '/path/to/no-data.svg', emptyNoDataSvgPath: '/path/to/no-data.svg',
emptyNoDataSmallSvgPath: '/path/to/no-data-small.svg', emptyNoDataSmallSvgPath: '/path/to/no-data-small.svg',
emptyUnableToConnectSvgPath: '/path/to/unable-to-connect.svg', emptyUnableToConnectSvgPath: '/path/to/unable-to-connect.svg',
environmentsEndpoint: '/root/hello-prometheus/environments/35',
currentEnvironmentName: 'production', currentEnvironmentName: 'production',
customMetricsAvailable: false, customMetricsAvailable: false,
customMetricsPath: '', customMetricsPath: '',
......
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