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

feature: Update according to feedback. #44

Merged
merged 1 commit into from
Jan 22, 2019
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
6 changes: 3 additions & 3 deletions app/views/SearchByUrlPage.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

@standard_layout("Service Search", "search") {
<header>
<h1 id="search-service-header">Service Search</h1>
<h1 id="search-service-header">Search for a service by URL</h1>
</header>
<div id="service-list">
<div class="board">
Expand All @@ -36,8 +36,8 @@ <h3 id="info-box-header" class="board__heading"><img class="info-icon" src="asse
<div class="row col-xs-12 ">
<p>Addresses beginning with the following are not tax platform services:</p>
<ul class="list list--minimal">
<li class="list-item">https://www.access.tax.service.gov.uk/</li>
<li class="list-item">https://www.gov.uk/</li>
<li class="list-item">https://www.access.tax.service.gov.uk/ (Owned by Secure Credential Platform)</li>
<li class="list-item">https://www.gov.uk/ (Owned by Government Digital Service)</li>
</ul>
</div>
</div>
Expand Down
7 changes: 4 additions & 3 deletions app/views/ServiceInfoPage.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,16 @@ <h1 id="service-header">Service: @service.name<span>@githubBadgeType(service)</s

<section class="section-wrapper">

@partials.details(service, productionEnvironmentRoute)
@partials.details(service)

@partials.serviceUrlDetails(productionEnvironmentRoute)

@partials.serviceRouteRuleViolations(serviceRoutes)

<div class="row">
@partials.repo_owning_teams(service)

@partials.code_and_builds(service, productionEnvironmentRoute)

@partials.code_and_builds(service)
</div>
<div class="row">
@for((environment, idx) <- service.environments.get.zipWithIndex) {
Expand Down
24 changes: 1 addition & 23 deletions app/views/partials/code_and_builds.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@import uk.gov.hmrc.cataloguefrontend.CatalogueFrontendSwitches
@import uk.gov.hmrc.cataloguefrontend.service.RouteRulesService.EnvironmentRoute

@(repo: RepositoryDetails, environmentRoute: Option[EnvironmentRoute] = None)
@(repo: RepositoryDetails)

<div id="code-and-build" class="col-md-6">
<div class="board">
Expand All @@ -32,28 +32,6 @@ <h3 class="board__heading">Code and Build</h3>
@for(ciLink <- repo.ci) {
<li class="list-item"><a id="link-to-@{ciLink.id}" href="@{ciLink.url}" target="_blank">@{ciLink.displayName}<span class="glyphicon glyphicon-new-window"/></a></li>
}
@if(CatalogueFrontendSwitches.routingRules.isEnabled && environmentRoute.isDefined) {
@defining(environmentRoute.get.routes.size > 3) { collapsable =>
<div class="board">
<h5 class="board__heading" id="headingRSU">
<div class="@if(collapsable){accordion-toggle collapsed}" data-toggle="@if(collapsable) {collapse}" data-target="#collapseRSU" aria-expanded="@if(collapsable) {false} else {true}" aria-controls="collapseRSU">
Routing Configuration(s):
</div>
</h5>
<div class="board__body">
<div id="collapseRSU" class="@if(collapsable) {collapse}" aria-labelledby="headingRSU">
<ul id="production-urls" class="list list--minimal">
@for((route, index) <- environmentRoute.get.routes.zipWithIndex) {
<li id="route-rule-@index" class="list-item">
<a target="_blank" title="@route.frontendPath" href="@route.ruleConfigurationUrl">@route.frontendPath<span class="glyphicon glyphicon-new-window"/></a>
</li>
}
</ul>
</div>
</div>
</div>
}
}
</ul>
</div>
</div>
Expand Down
32 changes: 1 addition & 31 deletions app/views/partials/details.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@import uk.gov.hmrc.cataloguefrontend.service.RouteRulesService.EnvironmentRoute
@import uk.gov.hmrc.cataloguefrontend.CatalogueFrontendSwitches

@(repositoryDetails: RepositoryDetails, environmentRoute: Option[EnvironmentRoute] = None)
@(repositoryDetails: RepositoryDetails)
<div id="details" >
<div class="board" class="col-md-12">
<h3 class="board__heading">Details</h3>
Expand All @@ -38,36 +38,6 @@ <h3 class="board__heading">Details</h3>
@repositoryDetails.lastActive.displayFormat
</li>
</ul>
@if(CatalogueFrontendSwitches.routingRules.isEnabled && environmentRoute.isDefined) {
@defining(environmentRoute.get.routes.size > 3) { collapsable =>
<ul id="service-urls-section" class="list list--minimal">
<div class="board">
<li class="list-item">
<h5 class="board__heading" id="headingSU">
<div class="@if(collapsable){accordion-toggle collapsed}" data-toggle="@if(collapsable) {collapse}" data-target="#collapseSU" aria-expanded="@if(collapsable) {false} else {true}" aria-controls="collapseSU">
URL(s):
</div>
</h5>
<div class="board__body">
<div id="collapseSU" class="@if(collapsable) {collapse}" aria-labelledby="headingSU">
<ul id="production-urls" class="list list--minimal">
@for((route, index) <- environmentRoute.get.routes.zipWithIndex) {
<li id="url-@index" class="list-item">
@if(route.isRegex) {
@route.frontendPath
} else {
<a href="https://[email protected]" target="_blank">@route.frontendPath <span class="glyphicon glyphicon-new-window"/></a>
}
</li>
}
</ul>
</div>
</div>
</li>
</div>
</ul>
}
}
</div>
</div>
</div>
43 changes: 43 additions & 0 deletions app/views/partials/serviceUrlDetails.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@*
* Copyright 2019 HM Revenue & Customs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*@

@import uk.gov.hmrc.cataloguefrontend.connector.RepositoryDetails
@import uk.gov.hmrc.cataloguefrontend.service.RouteRulesService.EnvironmentRoute
@import uk.gov.hmrc.cataloguefrontend.CatalogueFrontendSwitches

@(environmentRoute: Option[EnvironmentRoute] = None)
@if(CatalogueFrontendSwitches.routingRules.isEnabled && environmentRoute.isDefined) {
@defining(environmentRoute.get.routes.size > 3) { collapsable =>
<div id="service-urls-section" class="board">
<h3 class="board__heading" id="headingRSU">
<div class="@if(collapsable){accordion-toggle collapsed}" data-toggle="@if(collapsable) {collapse}" data-target="#collapseRSU" aria-expanded="@if(collapsable) {false} else {true}" aria-controls="collapseRSU">
Frontend Routing Configuration
</div>
</h3>
<div class="board__body">
<div id="collapseRSU" class="@if(collapsable) {collapse}" aria-labelledby="headingRSU">
<ul id="production-urls" class="list list--minimal">
@for((route, index) <- environmentRoute.get.routes.zipWithIndex) {
<li id="route-rule-@index" class="list-item">
<a target="_blank" title="@route.frontendPath" href="@route.ruleConfigurationUrl">@route.frontendPath<span class="glyphicon glyphicon-new-window"/></a>
</li>
}
</ul>
</div>
</div>
</div>
}
}
1 change: 0 additions & 1 deletion test/uk/gov/hmrc/cataloguefrontend/ServicePageSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ class ServicePageSpec extends UnitSpec with GuiceOneServerPerSuite with WireMock

response.body should include("https://deploy-dev.co.uk/job/deploy-microservice")
response.body should include("https://grafana-dev.co.uk/#/dashboard")

}

"show show 'Not deployed' for envs in which the service is not deployed" in {
Expand Down
10 changes: 5 additions & 5 deletions test/view/partials/CodeAndBuildsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,26 @@ class CodeAndBuildsSpec extends WordSpec with Matchers {
result should not include ("Config Explorer")
}

"display routing rules when feature flag is enabled" in {
/* "display routing rules when feature flag is enabled" in {
FeatureSwitch.enable(CatalogueFrontendSwitches.routingRules)
val result = views.html.partials.code_and_builds(repo, Some(environmentRoute)).body
val result = views.html.partials.code_and_builds(repo).body
result should include ("id=\"route-rule-0\"")
result should include ("id=\"route-rule-1\"")
}

"do not display routing rules when feature flag is disabled" in {
FeatureSwitch.disable(CatalogueFrontendSwitches.routingRules)
val result = views.html.partials.code_and_builds(repo, Some(environmentRoute)).body
val result = views.html.partials.code_and_builds(repo).body
result should not include ("id=\"route-rule-0\"")
result should not include ("id=\"route-rule-1\"")
}

"do not display routing rules when no rules" in {
FeatureSwitch.enable(CatalogueFrontendSwitches.routingRules)
val result = views.html.partials.code_and_builds(repo, None).body
val result = views.html.partials.code_and_builds(repo).body
result should not include ("id=\"route-rule-0\"")
result should not include ("id=\"route-rule-1\"")
}
}*/
}

}
35 changes: 4 additions & 31 deletions test/view/partials/DetailsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,55 +49,28 @@ class DetailsSpec extends WordSpec with Matchers {
"details" should {
"display description when available" in {
FeatureSwitch.enable(CatalogueFrontendSwitches.routingRules)
val result = views.html.partials.details(repo, None).body
val result = views.html.partials.details(repo).body
result should include ("some description")
}

"should not display description when it is not available" in {
FeatureSwitch.enable(CatalogueFrontendSwitches.routingRules)
val result = views.html.partials.details(repo.copy(description = ""), None).body
val result = views.html.partials.details(repo.copy(description = "")).body
result should not include ("some description")
}

"display Created At Date" in {
FeatureSwitch.enable(CatalogueFrontendSwitches.routingRules)
val result = views.html.partials.details(repo, None).body
val result = views.html.partials.details(repo).body
result should include ("id=\"created-at\"")
result should include ("31 Dec 2018 08:30")
}

"display Last Active Date" in {
FeatureSwitch.enable(CatalogueFrontendSwitches.routingRules)
val result = views.html.partials.details(repo, None).body
val result = views.html.partials.details(repo).body
result should include ("id=\"last-active\"")
result should include ("31 Dec 2018 18:30")
}

"display production URLs when feature flag is enabled" in {
FeatureSwitch.enable(CatalogueFrontendSwitches.routingRules)
val result = views.html.partials.details(repo, Some(environmentRoute)).body
result should include ("id=\"service-urls-section\"")
result should include ("id=\"production-urls\"")
result should include ("id=\"url-0\"")
result should include ("id=\"url-1\"")
}

"do not display production URLs when feature flag is disabled" in {
FeatureSwitch.disable(CatalogueFrontendSwitches.routingRules)
val result = views.html.partials.details(repo, Some(environmentRoute)).body
result should not include ("id=\"service-urls-section\"")
result should not include ("id=\"production-urls\"")
result should not include ("id=\"url-0\"")
result should not include ("id=\"url-1\"")
}

"do not display production URLs when no rules" in {
FeatureSwitch.enable(CatalogueFrontendSwitches.routingRules)
val result = views.html.partials.details(repo, None).body
result should not include ("id=\"service-urls-section\"")
result should not include ("id=\"production-urls\"")
result should not include ("id=\"url-0\"")
result should not include ("id=\"url-1\"")
}
}
}