From e11419690cc4c702afda4c84725cff1409a9b5c7 Mon Sep 17 00:00:00 2001 From: Ian McShane <557595+IanMcShane@users.noreply.github.com> Date: Tue, 22 Jan 2019 16:31:59 +0000 Subject: [PATCH] feature: Update according to feedback. --- app/views/SearchByUrlPage.scala.html | 6 +-- app/views/ServiceInfoPage.scala.html | 7 +-- app/views/partials/code_and_builds.scala.html | 24 +---------- app/views/partials/details.scala.html | 32 +------------- .../partials/serviceUrlDetails.scala.html | 43 +++++++++++++++++++ .../cataloguefrontend/ServicePageSpec.scala | 1 - test/view/partials/CodeAndBuildsSpec.scala | 10 ++--- test/view/partials/DetailsSpec.scala | 35 ++------------- 8 files changed, 61 insertions(+), 97 deletions(-) create mode 100644 app/views/partials/serviceUrlDetails.scala.html diff --git a/app/views/SearchByUrlPage.scala.html b/app/views/SearchByUrlPage.scala.html index bf9e19a15..b69768e2c 100644 --- a/app/views/SearchByUrlPage.scala.html +++ b/app/views/SearchByUrlPage.scala.html @@ -26,7 +26,7 @@ @standard_layout("Service Search", "search") {
-

Service Search

+

Search for a service by URL

@@ -36,8 +36,8 @@

Addresses beginning with the following are not tax platform services:

    -
  • https://www.access.tax.service.gov.uk/
  • -
  • https://www.gov.uk/
  • +
  • https://www.access.tax.service.gov.uk/ (Owned by Secure Credential Platform)
  • +
  • https://www.gov.uk/ (Owned by Government Digital Service)

diff --git a/app/views/ServiceInfoPage.scala.html b/app/views/ServiceInfoPage.scala.html index 4e1c1b957..eb96425d3 100644 --- a/app/views/ServiceInfoPage.scala.html +++ b/app/views/ServiceInfoPage.scala.html @@ -62,15 +62,16 @@

Service: @service.name@githubBadgeType(service) - @partials.details(service, productionEnvironmentRoute) + @partials.details(service) + + @partials.serviceUrlDetails(productionEnvironmentRoute) @partials.serviceRouteRuleViolations(serviceRoutes)
@partials.repo_owning_teams(service) - @partials.code_and_builds(service, productionEnvironmentRoute) - + @partials.code_and_builds(service)
@for((environment, idx) <- service.environments.get.zipWithIndex) { diff --git a/app/views/partials/code_and_builds.scala.html b/app/views/partials/code_and_builds.scala.html index 4bd1b2dd2..9e7c81ef5 100644 --- a/app/views/partials/code_and_builds.scala.html +++ b/app/views/partials/code_and_builds.scala.html @@ -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)
@@ -32,28 +32,6 @@

Code and Build

@for(ciLink <- repo.ci) {
  • @{ciLink.displayName}
  • } - @if(CatalogueFrontendSwitches.routingRules.isEnabled && environmentRoute.isDefined) { - @defining(environmentRoute.get.routes.size > 3) { collapsable => -
    -
    -
    - Routing Configuration(s): -
    -
    -
    -
    -
      - @for((route, index) <- environmentRoute.get.routes.zipWithIndex) { -
    • - @route.frontendPath -
    • - } -
    -
    -
    -
    - } - }
    diff --git a/app/views/partials/details.scala.html b/app/views/partials/details.scala.html index 4969743bb..61230d0ac 100644 --- a/app/views/partials/details.scala.html +++ b/app/views/partials/details.scala.html @@ -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)

    Details

    @@ -38,36 +38,6 @@

    Details

    @repositoryDetails.lastActive.displayFormat - @if(CatalogueFrontendSwitches.routingRules.isEnabled && environmentRoute.isDefined) { - @defining(environmentRoute.get.routes.size > 3) { collapsable => -
      -
      -
    • -
      -
      - URL(s): -
      -
      -
      -
      -
        - @for((route, index) <- environmentRoute.get.routes.zipWithIndex) { -
      • - @if(route.isRegex) { - @route.frontendPath - } else { - @route.frontendPath - } -
      • - } -
      -
      -
      -
    • -
      -
    - } - }
    \ No newline at end of file diff --git a/app/views/partials/serviceUrlDetails.scala.html b/app/views/partials/serviceUrlDetails.scala.html new file mode 100644 index 000000000..e51f2f90c --- /dev/null +++ b/app/views/partials/serviceUrlDetails.scala.html @@ -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 => +
    +

    +
    + Frontend Routing Configuration +
    +

    +
    +
    +
      + @for((route, index) <- environmentRoute.get.routes.zipWithIndex) { +
    • + @route.frontendPath +
    • + } +
    +
    +
    +
    + } +} diff --git a/test/uk/gov/hmrc/cataloguefrontend/ServicePageSpec.scala b/test/uk/gov/hmrc/cataloguefrontend/ServicePageSpec.scala index 064cbeb64..a32291906 100644 --- a/test/uk/gov/hmrc/cataloguefrontend/ServicePageSpec.scala +++ b/test/uk/gov/hmrc/cataloguefrontend/ServicePageSpec.scala @@ -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 { diff --git a/test/view/partials/CodeAndBuildsSpec.scala b/test/view/partials/CodeAndBuildsSpec.scala index c37e8218d..d9c28e158 100644 --- a/test/view/partials/CodeAndBuildsSpec.scala +++ b/test/view/partials/CodeAndBuildsSpec.scala @@ -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\"") - } + }*/ } } diff --git a/test/view/partials/DetailsSpec.scala b/test/view/partials/DetailsSpec.scala index f1089fbfb..f3d4c216a 100644 --- a/test/view/partials/DetailsSpec.scala +++ b/test/view/partials/DetailsSpec.scala @@ -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\"") - } } }