Skip to content

Commit

Permalink
Merge pull request #291 from digital-land/fix/links
Browse files Browse the repository at this point in the history
Fix/links
  • Loading branch information
rosado authored Aug 15, 2024
2 parents 885ed08 + d26cbe1 commit 339932a
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 17 deletions.
67 changes: 67 additions & 0 deletions docker-compose-real-backend-minus-frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
services:
redis:
image: redis:6.0.9
restart: on-failure
ports:
- "6379:6379"

localstack:
container_name: "${LOCALSTACK_DOCKER_NAME:-localstack-main}"
image: localstack/localstack:3.1
ports:
- "127.0.0.1:4566:4566" # LocalStack Gateway
- "127.0.0.1:4510-4559:4510-4559" # external services port range
environment:
# LocalStack configuration: https://docs.localstack.cloud/references/configuration/
DEBUG: ${DEBUG:-0}
AWS_DEFAULT_REGION: eu-west-2
SERVICES: sqs, s3
volumes:
- "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
- "./localstack_bootstrap:/etc/localstack/init/ready.d/"

request-api:
image: public.ecr.aws/l6z6v3j6/development-pub-async-request-api:main
# image: request-api:latest # Uncomment when working locally with this file
environment:
PYTHONUNBUFFERED: 1
AWS_ENDPOINT_URL: http://localstack:4566
CELERY_BROKER_URL: sqs://ABCDEFGHIJKLMNOPQRST:ZYXK7NiynGlTogH8Nj+P9nlE73sq3@localstack:4566
AWS_DEFAULT_REGION: eu-west-2
AWS_ACCESS_KEY_ID: example
AWS_SECRET_ACCESS_KEY: example
SQS_QUEUE_NAME: request-queue
DATABASE_URL: postgresql://postgres:password@request-db/request_database
restart: on-failure
ports:
- "8000:8000"

request-db:
image: postgres:16.2-alpine
environment:
POSTGRES_PASSWORD: password
POSTGRES_DB: request_database
restart: on-failure

request-processor:
image: public.ecr.aws/l6z6v3j6/development-pub-async-request-processor:main
# image: request-processor:latest # Uncomment when working locally with this file
environment:
PYTHONUNBUFFERED: 1
AWS_ENDPOINT_URL: http://localstack:4566
AWS_DEFAULT_REGION: eu-west-2
AWS_ACCESS_KEY_ID: example
AWS_SECRET_ACCESS_KEY: example
# CELERY_BROKER_URL: sqs://@sqs.eu-west-2.amazonaws.com
CELERY_BROKER_URL: sqs://example:example@localstack:4566
CELERY_BROKER_REGION: eu-west-2
CELERY_BROKER_IS_SECURE: "false"
DATABASE_URL: postgresql://postgres:password@request-db/request_database
REQUEST_FILES_BUCKET_NAME: dluhc-data-platform-request-files-local
restart: on-failure
deploy:
replicas: 2
volumes:
- "./request-processor-celery/docker_volume:/opt"

