Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a930ae63
Commit
a930ae63
authored
Apr 05, 2022
by
Takuya Noguchi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove environment_metrics from helpers
Signed-off-by:
Takuya Noguchi
<
takninnovationresearch@gmail.com
>
parent
ce3e9b18
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
11 additions
and
15 deletions
+11
-15
app/assets/javascripts/monitoring/stores/utils.js
app/assets/javascripts/monitoring/stores/utils.js
+2
-2
app/helpers/environment_helper.rb
app/helpers/environment_helper.rb
+1
-1
app/helpers/environments_helper.rb
app/helpers/environments_helper.rb
+1
-1
app/helpers/routing/projects_helper.rb
app/helpers/routing/projects_helper.rb
+0
-4
app/serializers/environment_status_entity.rb
app/serializers/environment_status_entity.rb
+1
-1
spec/frontend/monitoring/components/__snapshots__/dashboard_template_spec.js.snap
.../components/__snapshots__/dashboard_template_spec.js.snap
+1
-1
spec/frontend/monitoring/components/dashboard_url_time_spec.js
...frontend/monitoring/components/dashboard_url_time_spec.js
+1
-1
spec/frontend/monitoring/store/utils_spec.js
spec/frontend/monitoring/store/utils_spec.js
+2
-2
spec/helpers/environment_helper_spec.rb
spec/helpers/environment_helper_spec.rb
+1
-1
spec/helpers/environments_helper_spec.rb
spec/helpers/environments_helper_spec.rb
+1
-1
No files found.
app/assets/javascripts/monitoring/stores/utils.js
View file @
a930ae63
...
...
@@ -45,7 +45,7 @@ export const removeLeadingSlash = (str) => (str || '').replace(/^\/+/, '');
/**
* GraphQL environments API returns only id and name.
* For the environments dropdown we need metrics_path.
* This method parses the results and add nec
cessart
attrs
* This method parses the results and add nec
essary
attrs
*
* @param {Array} response Environments API result
* @param {String} projectPath Current project path
...
...
@@ -57,7 +57,7 @@ export const parseEnvironmentsResponse = (response = [], projectPath) =>
return
{
...
env
,
id
,
metrics_path
:
`
${
projectPath
}
/
environments/
${
id
}
/metrics
`
,
metrics_path
:
`
${
projectPath
}
/
-/metrics?environment=
${
id
}
`
,
};
});
...
...
app/helpers/environment_helper.rb
View file @
a930ae63
...
...
@@ -77,7 +77,7 @@ module EnvironmentHelper
can_destroy_environment:
can_destroy_environment?
(
environment
),
can_stop_environment:
can?
(
current_user
,
:stop_environment
,
environment
),
can_admin_environment:
can?
(
current_user
,
:admin_environment
,
project
),
environment_metrics_path:
environment_metrics_path
(
environment
),
environment_metrics_path:
project_metrics_dashboard_path
(
project
,
environment:
environment
),
environments_fetch_path:
project_environments_path
(
project
,
format: :json
),
environment_edit_path:
edit_project_environment_path
(
project
,
environment
),
environment_stop_path:
stop_project_environment_path
(
project
,
environment
),
...
...
app/helpers/environments_helper.rb
View file @
a930ae63
...
...
@@ -92,7 +92,7 @@ module EnvironmentsHelper
return
path
if
request
.
path
.
include?
(
path
)
end
environment_metrics_path
(
environment
)
project_metrics_dashboard_path
(
project
,
environment:
environment
)
end
def
project_and_environment_metrics_data
(
project
,
environment
)
...
...
app/helpers/routing/projects_helper.rb
View file @
a930ae63
...
...
@@ -18,10 +18,6 @@ module Routing
project_environment_path
(
environment
.
project
,
environment
,
*
args
)
end
def
environment_metrics_path
(
environment
,
*
args
)
metrics_project_environment_path
(
environment
.
project
,
environment
,
*
args
)
end
def
environment_delete_path
(
environment
,
*
args
)
expose_path
(
api_v4_projects_environments_path
(
id:
environment
.
project
.
id
,
environment_id:
environment
.
id
))
end
...
...
app/serializers/environment_status_entity.rb
View file @
a930ae63
...
...
@@ -16,7 +16,7 @@ class EnvironmentStatusEntity < Grape::Entity
end
expose
:metrics_monitoring_url
,
if:
->
(
*
)
{
can_read_environment?
}
do
|
es
|
environment_metrics_path
(
es
.
environment
)
project_metrics_dashboard_path
(
es
.
project
,
environment:
es
.
environment
)
end
expose
:stop_url
,
if:
->
(
*
)
{
can_stop_environment?
}
do
|
es
|
...
...
spec/frontend/monitoring/components/__snapshots__/dashboard_template_spec.js.snap
View file @
a930ae63
...
...
@@ -5,7 +5,7 @@ exports[`Dashboard template matches the default snapshot 1`] = `
class="prometheus-graphs"
data-qa-selector="prometheus_graphs"
environmentstate="available"
metricsdashboardbasepath="/monitoring/monitor-project/-/
environments/1/metrics
"
metricsdashboardbasepath="/monitoring/monitor-project/-/
metrics?environment=1
"
metricsendpoint="/monitoring/monitor-project/-/environments/1/additional_metrics.json"
>
<div>
...
...
spec/frontend/monitoring/components/dashboard_url_time_spec.js
View file @
a930ae63
...
...
@@ -126,7 +126,7 @@ describe('dashboard invalid url parameters', () => {
});
it
(
'
redirects to different time range
'
,
async
()
=>
{
const
toUrl
=
`
${
mockProjectDir
}
/-/
environments/1/metrics
`
;
const
toUrl
=
`
${
mockProjectDir
}
/-/
metrics?environment=1
`
;
removeParams
.
mockReturnValueOnce
(
toUrl
);
createMountedWrapper
();
...
...
spec/frontend/monitoring/store/utils_spec.js
View file @
a930ae63
...
...
@@ -547,7 +547,7 @@ describe('parseEnvironmentsResponse', () => {
{
id
:
1
,
name
:
'
env-1
'
,
metrics_path
:
`
${
projectPath
}
/
environments/1/metrics
`
,
metrics_path
:
`
${
projectPath
}
/
-/metrics?environment=1
`
,
},
],
},
...
...
@@ -562,7 +562,7 @@ describe('parseEnvironmentsResponse', () => {
{
id
:
12
,
name
:
'
env-12
'
,
metrics_path
:
`
${
projectPath
}
/
environments/12/metrics
`
,
metrics_path
:
`
${
projectPath
}
/
-/metrics?environment=12
`
,
},
],
},
...
...
spec/helpers/environment_helper_spec.rb
View file @
a930ae63
...
...
@@ -55,7 +55,7 @@ RSpec.describe EnvironmentHelper do
can_destroy_environment:
true
,
can_stop_environment:
true
,
can_admin_environment:
true
,
environment_metrics_path:
environment_metrics_path
(
environment
),
environment_metrics_path:
project_metrics_dashboard_path
(
project
,
environment:
environment
),
environments_fetch_path:
project_environments_path
(
project
,
format: :json
),
environment_edit_path:
edit_project_environment_path
(
project
,
environment
),
environment_stop_path:
stop_project_environment_path
(
project
,
environment
),
...
...
spec/helpers/environments_helper_spec.rb
View file @
a930ae63
...
...
@@ -20,7 +20,7 @@ RSpec.describe EnvironmentsHelper do
expect
(
metrics_data
).
to
include
(
'settings_path'
=>
edit_project_integration_path
(
project
,
'prometheus'
),
'clusters_path'
=>
project_clusters_path
(
project
),
'metrics_dashboard_base_path'
=>
environment_metrics_path
(
environment
),
'metrics_dashboard_base_path'
=>
project_metrics_dashboard_path
(
project
,
environment:
environment
),
'current_environment_name'
=>
environment
.
name
,
'documentation_path'
=>
help_page_path
(
'administration/monitoring/prometheus/index.md'
),
'add_dashboard_documentation_path'
=>
help_page_path
(
'operations/metrics/dashboards/index.md'
,
anchor:
'add-a-new-dashboard-to-your-project'
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment