Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the number of problems for each environment #1104

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Do not retrieve build for environments with `UNDEPLOYED` and `UNKNOWN` deployment status [#1101](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/1101)
- Integrated with CCv2 API V1 to show Dynatrace link [#1102](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/1102)
- Show OpenSearch link for each environment [#1103](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/1103)
- Show the number of problems for each environment [#1104](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/1104)

### `Project Import` enhancements
- Loading backoffice sources provided by SAP on project import [#1096](https://github.com/epam/sap-commerce-intellij-idea-plugin/issues/1096)
Expand Down
40 changes: 40 additions & 0 deletions resources/specs/commerce-cloud-management-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,39 @@ paths:
$ref: '#/components/responses/DefaultResponse'
'5XX':
$ref: '#/components/responses/DefaultResponse'
/subscriptions/{subscriptionCode}/environments/{environmentCode}/health:
parameters:
- name: subscriptionCode
in: path
description: Customer subscription code
required: true
schema:
type: string
- name: environmentCode
in: path
description: Environment in the subscription
required: true
schema:
type: string
get:
tags:
- environment
description: Get environment health
operationId: getEnvironmentHealthV1
parameters:
- $ref: '#/components/parameters/EndpointWebProxyFilter'
- $ref: '#/components/parameters/EndpointServiceFilter'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/EnvironmentHealthV1DTO'
'4XX':
$ref: '#/components/responses/DefaultResponse'
'5XX':
$ref: '#/components/responses/DefaultResponse'
/subscriptions/{subscriptionCode}/environments/{environmentCode}/endpoints:
parameters:
- name: subscriptionCode
Expand Down Expand Up @@ -1890,6 +1923,13 @@ components:
type: array
items:
$ref: '#/components/schemas/MediaStorageV1DTO'
EnvironmentHealthV1DTO:
description: V1 Entity to represent problems of the environment
type: object
properties:
problems:
description: Dynatrace problems
type: integer
MediaStorageV1DTO:
description: V1 Entity to represent a media storage
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ data class CCv2Environment(
var deployedBuild: CCv2Build? = null,
val dynatraceLink: String? = null,
val loggingLink: String? = null,
val problems: Int? = null,
) : CCv2DTO, Comparable<CCv2Environment> {

override fun compareTo(other: CCv2Environment) = name.compareTo(other.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ class CCv2Strategy {
// user may not have access to the environment
null
}
env to (deploymentAllowed to v1Env)
val v1EnvHealth = try {
EnvironmentApi(basePath = "https://portalrotapi.hana.ondemand.com/v1", client = client)
.getEnvironmentHealthV1(subscriptionCode, environmentCode)
} catch (e: ClientException) {
// user may not have access to the environment
null
}
env to Triple(deploymentAllowed, v1Env, v1EnvHealth)
}
}
?.awaitAll()
Expand All @@ -79,6 +86,7 @@ class CCv2Strategy {
val code = environment.code
val deploymentStatus = details.first
val v1Environment = details.second
val v1EnvironmentHealth = details.third

CCv2Environment(
code = code ?: "N/A",
Expand All @@ -89,6 +97,7 @@ class CCv2Strategy {
deploymentAllowed = deploymentStatus && (status == CCv2EnvironmentStatus.AVAILABLE || status == CCv2EnvironmentStatus.READY_FOR_DEPLOYMENT),
dynatraceLink = v1Environment?.dynatraceUrl,
loggingLink = v1Environment?.loggingUrl,
problems = v1EnvironmentHealth?.problems
)
}
?: emptyList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ object CCv2EnvironmentsDataView : AbstractCCv2DataView<CCv2Environment>() {
.gap(RightGap.SMALL)
browserLink("Dynatrace", environment.dynatraceLink ?: "")
.enabled(environment.dynatraceLink != null)
.comment("&nbsp;")
.comment(environment.problems
?.let { "problems: <strong>$it</strong>" } ?: "&nbsp;")
}
}.gap(RightGap.SMALL)

Expand Down
Loading