14 changes: 5 additions & 9 deletions src/controllers/OrganisationsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ const organisationsController = {
const { lpa, dataset: datasetId } = req.params

try {
const organisationResult = await datasette.runQuery(`SELECT name FROM organisation WHERE organisation = '${lpa}'`)
const organisationResult = await datasette.runQuery(`SELECT name, organisation FROM organisation WHERE organisation = '${lpa}'`)
const organisation = organisationResult.formattedData[0]

const datasetResult = await datasette.runQuery(`SELECT name FROM dataset WHERE dataset = '${datasetId}'`)
Expand All @@ -226,12 +226,8 @@ const organisationsController = {
const last200Datetime = last200Date.toISOString().slice(0, 19) + 'Z'

const params = {
organisation: {
name: organisation.name
},
dataset: {
name: dataset.name
},
organisation,
dataset,
errorData: {
endpoint_url: resourceStatus.endpoint_url,
http_status: resourceStatus.status,
Expand Down Expand Up @@ -282,10 +278,10 @@ const organisationsController = {
try {
entityNumber = entityNumber ? parseInt(entityNumber) : 1

const organisationResult = await datasette.runQuery(`SELECT name FROM organisation WHERE organisation = '${lpa}'`)
const organisationResult = await datasette.runQuery(`SELECT name, organisation FROM organisation WHERE organisation = '${lpa}'`)
const organisation = organisationResult.formattedData[0]

const datasetResult = await datasette.runQuery(`SELECT name FROM dataset WHERE dataset = '${datasetId}'`)
const datasetResult = await datasette.runQuery(`SELECT name, dataset FROM dataset WHERE dataset = '${datasetId}'`)
const dataset = datasetResult.formattedData[0]

if (!resourceId) {
Expand Down
2 changes: 1 addition & 1 deletion src/views/organisations/datasetTaskList.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
href: '/organisations'
},
{
text: organisation.name,
text: organisation.name | capitalize,
href: '/organisations/' + organisation.organisation
},
{
Expand Down
29 changes: 28 additions & 1 deletion src/views/organisations/http-error.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
{% from "govuk/components/summary-list/macro.njk" import govukSummaryList %}
{% from "govuk/components/breadcrumbs/macro.njk" import govukBreadcrumbs %}

{% extends "layouts/main.html" %}

{% set pageName %}{{organisation.name}} - {{dataset.name}} - Task list{% endset %}
{% set serviceType = 'manage' %}

{% block beforeContent %}

{{ super() }}

{{ govukBreadcrumbs({
items: [
{
text: "Home",
href: "/manage"
},
{
text: "Organisations",
href: '/organisations'
},
{
text: organisation.name | capitalize,
href: '/organisations/' + organisation.organisation
},
{
text: dataset.name | capitalize
}
]
}) }}

{% endblock %}

{% block content %}

<div class="govuk-grid-row">
Expand Down Expand Up @@ -59,7 +86,7 @@ <h3 class="govuk-heading-m">Error details</h3>
]
}) }}

<p>If your data URL has changed you can <a href="https://check.staging.digital-land.info/submit">resubmit your data URL</a>.</p>
<p>If your data URL has changed you can <a href="/submit">resubmit your data URL</a>.</p>

<p>You should try to make sure your data URLs stay the same when you update your data so we can collect your data
each night.</p>
Expand Down
6 changes: 3 additions & 3 deletions src/views/organisations/issueDetails.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
href: '/organisations'
},
{
text: organisation.name,
text: organisation.name | capitalize,
href: '/organisations/' + organisation.organisation
},
{
text: dataset.name,
text: dataset.name | capitalize,
href: '/organisations/' + organisation.organisation + '/' + dataset.dataset
},
{
text: issueType
text: issueType | capitalize
}
]
}) }}
Expand Down
7 changes: 5 additions & 2 deletions src/views/organisations/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
href: "/organisations"
},
{
text: organisation.name
text: organisation.name | capitalize
}
]
}) }}
Expand Down Expand Up @@ -75,7 +75,10 @@ <h2 class="govuk-heading-m">
{{dataset.slug | datasetSlugToReadableName}}
</a>
{% else %}
{{dataset.slug | datasetSlugToReadableName}}
<a class="govuk-link govuk-task-list__link"
href="/organisations/{{ organisation.organisation }}/{{dataset.slug}}/get-started">
{{dataset.slug | datasetSlugToReadableName}}
</a>
{% endif %}
</h2>
<div class="govuk-task-list__hint">
Expand Down
3 changes: 2 additions & 1 deletion test/unit/generic-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export const runGenericPageTests = (html, options) => {
const breadcrumbsChildren = breadcrumbs.children

options.breadcrumbs.forEach((breadcrumb, i) => {
expect(breadcrumbsChildren[i].textContent).toContain(breadcrumb.text)
const capitalizedText = breadcrumb.text.charAt(0).toUpperCase() + breadcrumb.text.slice(1).toLowerCase()
expect(breadcrumbsChildren[i].textContent).toContain(capitalizedText)

if (breadcrumb.href) {
const breadcrumbLink = breadcrumbsChildren[i].children[0]
Expand Down

0 comments on commit 339932a

Please sign in to comment.