Skip to content
代码片段 群组 项目
提交 388e63b0 编辑于 作者: Niklas's avatar Niklas 提交者: Alex Kalderimis
浏览文件

Add external_url field to Environment GraphQL Type

Changelog: added
上级 50e871a8
No related branches found
No related tags found
无相关合并请求
......@@ -21,6 +21,9 @@ class EnvironmentType < BaseObject
field :path, GraphQL::Types::String, null: false,
description: 'Path to the environment.'
field :external_url, GraphQL::Types::String, null: true,
description: 'External URL of the environment.'
field :metrics_dashboard, Types::Metrics::DashboardType, null: true,
description: 'Metrics dashboard schema for the environment.',
resolver: Resolvers::Metrics::DashboardResolver
......
......@@ -11457,6 +11457,7 @@ Describes where code is deployed for a project.
 
| Name | Type | Description |
| ---- | ---- | ----------- |
| <a id="environmentexternalurl"></a>`externalUrl` | [`String`](#string) | External URL of the environment. |
| <a id="environmentid"></a>`id` | [`ID!`](#id) | ID of the environment. |
| <a id="environmentlatestopenedmostseverealert"></a>`latestOpenedMostSevereAlert` | [`AlertManagementAlert`](#alertmanagementalert) | Most severe open alert for the environment. If multiple alerts have equal severity, the most recent is returned. |
| <a id="environmentname"></a>`name` | [`String!`](#string) | Human-readable name of the environment. |
......@@ -7,7 +7,7 @@
it 'has the expected fields' do
expected_fields = %w[
name id state metrics_dashboard latest_opened_most_severe_alert path deployments
name id state metrics_dashboard latest_opened_most_severe_alert path external_url deployments
]
expect(described_class).to have_graphql_fields(*expected_fields)
......@@ -17,7 +17,7 @@
context 'when there is an environment' do
let_it_be(:project) { create(:project) }
let_it_be(:environment) { create(:environment, project: project) }
let_it_be(:environment) { create(:environment, project: project, external_url: 'https://gitlab.com') }
let_it_be(:user) { create(:user) }
subject { GitlabSchema.execute(query, context: { current_user: user }).as_json }
......@@ -29,6 +29,7 @@
environment(name: "#{environment.name}") {
name
path
externalUrl
state
}
}
......@@ -50,6 +51,10 @@
)
end
it 'returns the external url of the environment' do
expect(subject['data']['project']['environment']['externalUrl']).to eq(environment.external_url)
end
context 'when query alert data for the environment' do
let_it_be(:query) do
%(
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册